backprop
CommandTrace a bug back to a spec gap and generate regression tests
Decompose specs into task frontiers with dependency tracking
> /plugin marketplace add LucasDuys/forge> /plugin install forge@forge-marketplace
description: "Decompose specs into task frontiers with dependency tracking"
argument-hint: "[--filter NAME] [--depth quick|standard|thorough] [--repos REPO1,REPO2]"
allowed-tools: ["Bash(node ${CLAUDE_PLUGIN_ROOT}/scripts/forge-tools.cjs:*)", "Bash(node ${CLAUDE_PLUGIN_ROOT}/scripts/forge-wizard.cjs:*)", "Read(*)", "Write(*)", "Edit(*)", "Glob(*)", "Grep(*)", "Agent(*)"]Decompose approved specifications into ordered task frontiers with dependency DAGs, token estimates, and repo tags.
Before anything else, fire the one-shot token-reduction wizard. Idempotent — prints once on first install, then no-ops forever. Suppressed when `/forge:watch` is rendering its own banner (R004.AC6).
node "${CLAUDE_PLUGIN_ROOT}/scripts/forge-wizard.cjs" --forge-dir .forge1. 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 with `status: approved` in its frontmatter. If none found, stop and tell the user: > No approved specs found in `.forge/specs/`. Run `/forge brainstorm` to create specs, then approve them before planning.
Parse flags from `$ARGUMENTS`:
| Flag | Default | Description | |------|---------|-------------| | `--filter NAME` | *(all specs)* | Only plan specs whose domain matches NAME | | `--depth quick\|standard\|thorough` | *(auto-detect)* | Task granularity level | | `--repos REPO1,REPO2` | *(all configured repos)* | Limit planning to specific repos |
If `--depth` is not provided and the project config has `auto_detect_depth: true`:
1. Read `.forge/config.json` for project settings (repos, depth, cross_repo_rules). 2. Read `.forge/capabilities.json` if it exists, to inform the planner about available MCP servers and skills.
These checks run automatically before planning. Do not skip them.
**Knowledge graph:** First check if `graphify-out/graph.json` already exists. If not, check if graphify is installed:
node "${CLAUDE_PLUGIN_ROOT}/scripts/forge-tools.cjs" graph-statusIf graphify is available and no graph exists, build one:
node "${CLAUDE_PLUGIN_ROOT}/scripts/forge-tools.cjs" graph-build --project-dir .Once a graph exists, extract the summary:
node "${CLAUDE_PLUGIN_ROOT}/scripts/forge-tools.cjs" graph-summary --graph graphify-out/graph.jsonThis returns god nodes (top 10 most-connected concepts), community structure, and stats. Pass this summary to the planner agent. The planner uses it to align task boundaries with module boundaries and order tasks by architectural impact.
**Design system:** Check if `DESIGN.md`, `design.md`, or `docs/DESIGN.md` exists. If found, check each spec for UI-related requirements. For specs with UI tasks:
Neither is required. If absent, planning proceeds with standard spec-only decomposition.
Before invoking the planner, run the **forge-speccer-validator** agent on every spec that will be planned. This catches stale or misspelled paths in the spec before the planner decomposes it into tasks that would target files that do not exist.
For each spec file being planned:
node "${CLAUDE_PLUGIN_ROOT}/scripts/forge-speccer-validator.cjs" <spec-path> <repo-root>Interpret the exit code and JSON output:
1. For each missing entry, compute an autocorrect suggestion via `findNearestPath(missingPath, repoRoot)` from the same module. 2. Dispatch a replan pass: invoke the **forge-speccer** agent (or a replan sub-task) with the original spec plus the list of `{line, path, suggested, alternatives}` entries and instructions to rewrite the spec with the corrected paths. If no `suggested` match exists for a given missing path, flag it for human review rather than inventing a path. 3. Write the corrected spec back to the same path (preserve the original under `.forge/specs/<name>.pre-replan.bak` for audit). 4. Re-run the validator on the corrected spec. If it now returns OK, proceed to planning. If it still returns REPLAN_NEEDED and the missing paths are unchanged, stop and surface the issue to the user with the unresolved entries — do not loop indefinitely.
This gate is mandatory. Skipping it risks a frontier whose tasks point at nonexistent files.
Before each `Agent` tool invocation during planning (forge-complexity for depth detection, forge-speccer-validator replan passes, forge-planner per spec), the orchestrator MUST resolve the per-phase model + effort hint via `scripts/forge-router.cjs::writeHandoff` and pass the resulting `model` to the Agent tool.
For every Agent dispatch:
1. Call `writeHandoff(forgeDir, taskId, role, complexityOrTask)`. Use the spec domain or planning step id as `taskId` (e.g. `plan-spec-auth`, `complexity-detect`). This writes `.forge/handoff.{task_id}.json` containing `{ model, effort, max_tokens, role, task_id }` (or the legacy 3-field shape `{ model, role, task_id }` when `FORGE_TOKEN_OPT=0`). 2. Read the returned object's `model` field and pa
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.