backprop
CommandTrace a bug back to a spec gap and generate regression tests
Continue Forge execution after context reset or interruption
> /plugin marketplace add LucasDuys/forge> /plugin install forge@forge-marketplace
description: "Continue Forge execution after context reset or interruption"
allowed-tools: ["Bash(node ${CLAUDE_PLUGIN_ROOT}/scripts/forge-tools.cjs:*)", "Read(*)", "Write(*)", "Edit(*)", "Glob(*)", "Grep(*)", "Bash(*)", "Agent(*)"]Continue an in-progress Forge execution from where it left off after a context reset, session close, or manual pause.
Check if `.forge/` exists. If it does not, stop and tell the user:
> No Forge project found. Run `/forge brainstorm` to get started.
Before loading any state, run forensic recovery. This handles crashed sessions, stale locks, budget exhaustion, and orphan worktrees. The forensic recovery scan is always safe to run -- on a clean state it is a no-op.
node "${CLAUDE_PLUGIN_ROOT}/scripts/forge-tools.cjs" forensic-recover --forge-dir .forgeThe command:
1. Sets phase to `recovering` while it runs 2. Inspects `.forge/.forge-loop.lock` -- takes over stale locks (heartbeat older than 5 minutes) 3. Reads checkpoints from `.forge/progress/` to find in-flight tasks 4. Cross-references git log + `task-status.json` to identify committed tasks 5. Lists worktrees and flags any orphans (worktrees for tasks not in any frontier or already committed) 6. If `phase: budget_exhausted`, reads `.forge/resume.md` and surfaces the reason 7. Writes a caveman-form summary to `.forge/state.md` notes 8. Sets final phase to `idle` (clean) or `needs_human` (warnings present) 9. Exits 0 on clean recovery, exit 2 if `needs_human`
**Show the recovery report to the user.** Read it carefully:
Add `--json` for machine-readable output if you need to parse the report programmatically.
Check if `.forge/.forge-resume.md` exists:
Read the following files to fully restore execution context:
1. **`.forge/state.md`** — Current position in the execution:
2. **`.forge/token-ledger.json`** — Token budget tracking:
3. **`.forge/capabilities.json`** — Available MCP servers, skills, and plugins that can enhance execution.
4. **`.forge/task-status.json`** — Programmatic task completion registry. This is the authoritative source for which tasks are complete — more reliable than parsing the markdown in state.md.
5. **The relevant frontier file from `.forge/plans/`** — Find the frontier file matching the current spec (e.g., `.forge/plans/{spec-domain}-frontier.md`). This contains the task DAG with tiers, dependencies, estimates, and completion status.
6. **The current spec from `.forge/specs/`** — Read `spec-{domain}.md` for the acceptance criteria of what you are implementing.
Run the setup-state command to create a fresh loop state file (`.forge/.forge-loop.json`), which re-enables the stop hook loop engine:
node "${CLAUDE_PLUGIN_ROOT}/scripts/forge-tools.cjs" setup-state \
--forge-dir .forge \
--spec "{SPEC}" \
--autonomy "{AUTONOMY}" \
--depth "{DEPTH}"Replace `{SPEC}`, `{AUTONOMY}`, and `{DEPTH}` with the values read from `.forge/state.md`.
**Important:** After running setup-state, also clear the `handoff_requested` flag in `.forge/state.md` by setting it to `false`. This prevents the stop hook from immediately triggering another handoff.
If `.forge/.forge-resume.md` exists, delete it — it has been consumed:
rm -f .forge/.forge-resume.md
You are now back in the Forge execution loop. Pick up exactly where you left off:
Turn a one-line idea into a branch with tested, reviewed, committed code. The brainstorm-to-commit pipeline for Claude Code.
Trace a bug back to a spec gap and generate regression tests
Turn an idea into concrete specs with testable requirements
Opt-in multiplayer mode -- brain-dump together, claim tasks across machines, flag decisions async
Implement tasks incrementally — build, test, verify, commit. Add "auto" to run the whole plan in one approved pass.