backprop

A workflow that connects a software bug to the requirement that should have prevented it, updates the specification, creates a regression test, and records the correction.

In plain words
What is it for?
Use it with a written bug description or a failing test when the project already has Forge specifications.
Why use it?
A code fix alone may solve only the current incident. Linking the bug to the specification helps make the expected behavior explicit and testable.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/lucasduys/forge/backprop
Clone the repo
git clone --depth 1 https://github.com/LucasDuys/forge
Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 628 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00012 $0.00628
Opus 5 $0.00006 $0.00314
Sonnet 5 $0.00002 $0.00126
Haiku 4.5 $0.00001 $0.00063

Measured 2d ago against content hash c95b8c5676c2, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

backprop scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/backprop.md · 58 lines

How it starts

The opening of the file, as written. The whole thing — 58 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Forge Backprop

Trace a runtime bug back to a specification gap, update the spec, generate a regression test, and log the correction for pattern detection.

Pre-flight Check

  1. Verify .forge/ exists. If it does not, stop and tell the user:

    .forge/ not found. Run /forge brainstorm first to generate specifications.

  2. Verify .forge/specs/ contains at least one spec-*.md file. If none found, stop and tell the user:

    No specs found in .forge/specs/. Run /forge brainstorm first to create specifications. Backprop requires existing specs to trace bugs against.

  3. Ensure .forge/history/ exists. If not, create it:

    mkdir -p .forge/history
    

Parse Arguments

Parse from $ARGUMENTS:

Input Format Description
Bug description Quoted string (first positional argument) Natural-language description of the bug
--from-test PATH Path to a test file Run this test, capture failure output, use it as the bug description

Exactly one of the two inputs must be provided. If neither is found, stop and tell the user:

Usage: /forge backprop "description of bug" or /forge backprop --from-test path/to/failing-test

--from-test mode

If --from-test PATH is provided:

  1. Verify the test file exists. If not, stop and tell the user the file was not found.
  2. Detect the test runner from the file extension and project config:
    • .test.ts, .test.js, .spec.ts, .spec.js — look for Jest, Vitest, or Mocha in package.json
    • .test.py, test_*.py — use pytest
    • .test.go — use go test
    • Other — ask the user how to run it
  3. Run the test, capturing stdout and stderr.
  4. Read the test source code.
  5. Combine the failure output and source code into the bug description context for the skill.

Invoke Backpropagation

Invoke the forge:backpropagation skill with:

  • The bug description (either from the quoted argument or from the test failure output)
  • The test file path (if --from-test was used)
  • The test source code (if --from-test was used)
  • The list of spec files in .forge/specs/

Read the full file on GitHub · 58 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 58 lines · 12 tokens per session scan A c95b8c5676c2

Subscribe to this mod's changes

backprop is a command published in the GitHub repository LucasDuys/forge (55 stars, last pushed 1mo ago), licensed MIT. It adds 12 tokens to every session and 628 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.