Subagent-Driven Development
Execute a plan in ONE session: dispatch a fresh implementer subagent per task → task review (spec + quality) after each → broad whole-branch review at the end. Upstream: https://github.com/obra/superpowers.
Fresh-context briefs, fan-out width, and the per-task economy are governed by [[parallel-subagent-economy]]; when to decompose-and-fan-out at all by [[monitor-orchestration]]. This file covers only what is SDD-specific: the per-task implementer + two-stage review loop.
Contents
- When to use vs. alternatives
- The per-task loop
- Model selection
- Handling implementer status
- Constructing reviewer prompts
- File handoffs + durable ledger
- Red flags
When to Use
- Have a plan + tasks mostly independent + staying in THIS session → this skill.
- Want a parallel session with human checkpoints →
superpowers:executing-plans instead.
- Tightly-coupled tasks or no plan → brainstorm/manual first.
- Continuous execution: do not check in between tasks. Stop only on unresolvable BLOCKED, genuine ambiguity, or all-done. Narrate ≤1 line between tool calls — the ledger and tool results are the record.
The Per-Task Loop
- Read plan once; note global constraints; create todos + check the ledger (§6).
- Pre-flight: scan the plan for tasks that contradict each other/the constraints, or that mandate something the rubric treats as a defect (test asserting nothing, verbatim-duplicated logic). Batch all findings to the human as one question before Task 1; if clean, proceed silently.
- Per task:
scripts/task-brief PLAN N → dispatch implementer (implementer-prompt.md). Answer its questions before it proceeds.
- On DONE:
scripts/review-package BASE HEAD → dispatch task reviewer (task-reviewer-prompt.md) with the printed path.
- Reviewer returns two verdicts (spec + quality). Critical/Important findings → fix subagent → re-review. Loop until both clean.
- Mark complete in todos + ledger. Next task.
- After all tasks: final whole-branch review via
../requesting-code-review/code-reviewer.md, then superpowers:finishing-a-development-branch.
Model Selection
Least-powerful model that handles the role. Always specify model explicitly — an omitted model inherits the session's (most expensive) model and defeats this.
- Plan text contains the complete code → transcription → cheapest tier.
- Single-file mechanical fix, complete spec → cheap.
- Multi-file integration / pattern-matching / debugging → standard (mid-tier is the floor for reviewers and prose-spec implementers).
- Design judgment / broad codebase understanding → most capable. The final whole-branch review is always this tier.
- Reviewer model scales to the diff's size/risk, not the session default.
- Turn count beats token price: cheapest models take 2-3× the turns on multi-step work, costing more overall.
Handling Implementer Status
- DONE → generate review package, dispatch reviewer.
- DONE_WITH_CONCERNS → read concerns first. Correctness/scope → resolve before review; observations → note and proceed.
- NEEDS_CONTEXT → provide the missing info, re-dispatch.
- BLOCKED → diagnose: context gap → re-dispatch same model with more context; needs reasoning → more capable model; too large → split; plan is wrong → escalate to human. Never retry the same model unchanged; never ignore an escalation.
Reviewer ⚠️ "cannot verify from diff" items — requirements in unchanged code or spanning tasks. Non-blocking for the rest of the review, but YOU resolve each before marking complete (you hold the cross-task context the reviewer lacks). A confirmed gap = failed spec review → back to implementer.
Constructing Reviewer Prompts
Per-task reviews are task-scoped gates; the broad review runs once at the end.
- Never pre-judge. No "do not flag X", "at most Minor", "the plan chose this". If you're tempted to spare yourself a loop, stop — let the reviewer raise it and adjudicate in the loop. The plan's example code is a starting point, not proof its weaknesses were chosen.
- BASE is the commit recorded before dispatching the implementer — never
HEAD~1 (drops all but the last commit of a multi-commit task).
- Global-constraints block = the reviewer's attention lens. Copy binding requirements verbatim from the plan: exact values, formats, stated relationships ("same layout as X"). Process rules (YAGNI, test hygiene) are already in the template.
- No open-ended directives ("check all uses", "run race tests if useful") without a concrete task-specific reason. Don't ask it to re-run tests the implementer already ran on the same code.
- Plan-mandated findings (or any finding conflicting with plan text) → the human decides: present finding + plan text, ask which governs. Don't dismiss it; don't dispatch a contradicting fix without asking.
- Fix dispatches carry the implementer contract: re-run the covering tests (name them — a one-line fix doesn't need the full suite), report command + output. Confirm all three present before re-review.
- Critical/Important → fix subagents. Minor → ledger, fed to the final review for triage. Final-review findings → ONE fix subagent with the full list, not one fixer per finding (each rebuilds context + re-runs suites).
- Final review gets its own package:
scripts/review-package $(git merge-base main HEAD) HEAD.
File Handoffs + Durable Ledger
Everything pasted into a dispatch — and everything a subagent prints back — stays resident in your context and is re-read every later turn. Move artifacts as files.
- Brief —
scripts/task-brief PLAN N extracts the task to a file. Dispatch = (1) one line on where the task fits; (2) brief path ("read first — your requirements, exact values verbatim"); (3) interfaces/decisions from earlier tasks the brief can't know; (4) your resolution of any ambiguity you spotted; (5) report-file path + contract. Exact values live ONLY in the brief.
- Report — name it after the brief (
task-N-brief.md → task-N-report.md). Implementer writes full detail there, returns only status + commits + one-line test summary + concerns.
- Reviewer gets three paths — brief, report, review-package — plus the binding global constraints.
- Never paste accumulated prior-task summaries into later dispatches (a real session hit 42k chars, 99% pasted history). A fresh subagent needs its task, the interfaces it touches, the constraints. Nothing else.
Ledger — conversation memory dies at compaction; controllers have re-dispatched entire completed sequences (most expensive failure observed). Track in $(git rev-parse --show-toplevel)/.superpowers/sdd/progress.md:
- At start,
cat it — tasks marked complete are DONE, resume at the first unmarked one.
- On a clean review, append (same message as other bookkeeping):
Task N: complete (commits <base7>..<head7>, review clean).
- After compaction, trust the ledger +
git log over recollection. git clean -fdx destroys it (git-ignored scratch) → recover from git log.
Red Flags — Never
- Implement on main/master without explicit consent.
- Skip task review, or accept a report missing either verdict (spec AND quality both required).
- Dispatch multiple implementers in parallel (conflicts).
- Make a subagent read the whole plan (hand it the brief).
- Dispatch a task reviewer without a diff file — generate it first.
- Move to the next task with open Critical/Important findings, or accept "close enough" on spec.
- Let implementer self-review replace actual review (both needed).
- Re-dispatch a task the ledger already marks complete.
Prompt Templates + Integration
implementer-prompt.md · task-reviewer-prompt.md · final review: ../requesting-code-review/code-reviewer.md.
- Workflow skills:
superpowers:using-git-worktrees (isolated workspace), superpowers:writing-plans (creates the plan), superpowers:finishing-a-development-branch (completion). Subagents follow superpowers:test-driven-development per task.
Rationalizations — stop, these skip review
| Excuse |
Reality |
| "One more task, then review" |
Stacked unreviewed tasks compound bugs. Review each before next. |
| "Reviewer flagged it Minor" |
Minor findings cascade. Fix or ledger-feed, don't ignore. |
| "Close enough on spec" |
"Close enough" is a gap. Let the reviewer adjudicate. |
Red Flags — STOP: skipping task review · accepting a report missing either verdict · moving to next task with open Critical/Important · "just this once" · re-dispatching unchanged.
1---2name: subagent-driven-development3description: Use when executing implementation plans with independent tasks in the current session4---56# Subagent-Driven Development78Execute a plan in ONE session: dispatch a fresh implementer subagent per task → task review (spec + quality) after each → broad whole-branch review at the end. Upstream: <https://github.com/obra/superpowers>.910Fresh-context briefs, fan-out width, and the per-task economy are governed by `[[parallel-subagent-economy]]`; when to decompose-and-fan-out at all by `[[monitor-orchestration]]`. This file covers only what is SDD-specific: the per-task implementer + two-stage review loop.1112## Contents13141. When to use vs. alternatives152. The per-task loop163. Model selection174. Handling implementer status185. Constructing reviewer prompts196. File handoffs + durable ledger207. Red flags2122## When to Use2324- Have a plan + tasks mostly independent + staying in THIS session → this skill.25- Want a parallel session with human checkpoints → `superpowers:executing-plans` instead.26- Tightly-coupled tasks or no plan → brainstorm/manual first.27- Continuous execution: do not check in between tasks. Stop only on unresolvable BLOCKED, genuine ambiguity, or all-done. Narrate ≤1 line between tool calls — the ledger and tool results are the record.2829## The Per-Task Loop30311. Read plan once; note global constraints; create todos + check the ledger (§6).322. Pre-flight: scan the plan for tasks that contradict each other/the constraints, or that mandate something the rubric treats as a defect (test asserting nothing, verbatim-duplicated logic). Batch all findings to the human as one question before Task 1; if clean, proceed silently.333. Per task: `scripts/task-brief PLAN N` → dispatch implementer (`implementer-prompt.md`). Answer its questions before it proceeds.344. On DONE: `scripts/review-package BASE HEAD` → dispatch task reviewer (`task-reviewer-prompt.md`) with the printed path.355. Reviewer returns two verdicts (spec + quality). Critical/Important findings → fix subagent → re-review. Loop until both clean.366. Mark complete in todos + ledger. Next task.377. After all tasks: final whole-branch review via `../requesting-code-review/code-reviewer.md`, then `superpowers:finishing-a-development-branch`.3839## Model Selection4041Least-powerful model that handles the role. Always specify model explicitly — an omitted model inherits the session's (most expensive) model and defeats this.4243- Plan text contains the complete code → transcription → cheapest tier.44- Single-file mechanical fix, complete spec → cheap.45- Multi-file integration / pattern-matching / debugging → standard (mid-tier is the floor for reviewers and prose-spec implementers).46- Design judgment / broad codebase understanding → most capable. The final whole-branch review is always this tier.47- Reviewer model scales to the diff's size/risk, not the session default.48- Turn count beats token price: cheapest models take 2-3× the turns on multi-step work, costing more overall.4950## Handling Implementer Status5152- **DONE** → generate review package, dispatch reviewer.53- **DONE_WITH_CONCERNS** → read concerns first. Correctness/scope → resolve before review; observations → note and proceed.54- **NEEDS_CONTEXT** → provide the missing info, re-dispatch.55- **BLOCKED** → diagnose: context gap → re-dispatch same model with more context; needs reasoning → more capable model; too large → split; plan is wrong → escalate to human. Never retry the same model unchanged; never ignore an escalation.5657**Reviewer ⚠️ "cannot verify from diff" items** — requirements in unchanged code or spanning tasks. Non-blocking for the rest of the review, but YOU resolve each before marking complete (you hold the cross-task context the reviewer lacks). A confirmed gap = failed spec review → back to implementer.5859## Constructing Reviewer Prompts6061Per-task reviews are task-scoped gates; the broad review runs once at the end.62631. **Never pre-judge.** No "do not flag X", "at most Minor", "the plan chose this". If you're tempted to spare yourself a loop, stop — let the reviewer raise it and adjudicate in the loop. The plan's example code is a starting point, not proof its weaknesses were chosen.642. **BASE is the commit recorded before dispatching the implementer — never `HEAD~1`** (drops all but the last commit of a multi-commit task).653. Global-constraints block = the reviewer's attention lens. Copy binding requirements verbatim from the plan: exact values, formats, stated relationships ("same layout as X"). Process rules (YAGNI, test hygiene) are already in the template.664. No open-ended directives ("check all uses", "run race tests if useful") without a concrete task-specific reason. Don't ask it to re-run tests the implementer already ran on the same code.675. **Plan-mandated findings** (or any finding conflicting with plan text) → the human decides: present finding + plan text, ask which governs. Don't dismiss it; don't dispatch a contradicting fix without asking.686. Fix dispatches carry the implementer contract: re-run the covering tests (name them — a one-line fix doesn't need the full suite), report command + output. Confirm all three present before re-review.697. Critical/Important → fix subagents. Minor → ledger, fed to the final review for triage. Final-review findings → ONE fix subagent with the full list, not one fixer per finding (each rebuilds context + re-runs suites).708. Final review gets its own package: `scripts/review-package $(git merge-base main HEAD) HEAD`.7172## File Handoffs + Durable Ledger7374Everything pasted into a dispatch — and everything a subagent prints back — stays resident in your context and is re-read every later turn. Move artifacts as files.7576- **Brief** — `scripts/task-brief PLAN N` extracts the task to a file. Dispatch = (1) one line on where the task fits; (2) brief path ("read first — your requirements, exact values verbatim"); (3) interfaces/decisions from earlier tasks the brief can't know; (4) your resolution of any ambiguity you spotted; (5) report-file path + contract. Exact values live ONLY in the brief.77- **Report** — name it after the brief (`task-N-brief.md` → `task-N-report.md`). Implementer writes full detail there, returns only status + commits + one-line test summary + concerns.78- **Reviewer** gets three paths — brief, report, review-package — plus the binding global constraints.79- Never paste accumulated prior-task summaries into later dispatches (a real session hit 42k chars, 99% pasted history). A fresh subagent needs its task, the interfaces it touches, the constraints. Nothing else.8081**Ledger** — conversation memory dies at compaction; controllers have re-dispatched entire completed sequences (most expensive failure observed). Track in `$(git rev-parse --show-toplevel)/.superpowers/sdd/progress.md`:8283- At start, `cat` it — tasks marked complete are DONE, resume at the first unmarked one.84- On a clean review, append (same message as other bookkeeping): `Task N: complete (commits <base7>..<head7>, review clean)`.85- After compaction, trust the ledger + `git log` over recollection. `git clean -fdx` destroys it (git-ignored scratch) → recover from `git log`.8687## Red Flags — Never8889- Implement on main/master without explicit consent.90- Skip task review, or accept a report missing either verdict (spec AND quality both required).91- Dispatch multiple implementers in parallel (conflicts).92- Make a subagent read the whole plan (hand it the brief).93- Dispatch a task reviewer without a diff file — generate it first.94- Move to the next task with open Critical/Important findings, or accept "close enough" on spec.95- Let implementer self-review replace actual review (both needed).96- Re-dispatch a task the ledger already marks complete.9798## Prompt Templates + Integration99100- `implementer-prompt.md` · `task-reviewer-prompt.md` · final review: `../requesting-code-review/code-reviewer.md`.101- Workflow skills: `superpowers:using-git-worktrees` (isolated workspace), `superpowers:writing-plans` (creates the plan), `superpowers:finishing-a-development-branch` (completion). Subagents follow `superpowers:test-driven-development` per task.102103## Rationalizations — stop, these skip review104105| Excuse | Reality |106|---|---|107| "One more task, then review" | Stacked unreviewed tasks compound bugs. Review each before next. |108| "Reviewer flagged it Minor" | Minor findings cascade. Fix or ledger-feed, don't ignore. |109| "Close enough on spec" | "Close enough" is a gap. Let the reviewer adjudicate. |110111**Red Flags — STOP:** skipping task review · accepting a report missing either verdict · moving to next task with open Critical/Important · "just this once" · re-dispatching unchanged.112113<!-- budget: ~101 -->