一键导入
backpropagation
Trace runtime bugs back to spec gaps — identify missing acceptance criteria, update specs, generate regression tests, and detect patterns
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Trace runtime bugs back to spec gaps — identify missing acceptance criteria, update specs, generate regression tests, and detect patterns
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Hackathon-native multiplayer collaboration mode -- brain-dump together, claim tasks across machines, flag decisions async. Drives the subcommands of /forge:collaborate.
Autonomous task implementation workflow — implement, test, review, commit for each task in the frontier
Interactive spec generation — turn ideas into concrete specs with R-numbered requirements and testable acceptance criteria
Graph-aware planning and research using codebase knowledge graphs — enables architecture-aware task decomposition, dependency discovery, and context reduction
DESIGN.md integration for Forge — ensures visual consistency across all UI tasks through standardized design specifications
Behavioral guardrails for Forge agents based on Andrej Karpathy's principles — prevents over-engineering, silent assumptions, scope creep, and unfocused execution
| name | backpropagation |
| description | Trace runtime bugs back to spec gaps — identify missing acceptance criteria, update specs, generate regression tests, and detect patterns |
You are running the Forge backpropagation workflow. Your job is to trace a runtime bug back to a specification gap, update the spec to close that gap, generate a regression test, and log the correction for systemic pattern detection.
You will receive:
--from-test mode)--from-test was used.forge/specs/Find the spec and requirement that should have prevented this bug.
Read all spec files in .forge/specs/. For each spec, extract:
linked_repos field (to know which repos are involved)Analyze the bug description (and test failure output if available) to determine:
Match the bug to the most relevant spec and requirement:
--from-test was used: read the test source code to understand which feature it tests, cross-reference with spec requirementsIf no spec appears to cover this area at all, note this as a potential "missing requirement" gap and pick the closest spec by domain.
Present your finding to the user:
Traced to:
spec-{domain}.md> R{NNN}: {requirement name} Reasoning: {why this requirement is the match}
Determine exactly what the spec's acceptance criteria failed to cover.
Read the identified requirement's acceptance criteria in full.
For each criterion, ask: "If this criterion were perfectly implemented and tested, would this bug still have occurred?"
Classify the gap into one of three types:
| Gap Type | Definition | Example |
|---|---|---|
| Missing criterion | The requirement exists but has no criterion covering this case | R001 requires user registration but no criterion tests duplicate email with different casing |
| Incomplete criterion | A criterion exists but is too vague to catch this edge case | Criterion says "validate email format" but doesn't specify which RFC or edge cases |
| Missing requirement | No requirement in any spec covers this behavior at all | No spec covers rate limiting, but the bug is a rate limit bypass |
Determine if this is a one-off edge case or a systemic pattern. Check:
.forge/history/backprop-log.md exist? If so, read it.Present the analysis:
Gap type: {missing_criterion | incomplete_criterion | missing_requirement} What was missed: {specific description of what the acceptance criteria should have covered} Pattern category: {input_validation | concurrency | error_handling | integration | other}
Write the proposed spec change and get user approval.
Draft the spec update based on gap type:
Present the proposed change clearly, showing before and after:
For missing criterion:
Proposed addition to R{NNN}:
- [ ] {New specific, testable criterion}
For incomplete criterion:
Proposed replacement in R{NNN}:
Before: - [ ] {old vague criterion} After: - [ ] {new specific criterion}
For missing requirement:
Proposed new requirement in spec-{domain}.md:
### R{NNN}: {Requirement Name} {Description} **Acceptance Criteria:** - [ ] {Criterion 1} - [ ] {Criterion 2}
Wait for explicit user approval. Do NOT modify the spec file until the user says yes, approves, or confirms. If the user suggests edits, incorporate them and re-present.
Once approved, apply the change to the spec file using the Edit tool. Preserve all existing content — only add or modify the specific criterion/requirement.
Write a test that would have caught this bug before it happened.
Determine the correct test location:
--from-test was used: place the new test near the original test file (same directory or same test suite)linked_repos field from the spec and the repo config in .forge/config.json to determine which repo the test belongs inWrite the regression test:
it('should reject duplicate email with different casing'))// Regression: backprop #{N} — {brief description}Run the regression test to verify it currently fails (proving the bug exists and the test would have caught it):
Present the test to the user:
Regression test written:
{test file path}Test status: {FAILS as expected / PASSES — bug may be fixed} What it verifies: {description of what the test checks}
Check if the user wants to verify the fix emerges from the updated spec.
Read .forge/config.json and check backprop.re_run_after_spec_update.
If re_run_after_spec_update is true:
The spec has been updated. You can run
/forge execute --filter {spec-domain}to verify that the fix emerges naturally from the updated specification. This will re-execute tasks related to the affected requirement.
If re_run_after_spec_update is false (or not set):
Tip: You can run
/forge execute --filter {spec-domain}to verify the fix emerges from the updated spec alone. Setbackprop.re_run_after_spec_update: truein.forge/config.jsonto enable automatic re-execution after backprop.
Append the backpropagation record to the history log.
If .forge/history/backprop-log.md does not exist, create it with a header:
# Backpropagation Log
Records of bugs traced back to spec gaps, with corrective actions taken.
---
Determine the next backprop ID:
id: numberAppend a new entry using the template from templates/backprop-report.md:
---
id: {N}
date: {YYYY-MM-DD}
spec: {spec-domain}
requirement: {R_ID}
gap_type: {missing_criterion|incomplete_criterion|missing_requirement}
pattern: {pattern_category}
---
# Backprop #{N}
## Bug Description
{Original bug description or test failure summary}
## Root Spec
- Spec: {spec file path}
- Requirement: {R_ID}: {requirement name}
- Gap: {What the acceptance criteria missed}
## Spec Update
{The new or modified acceptance criterion that was applied}
## Regression Test
- File: {test file path}
- Verifies: {What the test checks}
## Pattern
- Category: {pattern category}
- Occurrences: {total count of this pattern in the log}
- Systemic fix suggested: {yes/no}
Pattern detection — After logging, count occurrences of the same pattern category across all entries in the log:
Pattern detected: You've had {N} {pattern_category} gaps. This is a systemic pattern.
Suggested systemic fix: Add the following as a standard brainstorming question in future
/forge brainstormsessions:
Use the pattern-to-question mapping from references/backprop-patterns.md:
| Pattern (3+ occurrences) | Suggested Brainstorming Question |
|---|---|
| input_validation | "What are the edge cases for input formats? (unicode, empty, boundary values, special characters)" |
| concurrency | "What happens with concurrent access? (race conditions, ordering, idempotency)" |
| error_handling | "What failure modes exist? (network timeout, disk full, rate limit, partial failure)" |
| integration | "What cross-component contracts exist? (data formats, timing dependencies, versioning)" |
If the pattern is "other", suggest the user define a custom question based on the recurring theme.