chapter 07

Subagent-driven development

objectives

  • Run the full loop: fresh implementer per task, task review, bounded fix loop, ledger, whole-branch review
  • Choose the right fix-round operator: resume the implementer on rounds 1-3, go fresh on rounds 4-5
  • Apply the round-5 breaker: park with a ruling, or rule on whether the requirement is load-bearing
  • Match each dispatch role to a model tier: cheapest for mechanical transcription, mid for implementation and reviews, most capable for architecture and the whole-branch review
  • Decide honestly when the pattern is worth its token cost — inline execution is the cheaper alternative

Honesty first, because this chapter teaches the most expensive pattern in the course: subagent-driven development (SDD) is an advanced discipline with real token costs, and inline execution — doing the work yourself in the main conversation — is the cheaper alternative. SDD does not exist because it is clever. It exists for the projects where you are the bottleneck: a branch of many tasks, hours of context-heavy work, and a main conversation that would otherwise drown in implementation detail. The pattern trades tokens for two things inline work cannot buy at scale — every task built against a fresh context, and every task reviewed by an agent that did not build it.

The loop

Per task, the loop has this shape:

  1. Fresh implementer. Dispatch a new subagent whose brief is the task spec plus the ledger context it needs. It writes the code and returns a summary.
  2. Task review. Dispatch a reviewer that checks the work on two axes: spec compliance (did it build what the task actually said?) and quality (is the code good?).
  3. Fix loop. Findings go back to an implementer for a fix round — with a strict operator policy, below.
  4. Breaker. If five fix rounds pass without a pass, stop fixing and adjudicate.
  5. Ledger. Every outcome — pass, ruling, finding — is recorded.
  6. When all tasks are done, one final whole-branch review.

Diagram loading…

Why every implementer is fresh

One implementer per task — not one implementer for the branch. Each task's implementer is a new subagent that starts with the task brief and the ledger, and nothing else. The reasons compound:

The review: two lenses, one verdict

The reviewer is a separate dispatch — never the implementer grading its own work. Its two lenses are deliberately different:

The reviewer returns a verdict — pass, or findings. Findings are not opinions to argue; they are the input to the fix loop, and they go into the ledger whatever happens next.

The fix loop: resume, then go fresh

When the reviewer returns findings, the fixes happen in rounds, and who carries them out changes with the round count:

This is the pattern's quiet insight: context is an asset early and a liability late. The resume-then-fresh policy is how the loop spends that asset while it is still an asset.

The breaker at round 5

Round 5 ends the loop — not with a sixth fix round, but with adjudication. Five failed rounds is strong evidence that more rounds will not help; something above the code is wrong. The breaker has exactly two outcomes:

  1. Park with a ruling. The task is parked and the ledger records the ruling: what was attempted, what blocked it, what was decided, and what would have to change for the task to resume. The branch moves on — with the decision written down, not drifting in someone's memory.
  2. Rule on load-bearing. If the fix loop keeps missing the same requirement, the requirement itself goes on trial: is it actually load-bearing? A requirement that five rounds of competent effort cannot satisfy may be ambiguous, contradictory, or simply unnecessary. If it is not load-bearing, change the requirement — in the ledger, explicitly. If it is, the parked-task ruling above applies, and the blocker is now a named problem instead of a silent time sink.

The breaker is what makes the loop safe to run unattended-ish: it converts "the agent kept churning" into "the agent stopped and wrote down why."

The ledger: what survives compaction

Every state change goes into the ledger — a file (or files) in the repository, not chat messages: the task list and each task's state, decisions with their reasons, rulings from breakers, review findings pending resolution, interface changes worth knowing across tasks.

Why it must be a file, and why it must be everything: the ledger is what survives context compaction. A long SDD session will outgrow the parent's context window, and compaction summarizes the conversation away — the chat's memory of round 2's findings is gone after compaction. The ledger on disk is the durable state. When in doubt about what to write down, apply the compaction test: if the parent's context were compacted right now, what would the next dispatch need that it could not reconstruct from the repo? That is ledger content.

The final review: whole branch

When the ledger says every task is done, the loop runs one last dispatch — a review of the entire branch diff, not the per-task slices. Per-task reviews were correct for their purpose, but they are structurally blind to cross-task interactions: task 7 changed an interface task 3's code calls; no per-task reviewer could see that, because at review time the other half did not exist yet. The whole-branch review is where those seams get inspected, and it closes the loop before a human ever looks at the branch.

Picking the model per role

Every dispatch in the loop runs on a model, and Chapters 3 and 4 showed where that choice lives: OpenCode's model frontmatter field (a subagent inherits the parent's model when none is configured) and Claude Code's four-step resolution. In SDD, matching the tier to the role is one of the biggest cost levers you have:

| Role | Tier | Why | | --- | --- | --- | | Mechanical transcription — the complete code is already in the brief | Cheapest available | There is nothing to figure out; the model transcribes. Spend nothing here | | Prose-driven implementation and reviews | Mid tier | Turn count beats token price: cheap models often take 2-3x more turns to reach the same result, so the "cheap" choice can cost more per task | | Architecture decisions and the final whole-branch review | The most capable available | Judgment-heavy work where a missed cross-task interaction is the costliest possible miss | | Fix rounds 4-5 | One tier above the stuck implementer | The task has resisted that tier for three rounds — escalate before the breaker, not after it |

Two rows deserve a second look. The mid-tier row reverses most people's instinct: per-token price is the visible number, but a model that needs two or three times as many turns to converge burns more total tokens, more wall-clock, and more review cycles — the expensive-looking mid tier is often the economical one. And the last row is the loop's pressure valve: escalating the model tier on rounds 4-5 is one more thing to try before the breaker fires, and a fresh implementer sometimes succeeds for a dull reason — it was simply running on a tier that could reason about the problem.

What it costs, honestly

Do the arithmetic before adopting the pattern. One task costs an implementer dispatch plus a reviewer dispatch at minimum; every fix round adds a resume or a fresh dispatch plus a re-review; the whole branch adds a final review on top. That is roughly thirty dispatches for a five-task plan with two fix rounds each — versus one person working inline through the same list.

| Choose | When | | --- | --- | | Inline execution | Small tasks, tight iteration, quick fixes — work where the dispatch overhead exceeds the isolation benefit | | Subagent-driven development | Many-task branches, hours of context-heavy work, parallelizable tasks (Chapter 6), and work where review discipline matters more than speed |

The honest test: if you cannot articulate what the reviews and fresh contexts will catch in your specific project, run it inline. The pattern earns its cost where review pressure and context hygiene pay rent — and it burns tokens quietly everywhere else.

Full SDD walkthrough — owner screencast

Screencast coming soon

What you should now be able to say

If a colleague asks "what is subagent-driven development?", your answer is the loop: a fresh implementer per task, a reviewer checking spec compliance and quality, a fix loop that resumes the implementer on rounds 1-3 and goes fresh on 4-5, a breaker at round 5 that parks with a ruling or rules on load-bearing, a ledger that survives context compaction, and a whole-branch review at the end — adopted with open eyes about the token cost, because inline execution is the cheaper alternative whenever the isolation and review discipline are not actually buying you anything. Final chapter: the copy-paste recipes that turn everything since Chapter 5 into dispatches you can paste today.

Check yourself

Submit each question for instant feedback. Score 60% or higher and this chapter counts as done.

Why does SDD dispatch a FRESH implementer for every task instead of one implementer for the whole branch?
In the fix loop, rounds 1-3 resume the original implementer but rounds 4-5 dispatch a fresh one. What changes at round 4?
The task reviewer checks two different things: spec compliance (did it build what the task said?) and quality (is the code good?).
Five fix rounds have failed on a task. What does the round-5 breaker do?
Which belong in the ledger?
SDD is the right default for every change, because the reviews it adds can only improve the outcome.
Why does the model-tier guidance put prose-driven implementation and reviews on a mid tier instead of the cheapest?

Flashcards

Flip each card, then mark it honestly — marks are saved per card.

0/130 again0 got it

click to flip (Enter/Space works too)