maxsimcli 5.0.6 → 5.1.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 (91) hide show
  1. package/README.md +316 -288
  2. package/dist/assets/CHANGELOG.md +14 -0
  3. package/dist/assets/hooks/maxsim-capture-learnings.cjs +128 -0
  4. package/dist/assets/hooks/maxsim-capture-learnings.cjs.map +1 -0
  5. package/dist/assets/hooks/maxsim-check-update.cjs +126 -88
  6. package/dist/assets/hooks/maxsim-check-update.cjs.map +1 -1
  7. package/dist/assets/hooks/maxsim-notification-sound.cjs +87 -43
  8. package/dist/assets/hooks/maxsim-notification-sound.cjs.map +1 -1
  9. package/dist/assets/hooks/maxsim-statusline.cjs +45 -171
  10. package/dist/assets/hooks/maxsim-statusline.cjs.map +1 -1
  11. package/dist/assets/hooks/maxsim-stop-sound.cjs +86 -43
  12. package/dist/assets/hooks/maxsim-stop-sound.cjs.map +1 -1
  13. package/dist/assets/hooks/maxsim-sync-reminder.cjs +72 -21
  14. package/dist/assets/hooks/maxsim-sync-reminder.cjs.map +1 -1
  15. package/dist/assets/templates/agents/AGENTS.md +62 -51
  16. package/dist/assets/templates/agents/executor.md +44 -59
  17. package/dist/assets/templates/agents/planner.md +36 -31
  18. package/dist/assets/templates/agents/researcher.md +35 -43
  19. package/dist/assets/templates/agents/verifier.md +29 -31
  20. package/dist/assets/templates/commands/maxsim/debug.md +20 -154
  21. package/dist/assets/templates/commands/maxsim/execute.md +19 -33
  22. package/dist/assets/templates/commands/maxsim/go.md +21 -20
  23. package/dist/assets/templates/commands/maxsim/help.md +5 -14
  24. package/dist/assets/templates/commands/maxsim/init.md +18 -40
  25. package/dist/assets/templates/commands/maxsim/plan.md +22 -37
  26. package/dist/assets/templates/commands/maxsim/progress.md +15 -16
  27. package/dist/assets/templates/commands/maxsim/quick.md +18 -29
  28. package/dist/assets/templates/commands/maxsim/settings.md +18 -26
  29. package/dist/assets/templates/references/continuation-format.md +2 -4
  30. package/dist/assets/templates/references/model-profiles.md +2 -2
  31. package/dist/assets/templates/references/planning-config.md +10 -11
  32. package/dist/assets/templates/references/self-improvement.md +120 -0
  33. package/dist/assets/templates/rules/conventions.md +1 -1
  34. package/dist/assets/templates/rules/verification-protocol.md +1 -1
  35. package/dist/assets/templates/skills/brainstorming/SKILL.md +35 -26
  36. package/dist/assets/templates/skills/code-review/SKILL.md +78 -55
  37. package/dist/assets/templates/skills/commit-conventions/SKILL.md +70 -36
  38. package/dist/assets/templates/skills/github-operations/SKILL.md +142 -0
  39. package/dist/assets/templates/skills/handoff-contract/SKILL.md +62 -28
  40. package/dist/assets/templates/skills/maxsim-batch/SKILL.md +68 -42
  41. package/dist/assets/templates/skills/maxsim-simplify/SKILL.md +65 -40
  42. package/dist/assets/templates/skills/project-memory/SKILL.md +121 -0
  43. package/dist/assets/templates/skills/research/SKILL.md +126 -0
  44. package/dist/assets/templates/skills/roadmap-writing/SKILL.md +71 -68
  45. package/dist/assets/templates/skills/systematic-debugging/SKILL.md +37 -25
  46. package/dist/assets/templates/skills/tdd/SKILL.md +36 -39
  47. package/dist/assets/templates/skills/using-maxsim/SKILL.md +69 -55
  48. package/dist/assets/templates/skills/verification/SKILL.md +167 -0
  49. package/dist/assets/templates/workflows/batch.md +249 -268
  50. package/dist/assets/templates/workflows/diagnose-issues.md +225 -151
  51. package/dist/assets/templates/workflows/execute-plan.md +191 -981
  52. package/dist/assets/templates/workflows/execute.md +350 -309
  53. package/dist/assets/templates/workflows/go.md +119 -138
  54. package/dist/assets/templates/workflows/health.md +71 -114
  55. package/dist/assets/templates/workflows/help.md +85 -147
  56. package/dist/assets/templates/workflows/init-existing.md +180 -1373
  57. package/dist/assets/templates/workflows/init.md +53 -165
  58. package/dist/assets/templates/workflows/new-milestone.md +91 -334
  59. package/dist/assets/templates/workflows/new-project.md +165 -1384
  60. package/dist/assets/templates/workflows/plan-create.md +182 -73
  61. package/dist/assets/templates/workflows/plan-discuss.md +89 -82
  62. package/dist/assets/templates/workflows/plan-research.md +191 -85
  63. package/dist/assets/templates/workflows/plan.md +122 -58
  64. package/dist/assets/templates/workflows/progress.md +76 -310
  65. package/dist/assets/templates/workflows/quick.md +70 -495
  66. package/dist/assets/templates/workflows/sdd.md +231 -221
  67. package/dist/assets/templates/workflows/settings.md +90 -120
  68. package/dist/assets/templates/workflows/verify-phase.md +296 -258
  69. package/dist/cli.cjs +17 -23465
  70. package/dist/cli.cjs.map +1 -1
  71. package/dist/install.cjs +356 -8358
  72. package/dist/install.cjs.map +1 -1
  73. package/package.json +16 -22
  74. package/dist/assets/templates/skills/agent-system-map/SKILL.md +0 -92
  75. package/dist/assets/templates/skills/evidence-collection/SKILL.md +0 -87
  76. package/dist/assets/templates/skills/github-artifact-protocol/SKILL.md +0 -67
  77. package/dist/assets/templates/skills/github-tools-guide/SKILL.md +0 -89
  78. package/dist/assets/templates/skills/input-validation/SKILL.md +0 -51
  79. package/dist/assets/templates/skills/memory-management/SKILL.md +0 -75
  80. package/dist/assets/templates/skills/research-methodology/SKILL.md +0 -137
  81. package/dist/assets/templates/skills/sdd/SKILL.md +0 -91
  82. package/dist/assets/templates/skills/tool-priority-guide/SKILL.md +0 -80
  83. package/dist/assets/templates/skills/verification-before-completion/SKILL.md +0 -71
  84. package/dist/assets/templates/skills/verification-gates/SKILL.md +0 -169
  85. package/dist/assets/templates/workflows/discuss-phase.md +0 -683
  86. package/dist/assets/templates/workflows/research-phase.md +0 -73
  87. package/dist/assets/templates/workflows/verify-work.md +0 -572
  88. package/dist/core-D5zUr9cb.cjs +0 -4305
  89. package/dist/core-D5zUr9cb.cjs.map +0 -1
  90. package/dist/skills-CjFWZIGM.cjs +0 -6824
  91. package/dist/skills-CjFWZIGM.cjs.map +0 -1
@@ -5,278 +5,296 @@ Before executing any step in this workflow, verify:
5
5
  </sanity_check>
6
6
 
7
7
  <purpose>
8
- Execute phase plans sequentially using fresh-context subagents with mandatory 2-stage review between every task. Each task agent receives only the minimum context it needs. Review is a hard gate — no task starts until the previous task passes both review stages.
8
+ Spec-Driven Dispatch: fresh-agent-per-task execution for maximum context isolation. Each task gets a new executor agent with only the minimum context it needs. After each task, two reviewer agents check spec compliance and code quality. Review is a hard gate — the next task never starts until the current task passes both reviews. Max 3 fix attempts per task before escalation.
9
+
10
+ GitHub Issues is the SOLE source of truth for plan content, task status, and completion.
9
11
  </purpose>
10
12
 
11
13
  <core_principle>
12
- Fresh context per task. No context bleeding between tasks. Review is mandatory, never skippable. Previous task's full diff and conversation are NEVER passed to the next task agent.
14
+ Fresh context per task. No context bleeding between tasks. Review is mandatory and never skippable. Previous task diffs and agent conversations are NEVER passed to subsequent agents.
13
15
  </core_principle>
14
16
 
15
- <required_reading>
16
- Read STATE.md before any operation to load project context.
17
- </required_reading>
18
-
19
17
  <process>
20
18
 
21
- <step name="initialize" priority="first">
22
- Reuse the execute-phase init to load phase directory, plans, and model configuration:
19
+ ## Step 1 — Initialize
23
20
 
24
21
  ```bash
22
+ EXECUTOR_MODEL=$(node ~/.claude/maxsim/bin/maxsim-tools.cjs resolve-model executor --raw)
25
23
  INIT=$(node ~/.claude/maxsim/bin/maxsim-tools.cjs init execute-phase "${PHASE_ARG}")
26
24
  ```
27
25
 
28
- Parse JSON for: `executor_model`, `verifier_model`, `commit_docs`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `plans`, `incomplete_plans`, `plan_count`, `incomplete_count`, `state_exists`, `roadmap_exists`, `phase_req_ids`.
26
+ Parse JSON: `executor_model`, `verifier_model`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_issue_number`, `plan_count`, `incomplete_count`.
29
27
 
30
- **If `phase_found` is false:** Error — phase directory not found.
31
- **If `plan_count` is 0:** Error — no plans found in phase.
32
- </step>
28
+ If `phase_found` is false: error — phase not found.
29
+ If `plan_count` is 0: error — no plans found. Run `/maxsim:plan {phase}` first.
33
30
 
34
- <step name="discover_plans">
35
- Find incomplete plans by querying GitHub Issues (the source of truth for plans and completion status):
31
+ ## Step 2 — Load Plans from GitHub Issues
32
+
33
+ GitHub Issues is the sole source of truth. Fetch phase issue and its plan comments:
36
34
 
37
35
  ```bash
38
- node ~/.claude/maxsim/bin/maxsim-tools.cjs github get-issue --issue-number ${phase_issue_number} --include-comments
39
- node ~/.claude/maxsim/bin/maxsim-tools.cjs github list-sub-issues --phase-issue-number ${phase_issue_number}
36
+ node ~/.claude/maxsim/bin/maxsim-tools.cjs github get-issue \
37
+ --issue-number $PHASE_ISSUE_NUMBER --include-comments
38
+
39
+ node ~/.claude/maxsim/bin/maxsim-tools.cjs github list-sub-issues \
40
+ --phase-issue-number $PHASE_ISSUE_NUMBER
40
41
  ```
41
42
 
42
- Parse plan comments (`<!-- maxsim:type=plan -->`) from the phase issue. A plan is complete when all its task sub-issues are closed.
43
+ Parse plan comments (`<!-- maxsim:type=plan -->`). A plan is complete when all its task sub-issues are closed.
43
44
 
44
- **Filtering:** Skip plans where all task sub-issues are closed. If all plans complete: "All plans in phase are already complete" — exit.
45
+ Skip plans where all task sub-issues are closed (resume support).
46
+
47
+ If all plans are complete: exit with "All plans in phase are already complete."
45
48
 
46
49
  Report:
47
50
  ```
48
51
  ## SDD Execution Plan
49
52
 
50
- **Phase {X}: {Name}** — {incomplete_count} plans to execute
53
+ Phase {phase_number}: {phase_name} — {incomplete_count} plans to execute
51
54
 
52
55
  | Plan | Tasks | Objective |
53
56
  |------|-------|-----------|
54
- | 01-01 | 5 | {from plan objective, 5-10 words} |
55
- | 01-02 | 3 | ... |
57
+ | {plan_id} | {task_count} | {objective, 5-10 words} |
56
58
 
57
- **Mode:** Spec-Driven Dispatch — fresh agent per task, 2-stage review between tasks
59
+ Mode: Spec-Driven Dispatch — fresh agent per task, 2-stage review gate between tasks
58
60
  ```
59
- </step>
60
61
 
61
- <step name="load_plan">
62
- For each incomplete plan, read the plan content from the GitHub Issue comment (loaded in discover_plans) and extract the ordered task list.
62
+ ## Step 3 — Dispatch Loop
63
63
 
64
- Extract for each task:
65
- - **Task number** (sequential order in plan)
66
- - **Task name**
67
- - **Description** (what to implement)
68
- - **Acceptance criteria** (done criteria from plan)
69
- - **Relevant files** (files to read and/or modify)
70
- - **Done criteria** (verification steps)
64
+ For each incomplete plan, execute all tasks in sequence.
71
65
 
72
- Store as structured task list for the dispatch loop.
73
- </step>
66
+ ### Step 3a Parse plan tasks
74
67
 
75
- <step name="dispatch_loop">
76
- For each task in order within the current plan:
68
+ From the plan comment body, extract an ordered task list. For each task:
69
+ - Task number
70
+ - Task name
71
+ - Description
72
+ - Files to read and/or modify
73
+ - Acceptance criteria
74
+ - Done criteria
77
75
 
78
- **4a — Assemble Context**
76
+ ### Step 3b For each task: Assemble minimal context
79
77
 
80
- Build minimal context for the task agent. Include ONLY:
81
- - Task description and acceptance criteria
82
- - Relevant files list (files to read and modify)
83
- - Previous task commit hashes and files modified (NOT full diffs, NOT previous agent conversations)
84
- - Project CLAUDE.md (if exists) for coding conventions
85
- - .skills/ SKILL.md files (if exist) for relevant project rules
78
+ Build the minimum context for this task executor. Include ONLY:
86
79
 
87
- Context table (SDD principle):
88
80
  | Item | Include? |
89
81
  |------|----------|
90
82
  | Task description + acceptance criteria | ALWAYS |
91
- | Relevant files list | ALWAYS |
83
+ | Files to read and modify | ALWAYS |
92
84
  | Project CLAUDE.md | ALWAYS (if exists) |
93
- | Previous task commit hash + files modified | YES (minimal summary only) |
85
+ | Previous task commit hash + files modified | YES minimal summary only |
94
86
  | Previous task full diff | NEVER |
95
87
  | Previous agent conversation | NEVER |
96
- | Full plan file | NO (only current task extracted) |
97
-
98
- **4b — Spawn Executor**
88
+ | Full plan content | NO only current task extracted |
99
89
 
100
- Fresh executor agent with minimal context:
90
+ ### Step 3c — Spawn executor (fresh agent per task)
101
91
 
102
92
  ```
103
- Task(
93
+ Agent(
104
94
  subagent_type="executor",
105
95
  model="{executor_model}",
96
+ isolation="worktree",
106
97
  prompt="
98
+ You are executing a single task in a Spec-Driven Dispatch workflow.
99
+ You receive only the context for THIS task. Do not ask about other tasks.
100
+
107
101
  <objective>
108
- Execute task {task_number} of plan {plan_id} in phase {phase_number}-{phase_name}.
109
- Commit atomically when done.
102
+ Execute task {task_number} of plan {plan_id} in phase {phase_number}: {phase_name}.
103
+ Commit atomically when complete.
104
+ Move the task sub-issue on the board: In Progress when starting, Done when complete.
110
105
  </objective>
111
106
 
112
107
  <task>
113
108
  Name: {task_name}
114
109
  Description: {task_description}
115
- Acceptance criteria: {acceptance_criteria}
116
- Done criteria: {done_criteria}
110
+ Acceptance criteria:
111
+ {acceptance_criteria}
112
+ Done criteria:
113
+ {done_criteria}
117
114
  </task>
118
115
 
119
116
  <files_to_read>
120
- Read these files at execution start using the Read tool:
121
- - {relevant_files list}
122
- - ./CLAUDE.md (Project instructions, if exists — follow coding conventions)
123
- - .skills/ (Project skills, if exists — read SKILL.md for each, follow relevant rules)
117
+ Read these files at execution start:
118
+ {relevant_files_list}
119
+ - ./CLAUDE.md (if exists — follow coding conventions)
120
+ - .skills/ (if exists — read SKILL.md for each relevant skill)
124
121
  </files_to_read>
125
122
 
126
123
  <previous_task_context>
127
124
  {If first task: 'This is the first task in the plan.'}
128
- {If not first: 'Previous task committed as {commit_hash}. Files modified: {file_list}. Do NOT re-read or re-implement previous work.'}
125
+ {If not first: 'Previous task: {task_name}, commit: {commit_hash}, files modified: {file_list}. Do NOT re-read or re-implement previous work.'}
129
126
  </previous_task_context>
130
127
 
128
+ <board_transition>
129
+ Task sub-issue number: {task_issue_number}
130
+ Mark In Progress when starting:
131
+ node ~/.claude/maxsim/bin/maxsim-tools.cjs github move-issue --issue-number {task_issue_number} --status 'In Progress'
132
+ Mark Done when complete (before committing):
133
+ node ~/.claude/maxsim/bin/maxsim-tools.cjs github move-issue --issue-number {task_issue_number} --status 'Done'
134
+ node ~/.claude/maxsim/bin/maxsim-tools.cjs github close-issue --issue-number {task_issue_number}
135
+ </board_transition>
136
+
131
137
  <commit_protocol>
132
138
  After implementation:
133
139
  1. Run tests relevant to changed files
134
- 2. Stage files individually (NEVER git add . or git add -A)
135
- 3. Commit: {type}({phase}-{plan}): {description}
136
- 4. Report: commit hash, files modified, tests run
140
+ 2. Stage specific files only (NEVER git add . or git add -A)
141
+ 3. Commit: {type}({phase_number}-{plan_id}): {task_description_as_message}
142
+ 4. Report exactly: COMMIT: {hash} | FILES: {comma-separated list}
137
143
  </commit_protocol>
138
144
 
139
145
  <success_criteria>
140
146
  - [ ] All acceptance criteria met
141
147
  - [ ] Done criteria verified
142
148
  - [ ] Tests pass
149
+ - [ ] Task sub-issue marked In Progress then Done and closed
143
150
  - [ ] Atomic commit created
151
+ - [ ] Final output includes: COMMIT: {hash} | FILES: {list}
144
152
  </success_criteria>
145
153
  "
146
154
  )
147
155
  ```
148
156
 
149
- Record the commit hash from the executor's output.
157
+ Record the commit hash from executor output.
150
158
 
151
- **4c — Review Stage 1: Spec Compliance**
159
+ ### Step 3d — Review Stage 1: Spec Compliance
152
160
 
153
- Spawn verifier to check implementation matches task spec:
161
+ Spawn reviewer immediately after executor completes (foreground, no worktree):
154
162
 
155
163
  ```
156
- Task(
164
+ Agent(
157
165
  subagent_type="verifier",
158
166
  model="{executor_model}",
159
167
  prompt="
160
- ## Task: Review for spec compliance
161
-
162
- ## Suggested Skills: verification-gates, evidence-collection
163
-
164
- <objective>
165
- Review task {task_number} of plan {plan_id} for spec compliance.
166
- </objective>
168
+ Review task {task_number} of plan {plan_id} for SPEC COMPLIANCE.
167
169
 
168
170
  <task_spec>
169
171
  Name: {task_name}
170
172
  Description: {task_description}
171
173
  Acceptance criteria: {acceptance_criteria}
172
174
  Done criteria: {done_criteria}
173
- Relevant files: {relevant_files}
175
+ Files to modify: {relevant_files}
174
176
  </task_spec>
175
177
 
176
178
  <commit>
177
179
  Commit hash: {task_commit_hash}
178
180
  </commit>
179
181
 
180
- <instructions>
182
+ Instructions:
181
183
  1. Read each file in the relevant files list
182
- 2. Verify every acceptance criterion is met in the implementation
183
- 3. Verify done criteria pass
184
- 4. Check that ONLY specified files were modified (run: git diff --name-only {task_commit_hash}^..{task_commit_hash})
185
- 5. Report verdict: PASS or FAIL
186
- 6. If FAIL: list each unmet criterion with specific details
187
- </instructions>
184
+ 2. Run: git diff --name-only {task_commit_hash}^..{task_commit_hash}
185
+ 3. Verify every acceptance criterion is met in the implementation
186
+ 4. Verify done criteria pass
187
+ 5. Verify ONLY the specified files were modified (no extra files)
188
+ 6. If FAIL: list each unmet criterion with specific file:line evidence
189
+
190
+ Evidence format (use for each criterion):
191
+ CLAIM: {criterion text}
192
+ EVIDENCE: {file:line or command run}
193
+ OUTPUT: {what was found}
194
+ VERDICT: PASS | FAIL — {reason if fail}
195
+
196
+ Final line must be exactly:
197
+ SPEC REVIEW: PASS or SPEC REVIEW: FAIL — {unmet criteria list}
188
198
  "
189
199
  )
190
200
  ```
191
201
 
192
- **4d — Review Stage 2: Code Quality**
202
+ ### Step 3e — Review Stage 2: Code Quality
193
203
 
194
- Spawn verifier to check for bugs, edge cases, and conventions:
204
+ Spawn second reviewer in parallel with stage 1 or immediately after (foreground, no worktree):
195
205
 
196
206
  ```
197
- Task(
207
+ Agent(
198
208
  subagent_type="verifier",
199
209
  model="{executor_model}",
200
210
  prompt="
201
- ## Task: Review for code quality
202
-
203
- ## Suggested Skills: code-review
204
-
205
- <objective>
206
- Review task {task_number} of plan {plan_id} for code quality.
207
- Spec compliance already verified.
208
- </objective>
211
+ Review task {task_number} of plan {plan_id} for CODE QUALITY.
212
+ Spec compliance is being checked separately.
209
213
 
210
214
  <commit>
211
215
  Commit hash: {task_commit_hash}
212
216
  Files modified: {files_from_commit}
213
217
  </commit>
214
218
 
215
- <instructions>
216
- 1. Read CLAUDE.md for project conventions
219
+ Instructions:
220
+ 1. Read ./CLAUDE.md for project conventions (if exists)
217
221
  2. Read each modified file
218
- 3. Check for: bugs, unhandled edge cases, missing error handling, convention violations, security issues
219
- 4. Categorize: BLOCKER (must fix) or ADVISORY (note for later)
220
- 5. Report verdict: PASS (no blockers) or FAIL (list blocking issues)
221
- </instructions>
222
+ 3. Check for BLOCKERS:
223
+ - Bugs or logical errors
224
+ - Unhandled error paths
225
+ - Missing error handling for I/O or network calls
226
+ - Security issues (unsanitized input, exposed secrets)
227
+ - Convention violations (from CLAUDE.md)
228
+ 4. Check for ADVISORIES:
229
+ - Minor style inconsistencies
230
+ - Missing edge case handling (non-critical)
231
+ - Optimization opportunities
232
+
233
+ Evidence format:
234
+ CLAIM: {what was checked}
235
+ EVIDENCE: {file:line}
236
+ OUTPUT: {what was found}
237
+ VERDICT: PASS | FAIL — BLOCKER: {reason}
238
+
239
+ Final line must be exactly:
240
+ CODE REVIEW: PASS or CODE REVIEW: FAIL — {blocker list}
222
241
  "
223
242
  )
224
243
  ```
225
244
 
226
- **4e — Handle Failure**
245
+ ### Step 3f — Handle Review Failure (Max 3 Fix Attempts)
227
246
 
228
- If EITHER review stage returns FAIL:
247
+ If EITHER review returns FAIL:
229
248
 
230
- 1. Spawn a NEW fresh executor agent with:
231
- - Original task spec (description + acceptance criteria)
232
- - Review feedback (specific failures from reviewer)
233
- - Current file state (files to read, NOT previous agent conversation)
234
- - Instruction: fix ONLY the review issues, do NOT add new features
249
+ Spawn a fresh fix executor with only what is needed:
235
250
 
236
251
  ```
237
- Task(
252
+ Agent(
238
253
  subagent_type="executor",
239
254
  model="{executor_model}",
255
+ isolation="worktree",
240
256
  prompt="
241
- <objective>
242
257
  Fix review failures for task {task_number} of plan {plan_id}.
243
- Fix ONLY the issues listed below. Do NOT add new features or refactor beyond what is required.
244
- </objective>
258
+ Fix ONLY the issues listed. Do NOT add features or refactor beyond what is required.
245
259
 
246
260
  <original_task>
247
261
  Name: {task_name}
248
- Description: {task_description}
249
262
  Acceptance criteria: {acceptance_criteria}
250
263
  </original_task>
251
264
 
252
265
  <review_failures>
253
- {spec_review_failures if any}
254
- {code_review_failures if any}
266
+ {spec_failures if any — each as: CRITERION: {text} | VERDICT: FAIL — {reason}}
267
+ {code_failures if any — each as: BLOCKER: {description} | EVIDENCE: {file:line}}
255
268
  </review_failures>
256
269
 
257
270
  <files_to_read>
258
- {files modified by previous attempt — read current state}
271
+ {files modified by failed attempt — read current state from disk}
259
272
  </files_to_read>
260
273
 
261
- <commit_protocol>
262
- Stage and commit fixes: fix({phase}-{plan}): address review feedback for task {task_number}
263
- </commit_protocol>
274
+ Instructions:
275
+ 1. Read each file in files_to_read to see current state
276
+ 2. Fix each listed issue precisely
277
+ 3. Run tests after fixing
278
+ 4. Commit: fix({phase_number}-{plan_id}): address review feedback for task {task_number}
279
+ 5. Report: COMMIT: {hash} | FILES: {list}
264
280
  "
265
281
  )
266
282
  ```
267
283
 
268
- 2. Re-run BOTH review stages (4c and 4d) on the fix commit
269
- 3. **Cap at 3 fix attempts.** If still failing after 3 attempts: STOP and escalate to user.
284
+ Re-run BOTH review stages (3d and 3e) on the fix commit.
285
+
286
+ **Cap at 3 fix attempts total.** If still failing after 3 attempts, hard-stop and escalate:
270
287
 
271
288
  ```
272
289
  ## TASK BLOCKED — Review Failed After 3 Fix Attempts
273
290
 
274
- **Task:** {task_number} - {task_name}
275
- **Plan:** {plan_id}
276
- **Phase:** {phase_number} - {phase_name}
291
+ Task: {task_number} {task_name}
292
+ Plan: {plan_id}
293
+ Phase: {phase_number}: {phase_name}
277
294
 
278
- ### Unresolved Review Failures
279
- {remaining failures from last review}
295
+ ### Unresolved Failures
296
+ {remaining spec failures}
297
+ {remaining code blockers}
280
298
 
281
299
  ### Fix Attempt History
282
300
  | Attempt | Spec Review | Code Review | Commit |
@@ -286,150 +304,142 @@ Task(
286
304
  | 3 | {PASS/FAIL} | {PASS/FAIL} | {hash} |
287
305
 
288
306
  Options:
289
- - "fix manually" — You fix the issues, then resume
290
- - "skip task" — Mark incomplete, continue to next task
291
- - "stop" — Halt SDD execution
307
+ - "fix manually" — fix issues yourself, then type "resume" to continue
308
+ - "skip task" — mark incomplete, continue to next task
309
+ - "stop" — halt SDD execution
292
310
  ```
293
311
 
294
- **4f — Advance**
295
-
296
- After both reviews PASS, record task completion:
297
- - Commit hash
298
- - Files modified
299
-
300
- Pass ONLY this minimal summary to the next task context. Do NOT pass:
301
- - Full diff output
302
- - Review conversation content
303
- - Previous agent's reasoning or approach
312
+ ### Step 3g — Advance to next task
304
313
 
305
- **4g Report Task**
314
+ After both reviews PASS:
315
+ - Record commit hash and files-modified list
316
+ - Pass ONLY this minimal summary to the next task's `previous_task_context`
317
+ - Do NOT pass diffs, review content, or agent reasoning
306
318
 
307
319
  Display task completion:
308
-
309
320
  ```
310
321
  ---
311
322
  ## Task {N}/{total}: {task_name} — COMPLETE
312
323
 
313
- **Commit:** {commit_hash}
314
- **Files:** {files_modified_count} modified
315
- **Spec Review:** PASS
316
- **Code Review:** PASS
317
- {If fix iterations > 0: **Fix Iterations:** {count}}
324
+ Commit: {commit_hash}
325
+ Files modified: {count}
326
+ Spec Review: PASS
327
+ Code Review: PASS
328
+ {If fix_iterations > 0: Fix iterations: {count}}
318
329
 
319
- {If more tasks: Dispatching next task...}
330
+ {If more tasks remain: Dispatching task {N+1}...}
320
331
  ---
321
332
  ```
322
- </step>
323
333
 
324
- <step name="create_summary">
325
- After all tasks in a plan complete, build the summary content in memory and post it as a GitHub comment on the phase issue. Include:
334
+ Repeat step 3b–3g for the next task.
335
+
336
+ ## Step 4 — Post Plan Summary to GitHub
326
337
 
327
- **Frontmatter:** phase, plan, subsystem, tags, requires/provides/affects, tech-stack, key-files.created/modified, key-decisions, requirements-completed (copy from PLAN.md frontmatter), duration, completed date.
338
+ After all tasks in a plan complete, post a summary comment on the phase issue:
328
339
 
329
- **Body:**
330
- - One-liner: substantive description of what was built
331
- - Per-task status table:
340
+ ```bash
341
+ SUMMARY_FILE=$(mktemp)
342
+ cat > "$SUMMARY_FILE" << 'SUMMARY_EOF'
343
+ ---
344
+ phase: {phase_number}
345
+ plan: {plan_id}
346
+ execution_mode: sdd
347
+ completed: {ISO timestamp}
348
+ ---
349
+
350
+ ## {Plan ID}: {Objective}
351
+
352
+ {One-liner: substantive description of what was built}
332
353
 
333
- ```markdown
334
354
  ## Task Execution (SDD)
335
355
 
336
356
  | Task | Name | Status | Commit | Fix Iterations |
337
357
  |------|------|--------|--------|----------------|
338
- | 1 | {name} | PASS | {hash} | 0 |
339
- | 2 | {name} | PASS | {hash} | 1 |
340
- | 3 | {name} | PASS | {hash} | 0 |
358
+ | 1 | {name} | PASS | {hash} | {count} |
359
+ | 2 | {name} | PASS | {hash} | 0 |
341
360
 
342
- **Execution mode:** Spec-Driven Dispatch (fresh agent per task, 2-stage review)
343
- ```
361
+ **Execution mode:** Spec-Driven Dispatch fresh agent per task, 2-stage review gate
344
362
 
345
- - Review summary per task
346
- - Deviations (if any)
347
- - Issues encountered
363
+ ## Deviations
364
+ {List any departures from plan spec with rationale. "None." if clean.}
348
365
 
349
- Post summary to GitHub:
350
- ```bash
351
- # Write summary content to tmpfile
352
- SUMMARY_FILE=$(mktemp)
353
- cat > "$SUMMARY_FILE" << 'SUMMARY_EOF'
354
- {summary_content}
366
+ ## Issues Encountered
367
+ {List problems and resolutions. "None." if clean.}
368
+
369
+ ## Self-Check
370
+ {Verify first 2 created files exist: [ -f {file} ]}
371
+ {Verify commits: git log --oneline --all --grep="{phase_number}-{plan_id}"}
372
+ ## Self-Check: PASSED | ## Self-Check: FAILED — {reason}
373
+
374
+ <!-- maxsim:type=summary -->
355
375
  SUMMARY_EOF
356
376
 
357
- node ~/.claude/maxsim/bin/maxsim-tools.cjs github post-comment --issue-number ${phase_issue_number} --body-file "$SUMMARY_FILE" --type summary
377
+ node ~/.claude/maxsim/bin/maxsim-tools.cjs github post-comment \
378
+ --issue-number {phase_issue_number} \
379
+ --body-file "$SUMMARY_FILE" \
380
+ --type summary
358
381
  ```
359
382
 
360
- Self-check:
361
- - Verify first 2 files from `key-files.created` exist on disk
362
- - Check `git log --oneline --all --grep="{phase}-{plan}"` returns commits
363
- - Append `## Self-Check: PASSED` or `## Self-Check: FAILED` to summary content before posting
364
- </step>
365
-
366
- <step name="update_state">
367
- Standard state updates after plan completion:
383
+ ## Step 5 — Update State Files
368
384
 
369
385
  ```bash
370
- # Advance plan counter
371
386
  node ~/.claude/maxsim/bin/maxsim-tools.cjs state advance-plan
372
-
373
- # Recalculate progress
374
387
  node ~/.claude/maxsim/bin/maxsim-tools.cjs state update-progress
375
-
376
- # Record execution metrics
377
- node ~/.claude/maxsim/bin/maxsim-tools.cjs state record-metric \
378
- --phase "${PHASE}" --plan "${PLAN}" --duration "${DURATION}" \
379
- --tasks "${TASK_COUNT}" --files "${FILE_COUNT}"
380
-
381
- # Record session
382
388
  node ~/.claude/maxsim/bin/maxsim-tools.cjs state record-session \
383
- --stopped-at "Completed ${PHASE}-${PLAN}-PLAN.md (SDD)" \
389
+ --stopped-at "Completed {phase_number}-{plan_id} (SDD)" \
384
390
  --resume-file "None"
391
+ node ~/.claude/maxsim/bin/maxsim-tools.cjs roadmap update-plan-progress "{phase_number}"
385
392
 
386
- # Update roadmap progress
387
- node ~/.claude/maxsim/bin/maxsim-tools.cjs roadmap update-plan-progress "${PHASE}"
388
-
389
- # Mark requirements complete (if plan has requirements field)
390
- node ~/.claude/maxsim/bin/maxsim-tools.cjs requirements mark-complete ${REQ_IDS}
393
+ # Task code committed per-task; commit only planning artifacts
394
+ node ~/.claude/maxsim/bin/maxsim-tools.cjs commit \
395
+ "docs({phase_number}-{plan_id}): complete SDD execution" \
396
+ --files .planning/STATE.md .planning/ROADMAP.md .planning/REQUIREMENTS.md
391
397
  ```
392
- </step>
393
398
 
394
- <step name="git_commit_metadata">
395
- Task code already committed per-task. Commit planning artifacts:
399
+ ## Step 6 — Completion Check and Next Steps
396
400
 
397
- ```bash
398
- node ~/.claude/maxsim/bin/maxsim-tools.cjs commit "docs({phase}-{plan}): complete SDD execution" --files .planning/STATE.md .planning/ROADMAP.md .planning/REQUIREMENTS.md
399
- ```
400
-
401
- Note: No local SUMMARY.md is committed -- summary was posted to GitHub as a comment.
402
- </step>
401
+ After all plans are processed:
403
402
 
404
- <step name="offer_next">
405
- After all plans in the phase are processed:
406
-
407
- Check completion by querying the phase issue's task sub-issues:
408
403
  ```bash
409
- node ~/.claude/maxsim/bin/maxsim-tools.cjs github list-sub-issues --phase-issue-number ${phase_issue_number}
404
+ node ~/.claude/maxsim/bin/maxsim-tools.cjs github list-sub-issues \
405
+ --phase-issue-number $PHASE_ISSUE_NUMBER
410
406
  ```
411
407
 
412
- Count open vs closed sub-issues to determine completion.
413
-
414
- | Condition | Route | Action |
415
- |-----------|-------|--------|
416
- | open sub-issues remain | **A: More plans** | Find next incomplete plan (by open sub-issues). Show next plan, suggest `/maxsim:execute {phase}` (SDD mode) to continue. |
417
- | all sub-issues closed, more phases exist | **B: Phase done** | Show completion, suggest `/maxsim:execute {phase}` (verification) then `/maxsim:plan {next}`. |
418
- | all sub-issues closed, last phase | **C: Milestone done** | Show banner, suggest `/maxsim:progress` (milestone completion) + `/maxsim:execute` (verification). |
408
+ | Condition | Action |
409
+ |-----------|--------|
410
+ | Open sub-issues remain | Suggest `/maxsim:execute {phase}` (SDD mode) to continue |
411
+ | All sub-issues closed, more phases exist | Suggest `/maxsim:execute {phase}` (verification) then `/maxsim:plan {next}` |
412
+ | All sub-issues closed, last phase | Show completion banner, suggest `/maxsim:progress` |
419
413
 
420
- All routes: recommend `/clear` first for fresh context.
421
- </step>
414
+ Always recommend `/clear` before continuing to next phase.
422
415
 
423
416
  </process>
424
417
 
418
+ <success_criteria>
419
+ - [ ] Plan content loaded from GitHub Issue comments (not local PLAN.md)
420
+ - [ ] Plans with all closed task sub-issues skipped (resume support)
421
+ - [ ] Each task gets a FRESH executor agent with minimal context (no diff bleed)
422
+ - [ ] Previous task context is commit hash + files only (never full diff)
423
+ - [ ] Each executor uses isolation="worktree" and the Agent tool (not Task)
424
+ - [ ] Task sub-issues moved: In Progress when starting, Done+closed when complete
425
+ - [ ] Spec compliance review spawned after each executor
426
+ - [ ] Code quality review spawned after each executor
427
+ - [ ] Both reviews must PASS before next task starts (hard gate)
428
+ - [ ] Fix agents cap at 3 attempts before escalation to user
429
+ - [ ] Summary posted as GitHub comment: <!-- maxsim:type=summary -->
430
+ - [ ] No local SUMMARY.md written
431
+ - [ ] State files updated after each plan completes
432
+ </success_criteria>
433
+
425
434
  <failure_handling>
426
- - **Task agent fails (no commit):** Report failure, ask user: retry task or skip
427
- - **Review agent fails to return verdict:** Treat as FAIL, re-run review
428
- - **3 fix attempts exhausted:** Hard stop on task, escalate to user with full history
429
- - **classifyHandoffIfNeeded bug:** If agent reports "failed" with `classifyHandoffIfNeeded is not defined` — Claude Code runtime bug. Spot-check (commit exists, files modified) if pass, treat as success
430
- - **All tasks in plan blocked:** Stop plan, report to user, suggest manual intervention
435
+ - **Executor returns no commit:** Ask user retry task or skip
436
+ - **Review agent fails to return PASS/FAIL line:** Treat as FAIL, re-run review
437
+ - **3 fix attempts exhausted:** Hard stop on task, present full failure history to user
438
+ - **classifyHandoffIfNeeded error:** Claude Code runtime bug. Check if commit exists. If yes, treat as success and extract hash from git log.
439
+ - **All tasks in a plan blocked:** Stop plan, report to user, suggest manual intervention
440
+ - **GitHub sub-issue transition fails:** Log error, continue execution, note in summary
431
441
  </failure_handling>
432
442
 
433
443
  <resumption>
434
- Re-run `/maxsim:execute {phase}` (SDD mode) discover_plans queries GitHub for task sub-issue status, skips plans with all sub-issues closed, resumes from first incomplete plan. Within a plan, completed tasks (those with commits matching the plan pattern) can be detected and skipped.
444
+ Re-run `/maxsim:execute {phase}` — load_plans queries GitHub for task sub-issue status, skips plans with all sub-issues closed. Within a plan, completed tasks (commits matching `{phase}-{plan}` grep) can be detected and skipped if needed.
435
445
  </resumption>