hero-mmt-kit 1.0.0

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 (79) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/LICENSE +21 -0
  3. package/README.md +158 -0
  4. package/bin/hero-mmt-kit.js +70 -0
  5. package/package.json +35 -0
  6. package/presets/enterprise.json +3 -0
  7. package/presets/small-team.json +3 -0
  8. package/presets/solo.json +3 -0
  9. package/skills.manifest.json +72 -0
  10. package/src/detect.cjs +43 -0
  11. package/src/discover.cjs +159 -0
  12. package/src/doctor.cjs +130 -0
  13. package/src/init.cjs +114 -0
  14. package/src/integrations.cjs +93 -0
  15. package/src/links.cjs +37 -0
  16. package/src/merge.cjs +61 -0
  17. package/src/profile-config.cjs +28 -0
  18. package/src/render.cjs +27 -0
  19. package/src/skills.cjs +107 -0
  20. package/src/update.cjs +75 -0
  21. package/src/util.cjs +56 -0
  22. package/src/workflow-state.cjs +65 -0
  23. package/templates/.hero-mmt-kit/session.schema.json +15 -0
  24. package/templates/AGENTS.md.tmpl +16 -0
  25. package/templates/CLAUDE.md.tmpl +23 -0
  26. package/templates/common/.claude/hooks/git-guard.cjs +57 -0
  27. package/templates/common/.claude/hooks/session-bridge.cjs +43 -0
  28. package/templates/common/.claude/hooks/stop-reminder.cjs +43 -0
  29. package/templates/common/.claude/settings.json +27 -0
  30. package/templates/docs/ACTIVE_STATE.md +41 -0
  31. package/templates/docs/BROWNFIELD_DISCOVERY.md +45 -0
  32. package/templates/docs/DESIGN_STANDARDS.md +86 -0
  33. package/templates/docs/INTERACTION_PATTERNS.md +58 -0
  34. package/templates/docs/PERFORMANCE_STANDARDS.md +31 -0
  35. package/templates/docs/SECURITY_STANDARDS.md +38 -0
  36. package/templates/docs/templates/DESIGN_BRIEF.md +44 -0
  37. package/templates/docs/templates/PRD_AI_FEATURE.md +87 -0
  38. package/templates/skills/NOTICE +69 -0
  39. package/templates/skills/brainstorming/SKILL.md +161 -0
  40. package/templates/skills/brainstorming/scripts/frame-template.html +214 -0
  41. package/templates/skills/brainstorming/scripts/helper.js +88 -0
  42. package/templates/skills/brainstorming/scripts/server.cjs +354 -0
  43. package/templates/skills/brainstorming/scripts/start-server.sh +148 -0
  44. package/templates/skills/brainstorming/scripts/stop-server.sh +56 -0
  45. package/templates/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
  46. package/templates/skills/brainstorming/visual-companion.md +287 -0
  47. package/templates/skills/dispatching-parallel-agents/SKILL.md +186 -0
  48. package/templates/skills/executing-plans/SKILL.md +72 -0
  49. package/templates/skills/finishing-a-development-branch/SKILL.md +253 -0
  50. package/templates/skills/hero-coding/SKILL.md +69 -0
  51. package/templates/skills/hero-planning/SKILL.md +64 -0
  52. package/templates/skills/hero-reviewing/SKILL.md +66 -0
  53. package/templates/skills/hero-security/SKILL.md +425 -0
  54. package/templates/skills/hero-strict/SKILL.md +77 -0
  55. package/templates/skills/hero-unit-test/SKILL.md +79 -0
  56. package/templates/skills/receiving-code-review/SKILL.md +213 -0
  57. package/templates/skills/requesting-code-review/SKILL.md +108 -0
  58. package/templates/skills/requesting-code-review/code-reviewer.md +168 -0
  59. package/templates/skills/subagent-driven-development/SKILL.md +269 -0
  60. package/templates/skills/subagent-driven-development/code-quality-reviewer-prompt.md +34 -0
  61. package/templates/skills/subagent-driven-development/implementer-prompt.md +121 -0
  62. package/templates/skills/subagent-driven-development/scripts/review-package.sh +38 -0
  63. package/templates/skills/subagent-driven-development/scripts/sdd-workspace.sh +25 -0
  64. package/templates/skills/subagent-driven-development/scripts/task-brief.sh +58 -0
  65. package/templates/skills/subagent-driven-development/spec-reviewer-prompt.md +76 -0
  66. package/templates/skills/systematic-debugging/SKILL.md +296 -0
  67. package/templates/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  68. package/templates/skills/systematic-debugging/condition-based-waiting.md +115 -0
  69. package/templates/skills/systematic-debugging/defense-in-depth.md +122 -0
  70. package/templates/skills/systematic-debugging/find-polluter.sh +63 -0
  71. package/templates/skills/systematic-debugging/root-cause-tracing.md +169 -0
  72. package/templates/skills/test-driven-development/SKILL.md +371 -0
  73. package/templates/skills/test-driven-development/testing-anti-patterns.md +299 -0
  74. package/templates/skills/using-git-worktrees/SKILL.md +206 -0
  75. package/templates/skills/using-hero/SKILL.md +54 -0
  76. package/templates/skills/using-superpowers/SKILL.md +119 -0
  77. package/templates/skills/verification-before-completion/SKILL.md +139 -0
  78. package/templates/skills/writing-plans/SKILL.md +173 -0
  79. package/templates/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
@@ -0,0 +1,269 @@
1
+ ---
2
+ name: subagent-driven-development
3
+ description: Use when executing implementation plans with independent tasks in the current session
4
+ ---
5
+
6
+ # Subagent-Driven Development
7
+
8
+ Execute implementation plans by dispatching fresh subagents only where they improve speed, focus, isolation, or review quality. Use review budget deliberately: review is evidence, not ceremony.
9
+
10
+ **Why subagents:** You delegate bounded work to agents with isolated context. Precisely crafted prompts keep them focused and preserve the main session for routing, synthesis, and user communication.
11
+
12
+ **Core principle:** Main agent owns routing and final claims. Subagents are escalation tools, not a default swarm.
13
+
14
+ **Continuous execution:** Do not pause to ask whether to continue once the user approved execution. Continue until blocked, ambiguity genuinely prevents safe progress, or all tasks are complete.
15
+
16
+ ## When to Use
17
+
18
+ Use this skill when all are true:
19
+
20
+ 1. There is an implementation plan or a clear task list.
21
+ 2. Work has independent tasks, broad reading, noisy verification, or specialist review needs.
22
+ 3. Delegation saves meaningful time/context or improves quality enough to justify the cost.
23
+
24
+ Do **not** use this skill for small, localized, low-risk work where the main agent can implement and verify directly.
25
+
26
+ No plan yet, or purely ad-hoc investigation/debugging (e.g. unrelated test failures with no task list)? Use `dispatching-parallel-agents` instead.
27
+
28
+ ```dot
29
+ digraph when_to_use {
30
+ "Have implementation plan?" [shape=diamond];
31
+ "Delegation adds value?" [shape=diamond];
32
+ "Need same-session orchestration?" [shape=diamond];
33
+ "subagent-driven-development" [shape=box];
34
+ "executing-plans or direct execution" [shape=box];
35
+ "Manual execution or brainstorm first" [shape=box];
36
+
37
+ "Have implementation plan?" -> "Delegation adds value?" [label="yes"];
38
+ "Have implementation plan?" -> "Manual execution or brainstorm first" [label="no"];
39
+ "Delegation adds value?" -> "Need same-session orchestration?" [label="yes"];
40
+ "Delegation adds value?" -> "executing-plans or direct execution" [label="no"];
41
+ "Need same-session orchestration?" -> "subagent-driven-development" [label="yes"];
42
+ "Need same-session orchestration?" -> "executing-plans or direct execution" [label="no"];
43
+ }
44
+ ```
45
+
46
+ ## Review Budget
47
+
48
+ Pick the smallest review budget that fits the risk. Do not run multiple review passes unless each pass has a distinct purpose not already covered.
49
+
50
+ Pick the budget from actual risk and uncertainty, not by default. For each tier, this skill's review action is:
51
+
52
+ | Budget | Review action |
53
+ |---|---|
54
+ | `none` | Main-agent self-review + targeted verification + explicit verified/unverified handoff |
55
+ | `single-combined-review` | One reviewer checks requirement fit, correctness, tests/docs, and overengineering |
56
+ | `targeted-specialist-review` | One specialist reviewer for that risk; do not also run generic review unless needed |
57
+ | `full-multi-stage-review` | Spec/acceptance review and quality/security review may be separate |
58
+
59
+ **Final review is conditional.** Run a final integration review only when there were multiple independent task streams, high-risk/core changes, or prior reviews were narrow. If one combined review already covered the entire change, do not review the same scope again.
60
+
61
+ ## Pre-Flight Plan Review
62
+
63
+ Before dispatching Task 1, scan the whole plan once for internal contradictions or
64
+ plan-mandated anti-patterns — a test step that asserts nothing, verbatim duplication
65
+ the plan text itself demands, a later task that silently assumes an earlier task did
66
+ something the earlier task's spec doesn't actually require. Batch **all** findings
67
+ into a single question to the human before execution begins. Don't interrupt once per
68
+ discovery mid-plan — that trains the human to expect drip-fed surprises instead of one
69
+ clear go/no-go decision.
70
+
71
+ If the plan is clean, proceed without comment.
72
+
73
+ ## The Process
74
+
75
+ ```dot
76
+ digraph process {
77
+ rankdir=TB;
78
+
79
+ "Pre-flight plan scan" [shape=box];
80
+ "Read plan/task list once" [shape=box];
81
+ "Create/refresh task list" [shape=box];
82
+ "Select next task" [shape=box];
83
+ "Should main agent implement directly?" [shape=diamond];
84
+ "Main agent implements" [shape=box];
85
+ "Dispatch bounded implementer subagent" [shape=box];
86
+ "Implementer returns status + evidence" [shape=box];
87
+ "Run targeted verification" [shape=box];
88
+ "Choose review budget" [shape=diamond];
89
+ "No delegated review" [shape=box];
90
+ "Single combined or targeted review" [shape=box];
91
+ "Full multi-stage review" [shape=box];
92
+ "Fix confirmed findings" [shape=box];
93
+ "More tasks?" [shape=diamond];
94
+ "Optional final integration review" [shape=box];
95
+ "Final report with verified/unverified scope" [shape=box];
96
+
97
+ "Pre-flight plan scan" -> "Read plan/task list once";
98
+ "Read plan/task list once" -> "Create/refresh task list";
99
+ "Create/refresh task list" -> "Select next task";
100
+ "Select next task" -> "Should main agent implement directly?";
101
+ "Should main agent implement directly?" -> "Main agent implements" [label="yes"];
102
+ "Should main agent implement directly?" -> "Dispatch bounded implementer subagent" [label="no"];
103
+ "Dispatch bounded implementer subagent" -> "Implementer returns status + evidence";
104
+ "Main agent implements" -> "Run targeted verification";
105
+ "Implementer returns status + evidence" -> "Run targeted verification";
106
+ "Run targeted verification" -> "Choose review budget";
107
+ "Choose review budget" -> "No delegated review" [label="none"];
108
+ "Choose review budget" -> "Single combined or targeted review" [label="single/targeted"];
109
+ "Choose review budget" -> "Full multi-stage review" [label="full"];
110
+ "Single combined or targeted review" -> "Fix confirmed findings";
111
+ "Full multi-stage review" -> "Fix confirmed findings";
112
+ "No delegated review" -> "More tasks?";
113
+ "Fix confirmed findings" -> "More tasks?";
114
+ "More tasks?" -> "Select next task" [label="yes"];
115
+ "More tasks?" -> "Optional final integration review" [label="if warranted"];
116
+ "More tasks?" -> "Final report with verified/unverified scope" [label="otherwise"];
117
+ "Optional final integration review" -> "Final report with verified/unverified scope";
118
+ }
119
+ ```
120
+
121
+ ## Durable Progress
122
+
123
+ A compacted or resumed session loses in-context memory of what's already done. A
124
+ controller that lost its place has been observed re-dispatching entire completed task
125
+ sequences — the single most expensive failure mode in this skill. Guard against it with
126
+ a durable ledger, not just the ephemeral todo list:
127
+
128
+ - At skill start, run `bash scripts/sdd-workspace.sh` to resolve `.hero-mmt-kit/sdd/`,
129
+ then check `.hero-mmt-kit/sdd/progress.md` if it exists. Tasks it lists as complete
130
+ are **not** re-dispatched — verify quickly if anything looks stale, but trust the
131
+ ledger over a fuzzy recollection of prior context.
132
+ - When a task's review comes back clean, append one line before moving to the next
133
+ task:
134
+ ```
135
+ Task N: complete (commits <base7>..<head7>, review clean)
136
+ ```
137
+ - The ledger lives in the self-ignoring `.hero-mmt-kit/sdd/` scratch dir (see Prompt
138
+ Templates below) — it never needs the user's own `.gitignore` touched and is not
139
+ meant to be committed.
140
+
141
+ ## Model Selection
142
+
143
+ Use the least powerful model that can safely handle the role.
144
+
145
+ | Work | Suggested model tier |
146
+ |---|---|
147
+ | Simple summaries, narrow doc lookup, checklist verification | Fast/cheap model, e.g. Haiku tier |
148
+ | Bounded implementation, focused review, moderate investigation | Standard model, e.g. Sonnet tier |
149
+ | Architecture, ambiguous synthesis, high-risk review | Main-agent tier / strongest available |
150
+
151
+ Prefer one capable reviewer over several weak duplicate reviewers.
152
+
153
+ **Turn count beats token price.** A cheap model that takes 2-3x more turns to finish
154
+ multi-step implementation or review work often costs more overall in wall-clock time
155
+ and context than a stronger model that finishes in fewer turns — optimize for total
156
+ cost, not per-token price.
157
+
158
+ **Always specify a model explicitly on every dispatch** (implementer and reviewer
159
+ alike). An omitted `model:` field silently inherits the calling session's model —
160
+ usually the most expensive tier available, not a deliberate choice.
161
+
162
+ ## Handling Implementer Status
163
+
164
+ Implementer subagents report one of four statuses:
165
+
166
+ **DONE:** Proceed to verification and the selected review budget.
167
+
168
+ **DONE_WITH_CONCERNS:** Read the concerns. If they affect correctness/scope, resolve them before completion. If they are observations, note them in the final handoff.
169
+
170
+ **NEEDS_CONTEXT:** Provide missing context and re-dispatch with a narrower prompt.
171
+
172
+ **BLOCKED:** Change something before retrying: add context, use a stronger model, split the task, or escalate to the human if the plan is wrong.
173
+
174
+ Never force the same blocked prompt to retry unchanged.
175
+
176
+ ## Constructing Reviewer Prompts
177
+
178
+ **Do not pre-judge findings for the reviewer.** Never instruct a reviewer to ignore or
179
+ downgrade a specific issue before they've looked. If the prompt you're writing
180
+ contains "do not flag," "don't treat X as a defect," "at most Minor," or "the plan
181
+ chose" — stop: you are pre-judging, and you're removing the reviewer's only value,
182
+ which is an independent check.
183
+
184
+ **Handling ⚠️ Cannot verify from diff.** A reviewer may report this for a requirement
185
+ that lives in unchanged code or spans multiple tasks — it doesn't block the rest of
186
+ the review. But the **controller**, not the reviewer, must resolve each ⚠️ item (read
187
+ the relevant file, run the relevant check) before marking the task complete. Don't
188
+ treat ⚠️ as an automatic pass, and don't gate only on ❌ while leaving ⚠️ items open.
189
+
190
+ ## Prompt Templates
191
+
192
+ - `./implementer-prompt.md` - Dispatch implementer subagent. Build the task brief with
193
+ `bash scripts/task-brief.sh <plan-file> <N>` first — don't paste the full task text
194
+ or make the implementer read the whole plan.
195
+ - `./spec-reviewer-prompt.md` - Use only for `full-multi-stage-review` or explicit acceptance/spec risk.
196
+ - `./code-quality-reviewer-prompt.md` - Use for combined quality review, targeted quality review, or full review budgets.
197
+ - `./scripts/sdd-workspace.sh` - Resolves/creates `.hero-mmt-kit/sdd/`, the
198
+ self-ignoring scratch dir for task briefs, review packages, and the progress ledger.
199
+ - `./scripts/task-brief.sh PLAN_FILE N [OUTFILE]` - Extracts Task N's exact text into a
200
+ file the implementer reads directly.
201
+ - `./scripts/review-package.sh BASE HEAD [OUTFILE]` - Builds one diff file (log +
202
+ diffstat + full diff) for a reviewer to read directly.
203
+
204
+ Invoke scripts as `bash scripts/<name>.sh ...` (not `./scripts/<name>.sh`) — this
205
+ doesn't depend on the executable bit surviving install/copy on every platform.
206
+
207
+ ## Example: Pragmatic Coding Assistant
208
+
209
+ ```
210
+ Task: Update docs and a small installer helper.
211
+
212
+ 1. Main agent reads the relevant task list.
213
+ 2. Main agent edits directly because the change is localized.
214
+ 3. Run targeted tests and link checks.
215
+ 4. Review budget = none or single-combined-review.
216
+ 5. Final report says:
217
+ - verified: targeted tests, link check
218
+ - not verified: full e2e install on every OS
219
+ - user review: docs wording and release notes
220
+ ```
221
+
222
+ ## Example: High-Risk Multi-Task Work
223
+
224
+ ```
225
+ Task: Add auth-sensitive fullstack feature with API contract changes.
226
+
227
+ 1. Main agent locks contract and task list.
228
+ 2. Dispatch bounded backend and frontend implementers after contract approval.
229
+ 3. Run tests for each surface.
230
+ 4. Review budget = targeted-specialist-review or full-multi-stage-review:
231
+ - API/security reviewer checks authz and data exposure.
232
+ - UI reviewer checks accessibility if UI changed.
233
+ 5. Final integration review checks only cross-task seams not already reviewed.
234
+ ```
235
+
236
+ ## Red Flags
237
+
238
+ **Never:**
239
+ - Spawn subagents just because a skill exists.
240
+ - Run spec review, quality review, and final review over the same scope without a distinct purpose for each.
241
+ - Dispatch multiple implementation subagents in parallel for plan-execution work — even
242
+ on non-overlapping files, parallel implementers can't see each other's commits, and
243
+ conflicts compound silently instead of surfacing early. (This prohibition is specific
244
+ to implementer subagents in *this* skill, which mutate real code/git state in one
245
+ worktree. `dispatching-parallel-agents` still applies for independent, read-only
246
+ investigation — a different, ad-hoc use case.)
247
+ - Make a subagent read the whole plan when you can provide the exact task and relevant links.
248
+ - Ignore subagent questions or blockers.
249
+ - Proceed with unresolved Critical findings.
250
+ - Claim completion without verification evidence.
251
+
252
+ **If a reviewer finds issues:**
253
+ - Fix Critical and Important findings before proceeding.
254
+ - Re-review only the fix or the disputed finding, not the entire change, unless the fix expanded scope.
255
+ - Push back on incorrect findings with evidence.
256
+
257
+ ## Integration
258
+
259
+ Useful companion skills:
260
+ - **superpowers:writing-plans** - Creates the plan this skill may execute.
261
+ - **superpowers:requesting-code-review** - Provides a reviewer prompt when review budget calls for it.
262
+ - **superpowers:verification-before-completion** - Ensures final claims match evidence.
263
+ - **superpowers:using-git-worktrees** - Use when parallel agents may conflict or the user requests isolation.
264
+ - **superpowers:finishing-a-development-branch** - Use when finishing branch/MR work.
265
+
266
+ Subagents may use **superpowers:test-driven-development** when the selected workflow requires tests-first development or the task is a bugfix/behavior change.
267
+
268
+ Alternative workflow:
269
+ - **superpowers:executing-plans** - Use when direct inline execution with checkpoints is more efficient than subagent orchestration.
@@ -0,0 +1,34 @@
1
+ # Code Quality Reviewer Prompt Template
2
+
3
+ Use this template when dispatching a code quality reviewer subagent.
4
+
5
+ **Purpose:** Verify implementation is well-built (clean, tested, maintainable)
6
+
7
+ **Only dispatch after spec compliance review passes.**
8
+
9
+ ```
10
+ Task tool (general-purpose):
11
+ Use template at requesting-code-review/code-reviewer.md
12
+ model: [MODEL - explicit, do not omit. See SKILL.md Model Selection.]
13
+
14
+ DESCRIPTION: [task summary, from implementer's report]
15
+ PLAN_OR_REQUIREMENTS: Task N from [plan-file]
16
+ BASE_SHA: [commit before task]
17
+ HEAD_SHA: [current commit]
18
+ DIFF_FILE: [PATH from `bash scripts/review-package.sh BASE_SHA HEAD_SHA` - read
19
+ this instead of re-deriving the diff]
20
+ ```
21
+
22
+ **Do Not Trust the Report:** The implementer's self-report and any rationale they give
23
+ for a decision are unverified claims, not facts. Verify against `DIFF_FILE` and the
24
+ actual code — don't accept "I did it this way because..." at face value.
25
+
26
+ **In addition to standard code quality concerns, the reviewer should check:**
27
+ - Does each file have one clear responsibility with a well-defined interface?
28
+ - Are units decomposed so they can be understood and tested independently?
29
+ - Is the implementation following the file structure from the plan?
30
+ - Did this implementation create new files that are already large, or significantly grow existing files? (Don't flag pre-existing file sizes — focus on what this change contributed.)
31
+
32
+ **Code reviewer returns:** Strengths, Issues (Critical/Important/Minor), ⚠️ Cannot
33
+ verify from diff (requirement + why — the controller resolves these, not the
34
+ reviewer), Assessment
@@ -0,0 +1,121 @@
1
+ # Implementer Subagent Prompt Template
2
+
3
+ Use this template when dispatching an implementer subagent.
4
+
5
+ ```
6
+ Task tool (general-purpose):
7
+ description: "Implement Task N: [task name]"
8
+ model: [MODEL - explicit, e.g. claude-sonnet-4-5. Never omit - an omitted model
9
+ silently inherits the calling session's model tier. See SKILL.md Model Selection.]
10
+ prompt: |
11
+ You are implementing Task N: [task name]
12
+
13
+ ## Task Description
14
+
15
+ Read your exact task text from: [PATH to task-N-brief.md, produced by
16
+ `bash scripts/task-brief.sh <plan-file> N`]
17
+
18
+ Read only that file — not the rest of the plan. It's the verbatim task text
19
+ (no paraphrase drift from the controller re-typing it) scoped to just your task.
20
+
21
+ ## Context
22
+
23
+ [Scene-setting: where this fits, dependencies, architectural context]
24
+
25
+ ## Before You Begin
26
+
27
+ If you have questions about:
28
+ - The requirements or acceptance criteria
29
+ - The approach or implementation strategy
30
+ - Dependencies or assumptions
31
+ - Anything unclear in the task description
32
+
33
+ **Ask them now.** Raise any concerns before starting work.
34
+
35
+ ## Your Job
36
+
37
+ Once you're clear on requirements:
38
+ 1. Implement exactly what the task specifies
39
+ 2. Write tests (following TDD if task says to)
40
+ 3. Verify implementation works
41
+ 4. Commit your work
42
+ 5. Self-review (see below)
43
+ 6. Report back
44
+
45
+ Work from: [directory]
46
+
47
+ **While you work:** If you encounter something unexpected or unclear, **ask questions**.
48
+ It's always OK to pause and clarify. Don't guess or make assumptions.
49
+
50
+ ## Code Organization
51
+
52
+ You reason best about code you can hold in context at once, and your edits are more
53
+ reliable when files are focused. Keep this in mind:
54
+ - Follow the file structure defined in the plan
55
+ - Each file should have one clear responsibility with a well-defined interface
56
+ - If a file you're creating is growing beyond the plan's intent, stop and report
57
+ it as DONE_WITH_CONCERNS — don't split files on your own without plan guidance
58
+ - If an existing file you're modifying is already large or tangled, work carefully
59
+ and note it as a concern in your report
60
+ - In existing codebases, follow established patterns. Improve code you're touching
61
+ the way a good developer would, but don't restructure things outside your task.
62
+
63
+ ## When You're in Over Your Head
64
+
65
+ It is always OK to stop and say "this is too hard for me." Bad work is worse than
66
+ no work. You will not be penalized for escalating.
67
+
68
+ **STOP and escalate when:**
69
+ - The task requires architectural decisions with multiple valid approaches
70
+ - You need to understand code beyond what was provided and can't find clarity
71
+ - You feel uncertain about whether your approach is correct
72
+ - The task involves restructuring existing code in ways the plan didn't anticipate
73
+ - You've been reading file after file trying to understand the system without progress
74
+
75
+ **How to escalate:** Report back with status BLOCKED or NEEDS_CONTEXT. Describe
76
+ specifically what you're stuck on, what you've tried, and what kind of help you need.
77
+ The controller can provide more context, re-dispatch with a more capable model,
78
+ or break the task into smaller pieces.
79
+
80
+ ## Before Reporting Back: Self-Review
81
+
82
+ Review your work with fresh eyes. Ask yourself:
83
+
84
+ **Completeness:**
85
+ - Did I fully implement everything in the spec?
86
+ - Did I miss any requirements?
87
+ - Are there edge cases I didn't handle?
88
+
89
+ **Quality:**
90
+ - Is this my best work?
91
+ - Are names clear and accurate (match what things do, not how they work)?
92
+ - Is the code clean and maintainable?
93
+
94
+ **Discipline:**
95
+ - Did I avoid overbuilding (YAGNI)?
96
+ - Did I only build what was requested?
97
+ - Did I follow existing patterns in the codebase?
98
+
99
+ **Testing:**
100
+ - Do tests actually verify behavior (not just mock behavior)?
101
+ - Did I follow TDD if required?
102
+ - Are tests comprehensive?
103
+
104
+ If you find issues during self-review, fix them now before reporting.
105
+
106
+ ## Report Format
107
+
108
+ When done, report:
109
+ - **Status:** DONE | DONE_WITH_CONCERNS | BLOCKED | NEEDS_CONTEXT
110
+ - What you implemented (or what you attempted, if blocked)
111
+ - What you tested and test results
112
+ - Files changed
113
+ - Base commit before you started and HEAD commit after your final commit (the
114
+ controller needs both for the review package and the progress ledger)
115
+ - Self-review findings (if any)
116
+ - Any issues or concerns
117
+
118
+ Use DONE_WITH_CONCERNS if you completed the work but have doubts about correctness.
119
+ Use BLOCKED if you cannot complete the task. Use NEEDS_CONTEXT if you need
120
+ information that wasn't provided. Never silently produce work you're unsure about.
121
+ ```
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env bash
2
+ # Build a single reviewable diff package for BASE..HEAD.
3
+ # Usage: review-package.sh BASE HEAD [OUTFILE]
4
+ #
5
+ # Writes commit log, diffstat, and a full unified diff (10 lines context) to
6
+ # OUTFILE (default: <sdd-workspace>/review-<base7>..<head7>.diff) and prints
7
+ # OUTFILE's path on stdout. Purpose: a reviewer subagent reads the whole
8
+ # change with one Read instead of re-running git itself or the controller
9
+ # re-deriving the diff in-context.
10
+
11
+ set -euo pipefail
12
+
13
+ BASE="${1:?usage: review-package.sh BASE HEAD [OUTFILE]}"
14
+ HEAD="${2:?usage: review-package.sh BASE HEAD [OUTFILE]}"
15
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
16
+
17
+ BASE7="$(git rev-parse --short=7 "$BASE")"
18
+ HEAD7="$(git rev-parse --short=7 "$HEAD")"
19
+
20
+ if [[ -z "${3:-}" ]]; then
21
+ SDD_DIR="$(bash "$SCRIPT_DIR/sdd-workspace.sh")"
22
+ OUTFILE="${SDD_DIR}/review-${BASE7}..${HEAD7}.diff"
23
+ else
24
+ OUTFILE="$3"
25
+ fi
26
+
27
+ {
28
+ echo "## Commits ${BASE7}..${HEAD7}"
29
+ git log --oneline "${BASE}..${HEAD}"
30
+ echo
31
+ echo "## Diffstat"
32
+ git diff --stat "${BASE}..${HEAD}"
33
+ echo
34
+ echo "## Full diff (10 lines context)"
35
+ git diff -U10 "${BASE}..${HEAD}"
36
+ } > "$OUTFILE"
37
+
38
+ echo "$OUTFILE"
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env bash
2
+ # Resolve (and create) this repo's subagent-driven-development scratch workspace.
3
+ # Usage: sdd-workspace.sh
4
+ #
5
+ # Prints the absolute path to <repo-root>/.hero-mmt-kit/sdd/ on stdout.
6
+ # Creates the directory and a self-ignoring .gitignore inside it if missing,
7
+ # so task briefs, review packages, and the progress ledger never need the
8
+ # user's own .gitignore touched. Only this subtree is ignored — the rest of
9
+ # .hero-mmt-kit/ (config.json, session.json) stays tracked as before.
10
+
11
+ set -euo pipefail
12
+
13
+ REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null)" || {
14
+ echo "error: not inside a git repository" >&2
15
+ exit 1
16
+ }
17
+
18
+ SDD_DIR="${REPO_ROOT}/.hero-mmt-kit/sdd"
19
+ mkdir -p "$SDD_DIR"
20
+
21
+ if [[ ! -f "${SDD_DIR}/.gitignore" ]]; then
22
+ printf '*\n' > "${SDD_DIR}/.gitignore"
23
+ fi
24
+
25
+ echo "$SDD_DIR"
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env bash
2
+ # Extract one task's full markdown section from a plan file.
3
+ # Usage: task-brief.sh PLAN_FILE N [OUTFILE]
4
+ #
5
+ # Finds the heading matching "Task N" at whatever heading level it uses
6
+ # (writing-plans emits "### Task N: [Component Name]") and copies everything
7
+ # up to (not including) the next heading at the same or shallower level,
8
+ # respecting fenced code blocks (``` or ~~~) so a heading-looking line
9
+ # inside a fenced step (e.g. a comment in example code) doesn't end the
10
+ # section early.
11
+ #
12
+ # Writes the section to OUTFILE (default: <sdd-workspace>/task-N-brief.md)
13
+ # and prints OUTFILE's path on stdout. Purpose: the implementer reads its
14
+ # task from a file instead of the controller re-typing/paraphrasing the
15
+ # full task text into the dispatch prompt.
16
+
17
+ set -euo pipefail
18
+
19
+ PLAN_FILE="${1:?usage: task-brief.sh PLAN_FILE N [OUTFILE]}"
20
+ TASK_N="${2:?usage: task-brief.sh PLAN_FILE N [OUTFILE]}"
21
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
22
+
23
+ [[ -f "$PLAN_FILE" ]] || { echo "error: plan file not found: $PLAN_FILE" >&2; exit 1; }
24
+
25
+ if [[ -z "${3:-}" ]]; then
26
+ SDD_DIR="$(bash "$SCRIPT_DIR/sdd-workspace.sh")"
27
+ OUTFILE="${SDD_DIR}/task-${TASK_N}-brief.md"
28
+ else
29
+ OUTFILE="$3"
30
+ fi
31
+
32
+ awk -v task="$TASK_N" '
33
+ BEGIN { in_section = 0; in_fence = 0; fence = ""; level = 0; found = 0 }
34
+ {
35
+ line = $0
36
+ if (match(line, /^(```|~~~)/)) {
37
+ marker = substr(line, RSTART, 3)
38
+ if (!in_fence) { in_fence = 1; fence = marker }
39
+ else if (marker == fence) { in_fence = 0; fence = "" }
40
+ }
41
+
42
+ if (!in_fence && match(line, /^#+[ \t]/)) {
43
+ hashes = line; sub(/[ \t].*/, "", hashes); this_level = length(hashes)
44
+ is_target = (line ~ ("^#+[ \t]+Task[ \t]+" task "([^0-9.].*)?$"))
45
+
46
+ # Any heading at the same or shallower level ends the current section
47
+ # (not just another Task heading) - e.g. a "## Wave 2" group header
48
+ # between tasks must also close the task section before it.
49
+ if (in_section && this_level <= level) { in_section = 0 }
50
+ if (is_target && !in_section) { in_section = 1; level = this_level; found = 1 }
51
+ }
52
+
53
+ if (in_section) print line
54
+ }
55
+ END { if (!found) { print "TASK_NOT_FOUND" > "/dev/stderr"; exit 3 } }
56
+ ' "$PLAN_FILE" > "$OUTFILE"
57
+
58
+ echo "$OUTFILE"
@@ -0,0 +1,76 @@
1
+ # Spec Compliance Reviewer Prompt Template
2
+
3
+ Use this template when dispatching a spec compliance reviewer subagent.
4
+
5
+ **Purpose:** Verify implementer built what was requested (nothing more, nothing less)
6
+
7
+ ```
8
+ Task tool (general-purpose):
9
+ description: "Review spec compliance for Task N"
10
+ model: [MODEL - explicit, do not omit. See SKILL.md Model Selection.]
11
+ prompt: |
12
+ You are reviewing whether an implementation matches its specification.
13
+
14
+ ## What Was Requested
15
+
16
+ [FULL TEXT of task requirements]
17
+
18
+ ## What Implementer Claims They Built
19
+
20
+ [From implementer's report]
21
+
22
+ ## Diff to Review
23
+
24
+ Full diff: [PATH from `bash scripts/review-package.sh BASE_SHA HEAD_SHA`]
25
+
26
+ Read it in full before forming an opinion.
27
+
28
+ ## CRITICAL: Do Not Trust the Report
29
+
30
+ The implementer finished suspiciously quickly. Their report may be incomplete,
31
+ inaccurate, or optimistic. You MUST verify everything independently.
32
+
33
+ **DO NOT:**
34
+ - Take their word for what they implemented
35
+ - Trust their claims about completeness
36
+ - Accept their interpretation of requirements
37
+
38
+ Treat any rationale the implementer gives for a deviation ("I skipped X because
39
+ Y", "this approach is fine because Z") as an unverified claim too — verify the
40
+ reasoning against the actual spec/code, don't accept it at face value just because
41
+ it sounds plausible.
42
+
43
+ **DO:**
44
+ - Read the actual code they wrote
45
+ - Compare actual implementation to requirements line by line
46
+ - Check for missing pieces they claimed to implement
47
+ - Look for extra features they didn't mention
48
+
49
+ ## Your Job
50
+
51
+ Read the implementation code and verify:
52
+
53
+ **Missing requirements:**
54
+ - Did they implement everything that was requested?
55
+ - Are there requirements they skipped or missed?
56
+ - Did they claim something works but didn't actually implement it?
57
+
58
+ **Extra/unneeded work:**
59
+ - Did they build things that weren't requested?
60
+ - Did they over-engineer or add unnecessary features?
61
+ - Did they add "nice to haves" that weren't in spec?
62
+
63
+ **Misunderstandings:**
64
+ - Did they interpret requirements differently than intended?
65
+ - Did they solve the wrong problem?
66
+ - Did they implement the right feature but wrong way?
67
+
68
+ **Verify by reading code, not by trusting report.**
69
+
70
+ Report:
71
+ - ✅ Spec compliant (if everything matches after code inspection)
72
+ - ⚠️ Cannot verify from diff: [requirement, and why — e.g. it lives in unchanged
73
+ code, or spans a task not yet done. Does not block the rest of the review; the
74
+ controller resolves these before marking the task complete.]
75
+ - ❌ Issues found: [list specifically what's missing or extra, with file:line references]
76
+ ```