@wenaixi/dsh-superpower 7.4.1 → 7.5.1

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 (72) hide show
  1. package/README.md +110 -105
  2. package/README.zh.md +216 -0
  3. package/lib/catalog.d.ts +8 -2
  4. package/lib/catalog.d.ts.map +1 -1
  5. package/lib/catalog.js +64 -9
  6. package/lib/catalog.js.map +1 -1
  7. package/lib/client.js +68 -21
  8. package/lib/document.d.ts +8 -2
  9. package/lib/document.d.ts.map +1 -1
  10. package/lib/document.js +14 -4
  11. package/lib/document.js.map +1 -1
  12. package/lib/superpowers.d.ts +2 -0
  13. package/lib/superpowers.d.ts.map +1 -1
  14. package/lib/superpowers.js +8 -0
  15. package/lib/superpowers.js.map +1 -1
  16. package/lib/switches.d.ts +2 -10
  17. package/lib/switches.d.ts.map +1 -1
  18. package/lib/switches.js +29 -5
  19. package/lib/switches.js.map +1 -1
  20. package/package.json +3 -3
  21. package/skills/brainstorming/SKILL.md +235 -171
  22. package/skills/brainstorming/spec-document-reviewer-prompt.md +27 -25
  23. package/skills/brainstorming/visual-companion.md +65 -69
  24. package/skills/diagnosing-superpowers/SKILL.md +107 -43
  25. package/skills/diagnosing-superpowers/prompts/analyst-common.md +32 -18
  26. package/skills/diagnosing-superpowers/prompts/cost-and-time.md +25 -9
  27. package/skills/diagnosing-superpowers/prompts/plan-adherence.md +26 -12
  28. package/skills/diagnosing-superpowers/prompts/quality-evidence.md +23 -8
  29. package/skills/diagnosing-superpowers/prompts/repeated-work.md +25 -14
  30. package/skills/diagnosing-superpowers/prompts/request-conflicts.md +18 -9
  31. package/skills/diagnosing-superpowers/prompts/scrub-audit.md +23 -10
  32. package/skills/diagnosing-superpowers/prompts/scrub.md +25 -12
  33. package/skills/diagnosing-superpowers/prompts/similar-session.md +30 -22
  34. package/skills/diagnosing-superpowers/prompts/skill-timeline.md +26 -12
  35. package/skills/diagnosing-superpowers/prompts/stumbles.md +24 -12
  36. package/skills/diagnosing-superpowers/references/context-safety.md +15 -7
  37. package/skills/diagnosing-superpowers/references/github-issues.md +17 -9
  38. package/skills/diagnosing-superpowers/references/redaction-policy.md +27 -15
  39. package/skills/diagnosing-superpowers/references/session-discovery.md +31 -20
  40. package/skills/diagnosing-superpowers/templates/bundle-README.md +66 -40
  41. package/skills/diagnosing-superpowers/templates/case.md +49 -42
  42. package/skills/diagnosing-superpowers/templates/issue.md +32 -26
  43. package/skills/diagnosing-superpowers/templates/report.md +54 -48
  44. package/skills/dispatching-parallel-agents/SKILL.md +92 -90
  45. package/skills/executing-plans/SKILL.md +345 -197
  46. package/skills/finishing-a-development-branch/SKILL.md +107 -82
  47. package/skills/receiving-code-review/SKILL.md +129 -127
  48. package/skills/requesting-code-review/SKILL.md +52 -50
  49. package/skills/requesting-code-review/code-reviewer.md +132 -111
  50. package/skills/subagent-driven-development/SKILL.md +521 -298
  51. package/skills/subagent-driven-development/implementer-prompt.md +138 -117
  52. package/skills/subagent-driven-development/re-review-prompt.md +80 -48
  53. package/skills/subagent-driven-development/task-reviewer-prompt.md +189 -110
  54. package/skills/systematic-debugging/CREATION-LOG.md +85 -85
  55. package/skills/systematic-debugging/SKILL.md +221 -219
  56. package/skills/systematic-debugging/condition-based-waiting.md +48 -49
  57. package/skills/systematic-debugging/defense-in-depth.md +46 -46
  58. package/skills/systematic-debugging/root-cause-tracing.md +63 -63
  59. package/skills/systematic-debugging/test-academic.md +10 -10
  60. package/skills/systematic-debugging/test-pressure-1.md +40 -40
  61. package/skills/systematic-debugging/test-pressure-2.md +58 -58
  62. package/skills/systematic-debugging/test-pressure-3.md +48 -48
  63. package/skills/test-driven-development/SKILL.md +161 -153
  64. package/skills/test-driven-development/writing-good-tests.md +137 -84
  65. package/skills/using-git-worktrees/SKILL.md +74 -72
  66. package/skills/using-superpowers/SKILL.md +40 -39
  67. package/skills/using-superpowers/references/dsh-tools.md +36 -36
  68. package/skills/verification-before-completion/SKILL.md +85 -83
  69. package/skills/writing-plans/SKILL.md +123 -84
  70. package/skills/writing-skills/SKILL.md +419 -417
  71. package/skills/writing-skills/persuasion-principles.md +118 -118
  72. package/skills/writing-skills/testing-skills-with-subagents.md +190 -190
@@ -1,355 +1,578 @@
1
1
  ---
2
2
  name: subagent-driven-development
3
- description: "Superpower Skill:在当前会话内执行包含独立任务的实现计划时使用,基于 subagent 分发与逐任务评审保障质量。"
3
+ description: "Superpower Skill: Use when executing implementation plans with independent tasks in the current session"
4
+ description_zh: "Superpower Skill:在当前会话内执行包含独立任务的实现计划时使用,基于 subagent 分发与逐任务评审保障质量。"
4
5
  ---
5
6
 
6
- # subagent 驱动开发
7
7
 
8
- 按任务分发全新实现 subagent、每任务后进行任务评审(规格符合度 + 代码质量)、最后进行全分支广度评审来执行计划。
8
+ # Subagent-Driven Development
9
9
 
10
- **为什么使用 subagent:** 你将任务委托给拥有隔离上下文的 specialized agents。通过精确构造指令与上下文,确保其保持专注并顺利完成任务。它们不应继承你的会话上下文或历史——你只需构造其所需的一切。这也能保留你自己的上下文用于统筹协调。
10
+ 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.
11
11
 
12
- **核心原则:** 每任务全新 subagent + 任务评审(规格 + 质量)+ 最终广度评审 = 高质量、快迭代
12
+ **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.
13
13
 
14
- **叙述:** 工具调用之间至多用一行简短语句叙述——ledger 与工具结果负责承载记录。
14
+ **Core principle:** Fresh subagent per task + task review (spec + quality) + broad final review = high quality, fast iteration
15
15
 
16
- **持续执行:** 任务之间不要停下来向 human partner 确认。一次性不间断执行计划中的所有任务。仅在以下四种情况或全部任务完成时才停下。“是否继续?”之类的确认与进度总结只会浪费对方时间——对方已要求你执行计划,那就执行到底。
16
+ **Narration:** between tool calls, narrate at most one short line — the
17
+ ledger and the tool results carry the record.
17
18
 
18
- **做裁决,不停摆。** 运行中的计划不等待 human partner。冲突、歧义、计划缺陷、你本想申请突破的上限——自行裁决。规格是约束性依据,计划是对规格的论证,你的判断填补二者未覆盖之处。将每个决策以 `Ruling: <裁决内容> — <原因> — <若错的代价>` 记录到 ledger,然后继续。错误的裁决只会带来可见、可撤销的返工;而卡在问题上停摆的会话会耗掉对方一整天且毫无收益。
19
+ **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.
19
20
 
20
- 仅以下四件事能让你停下,且只有这四件:不可逆或破坏性操作;安全敏感操作;超出本 worktree、按惯例需先征询的副作用(如合并、推送到共享分支、发布);以及计划破损到每条前行路径都只能靠猜。对于这些,停下来提问。
21
+ **Rulings, not stalls.** A running plan does not wait on a human. Conflicts,
22
+ ambiguities, plan defects, a cap you would have asked to exceed — decide
23
+ them. The spec is the binding authority, the plan is its argument, and your
24
+ judgment settles what neither answers. Record every decision in the ledger as
25
+ `Ruling: <what you decided> — <why> — <what it costs if wrong>`, and keep
26
+ going. A wrong ruling costs rework your human partner can see and undo; a
27
+ session parked on a question costs their whole day and buys nothing.
21
28
 
22
- ## 何时使用
29
+ Four things stop you, and only these: an irreversible or destructive
30
+ operation; a security-sensitive action; a side effect outside this worktree
31
+ that norms say you ask about first (a merge, a push to a shared branch, a
32
+ publish); and a plan so broken that every path forward is a guess. For those,
33
+ stop and ask.
34
+
35
+ ## When to Use
23
36
 
24
37
  ```dot
25
38
  digraph when_to_use {
26
- "是否有实现计划?" [shape=diamond];
27
- "任务是否大多相互独立?" [shape=diamond];
28
- "human partner 选择内联执行,或没有 subagent 工具?" [shape=diamond];
39
+ "Have implementation plan?" [shape=diamond];
40
+ "Tasks mostly independent?" [shape=diamond];
41
+ "Partner chose inline, or no subagent tool?" [shape=diamond];
29
42
  "subagent-driven-development" [shape=box];
30
43
  "executing-plans" [shape=box];
31
- "手动执行或先行头脑风暴" [shape=box];
32
-
33
- "是否有实现计划?" -> "任务是否大多相互独立?" [label="是"];
34
- "是否有实现计划?" -> "手动执行或先行头脑风暴" [label="否"];
35
- "任务是否大多相互独立?" -> "human partner 选择内联执行,或没有 subagent 工具?" [label="是"];
36
- "任务是否大多相互独立?" -> "手动执行或先行头脑风暴" [label="否 - 高度耦合"];
37
- "human partner 选择内联执行,或没有 subagent 工具?" -> "executing-plans" [label="是"];
38
- "human partner 选择内联执行,或没有 subagent 工具?" -> "subagent-driven-development" [label="否"];
44
+ "Manual execution or brainstorm first" [shape=box];
45
+
46
+ "Have implementation plan?" -> "Tasks mostly independent?" [label="yes"];
47
+ "Have implementation plan?" -> "Manual execution or brainstorm first" [label="no"];
48
+ "Tasks mostly independent?" -> "Partner chose inline, or no subagent tool?" [label="yes"];
49
+ "Tasks mostly independent?" -> "Manual execution or brainstorm first" [label="no - tightly coupled"];
50
+ "Partner chose inline, or no subagent tool?" -> "executing-plans" [label="yes"];
51
+ "Partner chose inline, or no subagent tool?" -> "subagent-driven-development" [label="no"];
39
52
  }
40
53
  ```
41
54
 
42
- **对比 Executing Plans(内联执行):**
43
- - 每任务全新 subagent(无上下文污染),而非一个上下文执行所有任务
44
- - 每任务后评审(规格符合度 + 代码质量),而非仅在最后评审
45
- - 每任务与每次评审各消耗一个全新上下文;内联执行只消耗一个上下文外加一位最终 reviewer
46
- - 两者都在本会话中运行,共享同一计划 workspace 与 ledger,任务之间从不暂停
55
+ **vs. Executing Plans (inline):**
56
+ - Fresh subagent per task (no context pollution) instead of one context doing every task
57
+ - Review after each task (spec compliance + code quality) instead of only at the end
58
+ - Costs a fresh context per task and per review; inline costs one context plus one final reviewer
59
+ - Both run in this session, share the same plan workspace and ledger, and never pause between tasks
47
60
 
48
- ## 流程
61
+ ## The Process
49
62
 
50
63
  ```dot
51
64
  digraph process {
52
65
  rankdir=TB;
53
66
 
54
67
  subgraph cluster_per_task {
55
- label="单任务循环";
56
- "分发实现 subagent (./implementer-prompt.md)" [shape=box];
57
- "实现者是否提问?" [shape=diamond];
58
- "回答问题,提供上下文" [shape=box];
59
- "实现者实现、测试、提交、自检" [shape=box];
60
- "生成review package,分发任务 reviewer (./task-reviewer-prompt.md)" [shape=box];
61
- "规格 [OK] 且质量通过?" [shape=diamond];
62
- "finding 是否与计划文本冲突?" [shape=diamond];
63
- "对冲突进行裁决并记入 ledger" [shape=box];
64
- "修复轮次 R/5:R≤3 恢复原实现者;R≥4 启用全新、能力更强的实现者" [shape=box];
65
- "分发scoped re-review (./re-review-prompt.md)" [shape=box];
66
- "所有 finding 已处理?" [shape=diamond];
67
- "R = 5?" [shape=diamond];
68
- "逐条裁决未关闭的 finding" [shape=box];
69
- "是否存在承重型 finding?" [shape=diamond];
70
- "裁决后继续;仅当所有前行路径皆为猜测时才停下" [shape=box];
71
- "将 finding 连同裁决暂存至 ledger" [shape=box];
72
- "向 ledger 追加完成记录,标记 todo 已完成" [shape=box];
68
+ label="Per Task";
69
+ "Dispatch implementer subagent (./implementer-prompt.md)" [shape=box];
70
+ "Implementer asks questions?" [shape=diamond];
71
+ "Answer questions, provide context" [shape=box];
72
+ "Implementer implements, tests, commits, self-reviews" [shape=box];
73
+ "Generate review package, dispatch task reviewer (./task-reviewer-prompt.md)" [shape=box];
74
+ "Spec [OK] and quality approved?" [shape=diamond];
75
+ "Finding conflicts with plan text?" [shape=diamond];
76
+ "Rule on the conflict, ledger the ruling" [shape=box];
77
+ "Fix round R of 5: R≤3 resume implementer; R≥4 fresh implementer, more capable model" [shape=box];
78
+ "Dispatch scoped re-review (./re-review-prompt.md)" [shape=box];
79
+ "All findings addressed?" [shape=diamond];
80
+ "R = 5?" [shape=diamond];
81
+ "Adjudicate each open finding" [shape=box];
82
+ "Any load-bearing finding?" [shape=diamond];
83
+ "Rule and continue; stop only if every path forward is a guess" [shape=box];
84
+ "Park findings in ledger with rulings" [shape=box];
85
+ "Append completion to ledger, mark todo complete" [shape=box];
73
86
  }
74
87
 
75
- "准备:worktree、ledger 检查、读取计划、飞行前检查" [shape=box];
76
- "是否还有剩余任务?" [shape=diamond];
77
- "分发最终代码 reviewer (../requesting-code-review/code-reviewer.md)" [shape=box];
78
- "有最终 finding?一次修复分发、一次 scoped re-review、裁决残留项" [shape=box];
79
- "最终评审通过:删除本计划的 workspace" [shape=box];
80
- "使用 finishing-a-development-branch" [shape=box style=filled fillcolor=lightgreen];
81
-
82
- "准备:workspace、ledger 检查、读取计划、飞行前检查" -> "分发实现 subagent (./implementer-prompt.md)";
83
- "分发实现 subagent (./implementer-prompt.md)" -> "实现者是否提问?";
84
- "实现者是否提问?" -> "回答问题,提供上下文" [label="是"];
85
- "回答问题,提供上下文" -> "实现者实现、测试、提交、自检";
86
- "实现者是否提问?" -> "实现者实现、测试、提交、自检" [label="否"];
87
- "实现者实现、测试、提交、自检" -> "生成review package,分发任务 reviewer (./task-reviewer-prompt.md)";
88
- "生成review package,分发任务 reviewer (./task-reviewer-prompt.md)" -> "规格 [OK] 且质量通过?";
89
- "规格 [OK] 且质量通过?" -> "向 ledger 追加完成记录,标记 todo 已完成" [label="是"];
90
- "规格 [OK] 且质量通过?" -> "finding 是否与计划文本冲突?" [label="否"];
91
- "finding 是否与计划文本冲突?" -> "对冲突进行裁决并记入 ledger" [label="是"];
92
- "对冲突进行裁决并记入 ledger" -> "修复轮次 R/5:R≤3 恢复原实现者;R≥4 启用全新、能力更强的实现者";
93
- "finding 是否与计划文本冲突?" -> "修复轮次 R/5:R≤3 恢复原实现者;R≥4 启用全新、能力更强的实现者" [label="否"];
94
- "修复轮次 R/5:R≤3 恢复原实现者;R≥4 启用全新、能力更强的实现者" -> "分发scoped re-review (./re-review-prompt.md)";
95
- "分发scoped re-review (./re-review-prompt.md)" -> "所有 finding 已处理?";
96
- "所有 finding 已处理?" -> "向 ledger 追加完成记录,标记 todo 已完成" [label="是"];
97
- "所有 finding 已处理?" -> "R = 5?" [label="否"];
98
- "R = 5?" -> "修复轮次 R/5:R≤3 恢复原实现者;R≥4 启用全新、能力更强的实现者" [label="否 - 进入下一轮"];
99
- "R = 5?" -> "逐条裁决未关闭的 finding" [label="是 - 触发熔断"];
100
- "逐条裁决未关闭的 finding" -> "是否存在承重型 finding?";
101
- "是否存在承重型 finding?" -> "裁决后继续;仅当所有前行路径皆为猜测时才停下" [label="是"];
102
- "是否存在承重型 finding?" -> "将 finding 连同裁决暂存至 ledger" [label="否"];
103
- "将 finding 连同裁决暂存至 ledger" -> "向 ledger 追加完成记录,标记 todo 已完成";
104
- "向 ledger 追加完成记录,标记 todo 已完成" -> "是否还有剩余任务?";
105
- "是否还有剩余任务?" -> "分发实现 subagent (./implementer-prompt.md)" [label="是"];
106
- "是否还有剩余任务?" -> "分发最终代码 reviewer (../requesting-code-review/code-reviewer.md)" [label="否"];
107
- "分发最终代码 reviewer (../requesting-code-review/code-reviewer.md)" -> "有最终 finding?一次修复分发、一次scoped re-review、裁决残留项";
108
- "有最终 finding?一次修复分发、一次scoped re-review、裁决残留项" -> "最终评审通过:删除本计划的 workspace";
109
- "最终评审通过:删除本计划的 workspace" -> "使用 finishing-a-development-branch";
88
+ "Setup: worktree, ledger check, read plan, pre-flight review" [shape=box];
89
+ "More tasks remain?" [shape=diamond];
90
+ "Dispatch final code reviewer (../requesting-code-review/code-reviewer.md)" [shape=box];
91
+ "Final findings? ONE fix dispatch, one scoped re-review, adjudicate residuals" [shape=box];
92
+ "Final review clean: delete this plan's workspace" [shape=box];
93
+ "Use superpowers:finishing-a-development-branch" [shape=box style=filled fillcolor=lightgreen];
94
+
95
+ "Setup: worktree, ledger check, read plan, pre-flight review" -> "Dispatch implementer subagent (./implementer-prompt.md)";
96
+ "Dispatch implementer subagent (./implementer-prompt.md)" -> "Implementer asks questions?";
97
+ "Implementer asks questions?" -> "Answer questions, provide context" [label="yes"];
98
+ "Answer questions, provide context" -> "Implementer implements, tests, commits, self-reviews";
99
+ "Implementer asks questions?" -> "Implementer implements, tests, commits, self-reviews" [label="no"];
100
+ "Implementer implements, tests, commits, self-reviews" -> "Generate review package, dispatch task reviewer (./task-reviewer-prompt.md)";
101
+ "Generate review package, dispatch task reviewer (./task-reviewer-prompt.md)" -> "Spec [OK] and quality approved?";
102
+ "Spec [OK] and quality approved?" -> "Append completion to ledger, mark todo complete" [label="yes"];
103
+ "Spec [OK] and quality approved?" -> "Finding conflicts with plan text?" [label="no"];
104
+ "Finding conflicts with plan text?" -> "Rule on the conflict, ledger the ruling" [label="yes"];
105
+ "Rule on the conflict, ledger the ruling" -> "Fix round R of 5: R≤3 resume implementer; R≥4 fresh implementer, more capable model";
106
+ "Finding conflicts with plan text?" -> "Fix round R of 5: R≤3 resume implementer; R≥4 fresh implementer, more capable model" [label="no"];
107
+ "Fix round R of 5: R≤3 resume implementer; R≥4 fresh implementer, more capable model" -> "Dispatch scoped re-review (./re-review-prompt.md)";
108
+ "Dispatch scoped re-review (./re-review-prompt.md)" -> "All findings addressed?";
109
+ "All findings addressed?" -> "Append completion to ledger, mark todo complete" [label="yes"];
110
+ "All findings addressed?" -> "R = 5?" [label="no"];
111
+ "R = 5?" -> "Fix round R of 5: R≤3 resume implementer; R≥4 fresh implementer, more capable model" [label="no - next round"];
112
+ "R = 5?" -> "Adjudicate each open finding" [label="yes - breaker trips"];
113
+ "Adjudicate each open finding" -> "Any load-bearing finding?";
114
+ "Any load-bearing finding?" -> "Rule and continue; stop only if every path forward is a guess" [label="yes"];
115
+ "Any load-bearing finding?" -> "Park findings in ledger with rulings" [label="no"];
116
+ "Park findings in ledger with rulings" -> "Append completion to ledger, mark todo complete";
117
+ "Append completion to ledger, mark todo complete" -> "More tasks remain?";
118
+ "More tasks remain?" -> "Dispatch implementer subagent (./implementer-prompt.md)" [label="yes"];
119
+ "More tasks remain?" -> "Dispatch final code reviewer (../requesting-code-review/code-reviewer.md)" [label="no"];
120
+ "Dispatch final code reviewer (../requesting-code-review/code-reviewer.md)" -> "Final findings? ONE fix dispatch, one scoped re-review, adjudicate residuals";
121
+ "Final findings? ONE fix dispatch, one scoped re-review, adjudicate residuals" -> "Final review clean: delete this plan's workspace";
122
+ "Final review clean: delete this plan's workspace" -> "Use superpowers:finishing-a-development-branch";
110
123
  }
111
124
  ```
112
125
 
113
- ## 准备工作
114
-
115
- 确保工作在隔离的 worktree 中进行:使用 using-git-worktrees 创建或校验现有 worktree。未经 human partner 明确同意,绝不在 main/master 分支上开始实现。
116
-
117
- 对话记忆在压缩后不会保留。在真实会话中,丢失进度的控制器曾重新分发整串已完成任务——这是目前观察到代价最高的失败。请在 ledger 文件中跟踪进度,而不仅依赖 todos。
118
-
119
- - 每个计划拥有独立 workspace:在技能启动时,运行本技能的 `bash scripts/sdd-workspace PLAN_FILE`——它会打印该计划的 git 忽略目录(位于 `<repo-root>/.superpowers/sdd/` 下),该目录承载本计划的所有产物:ledger、brief、报告、review package。其他计划的目录绝不归你读写。
120
- - 在 `<workspace>/progress.md` 检查本计划的 ledger。若其首行写明了你的计划文件,则带有 `Task <N>: complete` 行的任务即视为已完成——不要重新分发;从首个没有该行的任务继续。若任务最后一行是修复轮次,则该任务处于循环中:从下一轮继续循环。若 ledger 首行指向另一计划文件——或在旧的扁平路径 `.superpowers/sdd/progress.md` 下发现游离 ledger——那是另一计划的进度:保持原位,为当前计划新建一份全新 ledger。
121
- - 以标识作为首行创建 ledger:`# SDD ledger — plan: <plan file path>`。
122
- - ledger 是你的恢复地图:其中记录的提交在 git 中真实存在,即使你的上下文已不再记得曾创建过它们。压缩之后,请信任 ledger 与 `git log`,而非你自己的记忆。
123
- - `git clean -fdx` 会销毁 workspace(它是被 git 忽略的临时区);若发生,请从 `git log` 恢复。
124
-
125
- 通读一次计划,记下其上下文与全局约束,并为每个任务创建 todo。若计划中指明了 Spec,也一并阅读:规格是计划所论证的权威依据,计划内部的冲突应以规格为准进行裁决。无法找到可达规格的计划需在 ledger 中注明——在没有规格的情况下做出的裁决均为临时性。
126
-
127
- 在分发任务 1 之前,对计划做一次冲突扫描,并边检查边记录检查内容:
128
-
129
- - 相互矛盾或与计划全局约束冲突的任务
130
- - 计划明确要求、但按评审标准视为缺陷的内容(例如断言为空的测试、逻辑块的逐字重复)
131
-
132
- 扫描输出是表格,而非结论。对每一对共享文件或接口的任务各列一行:两个任务、其一产出与另一消费内容的对照、以及你的发现。对每个任务各列一行:其自身文本是否自洽——所规定的测试与所规定的代码是否一致、所创建的文件与后续触及的文件是否一致。没有这些行的“扫描通过”不算完成扫描。
133
-
134
- 将表格写入 ledger。在执行开始前对所有 finding 进行裁决——每项裁决均对照要求它的计划文本——并将每条裁决记录到 ledger。若扫描干净,则无需多言直接继续。对扫描暴露的每个冲突进行裁决——规格是约束性依据,计划是其论证——将裁决记录在对应行旁,然后分发任务 1。评审循环仍是兜底机制,用于捕获仅在实现中才显现的冲突。
135
-
136
- ## 模型选择
137
-
138
- 为每个角色选用能胜任的最弱模型,以节省成本并提升速度。
139
-
140
- **机械性实现任务**(孤立函数、清晰规格、1-2 个文件):使用快速、廉价的模型。计划描述充分时,大多数实现任务都属于机械性任务。
141
-
142
- **集成与判断类任务**(多文件协同、模式匹配、调试):使用标准模型。
143
-
144
- **架构与设计任务**:使用当前可用能力最强的模型。最终全分支评审即属此类——请在最强模型上分发,而非使用会话默认模型。
145
-
146
- **评审任务**:根据差异的大小、复杂度与风险选择具有相应判断力的模型。小而机械的差异不需要最强模型;微妙的并发改动则需要。对小范围修复差异的scoped re-review,选用廉价至中等层级即可。
147
-
148
- **修复循环升级(第 4-5 轮)**:使用至少比卡住的实现者高一个层级的模型。
149
-
150
- **分发 subagent 时务必显式指定模型。** 省略模型会继承你会话的模型——通常是最强也最昂贵的模型——这会无声地破坏本节的约束。
151
-
152
- **轮次数量胜过 token 单价。** 墙钟耗时与上下文成本随 subagent 轮次数量线性增长,而最廉价的模型在多步任务上常需 2-3 倍轮次——总体成本反而更高。对 reviewer,以及基于自然语言描述工作的实现者,请以中等层级作为下限。当任务的计划文本已包含待编写的完整代码时,实现只是转录加测试:该实现者使用最廉价层级。单文件机械性修复同样使用最廉价层级。
153
-
154
- **任务复杂度信号(实现任务):**
155
- - 涉及 1-2 个文件且规格完整 → 廉价模型
156
- - 涉及多文件且有集成关注点 → 标准模型
157
- - 需要设计判断或对代码库的广泛理解 → 最强模型
158
-
159
- ### 可选:让控制器下沉一层(嵌套 subagent)
160
-
161
- 控制器会话是本技能中最昂贵的一席:它读取每一次分发结果、每一份报告,且通常跑在会话最强的模型上。若宿主支持嵌套 subagent(在主对话之下再开若干层),整个循环可以下沉一层运行,实测成本与墙钟耗时约减半。
162
-
163
- 这是 human partner 明确要求的可选项,不改变本技能的任何其他要求。当 human partner 提出该要求,或表示会话模型用于统筹过于昂贵时:以一个中等层级模型分发**一个**编排者 subagent,交给它计划路径,并要求端到端使用 subagent-driven-development。该编排者按本技能的模型选择规则自行分发实现者与 reviewer;workspace 与 ledger 都落在磁盘上,因此多一层不会丢失任何东西。它的最终消息必须原样携带「我的裁决」列表——该列表是决策送达 human partner 的通道,你负责转述,而不是概括。
164
-
165
- 仅对整份计划这样做。把单个任务的分发嵌套进去毫无收益,只会多占一席。
166
-
167
- ## 任务循环
168
-
169
- **批量处理小型同构工作。** 当计划列出多个同类的小而独立的编辑——同一种单行修复、常量变更或跨文件重复的字段添加——不要为每项任务各分发一个 subagent。将每份文件及其变更汇总到一份分发 brief 中,将整个批次交给单个 subagent,并把它的差异作为一个整体进行评审。只有需要独立判断、独立测试或独立评审面的工作,才保留一任务一分发。
170
-
171
- 你粘贴到分发提示中的一切——以及 subagent 返回的一切——都会在会话剩余时间内常驻上下文,并在后续每一轮被重新读取。请以文件形式移交产物。
172
-
173
- **等待已分发的 subagent 时:** 切勿以短超时 poll等待接口,也不要陷入无声的无限等待。当你有本地工作可做时——更新 ledger、打包下一份评审、阅读报告——持续推进;子代结果会自行到达。当你真正空闲时,以有界时长等待(平台允许时每次 5 至 10 分钟),并在每段间隔发布一行状态、核对存活的子代:列出它们,并追查任何已完成却未上报的子代。有界等待几乎保留了长等待的全部效率,同时保证卡住或丢失的子代能在数分钟内被发现,而非等到会话结束。
174
-
175
- ### 1. 分发实现者
176
-
177
- 在分发前记录基线 BASE(`git rev-parse HEAD`)——review package与修复轮次的差异需要它。
178
-
179
- - **task brief:** 分发实现者前,运行本技能的 `bash scripts/task-brief PLAN_FILE N`——它会将任务完整文本提取到唯一命名的文件并打印路径。按以下方式组织分发:让 brief 保持为需求的单一来源。你的分发应包含:(1) 一行说明本任务在项目中的位置;(2) brief 路径,并说明“先读此文件——它是你的需求,内有需逐字使用的精确取值”;(3) brief 无法获知的、来自先前任务的接口与决策;(4) 你在 brief 中发现的任何歧义的消解;(5) 报告文件路径与报告契约。精确取值(数值、魔法字符串、签名、测试用例)仅出现在 brief 中。切勿让 subagent 阅读整份计划文件。
180
- - **报告文件:** 以 brief 命名实现者的报告文件(brief `…/task-N-brief.md` → 报告 `…/task-N-report.md`),并写入分发提示。实现者在该文件中撰写完整报告,仅返回状态、提交记录、一行测试摘要与顾虑说明。
181
- - 分发提示只描述一项任务,而非会话历史。不要将累积的先前任务摘要(“任务 1-3 之后的状态”)粘贴到后续分发中——真实会话中曾出现分发达 42k 字符、其中 99% 为粘贴历史的情况。全新 subagent 只需要其任务、所触及的接口与全局约束,不需要其他。
182
- - 分发中携带无 subagent 契约(已在实现者模板中):实现者绝不分发 subagent——既不派生助手,也绝不派生 reviewer。评审由你在报告之后分发。在真实会话中,工作者自行派生的每个 reviewer 都与控制器分发的任务评审重复——相当于每任务多出一席评审。
183
- - 若先前任务在当前任务触及的区域暂存了 finding,请在分发中携带指向该 ledger 条目的指针。
184
- - 从分发结果中记录实现者的 agent 身份——修复循环第 1-3 轮将恢复该 agent。
185
- - 切勿并行分发多个实现 subagent(会冲突)。
186
-
187
- 模板:[implementer-prompt.md](implementer-prompt.md)
188
-
189
- ### 2. 处理报告
190
-
191
- 实现 subagent 会报告四种状态之一,请分别妥善处理:
192
-
193
- **DONE:** 生成review package(从本技能目录运行 `bash scripts/review-package PLAN_FILE BASE HEAD`——它会打印所写文件的唯一路径;BASE 为分发实现者前记录的提交——切勿使用 `HEAD~1`,它会在多提交任务中静默丢弃除最后一次提交外的所有内容),然后使用打印出的路径分发任务 reviewer。
194
-
195
- **DONE_WITH_CONCERNS:** 实现者已完成工作但标记了疑虑。先阅读顾虑再继续。若顾虑涉及正确性或范围,请在评审前处理;若只是观察性意见(例如“此文件正变得过大”),记录后进入评审。
196
-
197
- **NEEDS_CONTEXT:** 实现者需要未提供的信息。补充缺失的上下文并重新分发。
198
-
199
- **BLOCKED:** 实现者无法完成任务。评估阻塞原因:
200
- 1. 若是上下文问题,补充更多上下文并以相同模型重新分发
201
- 2. 若任务需要更强推理,以更强的模型重新分发
202
- 3. 若任务过大,将其拆分为更小的块
203
- 4. 若计划本身有误,对修正进行裁决、记入 ledger,并在分发中携带裁决后重新分发
204
-
205
- **切勿**忽视升级或在不做任何改变的情况下强制同一模型重试。若实现者表示卡住,一定有需要改变的地方。
206
-
207
- 若实现者在开始前或任务中提问——请清晰、完整地回答,按需提供额外上下文,不要催促其进入实现。
208
-
209
- ### 3. 评审任务
210
-
211
- 单任务评审是任务级关卡。广度评审仅在最终全分支评审时进行一次。切勿跳过任务评审,也不要接受缺少任一裁定的报告——规格符合度与任务质量二者缺一不可。实现者的自检永远不能替代任务评审;二者都需要。
212
-
213
- - 以文件形式将差异交给 reviewer:运行本技能的 `bash scripts/review-package PLAN_FILE BASE HEAD`,将打印出的文件路径传给 reviewer(或在无 bash 时:对该区间执行 `git log --oneline`、`git diff --stat` 与 `git diff -U10`,重定向到一个唯一命名的文件)。输出不会进入你自己的上下文,reviewer 通过一次 Read 调用即可看到提交列表、统计摘要与带上下文的完整差异。使用分发实现者前记录的 BASE——切勿使用 `HEAD~1`,它会静默截断多提交任务。切勿在没有差异文件的情况下分发任务 reviewer。
214
- - **reviewer 输入:** 任务 reviewer 获得三个路径——同一份 brief 文件、报告文件与review package——以及约束该任务的全局约束。
215
- - 你交给 reviewer 的全局约束块是其注意力透镜。请逐字复制计划全局约束章节或规格中的约束性要求:精确取值、精确格式、以及组件间的既定关系(“与 X 布局一致”、“与 Y 匹配”)。reviewer 模板中已包含流程规则(YAGNI、测试卫生、评审方法)——约束块用于承载本项目规格所要求的特定内容。
216
- - 不要添加诸如“检查所有用例”或“若有用则跑竞态测试”之类无具体任务依据的开放式指令
217
- - 不要要求 reviewer 重跑实现者已在相同代码上跑过的测试——实现者报告中已包含测试证据
218
- - 不要为 reviewer 预判 finding——绝不指示 reviewer 忽略或不标记某个具体问题。若你认为某 finding 可能是误报,让 reviewer 先提出,再在评审循环中裁决。若你正在编写的提示中出现“不要标记”、“不要将 X 视为缺陷”、“至多 Minor”或“计划如此选择”——请停下:你正在预判,通常是为了省去一次评审循环。
219
- 任务 reviewer 可能报告“[WARN] 无法从差异中验证”的条目——这些需求存在于未变更代码或跨任务范围。此类条目不阻塞评审其余部分,但你必须在标记任务完成前自行逐条消解:你掌握 reviewer 所缺乏的计划与跨任务上下文。若确认某条目为真实缺口,则视为规格评审未通过——它将与其他 finding 一同进入修复循环。
220
-
221
- 模板:[task-reviewer-prompt.md](task-reviewer-prompt.md)
222
-
223
- ### 4. 修复循环
224
-
225
- 当评审报告规格 [FAIL]、任意 Critical 或 Important 级 finding、或你确认为真实缺口的 [WARN] 条目时触发循环。
226
-
227
- 在循环开始前,有两条路径可立即退出:
228
-
229
- - 将 Minor 级 finding 随手记入进度 ledger(`Task <N>: minor (deferred): <one-liner>`),并将最终全分支评审指向该列表,以便其分拣哪些必须在合并前修复。无人阅读的汇总等于静默丢弃。Minor 级 finding 永不进入循环。
230
- - 被标记为计划强制要求的 finding——或任何与计划文本要求冲突的 finding——由你裁决:权衡 finding 与计划文本,以规格为约束性依据做出决定,并在采取行动前将裁决记入 ledger。不要因计划强制要求就驳回 finding,也不要在未记录裁决的情况下分发与计划相矛盾的修复。
231
- 其余项进入循环。一次修复轮次 = 一次修复分发 + 一次scoped re-review。每任务最多五轮:
232
-
233
- **第 1-3 轮——恢复原实现者。** 将未关闭的 finding 逐字发送。其上下文仍完整:它了解任务、代码与自身选择。若你的 harness 无法向存活 subagent 再发送消息,则分发携带 brief 路径、报告文件路径与 finding 的全新实现者——报告文件在两种情况下都是持久记忆。
234
-
235
- **第 4-5 轮——在更强模型上分发全新实现者**(见模型选择),携带 brief 路径、报告文件路径、未关闭 finding 及如下说明:“先前的实现者已尝试此任务 [N] 次;现由你接管。请阅读报告文件了解已尝试的内容。” 能挺过三次恢复的循环通常意味着实现者无法自见其问题——换视角并提升能力一步到位。
236
-
237
- **无论哪一轮,两种方式皆是:** 实现者修复后,重新运行覆盖受改代码的测试,将修复报告追加到同一报告文件,并返回简短契约。在重新分发 reviewer 前,确认修复报告包含覆盖测试、所运行命令及输出;三者齐全后再分发复审。在修复消息中写明覆盖测试文件——单行修复无需跑全量套件。
238
-
239
- **复审是范围化的。** 运行 `bash scripts/review-package PLAN_FILE FIX_BASE HEAD`,其中 FIX_BASE 为上次评审所见的 head,并使用 finding 列表、brief、报告文件与打印出的差异路径分发 [re-review-prompt.md](re-review-prompt.md)。re-reviewer 对每项 finding 给出 ADDRESSED 或 NOT ADDRESSED 的裁定,且仅标记修复差异中的新增破坏。若修复差异中出现新的 Critical/Important 破坏,则加入未关闭 finding 列表。超出范围的观察记入 ledger 作为延期 minor——永不延长循环。
240
-
241
- **每轮结束后,** 向 ledger 追加:`Task <N>: fix round <R>/5 (<X> addressed, <Y> open — <finding one-liners>; commits <a7>..<b7>)`
242
-
243
- 切勿在控制器会话中自行修复 finding——你的上下文需保持干净以用于统筹,且控制器修复会跳过评审。
244
-
245
- **熔断。** 当第 5 轮复审后仍有未关闭 finding 时,停止分发。自行逐条裁决未关闭 finding——你掌握计划与 reviewer 所缺乏的跨任务上下文:
246
-
247
- - **reviewer 有误,或观点可商榷:** 暂存——`Task <N>: parked — <finding> — Ruling: <代码成立的理由>`。最终评审将看到双方观点。
248
- - **属实,但无下游依赖:** 同样暂存,并给出“属实但延期”的裁决。
249
- - **属实且承重**——后续任务依赖于此,或暴露了计划缺陷:对能解开依赖的最小变更进行裁决,以 `Task <N>: Ruling: <finding> — <你的决定与理由>` 记入 ledger,并带入下一任务的分发。将结构性失败静默暂存,会让所有依赖任务都建于其上。仅当缺陷导致每条前行路径都只能靠猜时才停下。
250
-
251
- 仅在达到上限时才裁决。提前裁决以结束循环本质上是换名的预判。每次裁决均为 ledger 条目——静默丢弃是被禁止的。
252
-
253
- ### 5. 完成任务
254
-
255
- 当评审干净返回——或所有未关闭 finding 均在达到上限后附裁决被暂存——在同一条消息中连同其他记账一并向 ledger 追加完成行:
126
+ ## Setup
127
+
128
+ Ensure the work happens in an isolated workspace: use
129
+ superpowers:using-git-worktrees to create one or verify the existing one.
130
+ Never start implementation on a main/master branch without your human
131
+ partner's explicit consent.
132
+
133
+ Conversation memory does not survive compaction. In real sessions,
134
+ controllers that lost their place have re-dispatched entire completed task
135
+ sequences — the single most expensive failure observed. Track progress in
136
+ a ledger file, not only in todos.
137
+
138
+ - Each plan owns a workspace: at skill start, run this skill's
139
+ `bash scripts/sdd-workspace PLAN_FILE` — it prints the plan's git-ignored
140
+ directory (under `<repo-root>/.superpowers/sdd/`), home to
141
+ every artifact for THIS plan: ledger, briefs, reports, review packages.
142
+ Another plan's directory is never yours to read or write.
143
+ - Check for this plan's ledger at `<workspace>/progress.md`. If its first
144
+ line names your plan file, tasks with a `Task <N>: complete` line are DONE
145
+ — do not re-dispatch them; resume at the first task without one. A task
146
+ whose last line is a fix round is mid-loop: resume the loop at the next
147
+ round. A ledger whose first line names a different plan file — or a stray
148
+ ledger at the old flat path `.superpowers/sdd/progress.md` — is another
149
+ plan's progress: leave it in place and start your own, fresh.
150
+ - Create the ledger with its identity as the first line:
151
+ `# SDD ledger — plan: <plan file path>`.
152
+ - The ledger is your recovery map: the commits it names exist in git even
153
+ when your context no longer remembers creating them. After compaction,
154
+ trust the ledger and `git log` over your own recollection.
155
+ - `git clean -fdx` will destroy the workspace (it's git-ignored scratch); if
156
+ that happens, recover from `git log`.
157
+
158
+ Read the plan once, note its context and Global Constraints, and create a
159
+ todo per task. If the plan names a Spec, read that too: the spec is the
160
+ authority the plan argues from, and conflicts inside the plan resolve
161
+ against it. A plan with no reachable spec gets a ledger note saying so —
162
+ rulings made without one are provisional.
163
+
164
+ Before dispatching Task 1, scan the plan once for conflicts, writing down
165
+ what you checked as you check it:
166
+
167
+ - tasks that contradict each other or the plan's Global Constraints
168
+ - anything the plan explicitly mandates that the review rubric treats as a
169
+ defect (a test that asserts nothing, verbatim duplication of a logic block)
170
+
171
+ The scan's output is a table, not a verdict. One row for every pair of tasks
172
+ that share a file or an interface: the two tasks, what one produces against
173
+ what the other consumes, and what you found. One row for every task: whether
174
+ its own text agrees with itself — the tests it specifies against the code it
175
+ specifies, the files it creates against the files it later touches. "The scan
176
+ is clean" without those rows is not a scan you ran.
177
+
178
+ Write the table to the ledger. Rule on everything you find before execution
179
+ begins — each finding against the plan text that mandates it — and record
180
+ each ruling in the ledger. If the scan is clean, proceed without comment.
181
+ Rule on each conflict it surfaces — the spec is the binding authority, the
182
+ plan is its argument — record the ruling beside its row, and dispatch
183
+ Task 1. The review loop remains the net for conflicts that only emerge from
184
+ implementation.
185
+
186
+ ## Model Selection
187
+
188
+ Use the least powerful model that can handle each role to conserve cost and increase speed.
189
+
190
+ **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.
191
+
192
+ **Integration and judgment tasks** (multi-file coordination, pattern matching, debugging): use a standard model.
193
+
194
+ **Architecture and design tasks**: use the most capable available model.
195
+ The final whole-branch review is one of these — dispatch it on the most
196
+ capable available model, not the session default.
197
+
198
+ **Review tasks**: choose the model with the same judgment, scaled to the
199
+ diff's size, complexity, and risk. A small mechanical diff does not need the
200
+ most capable model; a subtle concurrency change does. Scoped re-reviews of
201
+ small fix diffs take a cheap-to-mid tier.
202
+
203
+ **Fix-loop escalation (rounds 4-5)**: use a model at least one tier above
204
+ the implementer that got stuck.
205
+
206
+ **Always specify the model explicitly when dispatching a subagent.** An
207
+ omitted model inherits your session's model — often the most capable and
208
+ most expensive — which silently defeats this section.
209
+
210
+ **Turn count beats token price.** Wall-clock and context cost scale with how
211
+ many turns a subagent takes, and the cheapest models routinely take 2-3× the
212
+ turns on multi-step work — costing more overall. Use a mid-tier model as the
213
+ floor for reviewers and for implementers working from prose descriptions.
214
+ When the task's plan text contains the complete code to write, the
215
+ implementation is transcription plus testing: use the cheapest tier for
216
+ that implementer. Single-file mechanical fixes also take the cheapest tier.
217
+
218
+ **Task complexity signals (implementation tasks):**
219
+ - Touches 1-2 files with a complete spec → cheap model
220
+ - Touches multiple files with integration concerns → standard model
221
+ - Requires design judgment or broad codebase understanding → most capable model
222
+
223
+ ### Optional: Drop the Controller a Level (Nested Subagents)
224
+
225
+ The controller session is the most expensive seat in this skill: it reads every dispatch result and every report, and usually runs on the session's strongest model. If the host supports nested subagents (opening further layers under the main conversation), the whole loop can run one level down; measured cost and wall-clock time roughly halve.
226
+
227
+ This is an opt-in your human partner explicitly asks for, and it changes nothing else in this skill. When they ask, or when the session model is too expensive to coordinate with: dispatch ONE orchestrator subagent on a mid-tier model, hand it the plan path, and require it to use subagent-driven-development end to end. The orchestrator dispatches implementers and reviewers per this skill's model-selection rules; the workspace and ledger live on disk, so the extra layer loses nothing. Its final message must carry the "my rulings" list verbatim — that list is the channel by which decisions reach your human partner; you relay it, not summarize it.
228
+
229
+ Only do this for the whole plan. Nesting single-task dispatch adds nothing and just occupies another seat.
230
+
231
+ ## The Task Loop
232
+
233
+ **Batch small same-shape work.** When the plan lists several tasks that are
234
+ each a small, independent edit of the same kind — the same one-line fix,
235
+ constant change, or field addition repeated across files — do not dispatch
236
+ one subagent per task. Compose ONE dispatch brief listing every file and
237
+ its change, send the whole batch to a single subagent, and review its diff
238
+ as one unit. Reserve one-dispatch-per-task for work that needs its own
239
+ judgment, its own tests, or its own review surface.
240
+
241
+ Everything you paste into a dispatch prompt — and everything a subagent
242
+ prints back — stays resident in your context for the rest of the session
243
+ and is re-read on every later turn. Hand artifacts over as files.
244
+
245
+ **Waiting on dispatched subagents:** never poll a wait interface with
246
+ short timeouts, and never sit in one silent, open-ended wait either.
247
+ While you have local work — ledger updates, packaging the next review,
248
+ reading reports — keep working; child results arrive on their own.
249
+ When you are genuinely idle, wait in bounded stretches (five to ten
250
+ minutes, where your platform allows), and between stretches post one
251
+ line of status and reconcile your live children: list them, and chase
252
+ any that finished without reporting. A bounded stretch keeps nearly
253
+ all of a long wait's efficiency while guaranteeing a stuck or lost
254
+ child is noticed within minutes, not at the end of the session.
255
+
256
+ ### 1. Dispatch the implementer
257
+
258
+ Record BASE (`git rev-parse HEAD`) before dispatching — the review package
259
+ and fix-round diffs need it.
260
+
261
+ - **Task brief:** before dispatching an implementer, run this skill's
262
+ `bash scripts/task-brief PLAN_FILE N` — it extracts the task's full text to a
263
+ uniquely named file and prints the path. Compose the dispatch so the
264
+ brief stays the single source of
265
+ requirements. Your dispatch should contain: (1) one line on where this
266
+ task fits in the project; (2) the brief path, introduced as "read this
267
+ first — it is your requirements, with the exact values to use verbatim";
268
+ (3) interfaces and decisions from earlier tasks that the brief cannot
269
+ know; (4) your resolution of any ambiguity you noticed in the brief;
270
+ (5) the report-file path and report contract. Exact values (numbers,
271
+ magic strings, signatures, test cases) appear only in the brief. Never
272
+ make a subagent read the whole plan file.
273
+ - **Report file:** name the implementer's report file after the brief
274
+ (brief `…/task-N-brief.md` → report `…/task-N-report.md`) and put it in
275
+ the dispatch prompt. The implementer writes the full report there and
276
+ returns only status, commits, a one-line test summary, and concerns.
277
+ - A dispatch prompt describes one task, not the session's history. Do not
278
+ paste accumulated prior-task summaries ("state after Tasks 1-3") into
279
+ later dispatches — a real session's dispatch hit 42k chars of which 99%
280
+ was pasted history. A fresh subagent needs its task, the interfaces it
281
+ touches, and the global constraints. Nothing else.
282
+ - The dispatch carries the no-subagents contract (it is in the
283
+ implementer template): the implementer never dispatches subagents —
284
+ not helpers, and never a reviewer. Review arrives from you, after the
285
+ report. In real sessions, every reviewer a worker spawned duplicated
286
+ the task review the controller dispatched anyway — a full extra
287
+ review seat per task.
288
+ - If an earlier task parked a finding in the area this task touches, carry
289
+ a pointer to that ledger entry in the dispatch.
290
+ - Record the implementer's agent identity from the dispatch result —
291
+ fix-loop rounds 1-3 resume this agent.
292
+ - Never dispatch multiple implementation subagents in parallel (conflicts).
293
+
294
+ Template: [implementer-prompt.md](implementer-prompt.md)
295
+
296
+ ### 2. Handle the report
297
+
298
+ Implementer subagents report one of four statuses. Handle each appropriately:
299
+
300
+ **DONE:** Generate the review package (`bash 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.
301
+
302
+ **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.
303
+
304
+ **NEEDS_CONTEXT:** The implementer needs information that wasn't provided. Provide the missing context and re-dispatch.
305
+
306
+ **BLOCKED:** The implementer cannot complete the task. Assess the blocker:
307
+ 1. If it's a context problem, provide more context and re-dispatch with the same model
308
+ 2. If the task requires more reasoning, re-dispatch with a more capable model
309
+ 3. If the task is too large, break it into smaller pieces
310
+ 4. If the plan itself is wrong, rule on the correction, ledger it, and re-dispatch with the ruling carried in the dispatch
311
+
312
+ **Never** ignore an escalation or force the same model to retry without changes. If the implementer said it's stuck, something needs to change.
313
+
314
+ If the implementer asks questions — before starting or mid-task — answer
315
+ clearly and completely, provide additional context if needed, and don't
316
+ rush it into implementation.
317
+
318
+ ### 3. Review the task
319
+
320
+ Per-task reviews are task-scoped gates. The broad review happens once, at the
321
+ final whole-branch review. Never skip the task review, and never accept a
322
+ report missing either verdict — spec compliance AND task quality are both
323
+ required. Implementer self-review never replaces the task review; both are
324
+ needed.
325
+
326
+ - Hand the reviewer its diff as a file: run this skill's
327
+ `bash scripts/review-package PLAN_FILE BASE HEAD` and pass the reviewer the file path
328
+ it prints (or, without bash: `git log --oneline`, `git diff --stat`,
329
+ and `git diff -U10` for the range, redirected to one uniquely named
330
+ file). The output never enters your own context, and the reviewer sees
331
+ the commit list, stat summary, and full diff with context in one Read
332
+ call. Use the BASE you recorded before dispatching the implementer —
333
+ never `HEAD~1`, which silently truncates multi-commit tasks. Never
334
+ dispatch a task reviewer without a diff file.
335
+ - **Reviewer inputs:** the task reviewer gets three paths — the same brief
336
+ file, the report file, and the review package — plus the global
337
+ constraints that bind the task.
338
+ - The global-constraints block you hand the reviewer is its attention
339
+ lens. Copy the binding requirements verbatim from the plan's Global
340
+ Constraints section or the spec: exact values, exact formats, and the
341
+ stated relationships between components ("same layout as X", "matches
342
+ Y"). The reviewer's template already carries the process rules (YAGNI,
343
+ test hygiene, review method) — the constraints block is for what THIS
344
+ project's spec demands.
345
+ - Do not add open-ended directives like "check all uses" or "run race tests
346
+ if useful" without a concrete, task-specific reason
347
+ - Do not ask a reviewer to re-run tests the implementer already ran on the
348
+ same code — the implementer's report carries the test evidence
349
+ - Do not pre-judge findings for the reviewer — never instruct a reviewer to
350
+ ignore or not flag a specific issue. If you believe a finding would be a
351
+ false positive, let the reviewer raise it and adjudicate it in the review
352
+ loop. If the prompt you are writing contains "do not flag," "don't treat X
353
+ as a defect," "at most Minor," or "the plan chose" — stop: you are
354
+ pre-judging, usually to spare yourself a review loop.
355
+ The task reviewer may report "[WARN] Cannot verify from diff" items — requirements
356
+ that live in unchanged code or span tasks. These do not block the rest of the
357
+ review, but you must resolve each one yourself before marking the task
358
+ complete: you hold the plan and cross-task context the reviewer
359
+ lacks. If you confirm an item is a real gap, treat it as a failed spec
360
+ review — it enters the fix loop with the other findings.
361
+
362
+ Template: [task-reviewer-prompt.md](task-reviewer-prompt.md)
363
+
364
+ ### 4. The fix loop
365
+
366
+ The loop triggers when the review reports spec [FAIL], any Critical or Important
367
+ finding, or a [WARN] item you confirmed as a real gap.
368
+
369
+ Before the loop starts, two routes leave it immediately:
370
+
371
+ - Record Minor findings in the progress ledger as you go
372
+ (`Task <N>: minor (deferred): <one-liner>`), and point the final
373
+ whole-branch review at that list so it can triage which must be fixed
374
+ before merge. A roll-up nobody reads is a silent discard. Minor findings
375
+ never enter the loop.
376
+ - A finding labeled plan-mandated — or any finding that conflicts with
377
+ what the plan's text requires — is yours to rule on: weigh the finding
378
+ against the plan text, decide with the spec as the binding authority, and
379
+ ledger the ruling before you act on it. Do not dismiss the finding because
380
+ the plan mandates it, and do not dispatch a fix that contradicts the plan
381
+ without a recorded ruling.
382
+ Everything else enters the loop. A fix round is one fix dispatch plus one
383
+ scoped re-review. Five rounds maximum per task:
384
+
385
+ **Rounds 1-3 — resume the original implementer.** Send it the open findings
386
+ verbatim. Its context is intact: it knows the task, the code, and its own
387
+ choices. If your harness cannot send another message to a live subagent,
388
+ dispatch a fresh implementer carrying the brief path, the report-file path,
389
+ and the findings — the report file is the persistent memory either way.
390
+
391
+ **Rounds 4-5 — dispatch a fresh implementer on a more capable model** (per
392
+ Model Selection), with the brief path, the report-file path, the open
393
+ findings, and this framing: "A prior implementer attempted this task
394
+ [N] times; you own it now. Read the report file for what was tried." A loop
395
+ that survives three resumes usually means the implementer cannot see its
396
+ own problem — fresh eyes and a capability bump in one move.
397
+
398
+ **Every round, either way:** the implementer fixes, re-runs the tests
399
+ covering the amended code, appends its fix report to the same report file,
400
+ and returns the short contract. Before re-dispatching the reviewer, confirm
401
+ the fix report contains the covering tests, the command run, and the
402
+ output; dispatch the re-review once all three are present. Name the
403
+ covering test files in the fix message — a one-line fix does not need the
404
+ whole suite.
405
+
406
+ **The re-review is scoped.** Run `bash scripts/review-package PLAN_FILE FIX_BASE HEAD`
407
+ where FIX_BASE is the head the previous review saw, and dispatch
408
+ [re-review-prompt.md](re-review-prompt.md) with the findings list, the
409
+ brief, the report file, and the printed diff path. The re-reviewer verdicts
410
+ each finding ADDRESSED or NOT ADDRESSED and flags new breakage in the fix
411
+ diff only. New Critical/Important breakage in the fix diff joins the open
412
+ findings list. Out-of-scope observations go to the ledger as deferred
413
+ minors — they never extend the loop.
414
+
415
+ **After each round,** append to the ledger:
416
+ `Task <N>: fix round <R>/5 (<X> addressed, <Y> open — <finding one-liners>; commits <a7>..<b7>)`
417
+
418
+ Never fix findings yourself in the controller session — your context stays
419
+ clean for coordination, and controller fixes skip review.
420
+
421
+ **The breaker.** When round 5's re-review still leaves findings open, stop
422
+ dispatching. Adjudicate each open finding yourself — you hold the plan and
423
+ the cross-task context the reviewer lacks:
424
+
425
+ - **The reviewer is wrong, or the point is contestable:** park it —
426
+ `Task <N>: parked — <finding> — Ruling: <why the code stands>`. The final
427
+ review sees both sides.
428
+ - **Real, but nothing downstream builds on it:** park it the same way, with
429
+ a ruling that says it's real and deferred.
430
+ - **Real and load-bearing** — a later task builds on it, or it reveals a
431
+ plan defect: rule on the smallest change that unblocks the dependent work,
432
+ ledger it as `Task <N>: Ruling: <finding> — <what you decided and why>`,
433
+ and carry it into the next task's dispatch. Parking a structural failure
434
+ silently lets every dependent task build on it. Stop only when the defect
435
+ leaves every path forward a guess.
436
+
437
+ Adjudicate only at the cap. Adjudicating earlier to end a loop is
438
+ pre-judging with a different name. Every adjudication is a ledger entry —
439
+ a silent discard is forbidden.
440
+
441
+ ### 5. Complete the task
442
+
443
+ When the review comes back clean — or every open finding is parked with a
444
+ ruling at the cap — append the completion line to the ledger in the same
445
+ message as your other bookkeeping:
256
446
 
257
447
  - `Task <N>: complete (commits <base7>..<head7>, review clean)`
258
- - `Task <N>: complete (commits <base7>..<head7>, <K> parked)` 触发熔断后
259
-
260
- 然后标记 todo 已完成并继续。切勿在评审仍有未修复或在达到上限后未附裁决暂存的 Critical/Important 问题时进入下一任务。
261
-
262
- ## 最终评审
263
-
264
- 最终全分支评审同样获得产物包:运行 `bash scripts/review-package PLAN_FILE MERGE_BASE HEAD`(MERGE_BASE = 分支起点提交,例如 `git merge-base main HEAD`),并在最终评审分发中包含打印出的路径,使最终 reviewer 只需读取一个文件,而无需用 git 命令重新推导分支差异。请在当前可用最强模型上分发(见模型选择),使用 requesting-code-review 的 [code-reviewer.md](../requesting-code-review/code-reviewer.md)。将 ledger 中延期 minor 与暂存行指向 reviewer,以便其分拣哪些必须在合并前修复。
265
-
266
- 若最终全分支评审返回 finding,仅分发一个携带完整 finding 列表的修复 subagent——而非每项 finding 各派一个修复者。按 finding 分派的修复者各自重建上下文并重跑套件;真实会话中最终评审修复波的成本曾超过所有任务之和。然后对修复波做一次scoped re-review(在修复区间上执行 `bash scripts/review-package PLAN_FILE FIX_BASE HEAD`,使用 [re-review-prompt.md](re-review-prompt.md))。对残留 finding 按任务循环熔断方式裁决:附裁决暂存,或对承重项进行裁决并记入 ledger。只有上述四类情况能在此让你停下。不存在第二波修复——残留承重 finding 将在 finishing-a-development-branch 呈现选项时上抛给 human partner。
267
-
268
- ## 收尾
269
-
270
- 在删除任何内容前,收集 ledger 中所有包含 `Ruling:` 的行——飞行前裁决、暂存 finding、熔断裁决,全部——按做出顺序汇总到最终消息的“我的裁决”下,每条附上若错的代价。列表必须穷尽:ledger 中有裁决,列表中就有。该列表是你代表 human partner 所做决策触达对方的唯一通道——对方会阅读并返工你做错的部分。随 workspace 一同消失的裁决,等同于秘密决策。
271
-
272
- 当最终全分支评审通过且其修复已合并后,删除本计划的 workspace(`rm -rf <workspace>`)——记录现已留存于 git 历史。同级目录属于其他计划;保持不动。
273
-
274
- 使用 finishing-a-development-branch。
275
-
276
- ## 常见托辞
277
-
278
- | 托辞 | 现实 |
448
+ - `Task <N>: complete (commits <base7>..<head7>, <K> parked)` after a
449
+ tripped breaker
450
+
451
+ Then mark the todo complete and move on. Never move to the next task while
452
+ the review has open Critical/Important issues that are neither fixed nor
453
+ parked-with-ruling at the cap.
454
+
455
+ ## Final Review
456
+
457
+ The final whole-branch review gets a package too: run
458
+ `bash scripts/review-package PLAN_FILE MERGE_BASE HEAD` (MERGE_BASE = the commit the
459
+ branch started from, e.g. `git merge-base main HEAD`) and include the
460
+ printed path in the final review dispatch, so the final reviewer reads
461
+ one file instead of re-deriving the branch diff with git commands. Dispatch
462
+ on the most capable available model (see Model Selection), using
463
+ superpowers:requesting-code-review's
464
+ [code-reviewer.md](../requesting-code-review/code-reviewer.md). Point it at
465
+ the ledger's deferred-minor and parked lines so it can triage which must be
466
+ fixed before merge.
467
+
468
+ If the final whole-branch review returns findings, dispatch ONE fix subagent
469
+ with the complete findings list — not one fixer per finding.
470
+ Per-finding fixers each rebuild context and re-run suites; a real
471
+ session's final-review fix wave cost more than all its tasks combined.
472
+ Then run exactly one scoped re-review of the fix wave
473
+ (`bash scripts/review-package PLAN_FILE FIX_BASE HEAD` over the fix range,
474
+ [re-review-prompt.md](re-review-prompt.md)).
475
+ Adjudicate any residual findings as in the task loop's breaker: park with
476
+ rulings, or rule on the load-bearing ones and ledger what you decided. Only
477
+ the four classes above stop you here. There is no second fix wave —
478
+ residual load-bearing findings surface to your human partner when
479
+ finishing-a-development-branch presents the options.
480
+
481
+ ## Finish
482
+
483
+ Before you delete anything, collect every ledger line containing `Ruling:` —
484
+ preflight rulings, parked findings, breaker adjudications, all of them — into
485
+ your final message under "Rulings I made", in the order you made them, each
486
+ with what it costs if wrong. The list is exhaustive: if the ledger holds a
487
+ ruling, the list holds it. That list is the only place the decisions you
488
+ took on your human partner's behalf reach them — they read it and rework
489
+ whatever you got wrong. A ruling that dies with the workspace was a decision
490
+ made in secret.
491
+
492
+ When the final whole-branch review is clean and its fixes are merged,
493
+ delete this plan's workspace (`rm -rf <workspace>`) — the git history is
494
+ the record now. Sibling directories belong to other plans; leave them
495
+ alone.
496
+
497
+ Use superpowers:finishing-a-development-branch.
498
+
499
+ ## Common Rationalizations
500
+
501
+ | Excuse | Reality |
279
502
  |--------|---------|
280
- | “规格符合度差不多就行” | 评审发现规格缺口 = 未完成。修复或打到上限后裁决——只有这两条出路。 |
281
- | “我自己修更快,分发是开销” | 控制器修复会污染你的上下文并跳过评审。请恢复实现者。 |
282
- | “再来一轮就能收敛” | 超过上限后轮次不会收敛——失败是结构性的。请裁决并分流。 |
283
- | “reviewer 反正还会找出新问题” | scoped re-review只验证修复;不会漫游。未触及代码上的新 finding 记入 ledger,不进入循环。 |
284
- | “这条 finding 明显有误,我直接丢弃” | 仅在达到上限时裁决,且每条裁决均为 ledger 条目。静默丢弃是被禁止的。 |
285
- | “修复很小,跳过复审” | 未经评审的修复正是回归的来源。每轮都以scoped re-review结束。 |
286
- | “评审拖慢循环” | 没有评审的循环只是未经验证的空转。评审是循环的刹车与方向盘。 |
287
- | “ledger 记账是开销” | ledger 在压缩后依然存活。没有 ledger 的控制器曾重新分发整串已完成任务。 |
288
- | “实现者自己派了 reviewer——多一份保障” | 那是重复席位,对同一差异做重复评审;任务评审才是关卡。工作者自派的 reviewer 是应标记的缺陷,而非严谨。 |
289
-
290
- ## 示例工作流
503
+ | "Close enough on spec compliance" | Reviewer found spec gaps = not done. Fix or hit the cap and adjudicate — those are the only exits. |
504
+ | "I'll fix it myself, dispatching is overhead" | Controller fixes pollute your context and skip review. Resume the implementer. |
505
+ | "One more round will converge" | Past the cap, rounds don't converge — the failure is structural. Adjudicate and route. |
506
+ | "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. |
507
+ | "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. |
508
+ | "The fix was small, skip the re-review" | Unreviewed fixes are how regressions land. Every round ends with a scoped re-review. |
509
+ | "Reviews slow the loop down" | The loop without reviews is just unverified churn. Reviews are the loop's brakes and steering. |
510
+ | "Ledger bookkeeping is overhead" | The ledger is what survives compaction. Controllers without one have re-dispatched entire completed task sequences. |
511
+ | "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. |
512
+
513
+ ## Example Workflow
291
514
 
292
515
  ```
293
- You: 我正在使用 subagent 驱动开发来执行此计划。
516
+ You: I'm using Subagent-Driven Development to execute this plan.
294
517
 
295
- [准备:worktree 已校验]
296
- [通读一次计划文件:docs/superpowers/plans/feature-plan.md]
297
- [解析 workspace:bash scripts/sdd-workspace docs/superpowers/plans/feature-plan.md — 内部无 ledger,全新开始]
298
- [为所有任务创建 todos]
518
+ [Setup: worktree verified]
519
+ [Read plan file once: docs/superpowers/plans/feature-plan.md]
520
+ [Resolve workspace: bash scripts/sdd-workspace docs/superpowers/plans/feature-plan.md — no ledger inside, fresh start]
521
+ [Create todos for all tasks]
299
522
 
300
- 任务 1:钩子安装脚本
523
+ Task 1: Hook installation script
301
524
 
302
- [为任务 1 运行 task-brief;携带 brief + 报告路径 + 上下文分发实现者]
525
+ [Run task-brief for Task 1; dispatch implementer with brief + report paths + context]
303
526
 
304
- Implementer: "开始前确认一下——钩子应安装在用户级还是系统级?"
527
+ Implementer: "Before I begin - should the hook be installed at user or system level?"
305
528
 
306
- You: "用户级(~/.config/superpowers/hooks/)"
529
+ You: "User level (~/.config/superpowers/hooks/)"
307
530
 
308
- Implementer: [稍后]
309
- - 已实现 install-hook 命令
310
- - 已添加测试,5/5 通过
311
- - 自检:发现遗漏 --force 标志,已补上
312
- - 已提交
531
+ Implementer: [Later]
532
+ - Implemented install-hook command
533
+ - Added tests, 5/5 passing
534
+ - Self-review: Found I missed --force flag, added it
535
+ - Committed
313
536
 
314
- [运行 review-package PLAN_FILE BASE HEAD;使用打印出的路径分发任务 reviewer]
315
- 任务 reviewer:规格 [OK] - 所有需求已满足,无多余内容。
316
- 优点:测试覆盖良好、整洁。问题:无。任务质量:通过。
537
+ [Run review-package PLAN_FILE BASE HEAD; dispatch task reviewer with the printed path]
538
+ Task reviewer: Spec [OK] - all requirements met, nothing extra.
539
+ Strengths: Good test coverage, clean. Issues: None. Task quality: Approved.
317
540
 
318
- [ledger:Task 1: complete (commits a1b2c3d..d4e5f6a, review clean)]
541
+ [Ledger: Task 1: complete (commits a1b2c3d..d4e5f6a, review clean)]
319
542
 
320
- 任务 2:恢复模式
543
+ Task 2: Recovery modes
321
544
 
322
- [为任务 2 运行 task-brief;携带 brief + 报告路径 + 上下文分发实现者]
545
+ [Run task-brief for Task 2; dispatch implementer with brief + report paths + context]
323
546
 
324
- Implementer: [无问题]
325
- - 已添加 verify/repair 模式
326
- - 8/8 测试通过
327
- - 已提交
547
+ Implementer: [No questions]
548
+ - Added verify/repair modes
549
+ - 8/8 tests passing
550
+ - Committed
328
551
 
329
- [运行 review-package PLAN_FILE BASE HEAD;使用打印出的路径分发任务 reviewer]
330
- 任务 reviewer:规格 [FAIL]:
331
- - 缺失:进度报告(规格要求“每 100 项报告一次”)
332
- 问题(Important):魔法数字(100)
552
+ [Run review-package PLAN_FILE BASE HEAD; dispatch task reviewer with the printed path]
553
+ Task reviewer: Spec [FAIL]:
554
+ - Missing: Progress reporting (spec says "report every 100 items")
555
+ Issues (Important): Magic number (100)
333
556
 
334
- [修复第 1 轮:恢复实现者并携带两项 finding]
335
- Implementer: 已添加进度报告,提取 PROGRESS_INTERVAL 常量。
336
- 重跑 test/recovery.test.js — 10/10 通过。修复报告已追加。
557
+ [Fix round 1: resume the implementer with both findings]
558
+ Implementer: Added progress reporting, extracted PROGRESS_INTERVAL constant.
559
+ Re-ran test/recovery.test.js — 10/10 passing. Fix report appended.
337
560
 
338
- [运行 review-package PLAN_FILE FIX_BASE HEAD;分发scoped re-review]
339
- re-reviewer:缺失进度报告 — ADDRESSED (src/recovery.js:41)。
340
- 魔法数字 — ADDRESSED (src/recovery.js:7)。新增破坏:无。
341
- 裁定:所有 finding 已处理。
561
+ [Run review-package PLAN_FILE FIX_BASE HEAD; dispatch scoped re-review]
562
+ Re-reviewer: Missing progress reporting — ADDRESSED (src/recovery.js:41).
563
+ Magic number — ADDRESSED (src/recovery.js:7). New breakage: none.
564
+ Verdict: all findings addressed.
342
565
 
343
- [ledger:Task 2: fix round 1/5 (2 addressed, 0 open; commits d4e5f6a..b7c8d9e)]
344
- [ledger:Task 2: complete (commits d4e5f6a..b7c8d9e, review clean)]
566
+ [Ledger: Task 2: fix round 1/5 (2 addressed, 0 open; commits d4e5f6a..b7c8d9e)]
567
+ [Ledger: Task 2: complete (commits d4e5f6a..b7c8d9e, review clean)]
345
568
 
346
569
  ...
347
570
 
348
- [所有任务之后]
349
- [运行 review-package PLAN_FILE MERGE_BASE HEAD;以最强模型分发最终 code-reviewer]
350
- 最终 reviewer:所有需求已满足。延期 minors 已分拣:无阻塞合并项。
571
+ [After all tasks]
572
+ [Run review-package PLAN_FILE MERGE_BASE HEAD; dispatch final code-reviewer, most capable model]
573
+ Final reviewer: All requirements met. Deferred minors triaged: none block merge.
351
574
 
352
- [删除本计划的 workspace——记录现已留存于 git]
575
+ [Delete this plan's workspace — the record now lives in git]
353
576
 
354
- 完成!使用 finishing-a-development-branch。
355
- ```
577
+ Done! Using superpowers:finishing-a-development-branch.
578
+ ```