@polderlabs/bizar 10.23.21 → 10.23.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/AGENTS.md +17 -14
  2. package/README.md +209 -67
  3. package/cli/banner.mjs +1 -1
  4. package/cli/commands/models.mjs +44 -3
  5. package/cli/commands/validate.mjs +6 -7
  6. package/cli/install/banner.mjs +1 -1
  7. package/cli/install/interactive-setup.mjs +13 -1
  8. package/cli/install/paths.mjs +2 -10
  9. package/cli/provision.mjs +21 -14
  10. package/cli/utils.mjs +2 -11
  11. package/config/claude/CLAUDE.md +17 -14
  12. package/config/claude/agents/bizar-accessibility-architect.md +153 -0
  13. package/config/claude/agents/bizar-agent-evaluator.md +210 -0
  14. package/config/claude/agents/bizar-architect.md +224 -0
  15. package/config/claude/agents/bizar-build-error-resolver.md +127 -0
  16. package/config/claude/agents/bizar-chief-of-staff.md +164 -0
  17. package/config/claude/agents/bizar-code-architect.md +84 -0
  18. package/config/claude/agents/bizar-code-explorer.md +82 -0
  19. package/config/claude/agents/bizar-code-reviewer.md +327 -0
  20. package/config/claude/agents/bizar-code-simplifier.md +60 -0
  21. package/config/claude/agents/bizar-comment-analyzer.md +58 -0
  22. package/config/claude/agents/bizar-conversation-analyzer.md +65 -0
  23. package/config/claude/agents/bizar-cpp-build-resolver.md +103 -0
  24. package/config/claude/agents/bizar-cpp-reviewer.md +85 -0
  25. package/config/claude/agents/bizar-csharp-reviewer.md +114 -0
  26. package/config/claude/agents/bizar-dart-build-resolver.md +214 -0
  27. package/config/claude/agents/bizar-database-reviewer.md +104 -0
  28. package/config/claude/agents/bizar-django-build-resolver.md +256 -0
  29. package/config/claude/agents/bizar-django-reviewer.md +173 -0
  30. package/config/claude/agents/bizar-doc-updater.md +120 -0
  31. package/config/claude/agents/bizar-docs-lookup.md +81 -0
  32. package/config/claude/agents/bizar-end-to-end-runner.md +120 -0
  33. package/config/claude/agents/bizar-fastapi-reviewer.md +83 -0
  34. package/config/claude/agents/bizar-flutter-reviewer.md +256 -0
  35. package/config/claude/agents/bizar-fsharp-reviewer.md +113 -0
  36. package/config/claude/agents/bizar-gan-evaluator.md +236 -0
  37. package/config/claude/agents/bizar-gan-generator.md +144 -0
  38. package/config/claude/agents/bizar-gan-planner.md +112 -0
  39. package/config/claude/agents/bizar-go-build-resolver.md +107 -0
  40. package/config/claude/agents/bizar-go-reviewer.md +89 -0
  41. package/config/claude/agents/bizar-harmonyos-app-resolver.md +186 -0
  42. package/config/claude/agents/bizar-harness-optimizer.md +59 -0
  43. package/config/claude/agents/bizar-healthcare-reviewer.md +96 -0
  44. package/config/claude/agents/bizar-homelab-architect.md +111 -0
  45. package/config/claude/agents/bizar-java-build-resolver.md +279 -0
  46. package/config/claude/agents/bizar-java-reviewer.md +194 -0
  47. package/config/claude/agents/bizar-kotlin-build-resolver.md +131 -0
  48. package/config/claude/agents/bizar-kotlin-reviewer.md +172 -0
  49. package/config/claude/agents/bizar-loop-operator.md +49 -0
  50. package/config/claude/agents/bizar-marketing-agent.md +163 -0
  51. package/config/claude/agents/bizar-mle-reviewer.md +166 -0
  52. package/config/claude/agents/bizar-network-architect.md +110 -0
  53. package/config/claude/agents/bizar-network-config-reviewer.md +110 -0
  54. package/config/claude/agents/bizar-network-troubleshooter.md +132 -0
  55. package/config/claude/agents/bizar-opensource-forker.md +211 -0
  56. package/config/claude/agents/bizar-opensource-packager.md +262 -0
  57. package/config/claude/agents/bizar-opensource-sanitizer.md +201 -0
  58. package/config/claude/agents/bizar-performance-optimizer.md +459 -0
  59. package/config/claude/agents/bizar-php-reviewer.md +113 -0
  60. package/config/claude/agents/bizar-planner.md +225 -0
  61. package/config/claude/agents/bizar-pr-test-analyzer.md +58 -0
  62. package/config/claude/agents/bizar-python-reviewer.md +111 -0
  63. package/config/claude/agents/bizar-pytorch-build-resolver.md +133 -0
  64. package/config/claude/agents/bizar-rag-pipeline-reviewer.md +71 -0
  65. package/config/claude/agents/bizar-react-build-resolver.md +219 -0
  66. package/config/claude/agents/bizar-react-reviewer.md +171 -0
  67. package/config/claude/agents/bizar-refactor-cleaner.md +98 -0
  68. package/config/claude/agents/bizar-rust-build-resolver.md +161 -0
  69. package/config/claude/agents/bizar-rust-reviewer.md +107 -0
  70. package/config/claude/agents/bizar-security-reviewer.md +121 -0
  71. package/config/claude/agents/bizar-seo-specialist.md +75 -0
  72. package/config/claude/agents/bizar-silent-failure-hunter.md +63 -0
  73. package/config/claude/agents/bizar-spec-miner.md +221 -0
  74. package/config/claude/agents/bizar-swift-build-resolver.md +174 -0
  75. package/config/claude/agents/bizar-swift-reviewer.md +120 -0
  76. package/config/claude/agents/bizar-tdd-guide.md +104 -0
  77. package/config/claude/agents/bizar-type-design-analyzer.md +54 -0
  78. package/config/claude/agents/bizar-typescript-reviewer.md +128 -0
  79. package/config/claude/agents/bizar-vue-reviewer.md +210 -0
  80. package/config/claude/agents/office-manager.md +13 -15
  81. package/config/claude/commands/bizar.md +6 -5
  82. package/config/claude/commands/plow-through.md +3 -2
  83. package/config/claude/commands/quick.md +14 -14
  84. package/config/claude/commands/team.md +5 -2
  85. package/config/claude/hooks/agent-model-guard.mjs +2 -2
  86. package/config/claude/hooks/sessionend-recall.mjs +1 -9
  87. package/config/claude/hooks/sessionstart-prime.mjs +2 -2
  88. package/config/claude/hooks/thinking-route.mjs +0 -1
  89. package/config/claude/hooks/worker-suggest.mjs +12 -24
  90. package/config/claude/hooks/workflow-route-guard.mjs +4 -3
  91. package/config/claude/hooks/workflow-route-state.mjs +1 -1
  92. package/config/skills/brainstorming/SKILL.md +253 -0
  93. package/config/skills/brainstorming/scripts/frame-template.html +213 -0
  94. package/config/skills/brainstorming/scripts/helper.js +167 -0
  95. package/config/skills/brainstorming/scripts/server.cjs +723 -0
  96. package/config/skills/brainstorming/scripts/start-server.sh +209 -0
  97. package/config/skills/brainstorming/scripts/stop-server.sh +120 -0
  98. package/config/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
  99. package/config/skills/brainstorming/visual-companion.md +299 -0
  100. package/config/skills/dispatching-parallel-agents/SKILL.md +170 -0
  101. package/config/skills/executing-plans/SKILL.md +67 -0
  102. package/config/skills/finishing-a-development-branch/SKILL.md +228 -0
  103. package/config/skills/receiving-code-review/SKILL.md +208 -0
  104. package/config/skills/requesting-code-review/SKILL.md +98 -0
  105. package/config/skills/requesting-code-review/code-reviewer.md +181 -0
  106. package/config/skills/subagent-driven-development/SKILL.md +571 -0
  107. package/config/skills/subagent-driven-development/implementer-prompt.md +154 -0
  108. package/config/skills/subagent-driven-development/re-review-prompt.md +115 -0
  109. package/config/skills/subagent-driven-development/scripts/review-package +46 -0
  110. package/config/skills/subagent-driven-development/scripts/sdd-workspace +40 -0
  111. package/config/skills/subagent-driven-development/scripts/task-brief +41 -0
  112. package/config/skills/subagent-driven-development/task-reviewer-prompt.md +207 -0
  113. package/config/skills/systematic-debugging/CREATION-LOG.md +119 -0
  114. package/config/skills/systematic-debugging/SKILL.md +286 -0
  115. package/config/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  116. package/config/skills/systematic-debugging/condition-based-waiting.md +115 -0
  117. package/config/skills/systematic-debugging/defense-in-depth.md +122 -0
  118. package/config/skills/systematic-debugging/find-polluter.sh +72 -0
  119. package/config/skills/systematic-debugging/root-cause-tracing.md +169 -0
  120. package/config/skills/systematic-debugging/test-academic.md +14 -0
  121. package/config/skills/systematic-debugging/test-pressure-1.md +58 -0
  122. package/config/skills/systematic-debugging/test-pressure-2.md +68 -0
  123. package/config/skills/systematic-debugging/test-pressure-3.md +69 -0
  124. package/config/skills/test-driven-development/SKILL.md +323 -0
  125. package/config/skills/test-driven-development/writing-good-tests.md +198 -0
  126. package/config/skills/using-git-worktrees/SKILL.md +170 -0
  127. package/config/skills/using-superpowers/SKILL.md +66 -0
  128. package/config/skills/using-superpowers/references/antigravity-tools.md +23 -0
  129. package/config/skills/using-superpowers/references/codex-tools.md +108 -0
  130. package/config/skills/using-superpowers/references/gemini-tools.md +63 -0
  131. package/config/skills/using-superpowers/references/hermes-tools.md +56 -0
  132. package/config/skills/using-superpowers/references/pi-tools.md +16 -0
  133. package/config/skills/verification-before-completion/SKILL.md +123 -0
  134. package/config/skills/writing-plans/SKILL.md +174 -0
  135. package/config/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
  136. package/config/skills/writing-skills/SKILL.md +682 -0
  137. package/config/skills/writing-skills/anthropic-best-practices.md +1150 -0
  138. package/config/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
  139. package/config/skills/writing-skills/graphviz-conventions.dot +172 -0
  140. package/config/skills/writing-skills/persuasion-principles.md +187 -0
  141. package/config/skills/writing-skills/render-graphs.js +169 -0
  142. package/config/skills/writing-skills/testing-skills-with-subagents.md +384 -0
  143. package/config/trigger-patterns.json +1 -1
  144. package/config/workflows/bizar-debug.js +1 -0
  145. package/config/workflows/bizar-implement.js +1 -0
  146. package/config/workflows/bizar-research.js +1 -0
  147. package/config/workflows/ultracode-research.js +1 -0
  148. package/config/workflows/ultracode-review.js +1 -0
  149. package/config/workflows/ultracode.js +1 -0
  150. package/package.json +1 -1
  151. package/packages/sdk/dist/version.d.ts +1 -1
  152. package/packages/sdk/dist/version.js +1 -1
  153. package/packages/sdk/package.json +1 -1
  154. package/config/claude/commands/migrate.md +0 -18
  155. package/config/claude/commands/tailscale-serve.md +0 -14
  156. package/config/claude/commands/tier.md +0 -31
  157. package/config/claude/commands/upgrade-defaults.md +0 -34
  158. package/config/claude/commands/use-default.md +0 -12
  159. package/config/claude/commands/use-premium.md +0 -12
@@ -0,0 +1,571 @@
1
+ ---
2
+ name: subagent-driven-development
3
+ description: Use when executing implementation plans with independent tasks in the current session
4
+ ---
5
+
6
+ > **Bizar compatibility:** This procedure is fully integrated into Bizar. Bizar system, repository, model-routing, autonomy, and approval policy control whenever they differ. Do not add a separate mandatory approval gate, recurse into dispatch, or override the active Bizar workflow.
7
+
8
+
9
+ # Subagent-Driven Development
10
+
11
+ Execute plan by dispatching a fresh implementer subagent per task, a task review (spec compliance + code quality) after each, and a broad whole-branch review at the end.
12
+
13
+ **Why subagents:** You delegate tasks to specialized agents with isolated context. By precisely crafting their instructions and context, you ensure they stay focused and succeed at their task. They should never inherit your session's context or history — you construct exactly what they need. This also preserves your own context for coordination work.
14
+
15
+ **Core principle:** Fresh subagent per task + task review (spec + quality) + broad final review = high quality, fast iteration
16
+
17
+ **Narration:** between tool calls, narrate at most one short line — the
18
+ ledger and the tool results carry the record.
19
+
20
+ **Continuous execution:** Do not pause to check in with your human partner between tasks. Execute all tasks from the plan without stopping. The only reasons to stop are the four named below, or all tasks complete. "Should I continue?" prompts and progress summaries waste their time — they asked you to execute the plan, so execute it.
21
+
22
+ **Rulings, not stalls.** A running plan does not wait on a human. Conflicts,
23
+ ambiguities, plan defects, a cap you would have asked to exceed — decide
24
+ them. The spec is the binding authority, the plan is its argument, and your
25
+ judgment settles what neither answers. Record every decision in the ledger as
26
+ `Ruling: <what you decided> — <why> — <what it costs if wrong>`, and keep
27
+ going. A wrong ruling costs rework your human partner can see and undo; a
28
+ session parked on a question costs their whole day and buys nothing.
29
+
30
+ Four things stop you, and only these: an irreversible or destructive
31
+ operation; a security-sensitive action; a side effect outside this worktree
32
+ that norms say you ask about first (a merge, a push to a shared branch, a
33
+ publish); and a plan so broken that every path forward is a guess. For those,
34
+ stop and ask.
35
+
36
+ ## When to Use
37
+
38
+ ```dot
39
+ digraph when_to_use {
40
+ "Have implementation plan?" [shape=diamond];
41
+ "Tasks mostly independent?" [shape=diamond];
42
+ "Stay in this session?" [shape=diamond];
43
+ "subagent-driven-development" [shape=box];
44
+ "executing-plans" [shape=box];
45
+ "Manual execution or brainstorm first" [shape=box];
46
+
47
+ "Have implementation plan?" -> "Tasks mostly independent?" [label="yes"];
48
+ "Have implementation plan?" -> "Manual execution or brainstorm first" [label="no"];
49
+ "Tasks mostly independent?" -> "Stay in this session?" [label="yes"];
50
+ "Tasks mostly independent?" -> "Manual execution or brainstorm first" [label="no - tightly coupled"];
51
+ "Stay in this session?" -> "subagent-driven-development" [label="yes"];
52
+ "Stay in this session?" -> "executing-plans" [label="no - parallel session"];
53
+ }
54
+ ```
55
+
56
+ **vs. Executing Plans (parallel session):**
57
+ - Same session (no context switch)
58
+ - Fresh subagent per task (no context pollution)
59
+ - Review after each task (spec compliance + code quality), broad review at the end
60
+ - Faster iteration (no human-in-loop between tasks)
61
+
62
+ ## The Process
63
+
64
+ ```dot
65
+ digraph process {
66
+ rankdir=TB;
67
+
68
+ subgraph cluster_per_task {
69
+ label="Per Task";
70
+ "Dispatch implementer subagent (./implementer-prompt.md)" [shape=box];
71
+ "Implementer asks questions?" [shape=diamond];
72
+ "Answer questions, provide context" [shape=box];
73
+ "Implementer implements, tests, commits, self-reviews" [shape=box];
74
+ "Generate review package, dispatch task reviewer (./task-reviewer-prompt.md)" [shape=box];
75
+ "Spec ✅ and quality approved?" [shape=diamond];
76
+ "Finding conflicts with plan text?" [shape=diamond];
77
+ "Rule on the conflict, ledger the ruling" [shape=box];
78
+ "Fix round R of 5: R≤3 resume implementer; R≥4 fresh implementer, more capable model" [shape=box];
79
+ "Dispatch scoped re-review (./re-review-prompt.md)" [shape=box];
80
+ "All findings addressed?" [shape=diamond];
81
+ "R = 5?" [shape=diamond];
82
+ "Adjudicate each open finding" [shape=box];
83
+ "Any load-bearing finding?" [shape=diamond];
84
+ "Rule and continue; stop only if every path forward is a guess" [shape=box];
85
+ "Park findings in ledger with rulings" [shape=box];
86
+ "Append completion to ledger, mark todo complete" [shape=box];
87
+ }
88
+
89
+ "Setup: worktree, ledger check, read plan, pre-flight review" [shape=box];
90
+ "More tasks remain?" [shape=diamond];
91
+ "Dispatch final code reviewer (../requesting-code-review/code-reviewer.md)" [shape=box];
92
+ "Final findings? ONE fix dispatch, one scoped re-review, adjudicate residuals" [shape=box];
93
+ "Final review clean: delete this plan's workspace" [shape=box];
94
+ "Use superpowers:finishing-a-development-branch" [shape=box style=filled fillcolor=lightgreen];
95
+
96
+ "Setup: worktree, ledger check, read plan, pre-flight review" -> "Dispatch implementer subagent (./implementer-prompt.md)";
97
+ "Dispatch implementer subagent (./implementer-prompt.md)" -> "Implementer asks questions?";
98
+ "Implementer asks questions?" -> "Answer questions, provide context" [label="yes"];
99
+ "Answer questions, provide context" -> "Implementer implements, tests, commits, self-reviews";
100
+ "Implementer asks questions?" -> "Implementer implements, tests, commits, self-reviews" [label="no"];
101
+ "Implementer implements, tests, commits, self-reviews" -> "Generate review package, dispatch task reviewer (./task-reviewer-prompt.md)";
102
+ "Generate review package, dispatch task reviewer (./task-reviewer-prompt.md)" -> "Spec ✅ and quality approved?";
103
+ "Spec ✅ and quality approved?" -> "Append completion to ledger, mark todo complete" [label="yes"];
104
+ "Spec ✅ and quality approved?" -> "Finding conflicts with plan text?" [label="no"];
105
+ "Finding conflicts with plan text?" -> "Rule on the conflict, ledger the ruling" [label="yes"];
106
+ "Rule on the conflict, ledger the ruling" -> "Fix round R of 5: R≤3 resume implementer; R≥4 fresh implementer, more capable model";
107
+ "Finding conflicts with plan text?" -> "Fix round R of 5: R≤3 resume implementer; R≥4 fresh implementer, more capable model" [label="no"];
108
+ "Fix round R of 5: R≤3 resume implementer; R≥4 fresh implementer, more capable model" -> "Dispatch scoped re-review (./re-review-prompt.md)";
109
+ "Dispatch scoped re-review (./re-review-prompt.md)" -> "All findings addressed?";
110
+ "All findings addressed?" -> "Append completion to ledger, mark todo complete" [label="yes"];
111
+ "All findings addressed?" -> "R = 5?" [label="no"];
112
+ "R = 5?" -> "Fix round R of 5: R≤3 resume implementer; R≥4 fresh implementer, more capable model" [label="no - next round"];
113
+ "R = 5?" -> "Adjudicate each open finding" [label="yes - breaker trips"];
114
+ "Adjudicate each open finding" -> "Any load-bearing finding?";
115
+ "Any load-bearing finding?" -> "Rule and continue; stop only if every path forward is a guess" [label="yes"];
116
+ "Any load-bearing finding?" -> "Park findings in ledger with rulings" [label="no"];
117
+ "Park findings in ledger with rulings" -> "Append completion to ledger, mark todo complete";
118
+ "Append completion to ledger, mark todo complete" -> "More tasks remain?";
119
+ "More tasks remain?" -> "Dispatch implementer subagent (./implementer-prompt.md)" [label="yes"];
120
+ "More tasks remain?" -> "Dispatch final code reviewer (../requesting-code-review/code-reviewer.md)" [label="no"];
121
+ "Dispatch final code reviewer (../requesting-code-review/code-reviewer.md)" -> "Final findings? ONE fix dispatch, one scoped re-review, adjudicate residuals";
122
+ "Final findings? ONE fix dispatch, one scoped re-review, adjudicate residuals" -> "Final review clean: delete this plan's workspace";
123
+ "Final review clean: delete this plan's workspace" -> "Use superpowers:finishing-a-development-branch";
124
+ }
125
+ ```
126
+
127
+ ## Setup
128
+
129
+ Ensure the work happens in an isolated workspace: use
130
+ superpowers:using-git-worktrees to create one or verify the existing one.
131
+ Never start implementation on a main/master branch without your human
132
+ partner's explicit consent.
133
+
134
+ Conversation memory does not survive compaction. In real sessions,
135
+ controllers that lost their place have re-dispatched entire completed task
136
+ sequences — the single most expensive failure observed. Track progress in
137
+ a ledger file, not only in todos.
138
+
139
+ - Each plan owns a workspace: at skill start, run this skill's
140
+ `scripts/sdd-workspace PLAN_FILE` — it prints the plan's git-ignored
141
+ directory (`<repo-root>/.superpowers/sdd/<plan-basename>/`), home to
142
+ every artifact for THIS plan: ledger, briefs, reports, review packages.
143
+ Another plan's directory is never yours to read or write.
144
+ - Check for this plan's ledger at `<workspace>/progress.md`. If its first
145
+ line names your plan file, tasks with a `Task <N>: complete` line are DONE
146
+ — do not re-dispatch them; resume at the first task without one. A task
147
+ whose last line is a fix round is mid-loop: resume the loop at the next
148
+ round. A ledger whose first line names a different plan file — or a stray
149
+ ledger at the old flat path `.superpowers/sdd/progress.md` — is another
150
+ plan's progress: leave it in place and start your own, fresh.
151
+ - Create the ledger with its identity as the first line:
152
+ `# SDD ledger — plan: <plan file path>`.
153
+ - The ledger is your recovery map: the commits it names exist in git even
154
+ when your context no longer remembers creating them. After compaction,
155
+ trust the ledger and `git log` over your own recollection.
156
+ - `git clean -fdx` will destroy the workspace (it's git-ignored scratch); if
157
+ that happens, recover from `git log`.
158
+
159
+ Read the plan once, note its context and Global Constraints, and create a
160
+ todo per task. If the plan names a Spec, read that too: the spec is the
161
+ authority the plan argues from, and conflicts inside the plan resolve
162
+ against it. A plan with no reachable spec gets a ledger note saying so —
163
+ rulings made without one are provisional.
164
+
165
+ Before dispatching Task 1, scan the plan once for conflicts, writing down
166
+ what you checked as you check it:
167
+
168
+ - tasks that contradict each other or the plan's Global Constraints
169
+ - anything the plan explicitly mandates that the review rubric treats as a
170
+ defect (a test that asserts nothing, verbatim duplication of a logic block)
171
+
172
+ The scan's output is a table, not a verdict. One row for every pair of tasks
173
+ that share a file or an interface: the two tasks, what one produces against
174
+ what the other consumes, and what you found. One row for every task: whether
175
+ its own text agrees with itself — the tests it specifies against the code it
176
+ specifies, the files it creates against the files it later touches. "The scan
177
+ is clean" without those rows is not a scan you ran.
178
+
179
+ Write the table to the ledger. Rule on everything you find before execution
180
+ begins — each finding against the plan text that mandates it — and record
181
+ each ruling in the ledger. If the scan is clean, proceed without comment.
182
+ Rule on each conflict it surfaces — the spec is the binding authority, the
183
+ plan is its argument — record the ruling beside its row, and dispatch
184
+ Task 1. The review loop remains the net for conflicts that only emerge from
185
+ implementation.
186
+
187
+ ## Model Selection
188
+
189
+ Use the least powerful model that can handle each role to conserve cost and increase speed.
190
+
191
+ **Mechanical implementation tasks** (isolated functions, clear specs, 1-2 files): use a fast, cheap model. Most implementation tasks are mechanical when the plan is well-specified.
192
+
193
+ **Integration and judgment tasks** (multi-file coordination, pattern matching, debugging): use a standard model.
194
+
195
+ **Architecture and design tasks**: use the most capable available model.
196
+ The final whole-branch review is one of these — dispatch it on the most
197
+ capable available model, not the session default.
198
+
199
+ **Review tasks**: choose the model with the same judgment, scaled to the
200
+ diff's size, complexity, and risk. A small mechanical diff does not need the
201
+ most capable model; a subtle concurrency change does. Scoped re-reviews of
202
+ small fix diffs take a cheap-to-mid tier.
203
+
204
+ **Fix-loop escalation (rounds 4-5)**: use a model at least one tier above
205
+ the implementer that got stuck.
206
+
207
+ **Always specify the model explicitly when dispatching a subagent.** An
208
+ omitted model inherits your session's model — often the most capable and
209
+ most expensive — which silently defeats this section.
210
+
211
+ **Turn count beats token price.** Wall-clock and context cost scale with how
212
+ many turns a subagent takes, and the cheapest models routinely take 2-3× the
213
+ turns on multi-step work — costing more overall. Use a mid-tier model as the
214
+ floor for reviewers and for implementers working from prose descriptions.
215
+ When the task's plan text contains the complete code to write, the
216
+ implementation is transcription plus testing: use the cheapest tier for
217
+ that implementer. Single-file mechanical fixes also take the cheapest tier.
218
+
219
+ **Task complexity signals (implementation tasks):**
220
+ - Touches 1-2 files with a complete spec → cheap model
221
+ - Touches multiple files with integration concerns → standard model
222
+ - Requires design judgment or broad codebase understanding → most capable model
223
+
224
+ ## The Task Loop
225
+
226
+ **Batch small same-shape work.** When the plan lists several tasks that are
227
+ each a small, independent edit of the same kind — the same one-line fix,
228
+ constant change, or field addition repeated across files — do not dispatch
229
+ one subagent per task. Compose ONE dispatch brief listing every file and
230
+ its change, send the whole batch to a single subagent, and review its diff
231
+ as one unit. Reserve one-dispatch-per-task for work that needs its own
232
+ judgment, its own tests, or its own review surface.
233
+
234
+ Everything you paste into a dispatch prompt — and everything a subagent
235
+ prints back — stays resident in your context for the rest of the session
236
+ and is re-read on every later turn. Hand artifacts over as files.
237
+
238
+ **Waiting on dispatched subagents:** never poll a wait interface with
239
+ short timeouts, and never sit in one silent, open-ended wait either.
240
+ While you have local work — ledger updates, packaging the next review,
241
+ reading reports — keep working; child results arrive on their own.
242
+ When you are genuinely idle, wait in bounded stretches (five to ten
243
+ minutes, where your platform allows), and between stretches post one
244
+ line of status and reconcile your live children: list them, and chase
245
+ any that finished without reporting. A bounded stretch keeps nearly
246
+ all of a long wait's efficiency while guaranteeing a stuck or lost
247
+ child is noticed within minutes, not at the end of the session.
248
+
249
+ ### 1. Dispatch the implementer
250
+
251
+ Record BASE (`git rev-parse HEAD`) before dispatching — the review package
252
+ and fix-round diffs need it.
253
+
254
+ - **Task brief:** before dispatching an implementer, run this skill's
255
+ `scripts/task-brief PLAN_FILE N` — it extracts the task's full text to a
256
+ uniquely named file and prints the path. Compose the dispatch so the
257
+ brief stays the single source of
258
+ requirements. Your dispatch should contain: (1) one line on where this
259
+ task fits in the project; (2) the brief path, introduced as "read this
260
+ first — it is your requirements, with the exact values to use verbatim";
261
+ (3) interfaces and decisions from earlier tasks that the brief cannot
262
+ know; (4) your resolution of any ambiguity you noticed in the brief;
263
+ (5) the report-file path and report contract. Exact values (numbers,
264
+ magic strings, signatures, test cases) appear only in the brief. Never
265
+ make a subagent read the whole plan file.
266
+ - **Report file:** name the implementer's report file after the brief
267
+ (brief `…/task-N-brief.md` → report `…/task-N-report.md`) and put it in
268
+ the dispatch prompt. The implementer writes the full report there and
269
+ returns only status, commits, a one-line test summary, and concerns.
270
+ - A dispatch prompt describes one task, not the session's history. Do not
271
+ paste accumulated prior-task summaries ("state after Tasks 1-3") into
272
+ later dispatches — a real session's dispatch hit 42k chars of which 99%
273
+ was pasted history. A fresh subagent needs its task, the interfaces it
274
+ touches, and the global constraints. Nothing else.
275
+ - The dispatch carries the no-subagents contract (it is in the
276
+ implementer template): the implementer never dispatches subagents —
277
+ not helpers, and never a reviewer. Review arrives from you, after the
278
+ report. In real sessions, every reviewer a worker spawned duplicated
279
+ the task review the controller dispatched anyway — a full extra
280
+ review seat per task.
281
+ - If an earlier task parked a finding in the area this task touches, carry
282
+ a pointer to that ledger entry in the dispatch.
283
+ - Record the implementer's agent identity from the dispatch result —
284
+ fix-loop rounds 1-3 resume this agent.
285
+ - Never dispatch multiple implementation subagents in parallel (conflicts).
286
+
287
+ Template: [implementer-prompt.md](implementer-prompt.md)
288
+
289
+ ### 2. Handle the report
290
+
291
+ Implementer subagents report one of four statuses. Handle each appropriately:
292
+
293
+ **DONE:** Generate the review package (`scripts/review-package PLAN_FILE BASE HEAD`, from this skill's directory — it prints the unique file path it wrote; BASE is the commit you recorded before dispatching the implementer — never `HEAD~1`, which silently drops all but the last commit of a multi-commit task), then dispatch the task reviewer with the printed path.
294
+
295
+ **DONE_WITH_CONCERNS:** The implementer completed the work but flagged doubts. Read the concerns before proceeding. If the concerns are about correctness or scope, address them before review. If they're observations (e.g., "this file is getting large"), note them and proceed to review.
296
+
297
+ **NEEDS_CONTEXT:** The implementer needs information that wasn't provided. Provide the missing context and re-dispatch.
298
+
299
+ **BLOCKED:** The implementer cannot complete the task. Assess the blocker:
300
+ 1. If it's a context problem, provide more context and re-dispatch with the same model
301
+ 2. If the task requires more reasoning, re-dispatch with a more capable model
302
+ 3. If the task is too large, break it into smaller pieces
303
+ 4. If the plan itself is wrong, rule on the correction, ledger it, and re-dispatch with the ruling carried in the dispatch
304
+
305
+ **Never** ignore an escalation or force the same model to retry without changes. If the implementer said it's stuck, something needs to change.
306
+
307
+ If the implementer asks questions — before starting or mid-task — answer
308
+ clearly and completely, provide additional context if needed, and don't
309
+ rush it into implementation.
310
+
311
+ ### 3. Review the task
312
+
313
+ Per-task reviews are task-scoped gates. The broad review happens once, at the
314
+ final whole-branch review. Never skip the task review, and never accept a
315
+ report missing either verdict — spec compliance AND task quality are both
316
+ required. Implementer self-review never replaces the task review; both are
317
+ needed.
318
+
319
+ - Hand the reviewer its diff as a file: run this skill's
320
+ `scripts/review-package PLAN_FILE BASE HEAD` and pass the reviewer the file path
321
+ it prints (or, without bash: `git log --oneline`, `git diff --stat`,
322
+ and `git diff -U10` for the range, redirected to one uniquely named
323
+ file). The output never enters your own context, and the reviewer sees
324
+ the commit list, stat summary, and full diff with context in one Read
325
+ call. Use the BASE you recorded before dispatching the implementer —
326
+ never `HEAD~1`, which silently truncates multi-commit tasks. Never
327
+ dispatch a task reviewer without a diff file.
328
+ - **Reviewer inputs:** the task reviewer gets three paths — the same brief
329
+ file, the report file, and the review package — plus the global
330
+ constraints that bind the task.
331
+ - The global-constraints block you hand the reviewer is its attention
332
+ lens. Copy the binding requirements verbatim from the plan's Global
333
+ Constraints section or the spec: exact values, exact formats, and the
334
+ stated relationships between components ("same layout as X", "matches
335
+ Y"). The reviewer's template already carries the process rules (YAGNI,
336
+ test hygiene, review method) — the constraints block is for what THIS
337
+ project's spec demands.
338
+ - Do not add open-ended directives like "check all uses" or "run race tests
339
+ if useful" without a concrete, task-specific reason
340
+ - Do not ask a reviewer to re-run tests the implementer already ran on the
341
+ same code — the implementer's report carries the test evidence
342
+ - Do not pre-judge findings for the reviewer — never instruct a reviewer to
343
+ ignore or not flag a specific issue. If you believe a finding would be a
344
+ false positive, let the reviewer raise it and adjudicate it in the review
345
+ loop. If the prompt you are writing contains "do not flag," "don't treat X
346
+ as a defect," "at most Minor," or "the plan chose" — stop: you are
347
+ pre-judging, usually to spare yourself a review loop.
348
+ The task reviewer may report "⚠️ Cannot verify from diff" items — requirements
349
+ that live in unchanged code or span tasks. These do not block the rest of the
350
+ review, but you must resolve each one yourself before marking the task
351
+ complete: you hold the plan and cross-task context the reviewer
352
+ lacks. If you confirm an item is a real gap, treat it as a failed spec
353
+ review — it enters the fix loop with the other findings.
354
+
355
+ Template: [task-reviewer-prompt.md](task-reviewer-prompt.md)
356
+
357
+ ### 4. The fix loop
358
+
359
+ The loop triggers when the review reports spec ❌, any Critical or Important
360
+ finding, or a ⚠️ item you confirmed as a real gap.
361
+
362
+ Before the loop starts, two routes leave it immediately:
363
+
364
+ - Record Minor findings in the progress ledger as you go
365
+ (`Task <N>: minor (deferred): <one-liner>`), and point the final
366
+ whole-branch review at that list so it can triage which must be fixed
367
+ before merge. A roll-up nobody reads is a silent discard. Minor findings
368
+ never enter the loop.
369
+ - A finding labeled plan-mandated — or any finding that conflicts with
370
+ what the plan's text requires — is yours to rule on: weigh the finding
371
+ against the plan text, decide with the spec as the binding authority, and
372
+ ledger the ruling before you act on it. Do not dismiss the finding because
373
+ the plan mandates it, and do not dispatch a fix that contradicts the plan
374
+ without a recorded ruling.
375
+ Everything else enters the loop. A fix round is one fix dispatch plus one
376
+ scoped re-review. Five rounds maximum per task:
377
+
378
+ **Rounds 1-3 — resume the original implementer.** Send it the open findings
379
+ verbatim. Its context is intact: it knows the task, the code, and its own
380
+ choices. If your harness cannot send another message to a live subagent,
381
+ dispatch a fresh implementer carrying the brief path, the report-file path,
382
+ and the findings — the report file is the persistent memory either way.
383
+
384
+ **Rounds 4-5 — dispatch a fresh implementer on a more capable model** (per
385
+ Model Selection), with the brief path, the report-file path, the open
386
+ findings, and this framing: "A prior implementer attempted this task
387
+ [N] times; you own it now. Read the report file for what was tried." A loop
388
+ that survives three resumes usually means the implementer cannot see its
389
+ own problem — fresh eyes and a capability bump in one move.
390
+
391
+ **Every round, either way:** the implementer fixes, re-runs the tests
392
+ covering the amended code, appends its fix report to the same report file,
393
+ and returns the short contract. Before re-dispatching the reviewer, confirm
394
+ the fix report contains the covering tests, the command run, and the
395
+ output; dispatch the re-review once all three are present. Name the
396
+ covering test files in the fix message — a one-line fix does not need the
397
+ whole suite.
398
+
399
+ **The re-review is scoped.** Run `scripts/review-package PLAN_FILE FIX_BASE HEAD`
400
+ where FIX_BASE is the head the previous review saw, and dispatch
401
+ [re-review-prompt.md](re-review-prompt.md) with the findings list, the
402
+ brief, the report file, and the printed diff path. The re-reviewer verdicts
403
+ each finding ADDRESSED or NOT ADDRESSED and flags new breakage in the fix
404
+ diff only. New Critical/Important breakage in the fix diff joins the open
405
+ findings list. Out-of-scope observations go to the ledger as deferred
406
+ minors — they never extend the loop.
407
+
408
+ **After each round,** append to the ledger:
409
+ `Task <N>: fix round <R>/5 (<X> addressed, <Y> open — <finding one-liners>; commits <a7>..<b7>)`
410
+
411
+ Never fix findings yourself in the controller session — your context stays
412
+ clean for coordination, and controller fixes skip review.
413
+
414
+ **The breaker.** When round 5's re-review still leaves findings open, stop
415
+ dispatching. Adjudicate each open finding yourself — you hold the plan and
416
+ the cross-task context the reviewer lacks:
417
+
418
+ - **The reviewer is wrong, or the point is contestable:** park it —
419
+ `Task <N>: parked — <finding> — Ruling: <why the code stands>`. The final
420
+ review sees both sides.
421
+ - **Real, but nothing downstream builds on it:** park it the same way, with
422
+ a ruling that says it's real and deferred.
423
+ - **Real and load-bearing** — a later task builds on it, or it reveals a
424
+ plan defect: rule on the smallest change that unblocks the dependent work,
425
+ ledger it as `Task <N>: Ruling: <finding> — <what you decided and why>`,
426
+ and carry it into the next task's dispatch. Parking a structural failure
427
+ silently lets every dependent task build on it. Stop only when the defect
428
+ leaves every path forward a guess.
429
+
430
+ Adjudicate only at the cap. Adjudicating earlier to end a loop is
431
+ pre-judging with a different name. Every adjudication is a ledger entry —
432
+ a silent discard is forbidden.
433
+
434
+ ### 5. Complete the task
435
+
436
+ When the review comes back clean — or every open finding is parked with a
437
+ ruling at the cap — append the completion line to the ledger in the same
438
+ message as your other bookkeeping:
439
+
440
+ - `Task <N>: complete (commits <base7>..<head7>, review clean)`
441
+ - `Task <N>: complete (commits <base7>..<head7>, <K> parked)` after a
442
+ tripped breaker
443
+
444
+ Then mark the todo complete and move on. Never move to the next task while
445
+ the review has open Critical/Important issues that are neither fixed nor
446
+ parked-with-ruling at the cap.
447
+
448
+ ## Final Review
449
+
450
+ The final whole-branch review gets a package too: run
451
+ `scripts/review-package PLAN_FILE MERGE_BASE HEAD` (MERGE_BASE = the commit the
452
+ branch started from, e.g. `git merge-base main HEAD`) and include the
453
+ printed path in the final review dispatch, so the final reviewer reads
454
+ one file instead of re-deriving the branch diff with git commands. Dispatch
455
+ on the most capable available model (see Model Selection), using
456
+ superpowers:requesting-code-review's
457
+ [code-reviewer.md](../requesting-code-review/code-reviewer.md). Point it at
458
+ the ledger's deferred-minor and parked lines so it can triage which must be
459
+ fixed before merge.
460
+
461
+ If the final whole-branch review returns findings, dispatch ONE fix subagent
462
+ with the complete findings list — not one fixer per finding.
463
+ Per-finding fixers each rebuild context and re-run suites; a real
464
+ session's final-review fix wave cost more than all its tasks combined.
465
+ Then run exactly one scoped re-review of the fix wave
466
+ (`scripts/review-package PLAN_FILE FIX_BASE HEAD` over the fix range,
467
+ [re-review-prompt.md](re-review-prompt.md)).
468
+ Adjudicate any residual findings as in the task loop's breaker: park with
469
+ rulings, or rule on the load-bearing ones and ledger what you decided. Only
470
+ the four classes above stop you here. There is no second fix wave —
471
+ residual load-bearing findings surface to your human partner when
472
+ finishing-a-development-branch presents the options.
473
+
474
+ ## Finish
475
+
476
+ Before you delete anything, collect every ledger line containing `Ruling:` —
477
+ preflight rulings, parked findings, breaker adjudications, all of them — into
478
+ your final message under "Rulings I made", in the order you made them, each
479
+ with what it costs if wrong. The list is exhaustive: if the ledger holds a
480
+ ruling, the list holds it. That list is the only place the decisions you
481
+ took on your human partner's behalf reach them — they read it and rework
482
+ whatever you got wrong. A ruling that dies with the workspace was a decision
483
+ made in secret.
484
+
485
+ When the final whole-branch review is clean and its fixes are merged,
486
+ delete this plan's workspace (`rm -rf <workspace>`) — the git history is
487
+ the record now. Sibling directories belong to other plans; leave them
488
+ alone.
489
+
490
+ Use superpowers:finishing-a-development-branch.
491
+
492
+ ## Common Rationalizations
493
+
494
+ | Excuse | Reality |
495
+ |--------|---------|
496
+ | "Close enough on spec compliance" | Reviewer found spec gaps = not done. Fix or hit the cap and adjudicate — those are the only exits. |
497
+ | "I'll fix it myself, dispatching is overhead" | Controller fixes pollute your context and skip review. Resume the implementer. |
498
+ | "One more round will converge" | Past the cap, rounds don't converge — the failure is structural. Adjudicate and route. |
499
+ | "The reviewer will just find something new anyway" | Scoped re-reviews verify fixes; they cannot wander. New findings on untouched code go to the ledger, not the loop. |
500
+ | "This finding is obviously wrong, I'll drop it" | You adjudicate only at the cap, and every ruling is a ledger entry. Silent discards are forbidden. |
501
+ | "The fix was small, skip the re-review" | Unreviewed fixes are how regressions land. Every round ends with a scoped re-review. |
502
+ | "Reviews slow the loop down" | The loop without reviews is just unverified churn. Reviews are the loop's brakes and steering. |
503
+ | "Ledger bookkeeping is overhead" | The ledger is what survives compaction. Controllers without one have re-dispatched entire completed task sequences. |
504
+ | "The implementer spawned its own reviewer — free extra assurance" | It's a duplicate seat reviewing the same diff; the task review is the gate. A worker-spawned reviewer is a defect to flag, not rigor. |
505
+
506
+ ## Example Workflow
507
+
508
+ ```
509
+ You: I'm using Subagent-Driven Development to execute this plan.
510
+
511
+ [Setup: worktree verified]
512
+ [Read plan file once: docs/superpowers/plans/feature-plan.md]
513
+ [Resolve workspace: scripts/sdd-workspace docs/superpowers/plans/feature-plan.md — no ledger inside, fresh start]
514
+ [Create todos for all tasks]
515
+
516
+ Task 1: Hook installation script
517
+
518
+ [Run task-brief for Task 1; dispatch implementer with brief + report paths + context]
519
+
520
+ Implementer: "Before I begin - should the hook be installed at user or system level?"
521
+
522
+ You: "User level (~/.config/superpowers/hooks/)"
523
+
524
+ Implementer: [Later]
525
+ - Implemented install-hook command
526
+ - Added tests, 5/5 passing
527
+ - Self-review: Found I missed --force flag, added it
528
+ - Committed
529
+
530
+ [Run review-package PLAN_FILE BASE HEAD; dispatch task reviewer with the printed path]
531
+ Task reviewer: Spec ✅ - all requirements met, nothing extra.
532
+ Strengths: Good test coverage, clean. Issues: None. Task quality: Approved.
533
+
534
+ [Ledger: Task 1: complete (commits a1b2c3d..d4e5f6a, review clean)]
535
+
536
+ Task 2: Recovery modes
537
+
538
+ [Run task-brief for Task 2; dispatch implementer with brief + report paths + context]
539
+
540
+ Implementer: [No questions]
541
+ - Added verify/repair modes
542
+ - 8/8 tests passing
543
+ - Committed
544
+
545
+ [Run review-package PLAN_FILE BASE HEAD; dispatch task reviewer with the printed path]
546
+ Task reviewer: Spec ❌:
547
+ - Missing: Progress reporting (spec says "report every 100 items")
548
+ Issues (Important): Magic number (100)
549
+
550
+ [Fix round 1: resume the implementer with both findings]
551
+ Implementer: Added progress reporting, extracted PROGRESS_INTERVAL constant.
552
+ Re-ran test/recovery.test.js — 10/10 passing. Fix report appended.
553
+
554
+ [Run review-package PLAN_FILE FIX_BASE HEAD; dispatch scoped re-review]
555
+ Re-reviewer: Missing progress reporting — ADDRESSED (src/recovery.js:41).
556
+ Magic number — ADDRESSED (src/recovery.js:7). New breakage: none.
557
+ Verdict: all findings addressed.
558
+
559
+ [Ledger: Task 2: fix round 1/5 (2 addressed, 0 open; commits d4e5f6a..b7c8d9e)]
560
+ [Ledger: Task 2: complete (commits d4e5f6a..b7c8d9e, review clean)]
561
+
562
+ ...
563
+
564
+ [After all tasks]
565
+ [Run review-package PLAN_FILE MERGE_BASE HEAD; dispatch final code-reviewer, most capable model]
566
+ Final reviewer: All requirements met. Deferred minors triaged: none block merge.
567
+
568
+ [Delete this plan's workspace — the record now lives in git]
569
+
570
+ Done! Using superpowers:finishing-a-development-branch.
571
+ ```