maxsimcli 4.8.0 → 4.9.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 (161) hide show
  1. package/dist/assets/CHANGELOG.md +13 -0
  2. package/dist/assets/hooks/maxsim-check-update.cjs +38 -0
  3. package/dist/assets/hooks/maxsim-check-update.cjs.map +1 -1
  4. package/dist/assets/hooks/maxsim-statusline.cjs +116 -48
  5. package/dist/assets/hooks/maxsim-statusline.cjs.map +1 -1
  6. package/dist/assets/hooks/maxsim-sync-reminder.cjs +117 -0
  7. package/dist/assets/hooks/maxsim-sync-reminder.cjs.map +1 -0
  8. package/dist/assets/templates/agents/AGENTS.md +78 -106
  9. package/dist/assets/templates/agents/executor.md +101 -0
  10. package/dist/assets/templates/agents/planner.md +86 -0
  11. package/dist/assets/templates/agents/researcher.md +71 -0
  12. package/dist/assets/templates/agents/verifier.md +88 -0
  13. package/dist/assets/templates/commands/maxsim/debug.md +7 -7
  14. package/dist/assets/templates/commands/maxsim/execute.md +45 -0
  15. package/dist/assets/templates/commands/maxsim/go.md +29 -0
  16. package/dist/assets/templates/commands/maxsim/help.md +2 -2
  17. package/dist/assets/templates/commands/maxsim/init.md +52 -0
  18. package/dist/assets/templates/commands/maxsim/plan.md +50 -0
  19. package/dist/assets/templates/commands/maxsim/progress.md +4 -3
  20. package/dist/assets/templates/commands/maxsim/quick.md +6 -4
  21. package/dist/assets/templates/commands/maxsim/settings.md +4 -3
  22. package/dist/assets/templates/references/continuation-format.md +16 -16
  23. package/dist/assets/templates/references/model-profile-resolution.md +1 -1
  24. package/dist/assets/templates/references/model-profiles.md +12 -19
  25. package/dist/assets/templates/rules/conventions.md +51 -0
  26. package/dist/assets/templates/rules/verification-protocol.md +57 -0
  27. package/dist/assets/templates/skills/agent-system-map/SKILL.md +92 -0
  28. package/dist/assets/templates/skills/brainstorming/SKILL.md +48 -36
  29. package/dist/assets/templates/skills/code-review/SKILL.md +40 -61
  30. package/dist/assets/templates/skills/commit-conventions/SKILL.md +75 -0
  31. package/dist/assets/templates/skills/evidence-collection/SKILL.md +87 -0
  32. package/dist/assets/templates/skills/handoff-contract/SKILL.md +70 -0
  33. package/dist/assets/templates/skills/input-validation/SKILL.md +51 -0
  34. package/dist/assets/templates/skills/maxsim-batch/SKILL.md +41 -45
  35. package/dist/assets/templates/skills/maxsim-simplify/SKILL.md +37 -90
  36. package/dist/assets/templates/skills/memory-management/SKILL.md +32 -67
  37. package/dist/assets/templates/skills/research-methodology/SKILL.md +137 -0
  38. package/dist/assets/templates/skills/roadmap-writing/SKILL.md +40 -58
  39. package/dist/assets/templates/skills/sdd/SKILL.md +34 -69
  40. package/dist/assets/templates/skills/systematic-debugging/SKILL.md +20 -26
  41. package/dist/assets/templates/skills/tdd/SKILL.md +25 -33
  42. package/dist/assets/templates/skills/tool-priority-guide/SKILL.md +80 -0
  43. package/dist/assets/templates/skills/using-maxsim/SKILL.md +42 -73
  44. package/dist/assets/templates/skills/verification-before-completion/SKILL.md +12 -24
  45. package/dist/assets/templates/skills/verification-gates/SKILL.md +169 -0
  46. package/dist/assets/templates/templates/UAT.md +3 -3
  47. package/dist/assets/templates/templates/VALIDATION.md +1 -1
  48. package/dist/assets/templates/templates/context.md +4 -4
  49. package/dist/assets/templates/templates/debug-subagent-prompt.md +3 -3
  50. package/dist/assets/templates/templates/discovery.md +2 -2
  51. package/dist/assets/templates/templates/phase-prompt.md +2 -2
  52. package/dist/assets/templates/templates/planner-subagent-prompt.md +7 -7
  53. package/dist/assets/templates/templates/project.md +1 -1
  54. package/dist/assets/templates/templates/research.md +1 -1
  55. package/dist/assets/templates/templates/state.md +2 -2
  56. package/dist/assets/templates/templates/summary.md +41 -0
  57. package/dist/assets/templates/workflows/batch.md +5 -5
  58. package/dist/assets/templates/workflows/diagnose-issues.md +2 -2
  59. package/dist/assets/templates/workflows/discovery-phase.md +3 -3
  60. package/dist/assets/templates/workflows/discuss-phase.md +11 -11
  61. package/dist/assets/templates/workflows/execute-phase.md +205 -11
  62. package/dist/assets/templates/workflows/execute-plan.md +299 -34
  63. package/dist/assets/templates/workflows/execute.md +421 -0
  64. package/dist/assets/templates/workflows/go.md +250 -0
  65. package/dist/assets/templates/workflows/health.md +5 -5
  66. package/dist/assets/templates/workflows/help.md +165 -435
  67. package/dist/assets/templates/workflows/init-existing.md +23 -23
  68. package/dist/assets/templates/workflows/init.md +205 -0
  69. package/dist/assets/templates/workflows/new-milestone.md +9 -9
  70. package/dist/assets/templates/workflows/new-project.md +26 -26
  71. package/dist/assets/templates/workflows/plan-create.md +298 -0
  72. package/dist/assets/templates/workflows/plan-discuss.md +347 -0
  73. package/dist/assets/templates/workflows/plan-phase.md +29 -29
  74. package/dist/assets/templates/workflows/plan-research.md +177 -0
  75. package/dist/assets/templates/workflows/plan.md +231 -0
  76. package/dist/assets/templates/workflows/progress.md +46 -42
  77. package/dist/assets/templates/workflows/quick.md +195 -14
  78. package/dist/assets/templates/workflows/research-phase.md +5 -5
  79. package/dist/assets/templates/workflows/sdd.md +20 -12
  80. package/dist/assets/templates/workflows/settings.md +18 -14
  81. package/dist/assets/templates/workflows/verify-phase.md +1 -1
  82. package/dist/assets/templates/workflows/verify-work.md +16 -16
  83. package/dist/cli.cjs +496 -91
  84. package/dist/cli.cjs.map +1 -1
  85. package/dist/core-D5zUr9cb.cjs.map +1 -1
  86. package/dist/install.cjs +234 -17
  87. package/dist/install.cjs.map +1 -1
  88. package/dist/mcp-server.cjs +21 -2
  89. package/dist/mcp-server.cjs.map +1 -1
  90. package/dist/skills-CjFWZIGM.cjs.map +1 -1
  91. package/package.json +1 -1
  92. package/dist/assets/hooks/maxsim-context-monitor.cjs +0 -121
  93. package/dist/assets/hooks/maxsim-context-monitor.cjs.map +0 -1
  94. package/dist/assets/templates/agents/maxsim-code-reviewer.md +0 -239
  95. package/dist/assets/templates/agents/maxsim-codebase-mapper.md +0 -214
  96. package/dist/assets/templates/agents/maxsim-debugger.md +0 -572
  97. package/dist/assets/templates/agents/maxsim-drift-checker.md +0 -522
  98. package/dist/assets/templates/agents/maxsim-executor.md +0 -504
  99. package/dist/assets/templates/agents/maxsim-integration-checker.md +0 -273
  100. package/dist/assets/templates/agents/maxsim-phase-researcher.md +0 -305
  101. package/dist/assets/templates/agents/maxsim-plan-checker.md +0 -343
  102. package/dist/assets/templates/agents/maxsim-planner.md +0 -610
  103. package/dist/assets/templates/agents/maxsim-project-researcher.md +0 -359
  104. package/dist/assets/templates/agents/maxsim-research-synthesizer.md +0 -263
  105. package/dist/assets/templates/agents/maxsim-roadmapper.md +0 -324
  106. package/dist/assets/templates/agents/maxsim-spec-reviewer.md +0 -245
  107. package/dist/assets/templates/agents/maxsim-verifier.md +0 -393
  108. package/dist/assets/templates/commands/maxsim/add-phase.md +0 -43
  109. package/dist/assets/templates/commands/maxsim/add-tests.md +0 -41
  110. package/dist/assets/templates/commands/maxsim/add-todo.md +0 -57
  111. package/dist/assets/templates/commands/maxsim/artefakte.md +0 -122
  112. package/dist/assets/templates/commands/maxsim/audit-milestone.md +0 -36
  113. package/dist/assets/templates/commands/maxsim/batch.md +0 -42
  114. package/dist/assets/templates/commands/maxsim/check-drift.md +0 -56
  115. package/dist/assets/templates/commands/maxsim/check-todos.md +0 -46
  116. package/dist/assets/templates/commands/maxsim/cleanup.md +0 -18
  117. package/dist/assets/templates/commands/maxsim/complete-milestone.md +0 -136
  118. package/dist/assets/templates/commands/maxsim/discuss-phase.md +0 -87
  119. package/dist/assets/templates/commands/maxsim/discuss.md +0 -70
  120. package/dist/assets/templates/commands/maxsim/execute-phase.md +0 -41
  121. package/dist/assets/templates/commands/maxsim/health.md +0 -22
  122. package/dist/assets/templates/commands/maxsim/init-existing.md +0 -46
  123. package/dist/assets/templates/commands/maxsim/insert-phase.md +0 -32
  124. package/dist/assets/templates/commands/maxsim/list-phase-assumptions.md +0 -46
  125. package/dist/assets/templates/commands/maxsim/map-codebase.md +0 -71
  126. package/dist/assets/templates/commands/maxsim/new-milestone.md +0 -44
  127. package/dist/assets/templates/commands/maxsim/new-project.md +0 -46
  128. package/dist/assets/templates/commands/maxsim/pause-work.md +0 -38
  129. package/dist/assets/templates/commands/maxsim/plan-milestone-gaps.md +0 -34
  130. package/dist/assets/templates/commands/maxsim/plan-phase.md +0 -44
  131. package/dist/assets/templates/commands/maxsim/realign.md +0 -39
  132. package/dist/assets/templates/commands/maxsim/reapply-patches.md +0 -110
  133. package/dist/assets/templates/commands/maxsim/remove-phase.md +0 -31
  134. package/dist/assets/templates/commands/maxsim/research-phase.md +0 -189
  135. package/dist/assets/templates/commands/maxsim/resume-work.md +0 -40
  136. package/dist/assets/templates/commands/maxsim/roadmap.md +0 -19
  137. package/dist/assets/templates/commands/maxsim/sdd.md +0 -39
  138. package/dist/assets/templates/commands/maxsim/set-profile.md +0 -34
  139. package/dist/assets/templates/commands/maxsim/update.md +0 -37
  140. package/dist/assets/templates/commands/maxsim/verify-work.md +0 -38
  141. package/dist/assets/templates/workflows/add-phase.md +0 -111
  142. package/dist/assets/templates/workflows/add-tests.md +0 -351
  143. package/dist/assets/templates/workflows/add-todo.md +0 -247
  144. package/dist/assets/templates/workflows/audit-milestone.md +0 -297
  145. package/dist/assets/templates/workflows/check-drift.md +0 -248
  146. package/dist/assets/templates/workflows/check-todos.md +0 -261
  147. package/dist/assets/templates/workflows/cleanup.md +0 -153
  148. package/dist/assets/templates/workflows/complete-milestone.md +0 -701
  149. package/dist/assets/templates/workflows/discuss.md +0 -343
  150. package/dist/assets/templates/workflows/insert-phase.md +0 -129
  151. package/dist/assets/templates/workflows/list-phase-assumptions.md +0 -178
  152. package/dist/assets/templates/workflows/map-codebase.md +0 -315
  153. package/dist/assets/templates/workflows/pause-work.md +0 -122
  154. package/dist/assets/templates/workflows/plan-milestone-gaps.md +0 -274
  155. package/dist/assets/templates/workflows/realign.md +0 -288
  156. package/dist/assets/templates/workflows/remove-phase.md +0 -154
  157. package/dist/assets/templates/workflows/resume-project.md +0 -306
  158. package/dist/assets/templates/workflows/roadmap.md +0 -130
  159. package/dist/assets/templates/workflows/set-profile.md +0 -81
  160. package/dist/assets/templates/workflows/transition.md +0 -544
  161. package/dist/assets/templates/workflows/update.md +0 -220
@@ -1,6 +1,6 @@
1
1
  <sanity_check>
2
2
  Before executing any step in this workflow, verify:
3
- 1. The current directory contains a `.planning/` folder — if not, stop and tell the user to run `/maxsim:new-project` first.
3
+ 1. The current directory contains a `.planning/` folder — if not, stop and tell the user to run `/maxsim:init` first.
4
4
  2. Git is initialized (`git rev-parse --git-dir` succeeds) — worktrees require a git repository.
5
5
  3. `.planning/ROADMAP.md` exists — if not, stop and tell the user to initialize the project.
6
6
  </sanity_check>
@@ -27,7 +27,7 @@ INIT=$(node ~/.claude/maxsim/bin/maxsim-tools.cjs init quick "$DESCRIPTION")
27
27
 
28
28
  Parse JSON for: `planner_model`, `executor_model`, `slug`, `date`, `timestamp`, `roadmap_exists`, `planning_exists`.
29
29
 
30
- **If `roadmap_exists` is false:** Error — Batch mode requires an active project with ROADMAP.md. Run `/maxsim:new-project` first.
30
+ **If `roadmap_exists` is false:** Error — Batch mode requires an active project with ROADMAP.md. Run `/maxsim:init` first.
31
31
 
32
32
  Verify git is available:
33
33
  ```bash
@@ -69,7 +69,7 @@ Display banner:
69
69
  </step>
70
70
 
71
71
  <step name="decompose">
72
- Spawn maxsim-planner with batch-specific prompt to produce a decomposition:
72
+ Spawn planner with batch-specific prompt to produce a decomposition:
73
73
 
74
74
  ```
75
75
  Task(
@@ -132,7 +132,7 @@ status: pending
132
132
  Return: ## PLANNING COMPLETE with unit count and decomposition path
133
133
  </output>
134
134
  ",
135
- subagent_type="maxsim-planner",
135
+ subagent_type="planner",
136
136
  model="{planner_model}",
137
137
  description="Batch decomposition: ${DESCRIPTION}"
138
138
  )
@@ -187,7 +187,7 @@ Options:
187
187
  Revise DECOMPOSITION.md to resolve all overlaps.
188
188
  </revision_context>
189
189
  ",
190
- subagent_type="maxsim-planner",
190
+ subagent_type="planner",
191
191
  model="{planner_model}",
192
192
  description="Revise batch decomposition: fix overlaps"
193
193
  )
@@ -79,8 +79,8 @@ For each gap, fill the debug-subagent-prompt template and spawn:
79
79
 
80
80
  ```
81
81
  Task(
82
- prompt=filled_debug_subagent_prompt + "\n\n<files_to_read>\n- {phase_dir}/{phase_num}-UAT.md\n- .planning/STATE.md\n</files_to_read>",
83
- subagent_type="general-purpose",
82
+ prompt="## Task: Diagnose root cause of test failure\n\n## Suggested Skills: systematic-debugging\n\n" + filled_debug_subagent_prompt + "\n\n<files_to_read>\n- {phase_dir}/{phase_num}-UAT.md\n- .planning/STATE.md\n</files_to_read>",
83
+ subagent_type="verifier",
84
84
  description="Debug: {truth_short}"
85
85
  )
86
86
  ```
@@ -4,7 +4,7 @@ Produces DISCOVERY.md (for Level 2-3) that informs PLAN.md creation.
4
4
 
5
5
  Called from plan-phase.md's mandatory_discovery step with a depth parameter.
6
6
 
7
- NOTE: For comprehensive ecosystem research ("how do experts build this"), use /maxsim:research-phase instead, which produces RESEARCH.md.
7
+ NOTE: For comprehensive ecosystem research ("how do experts build this"), use /maxsim:plan --research instead, which produces RESEARCH.md.
8
8
  </purpose>
9
9
 
10
10
  <required_reading>
@@ -256,8 +256,8 @@ Confidence: [level]
256
256
 
257
257
  What's next?
258
258
 
259
- 1. Discuss phase context (/maxsim:discuss-phase [current-phase])
260
- 2. Create phase plan (/maxsim:plan-phase [current-phase])
259
+ 1. Discuss phase context (/maxsim:plan (discussion stage) [current-phase])
260
+ 2. Create phase plan (/maxsim:plan [current-phase])
261
261
  3. Refine discovery (dig deeper)
262
262
  4. Review discovery
263
263
 
@@ -1,6 +1,6 @@
1
1
  <sanity_check>
2
2
  Before executing any step in this workflow, verify:
3
- 1. The current directory contains a `.planning/` folder — if not, stop and tell the user to run `/maxsim:new-project` first.
3
+ 1. The current directory contains a `.planning/` folder — if not, stop and tell the user to run `/maxsim:init` first.
4
4
  2. `.planning/ROADMAP.md` exists — if not, stop and tell the user to initialize the project.
5
5
  </sanity_check>
6
6
 
@@ -39,11 +39,11 @@ Every question directed at the user MUST use a structured tool. NEVER write a qu
39
39
  <downstream_awareness>
40
40
  **CONTEXT.md feeds into:**
41
41
 
42
- 1. **maxsim-phase-researcher** — Reads CONTEXT.md to know WHAT to research
42
+ 1. **researcher** — Reads CONTEXT.md to know WHAT to research
43
43
  - "User wants card-based layout" → researcher investigates card component patterns
44
44
  - "Infinite scroll decided" → researcher looks into virtualization libraries
45
45
 
46
- 2. **maxsim-planner** — Reads CONTEXT.md to know WHAT decisions are locked
46
+ 2. **planner** — Reads CONTEXT.md to know WHAT decisions are locked
47
47
  - "Pull-to-refresh on mobile" → planner includes that in task specs
48
48
  - "Claude's Discretion: loading skeleton" → planner can decide approach
49
49
 
@@ -199,7 +199,7 @@ Use AskUserQuestion:
199
199
  - header: "Plans exist"
200
200
  - question: "Phase [X] already has {plan_count} plan(s) created without user context. Your decisions here won't affect existing plans unless you replan."
201
201
  - options:
202
- - "Continue and replan after" — Capture context, then run /maxsim:plan-phase {X} to replan
202
+ - "Continue and replan after" — Capture context, then run /maxsim:plan {X} to replan
203
203
  - "View existing plans" — Show plans before deciding
204
204
  - "Cancel" — Skip discuss-phase
205
205
 
@@ -541,14 +541,14 @@ Created: .planning/phases/${PADDED_PHASE}-${SLUG}/${PADDED_PHASE}-CONTEXT.md
541
541
 
542
542
  **Phase ${PHASE}: [Name]** — [Goal from ROADMAP.md]
543
543
 
544
- `/maxsim:plan-phase ${PHASE}`
544
+ `/maxsim:plan ${PHASE}`
545
545
 
546
546
  <sub>`/clear` first → fresh context window</sub>
547
547
 
548
548
  ---
549
549
 
550
550
  **Also available:**
551
- - `/maxsim:plan-phase ${PHASE} --skip-research` — plan without research
551
+ - `/maxsim:plan ${PHASE} --skip-research` — plan without research
552
552
  - Review/edit CONTEXT.md before continuing
553
553
 
554
554
  ---
@@ -628,7 +628,7 @@ Task(
628
628
  <instructions>
629
629
  1. Read plan-phase.md from execution_context for your complete workflow
630
630
  2. Follow ALL steps: initialize, validate, load context, research, plan, verify, auto-advance
631
- 3. When spawning agents (maxsim-phase-researcher, maxsim-planner, maxsim-plan-checker), use Task with specified subagent_type and model
631
+ 3. When spawning agents (researcher, planner), use Task with specified subagent_type and model
632
632
  4. For step 14 (auto-advance to execute): spawn execute-phase as a Task with DIRECT file reference — tell it to read execute-phase.md. Include @file refs to execute-phase.md, checkpoints.md, tdd.md, model-profile-resolution.md. Pass --no-transition flag so execute-phase returns results instead of chaining further.
633
633
  5. Do NOT use the Skill tool or /maxsim: commands. Read workflow .md files directly.
634
634
  6. Return: PHASE COMPLETE (full pipeline success), PLANNING COMPLETE (planning done but execute failed/skipped), PLANNING INCONCLUSIVE, or GAPS FOUND
@@ -648,23 +648,23 @@ Task(
648
648
 
649
649
  Auto-advance pipeline finished: discuss → plan → execute
650
650
 
651
- Next: /maxsim:discuss-phase ${NEXT_PHASE} --auto
651
+ Next: /maxsim:plan ${NEXT_PHASE} --auto
652
652
  <sub>/clear first → fresh context window</sub>
653
653
  ```
654
654
  - **PLANNING COMPLETE** → Planning done, execution didn't complete:
655
655
  ```
656
656
  Auto-advance partial: Planning complete, execution did not finish.
657
- Continue: /maxsim:execute-phase ${PHASE}
657
+ Continue: /maxsim:execute ${PHASE}
658
658
  ```
659
659
  - **PLANNING INCONCLUSIVE / CHECKPOINT** → Stop chain:
660
660
  ```
661
661
  Auto-advance stopped: Planning needs input.
662
- Continue: /maxsim:plan-phase ${PHASE}
662
+ Continue: /maxsim:plan ${PHASE}
663
663
  ```
664
664
  - **GAPS FOUND** → Stop chain:
665
665
  ```
666
666
  Auto-advance stopped: Gaps found during execution.
667
- Continue: /maxsim:plan-phase ${PHASE} --gaps
667
+ Continue: /maxsim:plan ${PHASE} --gaps
668
668
  ```
669
669
 
670
670
  **If neither `--auto` nor config enabled:**
@@ -1,6 +1,6 @@
1
1
  <sanity_check>
2
2
  Before executing any step in this workflow, verify:
3
- 1. The current directory contains a `.planning/` folder — if not, stop and tell the user to run `/maxsim:new-project` first.
3
+ 1. The current directory contains a `.planning/` folder — if not, stop and tell the user to run `/maxsim:init` first.
4
4
  2. `.planning/ROADMAP.md` exists — if not, stop and tell the user to initialize the project.
5
5
  </sanity_check>
6
6
 
@@ -12,6 +12,16 @@ Execute all plans in a phase using wave-based parallel execution. Orchestrator s
12
12
  Orchestrator coordinates, not executes. Each subagent loads the full execute-plan context. Orchestrator: discover plans → analyze deps → group waves → spawn agents → handle checkpoints → collect results.
13
13
  </core_principle>
14
14
 
15
+ <agent_teams>
16
+ **Agent Teams Model:** MAXSIM uses Agent Teams for grouping parallel agents, NOT for peer-to-peer communication.
17
+
18
+ - `team_name` groups agents in a wave so Claude Code can track them as a unit
19
+ - All coordination routes through the orchestrator (this workflow)
20
+ - Subagents CANNOT spawn other subagents — only the orchestrator spawns agents
21
+ - Inter-wave handoff: orchestrator passes wave N results as context to wave N+1 agents
22
+ - Status tracking: orchestrator maintains a progress table per wave
23
+ </agent_teams>
24
+
15
25
  <required_reading>
16
26
  Read STATE.md before any operation to load project context.
17
27
 
@@ -29,6 +39,13 @@ INIT=$(node ~/.claude/maxsim/bin/maxsim-tools.cjs init execute-phase "${PHASE_AR
29
39
 
30
40
  Parse JSON for: `executor_model`, `verifier_model`, `commit_docs`, `parallelization`, `branching_strategy`, `branch_name`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `plans`, `incomplete_plans`, `plan_count`, `incomplete_count`, `state_exists`, `roadmap_exists`, `phase_req_ids`.
31
41
 
42
+ Also extract parallel execution fields:
43
+ ```
44
+ WORKTREE_MODE (from init JSON worktree_mode — "auto", "always", or "never")
45
+ MAX_PARALLEL_AGENTS (from init JSON max_parallel_agents — default 10)
46
+ REVIEW_CONFIG (from init JSON review_config — spec_review, code_review, simplify_review, retry_limit)
47
+ ```
48
+
32
49
  **If `phase_found` is false:** Error — phase directory not found.
33
50
  **If `plan_count` is 0:** Error — no plans found in phase.
34
51
  **If `state_exists` is false but `.planning/` exists:** Offer reconstruct or continue.
@@ -92,8 +109,167 @@ Report:
92
109
  ```
93
110
  </step>
94
111
 
112
+ <step name="decide_execution_mode">
113
+ After discovering plans and grouping by wave, determine whether to use batch (worktree) or standard execution.
114
+
115
+ ```bash
116
+ # Parse --worktrees / --no-worktrees flags from $ARGUMENTS
117
+ FLAG_OVERRIDE=""
118
+ if echo "$ARGUMENTS" | grep -q "\-\-worktrees"; then FLAG_OVERRIDE="worktrees"; fi
119
+ if echo "$ARGUMENTS" | grep -q "\-\-no-worktrees"; then FLAG_OVERRIDE="no-worktrees"; fi
120
+
121
+ # Call CLI decision function
122
+ MODE_RESULT=$(node ~/.claude/maxsim/bin/maxsim-tools.cjs decide-execution-mode \
123
+ "${INCOMPLETE_PLAN_COUNT}" "${WAVE_COUNT}" \
124
+ --worktree-mode "${WORKTREE_MODE}" \
125
+ ${FLAG_OVERRIDE:+--flag-override "$FLAG_OVERRIDE"})
126
+ EXECUTION_MODE=$(echo "$MODE_RESULT" | node -e "process.stdin.on('data',d=>console.log(JSON.parse(d).mode))")
127
+ ```
128
+
129
+ Display decision:
130
+ ```
131
+ **Execution Mode:** {Batch (worktree isolation) | Standard}
132
+ {If batch: "Will create {N} worktrees for parallel plan execution"}
133
+ {If standard and parallelization true: "Parallel within waves, sequential across waves"}
134
+ {If standard and parallelization false: "Sequential execution"}
135
+ ```
136
+
137
+ **If batch mode, validate plan independence:**
138
+ ```bash
139
+ # Build plans JSON from PLAN_INDEX data
140
+ VALID=$(node ~/.claude/maxsim/bin/maxsim-tools.cjs validate-plan-independence "$PLANS_JSON")
141
+ ```
142
+ If conflicts found: report conflicts, fall back to standard mode with warning.
143
+ </step>
144
+
95
145
  <step name="execute_waves">
96
- Execute each wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`, sequential if `false`.
146
+ Execute each wave in sequence. The execution path depends on `EXECUTION_MODE` from the decide_execution_mode step.
147
+
148
+ **BATCH PATH (when EXECUTION_MODE == "batch"):**
149
+
150
+ For each wave:
151
+
152
+ 1. **Create worktrees for all plans in the wave:**
153
+ ```bash
154
+ for PLAN_ID in $WAVE_PLANS; do
155
+ WT=$(node ~/.claude/maxsim/bin/maxsim-tools.cjs worktree-create "${PHASE_NUMBER}" "$PLAN_ID" "$WAVE_NUM")
156
+ # Parse WT JSON for path and branch
157
+ done
158
+ ```
159
+
160
+ 2. **Describe what is being built (BEFORE spawning):**
161
+
162
+ Read each plan's `<objective>`. Extract what is being built and why.
163
+
164
+ ```
165
+ ---
166
+ ## Wave {N} (Batch Mode)
167
+
168
+ **{Plan ID}: {Plan Name}**
169
+ {2-3 sentences: what this builds, technical approach, why it matters}
170
+
171
+ Spawning {count} isolated agent(s) in worktrees...
172
+ ---
173
+ ```
174
+
175
+ 3. **Spawn executor agents with worktree isolation:**
176
+
177
+ ```
178
+ Task(
179
+ subagent_type="executor",
180
+ model="{executor_model}",
181
+ isolation="worktree",
182
+ team_name="maxsim-phase-{PHASE_NUMBER}-wave-{WAVE_NUM}",
183
+ prompt="
184
+ <objective>
185
+ Execute plan {plan_number} of phase {phase_number}-{phase_name}.
186
+ Commit each task atomically. Create SUMMARY.md.
187
+ IMPORTANT: Do NOT update STATE.md or ROADMAP.md — the orchestrator handles metadata.
188
+ </objective>
189
+
190
+ <execution_context>
191
+ @./workflows/execute-plan.md
192
+ @./templates/summary.md
193
+ @./references/checkpoints.md
194
+ </execution_context>
195
+
196
+ <files_to_read>
197
+ Read these files at execution start using the Read tool:
198
+ - {phase_dir}/{plan_file} (Plan)
199
+ - .planning/STATE.md (State — READ ONLY, do not modify)
200
+ - .planning/config.json (Config, if exists)
201
+ - ./CLAUDE.md (Project instructions, if exists)
202
+ </files_to_read>
203
+
204
+ <constraints>
205
+ - You are running in a worktree. Do NOT modify .planning/STATE.md or .planning/ROADMAP.md.
206
+ - Only create SUMMARY.md and commit task code.
207
+ - The orchestrator will handle metadata updates after all agents complete.
208
+ </constraints>
209
+
210
+ <success_criteria>
211
+ - [ ] All tasks executed
212
+ - [ ] Each task committed individually
213
+ - [ ] SUMMARY.md created in plan directory
214
+ </success_criteria>
215
+ ",
216
+ run_in_background=true
217
+ )
218
+ ```
219
+
220
+ 4. **Track progress with status table** (update as agents complete):
221
+ ```
222
+ | Plan | Agent | Status | Duration |
223
+ |------|-------|--------|----------|
224
+ | 05-01 | agent-abc | Running... | 2m |
225
+ | 05-02 | agent-def | Complete | 5m |
226
+ ```
227
+
228
+ 5. **After all agents in wave complete, collect results:**
229
+ - Read each SUMMARY.md from the worktree paths
230
+ - Run spot-checks (same as standard path: files exist, commits present, review cycle check)
231
+ - Orchestrator performs batch metadata updates:
232
+ ```bash
233
+ for PLAN_ID in $COMPLETED_PLANS; do
234
+ node ~/.claude/maxsim/bin/maxsim-tools.cjs state advance-plan
235
+ node ~/.claude/maxsim/bin/maxsim-tools.cjs state update-progress
236
+ done
237
+ node ~/.claude/maxsim/bin/maxsim-tools.cjs roadmap update-plan-progress "${PHASE_NUMBER}"
238
+ ```
239
+ - Report:
240
+ ```
241
+ ---
242
+ ## Wave {N} Complete (Batch)
243
+
244
+ **{Plan ID}: {Plan Name}**
245
+ {What was built — from SUMMARY.md}
246
+ {Notable deviations, if any}
247
+
248
+ {If more waves: what this enables for next wave}
249
+ ---
250
+ ```
251
+
252
+ 6. **Cleanup worktrees after wave completes:**
253
+ ```bash
254
+ node ~/.claude/maxsim/bin/maxsim-tools.cjs worktree-cleanup --all
255
+ ```
256
+
257
+ 7. **Prepare inter-wave handoff context (for waves after Wave 1):**
258
+
259
+ When spawning agents for the next wave, include a brief context block so they can reference prior wave outputs without reading full SUMMARYs:
260
+
261
+ ```
262
+ <prior_wave_results>
263
+ Wave {N-1} completed:
264
+ {For each plan in prior wave: plan ID, one-liner from SUMMARY.md, key files created/modified}
265
+ </prior_wave_results>
266
+ ```
267
+
268
+ Add this block to the `<objective>` section of the next wave's Task() prompts.
269
+
270
+ 8. **Proceed to next wave.**
271
+
272
+ **STANDARD PATH (when EXECUTION_MODE == "standard"):**
97
273
 
98
274
  **For each wave:**
99
275
 
@@ -129,10 +305,13 @@ Execute each wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`
129
305
  Pass paths only — executors read files themselves with their fresh 200k context.
130
306
  This keeps orchestrator context lean (~10-15%).
131
307
 
308
+ When the wave has multiple plans (parallel execution), add `team_name` to group agents:
309
+
132
310
  ```
133
311
  Task(
134
- subagent_type="maxsim-executor",
312
+ subagent_type="executor",
135
313
  model="{executor_model}",
314
+ team_name="maxsim-phase-{PHASE_NUMBER}-wave-{WAVE_NUM}", // only for multi-plan waves
136
315
  prompt="
137
316
  <objective>
138
317
  Execute plan {plan_number} of phase {phase_number}-{phase_name}.
@@ -217,7 +396,20 @@ Execute each wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`
217
396
 
218
397
  6. **Execute checkpoint plans between waves** — see `<checkpoint_handling>`.
219
398
 
220
- 7. **Proceed to next wave.**
399
+ 7. **Prepare inter-wave handoff context (for waves after Wave 1):**
400
+
401
+ When spawning agents for the next wave, include a brief context block so they can reference prior wave outputs without reading full SUMMARYs:
402
+
403
+ ```
404
+ <prior_wave_results>
405
+ Wave {N-1} completed:
406
+ {For each plan in prior wave: plan ID, one-liner from SUMMARY.md, key files created/modified}
407
+ </prior_wave_results>
408
+ ```
409
+
410
+ Add this block to the `<objective>` section of the next wave's Task() prompts.
411
+
412
+ 8. **Proceed to next wave.**
221
413
  </step>
222
414
 
223
415
  <step name="checkpoint_handling">
@@ -270,6 +462,8 @@ After all waves:
270
462
  ```markdown
271
463
  ## Phase {X}: {Name} Execution Complete
272
464
 
465
+ **Execution Mode:** {Batch (worktree) | Standard}
466
+ **Worktrees Used:** {N} (batch only — omit for standard mode)
273
467
  **Waves:** {N} | **Plans:** {M}/{total} complete
274
468
 
275
469
  | Wave | Plans | Status |
@@ -366,7 +560,7 @@ Phase requirement IDs: {phase_req_ids}
366
560
  Check must_haves against actual codebase.
367
561
  Cross-reference requirement IDs from PLAN frontmatter against REQUIREMENTS.md — every ID MUST be accounted for.
368
562
  Create VERIFICATION.md.",
369
- subagent_type="maxsim-verifier",
563
+ subagent_type="verifier",
370
564
  model="{verifier_model}"
371
565
  )
372
566
  ```
@@ -380,7 +574,7 @@ grep "^status:" "$PHASE_DIR"/*-VERIFICATION.md | cut -d: -f2 | tr -d ' '
380
574
  |--------|--------|
381
575
  | `passed` | → update_roadmap |
382
576
  | `human_needed` | Present items for human testing, get approval or feedback |
383
- | `gaps_found` | Present gap summary, offer `/maxsim:plan-phase {phase} --gaps` |
577
+ | `gaps_found` | Present gap summary, offer `/maxsim:plan {phase} --gaps` |
384
578
 
385
579
  **If human_needed:**
386
580
  ```
@@ -406,15 +600,15 @@ All automated checks passed. {N} items need human testing:
406
600
  ---
407
601
  ## ▶ Next Up
408
602
 
409
- `/maxsim:plan-phase {X} --gaps`
603
+ `/maxsim:plan {X} --gaps`
410
604
 
411
605
  <sub>`/clear` first → fresh context window</sub>
412
606
 
413
607
  Also: `cat {phase_dir}/{phase_num}-VERIFICATION.md` — full report
414
- Also: `/maxsim:verify-work {X}` — manual testing first
608
+ Also: `/maxsim:execute {X}` (includes verification) — manual testing first
415
609
  ```
416
610
 
417
- Gap closure cycle: `/maxsim:plan-phase {X} --gaps` reads VERIFICATION.md → creates gap plans with `gap_closure: true` → user runs `/maxsim:execute-phase {X} --gaps-only` → verifier re-runs.
611
+ Gap closure cycle: `/maxsim:plan {X} --gaps` reads VERIFICATION.md → creates gap plans with `gap_closure: true` → user runs `/maxsim:execute {X} --gaps-only` → verifier re-runs.
418
612
  </step>
419
613
 
420
614
  <step name="update_roadmap">
@@ -449,7 +643,7 @@ mcp__maxsim-dashboard__submit_lifecycle_event(
449
643
 
450
644
  <step name="offer_next">
451
645
 
452
- **Exception:** If `gaps_found`, the `verify_phase_goal` step already presents the gap-closure path (`/maxsim:plan-phase {X} --gaps`). No additional routing needed — skip auto-advance.
646
+ **Exception:** If `gaps_found`, the `verify_phase_goal` step already presents the gap-closure path (`/maxsim:plan {X} --gaps`). No additional routing needed — skip auto-advance.
453
647
 
454
648
  **No-transition check (spawned by auto-advance chain):**
455
649
 
@@ -515,7 +709,7 @@ Orchestrator: ~10-15% context. Subagents: fresh 200k each. No polling (Task bloc
515
709
  </failure_handling>
516
710
 
517
711
  <resumption>
518
- Re-run `/maxsim:execute-phase {phase}` → discover_plans finds completed SUMMARYs → skips them → resumes from first incomplete plan → continues wave execution.
712
+ Re-run `/maxsim:execute {phase}` → discover_plans finds completed SUMMARYs → skips them → resumes from first incomplete plan → continues wave execution.
519
713
 
520
714
  STATE.md tracks: last completed plan, current wave, pending checkpoints.
521
715
  </resumption>