claude-everything-workflow 0.1.8 → 0.2.2

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 (132) hide show
  1. package/AGENTS.md +19 -20
  2. package/README.md +112 -104
  3. package/agents/code-reviewer.md +15 -44
  4. package/agents/harness-optimizer.md +3 -2
  5. package/agents/planner.md +23 -107
  6. package/commands/code-review.md +25 -9
  7. package/commands/learn.md +97 -0
  8. package/commands/pr.md +4 -0
  9. package/commands/to-spec.md +11 -0
  10. package/hooks/check-code-size.js +33 -12
  11. package/hooks/check-console-log.js +72 -24
  12. package/package.json +5 -2
  13. package/rules/01-base.md +19 -42
  14. package/rules/02-code-size.md +6 -17
  15. package/rules/03-architecture.md +16 -54
  16. package/rules/04-error-handling.md +4 -25
  17. package/rules/05-git-workflow.md +9 -37
  18. package/rules/06-comments.md +3 -37
  19. package/rules/07-forbidden.md +6 -30
  20. package/rules/08-specialty-rules-index.md +18 -0
  21. package/rules/09-first-principles-adversarial-testing.md +6 -18
  22. package/rules/common/agent-orchestration.md +10 -47
  23. package/rules/common/context-hygiene.md +9 -72
  24. package/rules/common/harness-engineering.md +11 -38
  25. package/rules/common/hooks.md +11 -82
  26. package/rules/common/performance.md +8 -71
  27. package/rules/common/pr-automation.md +7 -68
  28. package/rules/common/skills-learning.md +12 -36
  29. package/rules/common/testing.md +15 -59
  30. package/scripts/cleanup-retired-skills.js +214 -0
  31. package/scripts/install.ps1 +73 -85
  32. package/scripts/install.sh +54 -77
  33. package/scripts/learning/review-confidence.js +1 -4
  34. package/scripts/merge-claude-settings.cjs +75 -0
  35. package/scripts/retired-skill-files.json +37 -0
  36. package/scripts/upstream-capability-baseline.json +27 -0
  37. package/scripts/upstream-capability-map.json +150 -0
  38. package/scripts/verify/core.js +91 -0
  39. package/scripts/verify/grilling-spec-gate-checks.js +260 -0
  40. package/scripts/verify/metadata-checks.js +724 -0
  41. package/scripts/verify/repository-checks.js +435 -0
  42. package/scripts/verify/runtime-checks.js +593 -0
  43. package/scripts/verify/workflow-checks.js +741 -0
  44. package/scripts/verify/workflow-ownership-fixtures.js +371 -0
  45. package/scripts/verify/workflow-ownership.js +780 -0
  46. package/scripts/verify-harness.js +16 -1075
  47. package/scripts/verify-upstream-capability-map.js +117 -0
  48. package/skills/README.md +24 -10
  49. package/skills/code-review/SKILL.md +50 -0
  50. package/skills/code-review/references/spec-reviewer-prompt.md +24 -0
  51. package/skills/code-review/references/standards-reviewer-prompt.md +35 -0
  52. package/skills/codebase-design/SKILL.md +63 -0
  53. package/skills/codebase-design/references/deepening.md +27 -0
  54. package/skills/codebase-design/references/design-it-twice.md +17 -0
  55. package/skills/continuous-learning-v2/SKILL.md +7 -7
  56. package/skills/continuous-learning-v2/config.json +0 -4
  57. package/skills/domain-modeling/SKILL.md +100 -0
  58. package/skills/feature-acceptance/SKILL.md +89 -0
  59. package/skills/grilling/SKILL.md +83 -0
  60. package/skills/handoff/SKILL.md +56 -0
  61. package/skills/implement/SKILL.md +97 -0
  62. package/skills/improve-codebase-architecture/SKILL.md +48 -0
  63. package/skills/iterative-retrieval/SKILL.md +10 -1
  64. package/skills/learn/README.md +2 -2
  65. package/skills/project-context/SKILL.md +94 -0
  66. package/skills/project-context/agents/openai.yaml +6 -0
  67. package/skills/project-context/references/project-context-template.md +61 -0
  68. package/skills/prototype/SKILL.md +50 -0
  69. package/skills/prototype/references/logic.md +28 -0
  70. package/skills/prototype/references/ui.md +30 -0
  71. package/skills/research/SKILL.md +48 -0
  72. package/skills/resolving-merge-conflicts/SKILL.md +27 -0
  73. package/skills/spec-gate/SKILL.md +149 -0
  74. package/skills/spec-gate/agents/openai.yaml +4 -0
  75. package/skills/spec-gate/references/spec-document-reviewer-prompt.md +31 -0
  76. package/skills/subagent-driven-development/SKILL.md +95 -414
  77. package/skills/systematic-debugging/SKILL.md +7 -51
  78. package/skills/systematic-debugging/references/diagnosing-bugs.upstream.md +129 -0
  79. package/skills/systematic-debugging/scripts/hitl-loop.template.js +75 -0
  80. package/skills/systematic-debugging/scripts/hitl-loop.template.sh +41 -0
  81. package/skills/test-driven-development/SKILL.md +18 -2
  82. package/skills/to-tickets/SKILL.md +94 -0
  83. package/skills/triage/SKILL.md +53 -0
  84. package/skills/triage/references/agent-brief.md +32 -0
  85. package/skills/triage/references/out-of-scope.md +14 -0
  86. package/skills/using-superpowers/SKILL.md +140 -40
  87. package/skills/visual-companion/SKILL.md +62 -0
  88. package/skills/visual-companion/agents/openai.yaml +4 -0
  89. package/skills/{brainstorming/visual-companion.md → visual-companion/references/guide.md} +1 -1
  90. package/skills/{brainstorming → visual-companion}/scripts/frame-template.html +42 -12
  91. package/skills/visual-companion/scripts/pages.cjs +28 -0
  92. package/skills/visual-companion/scripts/server-utils.cjs +82 -0
  93. package/skills/{brainstorming → visual-companion}/scripts/server.cjs +108 -248
  94. package/skills/{brainstorming → visual-companion}/scripts/start-server.sh +18 -4
  95. package/skills/visual-companion/scripts/websocket.cjs +86 -0
  96. package/skills/wayfinder/SKILL.md +57 -0
  97. package/commands/e2e.md +0 -28
  98. package/commands/evolve.md +0 -42
  99. package/commands/harness-audit.md +0 -27
  100. package/commands/instinct-status.md +0 -38
  101. package/commands/learn-eval.md +0 -91
  102. package/commands/projects.md +0 -27
  103. package/commands/promote.md +0 -29
  104. package/commands/prune.md +0 -46
  105. package/commands/tdd.md +0 -27
  106. package/homunculus/instincts/personal/always-test-first.md +0 -28
  107. package/homunculus/instincts/personal/pr-ci-quality-gate.md +0 -30
  108. package/rules/08-ecc-integration.md +0 -46
  109. package/rules/common/implementation.md +0 -25
  110. package/rules/common/security.md +0 -19
  111. package/skills/brainstorming/SKILL.md +0 -185
  112. package/skills/brainstorming/agents/openai.yaml +0 -3
  113. package/skills/brainstorming/spec-document-reviewer-prompt.md +0 -49
  114. package/skills/context-budget/SKILL.md +0 -59
  115. package/skills/documentation-lookup/SKILL.md +0 -90
  116. package/skills/executing-plans/SKILL.md +0 -66
  117. package/skills/skill-creator/LICENSE.txt +0 -202
  118. package/skills/skill-creator/SKILL.md +0 -356
  119. package/skills/skill-creator/references/output-patterns.md +0 -82
  120. package/skills/skill-creator/references/workflows.md +0 -28
  121. package/skills/skill-creator/scripts/init_skill.py +0 -303
  122. package/skills/skill-creator/scripts/package_skill.py +0 -110
  123. package/skills/skill-creator/scripts/quick_validate.py +0 -95
  124. package/skills/subagent-driven-development/implementer-prompt.md +0 -139
  125. package/skills/subagent-driven-development/scripts/review-package +0 -44
  126. package/skills/subagent-driven-development/scripts/sdd-workspace +0 -22
  127. package/skills/subagent-driven-development/scripts/task-brief +0 -40
  128. package/skills/subagent-driven-development/task-reviewer-prompt.md +0 -188
  129. package/skills/writing-plans/SKILL.md +0 -206
  130. package/skills/writing-plans/plan-document-reviewer-prompt.md +0 -49
  131. /package/skills/{brainstorming → visual-companion}/scripts/helper.js +0 -0
  132. /package/skills/{brainstorming → visual-companion}/scripts/stop-server.sh +0 -0
@@ -1,425 +1,106 @@
1
1
  ---
2
2
  name: subagent-driven-development
3
- description: Use when executing an approved implementation plan with mostly independent tasks in the current session, when the user has explicitly approved SDD-style task execution or commit-per-task workflow. Uses task briefs, implementer report files, review diff packages, and a .superpowers/sdd progress ledger.
3
+ description: "Use when the router finds two or more independent, unblocked frontier tickets in a user-authorized delivery scope. Dispatch one fresh subagent per ticket in a separate worktree, then integrate reviewed diffs into a controller-owned worktree; tickets remain the implementation contract and no detailed execution plan is generated."
4
4
  ---
5
5
 
6
6
  # Subagent-Driven Development
7
7
 
8
- Execute a 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.
9
-
10
- **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.
11
-
12
- **Core principle:** Fresh subagent per task + task review (spec + quality) + broad final review = high quality, fast iteration
13
-
14
- **Narration:** between tool calls, narrate at most one short line — the
15
- ledger and the tool results carry the record.
16
-
17
- **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: BLOCKED status you cannot resolve, ambiguity that genuinely prevents progress, or all tasks complete. "Should I continue?" prompts and progress summaries waste their time — they asked you to execute the plan, so execute it.
8
+ Run several independent frontier tickets in parallel without reintroducing a long implementation plan.
9
+ Each fresh subagent receives one approved ticket, discovers current code details itself, and returns evidence
10
+ for review. The controller owns ticket selection, worktree isolation, review, tracker mutations and user
11
+ communication.
18
12
 
19
13
  ## When to Use
20
14
 
21
- ```dot
22
- digraph when_to_use {
23
- "Have implementation plan?" [shape=diamond];
24
- "Tasks mostly independent?" [shape=diamond];
25
- "Stay in this session?" [shape=diamond];
26
- "subagent-driven-development" [shape=box];
27
- "executing-plans" [shape=box];
28
- "Manual execution or brainstorm first" [shape=box];
29
-
30
- "Have implementation plan?" -> "Tasks mostly independent?" [label="yes"];
31
- "Have implementation plan?" -> "Manual execution or brainstorm first" [label="no"];
32
- "Tasks mostly independent?" -> "Stay in this session?" [label="yes"];
33
- "Tasks mostly independent?" -> "Manual execution or brainstorm first" [label="no - tightly coupled"];
34
- "Stay in this session?" -> "subagent-driven-development" [label="yes"];
35
- "Stay in this session?" -> "executing-plans" [label="no - parallel session"];
36
- }
37
- ```
38
-
39
- **vs. Executing Plans (parallel session):**
40
- - Same session (no context switch)
41
- - Fresh subagent per task (no context pollution)
42
- - Review after each task (spec compliance + code quality), broad review at the end
43
- - Faster iteration (no human-in-loop between tasks)
44
-
45
- ## The Process
46
-
47
- ```dot
48
- digraph process {
49
- rankdir=TB;
50
-
51
- subgraph cluster_per_task {
52
- label="Per Task";
53
- "Dispatch implementer subagent (./implementer-prompt.md)" [shape=box];
54
- "Implementer subagent asks questions?" [shape=diamond];
55
- "Answer questions, provide context" [shape=box];
56
- "Implementer subagent implements, tests, commits, self-reviews" [shape=box];
57
- "Write diff file, dispatch task reviewer subagent (./task-reviewer-prompt.md)" [shape=box];
58
- "Task reviewer reports spec ✅ and quality approved?" [shape=diamond];
59
- "Dispatch fix subagent for Critical/Important findings" [shape=box];
60
- "Mark task complete in todo list and progress ledger" [shape=box];
61
- }
62
-
63
- "Read plan, note context and global constraints, create todos" [shape=box];
64
- "More tasks remain?" [shape=diamond];
65
- "Dispatch final code reviewer subagent (agents/code-reviewer.md)" [shape=box];
66
- "Use verification-before-completion, then /verify and /pr when requested" [shape=box style=filled fillcolor=lightgreen];
67
-
68
- "Read plan, note context and global constraints, create todos" -> "Dispatch implementer subagent (./implementer-prompt.md)";
69
- "Dispatch implementer subagent (./implementer-prompt.md)" -> "Implementer subagent asks questions?";
70
- "Implementer subagent asks questions?" -> "Answer questions, provide context" [label="yes"];
71
- "Answer questions, provide context" -> "Dispatch implementer subagent (./implementer-prompt.md)";
72
- "Implementer subagent asks questions?" -> "Implementer subagent implements, tests, commits, self-reviews" [label="no"];
73
- "Implementer subagent implements, tests, commits, self-reviews" -> "Write diff file, dispatch task reviewer subagent (./task-reviewer-prompt.md)";
74
- "Write diff file, dispatch task reviewer subagent (./task-reviewer-prompt.md)" -> "Task reviewer reports spec ✅ and quality approved?";
75
- "Task reviewer reports spec ✅ and quality approved?" -> "Dispatch fix subagent for Critical/Important findings" [label="no"];
76
- "Dispatch fix subagent for Critical/Important findings" -> "Write diff file, dispatch task reviewer subagent (./task-reviewer-prompt.md)" [label="re-review"];
77
- "Task reviewer reports spec ✅ and quality approved?" -> "Mark task complete in todo list and progress ledger" [label="yes"];
78
- "Mark task complete in todo list and progress ledger" -> "More tasks remain?";
79
- "More tasks remain?" -> "Dispatch implementer subagent (./implementer-prompt.md)" [label="yes"];
80
- "More tasks remain?" -> "Dispatch final code reviewer subagent (agents/code-reviewer.md)" [label="no"];
81
- "Dispatch final code reviewer subagent (agents/code-reviewer.md)" -> "Use verification-before-completion, then /verify and /pr when requested";
82
- }
83
- ```
84
-
85
- ## Local Git Boundary
86
-
87
- This workflow depends on per-task commits so review packages can compare each task's recorded `BASE` and `HEAD`. Use it only when the user has explicitly approved commit handling, PR handling, or SDD execution for the plan.
88
-
89
- If commit handling is not approved, use `skills/executing-plans/SKILL.md` instead and keep changes uncommitted.
90
-
91
- ## Pre-Flight Plan Review
92
-
93
- Before dispatching Task 1, scan the plan once for conflicts:
94
-
95
- - tasks that contradict each other or the plan's Global Constraints
96
- - anything the plan explicitly mandates that the review rubric treats as a
97
- defect (a test that asserts nothing, verbatim duplication of a logic block)
98
-
99
- Present everything you find to your human partner as one batched question —
100
- each finding beside the plan text that mandates it, asking which governs —
101
- before execution begins, not one interrupt per discovery mid-plan. If the
102
- scan is clean, proceed without comment. The review loop remains the net for
103
- conflicts that only emerge from implementation.
104
-
105
- ## Model Selection
106
-
107
- Use the least powerful model that can handle each role to conserve cost and increase speed.
108
-
109
- **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.
110
-
111
- **Integration and judgment tasks** (multi-file coordination, pattern matching, debugging): use a standard model.
112
-
113
- **Architecture and design tasks**: use the most capable available model.
114
- The final whole-branch review is one of these — dispatch it on the most
115
- capable available model, not the session default.
116
-
117
- **Review tasks**: choose the model with the same judgment, scaled to the
118
- diff's size, complexity, and risk. A small mechanical diff does not need the
119
- most capable model; a subtle concurrency change does.
120
-
121
- **Always specify the model explicitly when dispatching a subagent.** An
122
- omitted model inherits your session's model — often the most capable and
123
- most expensive — which silently defeats this section.
124
-
125
- **Turn count beats token price.** Wall-clock and context cost scale with how
126
- many turns a subagent takes, and the cheapest models routinely take 2-3× the
127
- turns on multi-step work — costing more overall. Use a mid-tier model as the
128
- floor for reviewers and for implementers working from prose descriptions.
129
- When the task's plan text contains the complete code to write, the
130
- implementation is transcription plus testing: use the cheapest tier for
131
- that implementer. Single-file mechanical fixes also take the cheapest tier.
132
-
133
- **Task complexity signals (implementation tasks):**
134
- - Touches 1-2 files with a complete spec → cheap model
135
- - Touches multiple files with integration concerns → standard model
136
- - Requires design judgment or broad codebase understanding → most capable model
137
-
138
- ## Handling Implementer Status
139
-
140
- Implementer subagents report one of four statuses. Handle each appropriately:
141
-
142
- **DONE:** Generate the review package (`scripts/review-package 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.
143
-
144
- **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.
145
-
146
- **NEEDS_CONTEXT:** The implementer needs information that wasn't provided. Provide the missing context and re-dispatch.
147
-
148
- **BLOCKED:** The implementer cannot complete the task. Assess the blocker:
149
- 1. If it's a context problem, provide more context and re-dispatch with the same model
150
- 2. If the task requires more reasoning, re-dispatch with a more capable model
151
- 3. If the task is too large, break it into smaller pieces
152
- 4. If the plan itself is wrong, escalate to the human
153
-
154
- **Never** ignore an escalation or force the same model to retry without changes. If the implementer said it's stuck, something needs to change.
155
-
156
- ## Handling Reviewer ⚠️ Items
157
-
158
- The task reviewer may report "⚠️ Cannot verify from diff" items — requirements
159
- that live in unchanged code or span tasks. These do not block the rest of the
160
- review, but you must resolve each one yourself before marking the task
161
- complete: you hold the plan and cross-task context the reviewer
162
- lacks. If you confirm an item is a real gap, treat it as a failed spec
163
- review — send it back to the implementer and re-review.
164
-
165
- ## Constructing Reviewer Prompts
166
-
167
- Per-task reviews are task-scoped gates. The broad review happens once, at the
168
- final whole-branch review. When you fill a reviewer template:
169
-
170
- - Do not add open-ended directives like "check all uses" or "run race tests
171
- if useful" without a concrete, task-specific reason
172
- - Do not ask a reviewer to re-run tests the implementer already ran on the
173
- same code — the implementer's report carries the test evidence
174
- - Do not pre-judge findings for the reviewer — never instruct a reviewer to
175
- ignore or not flag a specific issue. If you believe a finding would be a
176
- false positive, let the reviewer raise it and adjudicate it in the review
177
- loop. If the prompt you are writing contains "do not flag," "don't treat X
178
- as a defect," "at most Minor," or "the plan chose" — stop: you are
179
- pre-judging, usually to spare yourself a review loop.
180
- - The global-constraints block you hand the reviewer is its attention
181
- lens. Copy the binding requirements verbatim from the plan's Global
182
- Constraints section or the spec: exact values, exact formats, and the
183
- stated relationships between components ("same layout as X", "matches
184
- Y"). The reviewer's template already carries the process rules (YAGNI,
185
- test hygiene, review method) — the constraints block is for what THIS
186
- project's spec demands.
187
- - Hand the reviewer its diff as a file: run this skill's
188
- `scripts/review-package BASE HEAD` and pass the reviewer the file path
189
- it prints (or, without bash: `git log --oneline`, `git diff --stat`,
190
- and `git diff -U10` for the range, redirected to one uniquely named
191
- file). The output never enters your own context, and the reviewer sees
192
- the commit list, stat summary, and full diff with context in one Read
193
- call. Use the BASE you recorded before dispatching the implementer —
194
- never `HEAD~1`, which silently truncates multi-commit tasks.
195
- - A dispatch prompt describes one task, not the session's history. Do not
196
- paste accumulated prior-task summaries ("state after Tasks 1-3") into
197
- later dispatches — a real session's dispatch hit 42k chars of which 99%
198
- was pasted history. A fresh subagent needs its task, the interfaces it
199
- touches, and the global constraints. Nothing else.
200
- - Dispatch fix subagents for Critical and Important findings. Record Minor
201
- findings in the progress ledger as you go, and point the final
202
- whole-branch review at that list so it can triage which must be fixed
203
- before merge. A roll-up nobody reads is a silent discard.
204
- - A finding labeled plan-mandated — or any finding that conflicts with
205
- what the plan's text requires — is the human's decision, like any plan
206
- contradiction: present the finding and the plan text, ask which governs.
207
- Do not dismiss the finding because the plan mandates it, and do not
208
- dispatch a fix that contradicts the plan without asking.
209
- - The final whole-branch review gets a package too: run
210
- `scripts/review-package MERGE_BASE HEAD` (MERGE_BASE = the commit the
211
- branch started from, e.g. `git merge-base main HEAD`) and include the
212
- printed path in the final review dispatch, so the final reviewer reads
213
- one file instead of re-deriving the branch diff with git commands.
214
- - Every fix dispatch carries the implementer contract: the fix subagent
215
- re-runs the tests covering its change and reports the results. Name the
216
- covering test files in the dispatch — a one-line fix does not need the
217
- whole suite. Before re-dispatching the reviewer, confirm the fix report
218
- contains the covering tests, the command run, and the output; dispatch
219
- the re-review once all three are present.
220
- - If the final whole-branch review returns findings, dispatch ONE fix
221
- subagent with the complete findings list — not one fixer per finding.
222
- Per-finding fixers each rebuild context and re-run suites; a real
223
- session's final-review fix wave cost more than all its tasks combined.
224
-
225
- ## File Handoffs
226
-
227
- Everything you paste into a dispatch prompt — and everything a subagent
228
- prints back — stays resident in your context for the rest of the session
229
- and is re-read on every later turn. Hand artifacts over as files:
230
-
231
- - **Task brief:** before dispatching an implementer, run this skill's
232
- `scripts/task-brief PLAN_FILE N` — it extracts the task's full text to a
233
- uniquely named file and prints the path. Compose the dispatch so the
234
- brief stays the single source of requirements. Your dispatch should
235
- contain: (1) one line on where this task fits in the project; (2) the
236
- brief path, introduced as "read this first — it is your requirements,
237
- with the exact values to use verbatim"; (3) interfaces and decisions
238
- from earlier tasks that the brief cannot know; (4) your resolution of
239
- any ambiguity you noticed in the brief; (5) the report-file path and
240
- report contract. Exact values (numbers, magic strings, signatures, test
241
- cases) appear only in the brief.
242
- - **Report file:** name the implementer's report file after the brief
243
- (brief `…/task-N-brief.md` → report `…/task-N-report.md`) and put it in
244
- the dispatch prompt. The implementer writes the full report there and
245
- returns only status, commits, a one-line test summary, and concerns.
246
- - **Reviewer inputs:** the task reviewer gets three paths — the same brief
247
- file, the report file, and the review package — plus the global
248
- constraints that bind the task.
249
- - Fix dispatches append their fix report (with test results) to the same
250
- report file and return a short summary; re-reviews read the updated file.
251
-
252
- ## Durable Progress
253
-
254
- Conversation memory does not survive compaction. In real sessions,
255
- controllers that lost their place have re-dispatched entire completed task
256
- sequences — the single most expensive failure observed. Track progress in
257
- a ledger file, not only in todos.
258
-
259
- - At skill start, check for a ledger:
260
- `cat "$(git rev-parse --show-toplevel)/.superpowers/sdd/progress.md"`. Tasks listed there
261
- as complete are DONE — do not re-dispatch them; resume at the first task
262
- not marked complete.
263
- - When a task's review comes back clean, append one line to the ledger in
264
- the same message as your other bookkeeping:
265
- `Task N: complete (commits <base7>..<head7>, review clean)`.
266
- - The ledger is your recovery map: the commits it names exist in git even
267
- when your context no longer remembers creating them. After compaction,
268
- trust the ledger and `git log` over your own recollection.
269
- - `git clean -fdx` will destroy the ledger (it's git-ignored scratch); if
270
- that happens, recover from `git log`.
271
-
272
- ## Prompt Templates
273
-
274
- - [implementer-prompt.md](implementer-prompt.md) - Dispatch implementer subagent
275
- - [task-reviewer-prompt.md](task-reviewer-prompt.md) - Dispatch task reviewer subagent (spec compliance + code quality)
276
- - Final whole-branch review: use `agents/code-reviewer.md`, adding `agents/security-reviewer.md` or `agents/database-reviewer.md` when the touched area warrants it.
277
-
278
- ## Example Workflow
279
-
280
- ```
281
- You: I'm using Subagent-Driven Development to execute this plan.
282
-
283
- [Read plan file once: docs/superpowers/plans/feature-plan.md]
284
- [Create todos for all tasks]
285
-
286
- Task 1: Hook installation script
287
-
288
- [Run task-brief for Task 1; dispatch implementer with brief + report paths + context]
289
-
290
- Implementer: "Before I begin - should the hook be installed at user or system level?"
291
-
292
- You: "User level (~/.config/superpowers/hooks/)"
293
-
294
- Implementer: "Got it. Implementing now..."
295
- [Later] Implementer:
296
- - Implemented install-hook command
297
- - Added tests, 5/5 passing
298
- - Self-review: Found I missed --force flag, added it
299
- - Committed
300
-
301
- [Run review-package, dispatch task reviewer with the printed path]
302
- Task reviewer: Spec ✅ - all requirements met, nothing extra.
303
- Strengths: Good test coverage, clean. Issues: None. Task quality: Approved.
304
-
305
- [Mark Task 1 complete]
306
-
307
- Task 2: Recovery modes
308
-
309
- [Run task-brief for Task 2; dispatch implementer with brief + report paths + context]
310
-
311
- Implementer: [No questions, proceeds]
312
- Implementer:
313
- - Added verify/repair modes
314
- - 8/8 tests passing
315
- - Self-review: All good
316
- - Committed
317
-
318
- [Run review-package, dispatch task reviewer with the printed path]
319
- Task reviewer: Spec ❌:
320
- - Missing: Progress reporting (spec says "report every 100 items")
321
- - Extra: Added --json flag (not requested)
322
- Issues (Important): Magic number (100)
323
-
324
- [Dispatch fix subagent with all findings]
325
- Fixer: Removed --json flag, added progress reporting, extracted PROGRESS_INTERVAL constant
326
-
327
- [Task reviewer reviews again]
328
- Task reviewer: Spec ✅. Task quality: Approved.
329
-
330
- [Mark Task 2 complete]
331
-
332
- ...
333
-
334
- [After all tasks]
335
- [Dispatch final code-reviewer]
336
- Final reviewer: All requirements met, ready to merge
337
-
338
- Done!
15
+ Use only when all of the following are true:
16
+
17
+ - the router is executing a user-authorized delivery scope and records why SDD is safer or faster than
18
+ serial `implement`;
19
+ - at least two selected tickets are `ready-for-agent`, unclaimed and have no unresolved blocker;
20
+ - the tickets do not modify the same files, shared migration, release boundary or external state;
21
+ - each ticket can finish in one fresh subagent context.
22
+
23
+ Announce the selected topology and its reason in one line, then continue. Otherwise use `implement` for
24
+ one ticket. Do not manufacture extra tickets merely to justify parallelism.
25
+
26
+ ## Prepare
27
+
28
+ 1. Read the full source ticket and its blocker status; record its acceptance criteria and the user-approved
29
+ scope.
30
+ 2. Confirm the selected tickets form the frontier and have no overlapping write surface. If overlap is
31
+ uncertain, run them sequentially.
32
+ 3. Create one clean controller-owned integration worktree at the common base, plus one separate worktree
33
+ and branch per ticket using `skills/using-git-worktrees/SKILL.md`. The integration worktree is the only
34
+ delivery target; do not share a checkout between implementers.
35
+ 4. Record the common base and every worktree path. The integration worktree must have no unrelated dirty
36
+ or untracked files before the first diff is applied.
37
+ 5. Do not generate a detailed implementation plan, task brief file, or code skeleton. The ticket is the
38
+ implementation contract.
39
+
40
+ ## Dispatch
41
+
42
+ For each ticket, dispatch one fresh subagent with only:
43
+
44
+ ```text
45
+ Ticket: <reference and full body>
46
+ Worktree: <absolute path>
47
+ Base: <commit>
48
+ Context: <why this behavior exists, confirmed interfaces, and completed blockers>
49
+
50
+ Implement only this ticket. Inspect the current code to choose files and implementation details.
51
+ Use test-driven-development for behavior changes. Keep the ticket's acceptance criteria as the
52
+ source of truth; do not expand scope or start another ticket.
53
+
54
+ Do not stage, commit, push, open a PR, claim/resolve/comment on a tracker, or perform any other external
55
+ mutation. Leave only this ticket's worktree diff, including task-owned untracked files.
56
+
57
+ Before reporting, run focused verification, self-review the diff, and report:
58
+ - status: DONE | BLOCKED | NEEDS_DECISION
59
+ - changed files and tests run
60
+ - task-owned untracked files created since dispatch
61
+ - RED/GREEN evidence when TDD applied
62
+ - unresolved risk or assumption
339
63
  ```
340
64
 
341
- ## Advantages
342
-
343
- **vs. Manual execution:**
344
- - Subagents follow TDD naturally
345
- - Fresh context per task (no confusion)
346
- - Parallel-safe (subagents don't interfere)
347
- - Subagent can ask questions (before AND during work)
348
-
349
- **vs. Executing Plans:**
350
- - Same session (no handoff)
351
- - Continuous progress (no waiting)
352
- - Review checkpoints automatic
353
-
354
- **Efficiency gains:**
355
- - Controller curates exactly what context is needed; bulk artifacts move
356
- as files, not pasted text
357
- - Subagent gets complete information upfront
358
- - Questions surfaced before work begins (not after)
359
-
360
- **Quality gates:**
361
- - Self-review catches issues before handoff
362
- - Task review carries two verdicts: spec compliance and code quality
363
- - Review loops ensure fixes actually work
364
- - Spec compliance prevents over/under-building
365
- - Code quality ensures implementation is well-built
366
-
367
- **Cost:**
368
- - More subagent invocations (implementer + reviewer per task)
369
- - Controller does more prep work (extracting all tasks upfront)
370
- - Review loops add iterations
371
- - But catches issues early (cheaper than debugging later)
372
-
373
- ## Red Flags
374
-
375
- **Never:**
376
- - Start implementation on main/master branch without explicit user consent
377
- - Use SDD when commit handling has not been approved; use `skills/executing-plans/SKILL.md` instead
378
- - Skip task review, or accept a report missing either verdict (spec compliance AND task quality are both required)
379
- - Proceed with unfixed issues
380
- - Dispatch multiple implementation subagents in parallel (conflicts)
381
- - Make a subagent read the whole plan file (hand it its task brief —
382
- `scripts/task-brief` — instead)
383
- - Skip scene-setting context (subagent needs to understand where task fits)
384
- - Ignore subagent questions (answer before letting them proceed)
385
- - Accept "close enough" on spec compliance (reviewer found spec issues = not done)
386
- - Skip review loops (reviewer found issues = implementer fixes = review again)
387
- - Let implementer self-review replace actual review (both are needed)
388
- - Tell a reviewer what not to flag, or pre-rate a finding's severity in the
389
- dispatch prompt ("treat it as Minor at most") — the plan's example code is
390
- a starting point, not evidence that its weaknesses were chosen
391
- - Dispatch a task reviewer without a diff file — generate it first
392
- (`scripts/review-package BASE HEAD`) and name the printed path in the
393
- prompt
394
- - Move to next task while the review has open Critical/Important issues
395
- - Re-dispatch a task the progress ledger already marks complete — check
396
- the ledger (and `git log`) after any compaction or resume
397
-
398
- **If subagent asks questions:**
399
- - Answer clearly and completely
400
- - Provide additional context if needed
401
- - Don't rush them into implementation
402
-
403
- **If reviewer finds issues:**
404
- - Implementer (same subagent) fixes them
405
- - Reviewer reviews again
406
- - Repeat until approved
407
- - Don't skip the re-review
408
-
409
- **If subagent fails task:**
410
- - Dispatch fix subagent with specific instructions
411
- - Don't try to fix manually (context pollution)
412
-
413
- ## Integration
414
-
415
- **Required workflow skills:**
416
- - **skills/using-git-worktrees/SKILL.md** - Ensures isolated workspace when needed
417
- - **skills/writing-plans/SKILL.md** - Creates the plan this skill executes
418
- - **agents/code-reviewer.md** - Final whole-branch review template
419
- - **skills/verification-before-completion/SKILL.md** - Fresh evidence gate before completion claims
420
-
421
- **Subagents should use:**
422
- - **skills/test-driven-development/SKILL.md** - Subagents follow TDD for behavior-changing tasks
423
-
424
- **Alternative workflow:**
425
- - **skills/executing-plans/SKILL.md** - Use when task coupling is high, commit handling is not approved, or same-session SDD is not appropriate
65
+ If an agent finds a consequential decision, stop that ticket and return it to `using-superpowers`; do not
66
+ let a parallel worker decide it unilaterally.
67
+
68
+ ## Review, Integrate and Resolve
69
+
70
+ 1. Review each completed ticket against its ticket body and its worker review package. That package must
71
+ include tracked, staged, unstaged and task-owned untracked files from the recorded worker base. Run the
72
+ ticket's required verification, then use `skills/code-review/SKILL.md`; the ticket is the Spec source.
73
+ 2. For each ticket that passes, generate an applyable binary patch from its recorded worker base. Record
74
+ task-owned untracked files before and after dispatch, then append a `git diff --binary --no-index`
75
+ patch for every new untracked file. Apply both tracked and untracked patches with a three-way apply to
76
+ the controller-owned integration worktree. Never copy files between worktrees.
77
+ 3. Confirm every applied tracked and task-owned untracked file is present in the integration worktree, run
78
+ `git diff --check`, and run the ticket's integration-sensitive verification. An apply conflict or
79
+ regression keeps that ticket `in-progress`; do not resolve it or silently discard its worker diff.
80
+ 4. After every selected ticket is integrated, use `skills/code-review/SKILL.md` against the complete
81
+ integration worktree package from the common base. Include its tracked, staged, unstaged and
82
+ task-owned untracked files, and give every selected ticket body as the combined Spec source. Then run
83
+ the combined verification required by the selected tickets. Do not resolve any selected ticket until
84
+ this integrate-and-verify gate passes.
85
+ 5. Update a local tracker only for integrated tickets that pass the gate. External claim, comment or close
86
+ operations still require the confirmation specified by `implement`.
87
+ 6. Refresh the graph after every resolve and return it to the router. The router may select the next
88
+ topology only for frontier tickets that remain inside the same user-authorized delivery scope.
89
+
90
+ ## Boundaries
91
+
92
+ - One fresh subagent owns one ticket and one separate worktree.
93
+ - Do not generate a detailed implementation plan or depend on file-by-file instructions.
94
+ - Do not parallelize tickets with a real dependency, overlapping files, shared migrations or shared external
95
+ side effects.
96
+ - Do not auto-commit, push, open a PR or close an external Issue. A topology choice does not authorize
97
+ external tracker mutation or a new product scope.
98
+ - Keep the integration worktree and its uncommitted, task-owned diff as the handoff target until the user
99
+ separately authorizes commit, push, PR or cleanup.
100
+
101
+ ## Example
102
+
103
+ Tickets `01` and `02` are both unblocked and modify different packages. The router selects SDD, creates one
104
+ integration worktree plus two worker worktrees, then dispatches two fresh subagents. Each implements and
105
+ verifies only its own ticket. Review both worker diffs, apply passing diffs to the integration worktree, and
106
+ run the combined gate before resolving either ticket or returning the unlocked frontier to the router.
@@ -1,59 +1,15 @@
1
1
  ---
2
2
  name: systematic-debugging
3
- description: Use when encountering any bug, failing test, flaky behavior, or unexpected result before proposing fixes. Keeps debugging lightweight but root-cause driven.
3
+ description: Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.
4
4
  ---
5
5
 
6
6
  # Systematic Debugging
7
7
 
8
- Use this skill when implementation or verification reveals a bug, failing test, flaky behavior, or unexpected result.
8
+ 先完整读取 `references/diagnosing-bugs.upstream.md`,严格按其中六阶段的原始顺序与门禁执行;
9
+ 不得改写、缩减或跳过阶段,除非原文明确允许并记录理由。
9
10
 
10
- The goal is not to make debugging heavy. The goal is to stop guessing. Complete the four phases in order, then return to the active task or plan.
11
+ ## 项目运行适配
11
12
 
12
- <HARD-GATE>
13
- Do not propose or apply a fix until Phase 1 identifies a credible root cause and Phase 3 has tested the hypothesis with the smallest useful check.
14
- </HARD-GATE>
15
-
16
- ## Phase 1: Root Cause Investigation
17
-
18
- - Reproduce the failure with the smallest command or scenario.
19
- - Capture the exact error, failing assertion, log line, or unexpected output.
20
- - Trace backward from the symptom to the first incorrect state.
21
- - Identify what changed recently and which boundary it crosses.
22
-
23
- Output: one sentence naming the likely root cause and the evidence for it.
24
-
25
- ## Phase 2: Pattern Analysis
26
-
27
- - Check whether the same pattern appears elsewhere in the codebase.
28
- - Compare against nearby working implementations.
29
- - Decide whether this is a local bug, contract mismatch, missing test, environment issue, or design gap.
30
-
31
- Output: the smallest affected scope and any similar files that should or should not change.
32
-
33
- ## Phase 3: Hypothesis Test
34
-
35
- - Form one falsifiable hypothesis.
36
- - Run or add the smallest diagnostic check that can prove or disprove it.
37
- - If the hypothesis fails, return to Phase 1 with the new evidence.
38
- - After two failed fix hypotheses, stop and reassess the design before trying another fix.
39
-
40
- Output: confirmed hypothesis or reason for returning to investigation.
41
-
42
- ## Phase 4: Fix And Verify
43
-
44
- - Add or update the failing test first when the project has a suitable test path.
45
- - Apply one focused fix at the source of the root cause.
46
- - Run the failing test or reproduction command.
47
- - Run the task's required verification from the plan.
48
- - Remove diagnostic logging or temporary probes.
49
-
50
- Output: root cause, fix summary, commands run, result, and remaining risk.
51
-
52
- ## Return To Plan
53
-
54
- After the fix is verified, return to the original task:
55
-
56
- - Re-run the task's normal test command.
57
- - Re-run requirement/spec compliance review.
58
- - Re-run code quality review.
59
- - Only then mark the task complete.
13
+ 上游六阶段原文及 `scripts/hitl-loop.template.sh` 作为上游原始 Bash 模板留档,保持原样。
14
+ 当上游原文提到 HITL Bash 或 `.sh` 路径时,项目实际运行一律替换为
15
+ `scripts/hitl-loop.template.js`。它是 HITL 的唯一运行入口;不要执行留档的 Bash 模板。