gsd-code-first 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 (238) hide show
  1. package/LICENSE +21 -0
  2. package/README.ja-JP.md +834 -0
  3. package/README.ko-KR.md +823 -0
  4. package/README.md +937 -0
  5. package/README.pt-BR.md +452 -0
  6. package/README.zh-CN.md +800 -0
  7. package/agents/gsd-advisor-researcher.md +104 -0
  8. package/agents/gsd-annotator.md +148 -0
  9. package/agents/gsd-arc-executor.md +537 -0
  10. package/agents/gsd-arc-planner.md +374 -0
  11. package/agents/gsd-assumptions-analyzer.md +105 -0
  12. package/agents/gsd-code-planner.md +155 -0
  13. package/agents/gsd-codebase-mapper.md +770 -0
  14. package/agents/gsd-debugger.md +1373 -0
  15. package/agents/gsd-executor.md +509 -0
  16. package/agents/gsd-integration-checker.md +443 -0
  17. package/agents/gsd-nyquist-auditor.md +176 -0
  18. package/agents/gsd-phase-researcher.md +698 -0
  19. package/agents/gsd-plan-checker.md +773 -0
  20. package/agents/gsd-planner.md +1354 -0
  21. package/agents/gsd-project-researcher.md +654 -0
  22. package/agents/gsd-prototyper.md +161 -0
  23. package/agents/gsd-research-synthesizer.md +247 -0
  24. package/agents/gsd-roadmapper.md +679 -0
  25. package/agents/gsd-ui-auditor.md +439 -0
  26. package/agents/gsd-ui-checker.md +300 -0
  27. package/agents/gsd-ui-researcher.md +357 -0
  28. package/agents/gsd-user-profiler.md +171 -0
  29. package/agents/gsd-verifier.md +700 -0
  30. package/bin/install.js +5009 -0
  31. package/commands/gsd/add-backlog.md +76 -0
  32. package/commands/gsd/add-phase.md +43 -0
  33. package/commands/gsd/add-tests.md +41 -0
  34. package/commands/gsd/add-todo.md +47 -0
  35. package/commands/gsd/annotate.md +54 -0
  36. package/commands/gsd/audit-milestone.md +36 -0
  37. package/commands/gsd/audit-uat.md +24 -0
  38. package/commands/gsd/autonomous.md +41 -0
  39. package/commands/gsd/check-todos.md +45 -0
  40. package/commands/gsd/cleanup.md +18 -0
  41. package/commands/gsd/complete-milestone.md +136 -0
  42. package/commands/gsd/debug.md +173 -0
  43. package/commands/gsd/deep-plan.md +52 -0
  44. package/commands/gsd/discuss-phase.md +64 -0
  45. package/commands/gsd/do.md +30 -0
  46. package/commands/gsd/execute-phase.md +59 -0
  47. package/commands/gsd/extract-plan.md +35 -0
  48. package/commands/gsd/fast.md +30 -0
  49. package/commands/gsd/forensics.md +56 -0
  50. package/commands/gsd/health.md +22 -0
  51. package/commands/gsd/help.md +22 -0
  52. package/commands/gsd/insert-phase.md +32 -0
  53. package/commands/gsd/iterate.md +124 -0
  54. package/commands/gsd/join-discord.md +18 -0
  55. package/commands/gsd/list-phase-assumptions.md +46 -0
  56. package/commands/gsd/list-workspaces.md +19 -0
  57. package/commands/gsd/manager.md +39 -0
  58. package/commands/gsd/map-codebase.md +71 -0
  59. package/commands/gsd/milestone-summary.md +51 -0
  60. package/commands/gsd/new-milestone.md +44 -0
  61. package/commands/gsd/new-project.md +42 -0
  62. package/commands/gsd/new-workspace.md +44 -0
  63. package/commands/gsd/next.md +24 -0
  64. package/commands/gsd/note.md +34 -0
  65. package/commands/gsd/pause-work.md +38 -0
  66. package/commands/gsd/plan-milestone-gaps.md +34 -0
  67. package/commands/gsd/plan-phase.md +47 -0
  68. package/commands/gsd/plant-seed.md +28 -0
  69. package/commands/gsd/pr-branch.md +25 -0
  70. package/commands/gsd/profile-user.md +46 -0
  71. package/commands/gsd/progress.md +24 -0
  72. package/commands/gsd/prototype.md +56 -0
  73. package/commands/gsd/quick.md +47 -0
  74. package/commands/gsd/reapply-patches.md +123 -0
  75. package/commands/gsd/remove-phase.md +31 -0
  76. package/commands/gsd/remove-workspace.md +26 -0
  77. package/commands/gsd/research-phase.md +195 -0
  78. package/commands/gsd/resume-work.md +40 -0
  79. package/commands/gsd/review-backlog.md +61 -0
  80. package/commands/gsd/review.md +37 -0
  81. package/commands/gsd/session-report.md +19 -0
  82. package/commands/gsd/set-mode.md +41 -0
  83. package/commands/gsd/set-profile.md +12 -0
  84. package/commands/gsd/settings.md +36 -0
  85. package/commands/gsd/ship.md +23 -0
  86. package/commands/gsd/stats.md +18 -0
  87. package/commands/gsd/thread.md +127 -0
  88. package/commands/gsd/ui-phase.md +34 -0
  89. package/commands/gsd/ui-review.md +32 -0
  90. package/commands/gsd/update.md +37 -0
  91. package/commands/gsd/validate-phase.md +35 -0
  92. package/commands/gsd/verify-work.md +38 -0
  93. package/commands/gsd/workstreams.md +63 -0
  94. package/get-shit-done/bin/gsd-tools.cjs +946 -0
  95. package/get-shit-done/bin/lib/arc-scanner.cjs +341 -0
  96. package/get-shit-done/bin/lib/commands.cjs +959 -0
  97. package/get-shit-done/bin/lib/config.cjs +466 -0
  98. package/get-shit-done/bin/lib/core.cjs +1230 -0
  99. package/get-shit-done/bin/lib/frontmatter.cjs +336 -0
  100. package/get-shit-done/bin/lib/init.cjs +1442 -0
  101. package/get-shit-done/bin/lib/milestone.cjs +252 -0
  102. package/get-shit-done/bin/lib/model-profiles.cjs +68 -0
  103. package/get-shit-done/bin/lib/phase.cjs +888 -0
  104. package/get-shit-done/bin/lib/profile-output.cjs +952 -0
  105. package/get-shit-done/bin/lib/profile-pipeline.cjs +539 -0
  106. package/get-shit-done/bin/lib/roadmap.cjs +329 -0
  107. package/get-shit-done/bin/lib/security.cjs +382 -0
  108. package/get-shit-done/bin/lib/state.cjs +1031 -0
  109. package/get-shit-done/bin/lib/template.cjs +222 -0
  110. package/get-shit-done/bin/lib/uat.cjs +282 -0
  111. package/get-shit-done/bin/lib/verify.cjs +888 -0
  112. package/get-shit-done/bin/lib/workstream.cjs +491 -0
  113. package/get-shit-done/commands/gsd/workstreams.md +63 -0
  114. package/get-shit-done/references/arc-standard.md +315 -0
  115. package/get-shit-done/references/checkpoints.md +778 -0
  116. package/get-shit-done/references/continuation-format.md +249 -0
  117. package/get-shit-done/references/decimal-phase-calculation.md +64 -0
  118. package/get-shit-done/references/git-integration.md +295 -0
  119. package/get-shit-done/references/git-planning-commit.md +38 -0
  120. package/get-shit-done/references/model-profile-resolution.md +36 -0
  121. package/get-shit-done/references/model-profiles.md +139 -0
  122. package/get-shit-done/references/phase-argument-parsing.md +61 -0
  123. package/get-shit-done/references/planning-config.md +202 -0
  124. package/get-shit-done/references/questioning.md +162 -0
  125. package/get-shit-done/references/tdd.md +263 -0
  126. package/get-shit-done/references/ui-brand.md +160 -0
  127. package/get-shit-done/references/user-profiling.md +681 -0
  128. package/get-shit-done/references/verification-patterns.md +612 -0
  129. package/get-shit-done/references/workstream-flag.md +58 -0
  130. package/get-shit-done/templates/DEBUG.md +164 -0
  131. package/get-shit-done/templates/UAT.md +265 -0
  132. package/get-shit-done/templates/UI-SPEC.md +100 -0
  133. package/get-shit-done/templates/VALIDATION.md +76 -0
  134. package/get-shit-done/templates/claude-md.md +122 -0
  135. package/get-shit-done/templates/codebase/architecture.md +255 -0
  136. package/get-shit-done/templates/codebase/concerns.md +310 -0
  137. package/get-shit-done/templates/codebase/conventions.md +307 -0
  138. package/get-shit-done/templates/codebase/integrations.md +280 -0
  139. package/get-shit-done/templates/codebase/stack.md +186 -0
  140. package/get-shit-done/templates/codebase/structure.md +285 -0
  141. package/get-shit-done/templates/codebase/testing.md +480 -0
  142. package/get-shit-done/templates/config.json +44 -0
  143. package/get-shit-done/templates/context.md +352 -0
  144. package/get-shit-done/templates/continue-here.md +78 -0
  145. package/get-shit-done/templates/copilot-instructions.md +7 -0
  146. package/get-shit-done/templates/debug-subagent-prompt.md +91 -0
  147. package/get-shit-done/templates/dev-preferences.md +21 -0
  148. package/get-shit-done/templates/discovery.md +146 -0
  149. package/get-shit-done/templates/discussion-log.md +63 -0
  150. package/get-shit-done/templates/milestone-archive.md +123 -0
  151. package/get-shit-done/templates/milestone.md +115 -0
  152. package/get-shit-done/templates/phase-prompt.md +610 -0
  153. package/get-shit-done/templates/planner-subagent-prompt.md +117 -0
  154. package/get-shit-done/templates/project.md +186 -0
  155. package/get-shit-done/templates/requirements.md +231 -0
  156. package/get-shit-done/templates/research-project/ARCHITECTURE.md +204 -0
  157. package/get-shit-done/templates/research-project/FEATURES.md +147 -0
  158. package/get-shit-done/templates/research-project/PITFALLS.md +200 -0
  159. package/get-shit-done/templates/research-project/STACK.md +120 -0
  160. package/get-shit-done/templates/research-project/SUMMARY.md +170 -0
  161. package/get-shit-done/templates/research.md +552 -0
  162. package/get-shit-done/templates/retrospective.md +54 -0
  163. package/get-shit-done/templates/roadmap.md +202 -0
  164. package/get-shit-done/templates/state.md +176 -0
  165. package/get-shit-done/templates/summary-complex.md +59 -0
  166. package/get-shit-done/templates/summary-minimal.md +41 -0
  167. package/get-shit-done/templates/summary-standard.md +48 -0
  168. package/get-shit-done/templates/summary.md +248 -0
  169. package/get-shit-done/templates/user-profile.md +146 -0
  170. package/get-shit-done/templates/user-setup.md +311 -0
  171. package/get-shit-done/templates/verification-report.md +322 -0
  172. package/get-shit-done/workflows/add-phase.md +112 -0
  173. package/get-shit-done/workflows/add-tests.md +351 -0
  174. package/get-shit-done/workflows/add-todo.md +158 -0
  175. package/get-shit-done/workflows/audit-milestone.md +340 -0
  176. package/get-shit-done/workflows/audit-uat.md +109 -0
  177. package/get-shit-done/workflows/autonomous.md +891 -0
  178. package/get-shit-done/workflows/check-todos.md +177 -0
  179. package/get-shit-done/workflows/cleanup.md +152 -0
  180. package/get-shit-done/workflows/complete-milestone.md +767 -0
  181. package/get-shit-done/workflows/diagnose-issues.md +231 -0
  182. package/get-shit-done/workflows/discovery-phase.md +289 -0
  183. package/get-shit-done/workflows/discuss-phase-assumptions.md +653 -0
  184. package/get-shit-done/workflows/discuss-phase.md +1049 -0
  185. package/get-shit-done/workflows/do.md +104 -0
  186. package/get-shit-done/workflows/execute-phase.md +846 -0
  187. package/get-shit-done/workflows/execute-plan.md +514 -0
  188. package/get-shit-done/workflows/fast.md +105 -0
  189. package/get-shit-done/workflows/forensics.md +265 -0
  190. package/get-shit-done/workflows/health.md +181 -0
  191. package/get-shit-done/workflows/help.md +634 -0
  192. package/get-shit-done/workflows/insert-phase.md +130 -0
  193. package/get-shit-done/workflows/list-phase-assumptions.md +178 -0
  194. package/get-shit-done/workflows/list-workspaces.md +56 -0
  195. package/get-shit-done/workflows/manager.md +362 -0
  196. package/get-shit-done/workflows/map-codebase.md +377 -0
  197. package/get-shit-done/workflows/milestone-summary.md +223 -0
  198. package/get-shit-done/workflows/new-milestone.md +486 -0
  199. package/get-shit-done/workflows/new-project.md +1250 -0
  200. package/get-shit-done/workflows/new-workspace.md +237 -0
  201. package/get-shit-done/workflows/next.md +97 -0
  202. package/get-shit-done/workflows/node-repair.md +92 -0
  203. package/get-shit-done/workflows/note.md +156 -0
  204. package/get-shit-done/workflows/pause-work.md +176 -0
  205. package/get-shit-done/workflows/plan-milestone-gaps.md +273 -0
  206. package/get-shit-done/workflows/plan-phase.md +859 -0
  207. package/get-shit-done/workflows/plant-seed.md +169 -0
  208. package/get-shit-done/workflows/pr-branch.md +129 -0
  209. package/get-shit-done/workflows/profile-user.md +450 -0
  210. package/get-shit-done/workflows/progress.md +507 -0
  211. package/get-shit-done/workflows/quick.md +757 -0
  212. package/get-shit-done/workflows/remove-phase.md +155 -0
  213. package/get-shit-done/workflows/remove-workspace.md +90 -0
  214. package/get-shit-done/workflows/research-phase.md +82 -0
  215. package/get-shit-done/workflows/resume-project.md +326 -0
  216. package/get-shit-done/workflows/review.md +228 -0
  217. package/get-shit-done/workflows/session-report.md +146 -0
  218. package/get-shit-done/workflows/settings.md +283 -0
  219. package/get-shit-done/workflows/ship.md +228 -0
  220. package/get-shit-done/workflows/stats.md +60 -0
  221. package/get-shit-done/workflows/transition.md +671 -0
  222. package/get-shit-done/workflows/ui-phase.md +302 -0
  223. package/get-shit-done/workflows/ui-review.md +165 -0
  224. package/get-shit-done/workflows/update.md +323 -0
  225. package/get-shit-done/workflows/validate-phase.md +174 -0
  226. package/get-shit-done/workflows/verify-phase.md +254 -0
  227. package/get-shit-done/workflows/verify-work.md +637 -0
  228. package/hooks/dist/gsd-check-update.js +114 -0
  229. package/hooks/dist/gsd-context-monitor.js +156 -0
  230. package/hooks/dist/gsd-prompt-guard.js +96 -0
  231. package/hooks/dist/gsd-statusline.js +119 -0
  232. package/hooks/dist/gsd-workflow-guard.js +94 -0
  233. package/package.json +52 -0
  234. package/scripts/base64-scan.sh +262 -0
  235. package/scripts/build-hooks.js +82 -0
  236. package/scripts/prompt-injection-scan.sh +198 -0
  237. package/scripts/run-tests.cjs +29 -0
  238. package/scripts/secret-scan.sh +227 -0
@@ -0,0 +1,846 @@
1
+ <purpose>
2
+ Execute all plans in a phase using wave-based parallel execution. Orchestrator stays lean — delegates plan execution to subagents.
3
+ </purpose>
4
+
5
+ <core_principle>
6
+ 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.
7
+ </core_principle>
8
+
9
+ <runtime_compatibility>
10
+ **Subagent spawning is runtime-specific:**
11
+ - **Claude Code:** Uses `Task(subagent_type="gsd-executor", ...)` — blocks until complete, returns result
12
+ - **Copilot:** Subagent spawning does not reliably return completion signals. **Default to
13
+ sequential inline execution**: read and follow execute-plan.md directly for each plan
14
+ instead of spawning parallel agents. Only attempt parallel spawning if the user
15
+ explicitly requests it — and in that case, rely on the spot-check fallback in step 3
16
+ to detect completion.
17
+ - **Other runtimes:** If `Task`/`task` tool is unavailable, use sequential inline execution as the
18
+ fallback. Check for tool availability at runtime rather than assuming based on runtime name.
19
+
20
+ **Fallback rule:** If a spawned agent completes its work (commits visible, SUMMARY.md exists) but
21
+ the orchestrator never receives the completion signal, treat it as successful based on spot-checks
22
+ and continue to the next wave/plan. Never block indefinitely waiting for a signal — always verify
23
+ via filesystem and git state.
24
+ </runtime_compatibility>
25
+
26
+ <required_reading>
27
+ Read STATE.md before any operation to load project context.
28
+ </required_reading>
29
+
30
+ <available_agent_types>
31
+ These are the valid GSD subagent types registered in .claude/agents/ (or equivalent for your runtime).
32
+ Always use the exact name from this list — do not fall back to 'general-purpose' or other built-in types:
33
+
34
+ - gsd-executor — Executes plan tasks, commits, creates SUMMARY.md
35
+ - gsd-verifier — Verifies phase completion, checks quality gates
36
+ - gsd-planner — Creates detailed plans from phase scope
37
+ - gsd-phase-researcher — Researches technical approaches for a phase
38
+ - gsd-plan-checker — Reviews plan quality before execution
39
+ - gsd-debugger — Diagnoses and fixes issues
40
+ - gsd-codebase-mapper — Maps project structure and dependencies
41
+ - gsd-integration-checker — Checks cross-phase integration
42
+ - gsd-nyquist-auditor — Validates verification coverage
43
+ - gsd-ui-researcher — Researches UI/UX approaches
44
+ - gsd-ui-checker — Reviews UI implementation quality
45
+ - gsd-ui-auditor — Audits UI against design requirements
46
+ </available_agent_types>
47
+
48
+ <process>
49
+
50
+ <step name="parse_args" priority="first">
51
+ Parse `$ARGUMENTS` before loading any context:
52
+
53
+ - First positional token → `PHASE_ARG`
54
+ - Optional `--wave N` → `WAVE_FILTER`
55
+ - Optional `--gaps-only` keeps its current meaning
56
+
57
+ If `--wave` is absent, preserve the current behavior of executing all incomplete waves in the phase.
58
+ </step>
59
+
60
+ <step name="initialize" priority="first">
61
+ Load all context in one call:
62
+
63
+ ```bash
64
+ INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init execute-phase "${PHASE_ARG}")
65
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
66
+ AGENT_SKILLS=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-executor 2>/dev/null)
67
+ ```
68
+
69
+ 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`.
70
+
71
+ **If `phase_found` is false:** Error — phase directory not found.
72
+ **If `plan_count` is 0:** Error — no plans found in phase.
73
+ **If `state_exists` is false but `.planning/` exists:** Offer reconstruct or continue.
74
+
75
+ When `parallelization` is false, plans within a wave execute sequentially.
76
+
77
+ **Runtime detection for Copilot:**
78
+ Check if the current runtime is Copilot by testing for the `@gsd-executor` agent pattern
79
+ or absence of the `Task()` subagent API. If running under Copilot, force sequential inline
80
+ execution regardless of the `parallelization` setting — Copilot's subagent completion
81
+ signals are unreliable (see `<runtime_compatibility>`). Set `COPILOT_SEQUENTIAL=true`
82
+ internally and skip the `execute_waves` step in favor of `check_interactive_mode`'s
83
+ inline path for each plan.
84
+
85
+ **REQUIRED — Sync chain flag with intent.** If user invoked manually (no `--auto`), clear the ephemeral chain flag from any previous interrupted `--auto` chain. This prevents stale `_auto_chain_active: true` from causing unwanted auto-advance. This does NOT touch `workflow.auto_advance` (the user's persistent settings preference). You MUST execute this bash block before any config reads:
86
+ ```bash
87
+ # REQUIRED: prevents stale auto-chain from previous --auto runs
88
+ if [[ ! "$ARGUMENTS" =~ --auto ]]; then
89
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active false 2>/dev/null
90
+ fi
91
+ ```
92
+ </step>
93
+
94
+ <step name="check_interactive_mode">
95
+ **Parse `--interactive` flag from $ARGUMENTS.**
96
+
97
+ **If `--interactive` flag present:** Switch to interactive execution mode.
98
+
99
+ Interactive mode executes plans sequentially **inline** (no subagent spawning) with user
100
+ checkpoints between tasks. The user can review, modify, or redirect work at any point.
101
+
102
+ **Interactive execution flow:**
103
+
104
+ 1. Load plan inventory as normal (discover_and_group_plans)
105
+ 2. For each plan (sequentially, ignoring wave grouping):
106
+
107
+ a. **Present the plan to the user:**
108
+ ```
109
+ ## Plan {plan_id}: {plan_name}
110
+
111
+ Objective: {from plan file}
112
+ Tasks: {task_count}
113
+
114
+ Options:
115
+ - Execute (proceed with all tasks)
116
+ - Review first (show task breakdown before starting)
117
+ - Skip (move to next plan)
118
+ - Stop (end execution, save progress)
119
+ ```
120
+
121
+ b. **If "Review first":** Read and display the full plan file. Ask again: Execute, Modify, Skip.
122
+
123
+ c. **If "Execute":** Read and follow `~/.claude/get-shit-done/workflows/execute-plan.md` **inline**
124
+ (do NOT spawn a subagent). Execute tasks one at a time.
125
+
126
+ d. **After each task:** Pause briefly. If the user intervenes (types anything), stop and address
127
+ their feedback before continuing. Otherwise proceed to next task.
128
+
129
+ e. **After plan complete:** Show results, commit, create SUMMARY.md, then present next plan.
130
+
131
+ 3. After all plans: proceed to verification (same as normal mode).
132
+
133
+ **Benefits of interactive mode:**
134
+ - No subagent overhead — dramatically lower token usage
135
+ - User catches mistakes early — saves costly verification cycles
136
+ - Maintains GSD's planning/tracking structure
137
+ - Best for: small phases, bug fixes, verification gaps, learning GSD
138
+
139
+ **Skip to handle_branching step** (interactive plans execute inline after grouping).
140
+ </step>
141
+
142
+ <step name="handle_branching">
143
+ Check `branching_strategy` from init:
144
+
145
+ **"none":** Skip, continue on current branch.
146
+
147
+ **"phase" or "milestone":** Use pre-computed `branch_name` from init:
148
+ ```bash
149
+ git checkout -b "$BRANCH_NAME" 2>/dev/null || git checkout "$BRANCH_NAME"
150
+ ```
151
+
152
+ All subsequent commits go to this branch. User handles merging.
153
+ </step>
154
+
155
+ <step name="validate_phase">
156
+ From init JSON: `phase_dir`, `plan_count`, `incomplete_count`.
157
+
158
+ Report: "Found {plan_count} plans in {phase_dir} ({incomplete_count} incomplete)"
159
+
160
+ **Update STATE.md for phase start:**
161
+ ```bash
162
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state begin-phase --phase "${PHASE_NUMBER}" --name "${PHASE_NAME}" --plans "${PLAN_COUNT}"
163
+ ```
164
+ This updates Status, Last Activity, Current focus, Current Position, and plan counts in STATE.md so frontmatter and body text reflect the active phase immediately.
165
+ </step>
166
+
167
+ <step name="discover_and_group_plans">
168
+ Load plan inventory with wave grouping in one call:
169
+
170
+ ```bash
171
+ PLAN_INDEX=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phase-plan-index "${PHASE_NUMBER}")
172
+ ```
173
+
174
+ Parse JSON for: `phase`, `plans[]` (each with `id`, `wave`, `autonomous`, `objective`, `files_modified`, `task_count`, `has_summary`), `waves` (map of wave number → plan IDs), `incomplete`, `has_checkpoints`.
175
+
176
+ **Filtering:** Skip plans where `has_summary: true`. If `--gaps-only`: also skip non-gap_closure plans. If `WAVE_FILTER` is set: also skip plans whose `wave` does not equal `WAVE_FILTER`.
177
+
178
+ **Wave safety check:** If `WAVE_FILTER` is set and there are still incomplete plans in any lower wave that match the current execution mode, STOP and tell the user to finish earlier waves first. Do not let Wave 2+ execute while prerequisite earlier-wave plans remain incomplete.
179
+
180
+ If all filtered: "No matching incomplete plans" → exit.
181
+
182
+ Report:
183
+ ```
184
+ ## Execution Plan
185
+
186
+ **Phase {X}: {Name}** — {total_plans} matching plans across {wave_count} wave(s)
187
+
188
+ {If WAVE_FILTER is set: `Wave filter active: executing only Wave {WAVE_FILTER}`.}
189
+
190
+ | Wave | Plans | What it builds |
191
+ |------|-------|----------------|
192
+ | 1 | 01-01, 01-02 | {from plan objectives, 3-8 words} |
193
+ | 2 | 01-03 | ... |
194
+ ```
195
+ </step>
196
+
197
+ <step name="execute_waves">
198
+ Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`, sequential if `false`.
199
+
200
+ **For each wave:**
201
+
202
+ 1. **Describe what's being built (BEFORE spawning):**
203
+
204
+ Read each plan's `<objective>`. Extract what's being built and why.
205
+
206
+ ```
207
+ ---
208
+ ## Wave {N}
209
+
210
+ **{Plan ID}: {Plan Name}**
211
+ {2-3 sentences: what this builds, technical approach, why it matters}
212
+
213
+ Spawning {count} agent(s)...
214
+ ---
215
+ ```
216
+
217
+ - Bad: "Executing terrain generation plan"
218
+ - Good: "Procedural terrain generator using Perlin noise — creates height maps, biome zones, and collision meshes. Required before vehicle physics can interact with ground."
219
+
220
+ 2. **Spawn executor agents:**
221
+
222
+ Pass paths only — executors read files themselves with their fresh context window.
223
+ For 200k models, this keeps orchestrator context lean (~10-15%).
224
+ For 1M+ models (Opus 4.6, Sonnet 4.6), richer context can be passed directly.
225
+
226
+ ```
227
+ Task(
228
+ subagent_type="gsd-executor",
229
+ model="{executor_model}",
230
+ isolation="worktree",
231
+ prompt="
232
+ <objective>
233
+ Execute plan {plan_number} of phase {phase_number}-{phase_name}.
234
+ Commit each task atomically. Create SUMMARY.md. Update STATE.md and ROADMAP.md.
235
+ </objective>
236
+
237
+ <parallel_execution>
238
+ You are running as a PARALLEL executor agent. Use --no-verify on all git
239
+ commits to avoid pre-commit hook contention with other agents. The
240
+ orchestrator validates hooks once after all agents complete.
241
+ For gsd-tools commits: add --no-verify flag.
242
+ For direct git commits: use git commit --no-verify -m "..."
243
+ </parallel_execution>
244
+
245
+ <execution_context>
246
+ @~/.claude/get-shit-done/workflows/execute-plan.md
247
+ @~/.claude/get-shit-done/templates/summary.md
248
+ @~/.claude/get-shit-done/references/checkpoints.md
249
+ @~/.claude/get-shit-done/references/tdd.md
250
+ </execution_context>
251
+
252
+ <files_to_read>
253
+ Read these files at execution start using the Read tool:
254
+ - {phase_dir}/{plan_file} (Plan)
255
+ - .planning/PROJECT.md (Project context — core value, requirements, evolution rules)
256
+ - .planning/STATE.md (State)
257
+ - .planning/config.json (Config, if exists)
258
+ - ./CLAUDE.md (Project instructions, if exists — follow project-specific guidelines and coding conventions)
259
+ - .claude/skills/ or .agents/skills/ (Project skills, if either exists — list skills, read SKILL.md for each, follow relevant rules during implementation)
260
+ </files_to_read>
261
+
262
+ ${AGENT_SKILLS}
263
+
264
+ <mcp_tools>
265
+ If CLAUDE.md or project instructions reference MCP tools (e.g. jCodeMunch, context7,
266
+ or other MCP servers), prefer those tools over Grep/Glob for code navigation when available.
267
+ MCP tools often save significant tokens by providing structured code indexes.
268
+ Check tool availability first — if MCP tools are not accessible, fall back to Grep/Glob.
269
+ </mcp_tools>
270
+
271
+ <success_criteria>
272
+ - [ ] All tasks executed
273
+ - [ ] Each task committed individually
274
+ - [ ] SUMMARY.md created in plan directory
275
+ - [ ] STATE.md updated with position and decisions
276
+ - [ ] ROADMAP.md updated with plan progress (via `roadmap update-plan-progress`)
277
+ </success_criteria>
278
+ "
279
+ )
280
+ ```
281
+
282
+ 3. **Wait for all agents in wave to complete.**
283
+
284
+ **Completion signal fallback (Copilot and runtimes where Task() may not return):**
285
+
286
+ If a spawned agent does not return a completion signal but appears to have finished
287
+ its work, do NOT block indefinitely. Instead, verify completion via spot-checks:
288
+
289
+ ```bash
290
+ # For each plan in this wave, check if the executor finished:
291
+ SUMMARY_EXISTS=$(test -f "{phase_dir}/{plan_number}-{plan_padded}-SUMMARY.md" && echo "true" || echo "false")
292
+ COMMITS_FOUND=$(git log --oneline --all --grep="{phase_number}-{plan_padded}" --since="1 hour ago" | head -1)
293
+ ```
294
+
295
+ **If SUMMARY.md exists AND commits are found:** The agent completed successfully —
296
+ treat as done and proceed to step 4. Log: `"✓ {Plan ID} completed (verified via spot-check — completion signal not received)"`
297
+
298
+ **If SUMMARY.md does NOT exist after a reasonable wait:** The agent may still be
299
+ running or may have failed silently. Check `git log --oneline -5` for recent
300
+ activity. If commits are still appearing, wait longer. If no activity, report
301
+ the plan as failed and route to the failure handler in step 5.
302
+
303
+ **This fallback applies automatically to all runtimes.** Claude Code's Task() normally
304
+ returns synchronously, but the fallback ensures resilience if it doesn't.
305
+
306
+ 4. **Post-wave hook validation (parallel mode only):**
307
+
308
+ When agents committed with `--no-verify`, run pre-commit hooks once after the wave:
309
+ ```bash
310
+ # Run project's pre-commit hooks on the current state
311
+ git diff --cached --quiet || git stash # stash any unstaged changes
312
+ git hook run pre-commit 2>&1 || echo "⚠ Pre-commit hooks failed — review before continuing"
313
+ ```
314
+ If hooks fail: report the failure and ask "Fix hook issues now?" or "Continue to next wave?"
315
+
316
+ 5. **Report completion — spot-check claims first:**
317
+
318
+ For each SUMMARY.md:
319
+ - Verify first 2 files from `key-files.created` exist on disk
320
+ - Check `git log --oneline --all --grep="{phase}-{plan}"` returns ≥1 commit
321
+ - Check for `## Self-Check: FAILED` marker
322
+
323
+ If ANY spot-check fails: report which plan failed, route to failure handler — ask "Retry plan?" or "Continue with remaining waves?"
324
+
325
+ If pass:
326
+ ```
327
+ ---
328
+ ## Wave {N} Complete
329
+
330
+ **{Plan ID}: {Plan Name}**
331
+ {What was built — from SUMMARY.md}
332
+ {Notable deviations, if any}
333
+
334
+ {If more waves: what this enables for next wave}
335
+ ---
336
+ ```
337
+
338
+ - Bad: "Wave 2 complete. Proceeding to Wave 3."
339
+ - Good: "Terrain system complete — 3 biome types, height-based texturing, physics collision meshes. Vehicle physics (Wave 3) can now reference ground surfaces."
340
+
341
+ 5. **Handle failures:**
342
+
343
+ **Known Claude Code bug (classifyHandoffIfNeeded):** If an agent reports "failed" with error containing `classifyHandoffIfNeeded is not defined`, this is a Claude Code runtime bug — not a GSD or agent issue. The error fires in the completion handler AFTER all tool calls finish. In this case: run the same spot-checks as step 4 (SUMMARY.md exists, git commits present, no Self-Check: FAILED). If spot-checks PASS → treat as **successful**. If spot-checks FAIL → treat as real failure below.
344
+
345
+ For real failures: report which plan failed → ask "Continue?" or "Stop?" → if continue, dependent plans may also fail. If stop, partial completion report.
346
+
347
+ 5b. **Pre-wave dependency check (waves 2+ only):**
348
+
349
+ Before spawning wave N+1, for each plan in the upcoming wave:
350
+ ```bash
351
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" verify key-links {phase_dir}/{plan}-PLAN.md
352
+ ```
353
+
354
+ If any key-link from a PRIOR wave's artifact fails verification:
355
+
356
+ ## Cross-Plan Wiring Gap
357
+
358
+ | Plan | Link | From | Expected Pattern | Status |
359
+ |------|------|------|-----------------|--------|
360
+ | {plan} | {via} | {from} | {pattern} | NOT FOUND |
361
+
362
+ Wave {N} artifacts may not be properly wired. Options:
363
+ 1. Investigate and fix before continuing
364
+ 2. Continue (may cause cascading failures in wave {N+1})
365
+
366
+ Key-links referencing files in the CURRENT (upcoming) wave are skipped.
367
+
368
+ 6. **Execute checkpoint plans between waves** — see `<checkpoint_handling>`.
369
+
370
+ 7. **Proceed to next wave.**
371
+ </step>
372
+
373
+ <step name="checkpoint_handling">
374
+ Plans with `autonomous: false` require user interaction.
375
+
376
+ **Auto-mode checkpoint handling:**
377
+
378
+ Read auto-advance config (chain flag + user preference):
379
+ ```bash
380
+ AUTO_CHAIN=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false")
381
+ AUTO_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
382
+ ```
383
+
384
+ When executor returns a checkpoint AND (`AUTO_CHAIN` is `"true"` OR `AUTO_CFG` is `"true"`):
385
+ - **human-verify** → Auto-spawn continuation agent with `{user_response}` = `"approved"`. Log `⚡ Auto-approved checkpoint`.
386
+ - **decision** → Auto-spawn continuation agent with `{user_response}` = first option from checkpoint details. Log `⚡ Auto-selected: [option]`.
387
+ - **human-action** → Present to user (existing behavior below). Auth gates cannot be automated.
388
+
389
+ **Standard flow (not auto-mode, or human-action type):**
390
+
391
+ 1. Spawn agent for checkpoint plan
392
+ 2. Agent runs until checkpoint task or auth gate → returns structured state
393
+ 3. Agent return includes: completed tasks table, current task + blocker, checkpoint type/details, what's awaited
394
+ 4. **Present to user:**
395
+ ```
396
+ ## Checkpoint: [Type]
397
+
398
+ **Plan:** 03-03 Dashboard Layout
399
+ **Progress:** 2/3 tasks complete
400
+
401
+ [Checkpoint Details from agent return]
402
+ [Awaiting section from agent return]
403
+ ```
404
+ 5. User responds: "approved"/"done" | issue description | decision selection
405
+ 6. **Spawn continuation agent (NOT resume)** using continuation-prompt.md template:
406
+ - `{completed_tasks_table}`: From checkpoint return
407
+ - `{resume_task_number}` + `{resume_task_name}`: Current task
408
+ - `{user_response}`: What user provided
409
+ - `{resume_instructions}`: Based on checkpoint type
410
+ 7. Continuation agent verifies previous commits, continues from resume point
411
+ 8. Repeat until plan completes or user stops
412
+
413
+ **Why fresh agent, not resume:** Resume relies on internal serialization that breaks with parallel tool calls. Fresh agents with explicit state are more reliable.
414
+
415
+ **Checkpoints in parallel waves:** Agent pauses and returns while other parallel agents may complete. Present checkpoint, spawn continuation, wait for all before next wave.
416
+ </step>
417
+
418
+ <step name="aggregate_results">
419
+ After all waves:
420
+
421
+ ```markdown
422
+ ## Phase {X}: {Name} Execution Complete
423
+
424
+ **Waves:** {N} | **Plans:** {M}/{total} complete
425
+
426
+ | Wave | Plans | Status |
427
+ |------|-------|--------|
428
+ | 1 | plan-01, plan-02 | ✓ Complete |
429
+ | CP | plan-03 | ✓ Verified |
430
+ | 2 | plan-04 | ✓ Complete |
431
+
432
+ ### Plan Details
433
+ 1. **03-01**: [one-liner from SUMMARY.md]
434
+ 2. **03-02**: [one-liner from SUMMARY.md]
435
+
436
+ ### Issues Encountered
437
+ [Aggregate from SUMMARYs, or "None"]
438
+ ```
439
+ </step>
440
+
441
+ <step name="handle_partial_wave_execution">
442
+ If `WAVE_FILTER` was used, re-run plan discovery after execution:
443
+
444
+ ```bash
445
+ POST_PLAN_INDEX=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phase-plan-index "${PHASE_NUMBER}")
446
+ ```
447
+
448
+ Apply the same "incomplete" filtering rules as earlier:
449
+ - ignore plans with `has_summary: true`
450
+ - if `--gaps-only`, only consider `gap_closure: true` plans
451
+
452
+ **If incomplete plans still remain anywhere in the phase:**
453
+ - STOP here
454
+ - Do NOT run phase verification
455
+ - Do NOT mark the phase complete in ROADMAP/STATE
456
+ - Present:
457
+
458
+ ```markdown
459
+ ## Wave {WAVE_FILTER} Complete
460
+
461
+ Selected wave finished successfully. This phase still has incomplete plans, so phase-level verification and completion were intentionally skipped.
462
+
463
+ /gsd:execute-phase {phase} ${GSD_WS} # Continue remaining waves
464
+ /gsd:execute-phase {phase} --wave {next} ${GSD_WS} # Run the next wave explicitly
465
+ ```
466
+
467
+ **If no incomplete plans remain after the selected wave finishes:**
468
+ - continue with the normal phase-level verification and completion flow below
469
+ - this means the selected wave happened to be the last remaining work in the phase
470
+ </step>
471
+
472
+ <step name="close_parent_artifacts">
473
+ **For decimal/polish phases only (X.Y pattern):** Close the feedback loop by resolving parent UAT and debug artifacts.
474
+
475
+ **Skip if** phase number has no decimal (e.g., `3`, `04`) — only applies to gap-closure phases like `4.1`, `03.1`.
476
+
477
+ **1. Detect decimal phase and derive parent:**
478
+ ```bash
479
+ # Check if phase_number contains a decimal
480
+ if [[ "$PHASE_NUMBER" == *.* ]]; then
481
+ PARENT_PHASE="${PHASE_NUMBER%%.*}"
482
+ fi
483
+ ```
484
+
485
+ **2. Find parent UAT file:**
486
+ ```bash
487
+ PARENT_INFO=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" find-phase "${PARENT_PHASE}" --raw)
488
+ # Extract directory from PARENT_INFO JSON, then find UAT file in that directory
489
+ ```
490
+
491
+ **If no parent UAT found:** Skip this step (gap-closure may have been triggered by VERIFICATION.md instead).
492
+
493
+ **3. Update UAT gap statuses:**
494
+
495
+ Read the parent UAT file's `## Gaps` section. For each gap entry with `status: failed`:
496
+ - Update to `status: resolved`
497
+
498
+ **4. Update UAT frontmatter:**
499
+
500
+ If all gaps now have `status: resolved`:
501
+ - Update frontmatter `status: diagnosed` → `status: resolved`
502
+ - Update frontmatter `updated:` timestamp
503
+
504
+ **5. Resolve referenced debug sessions:**
505
+
506
+ For each gap that has a `debug_session:` field:
507
+ - Read the debug session file
508
+ - Update frontmatter `status:` → `resolved`
509
+ - Update frontmatter `updated:` timestamp
510
+ - Move to resolved directory:
511
+ ```bash
512
+ mkdir -p .planning/debug/resolved
513
+ mv .planning/debug/{slug}.md .planning/debug/resolved/
514
+ ```
515
+
516
+ **6. Commit updated artifacts:**
517
+ ```bash
518
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(phase-${PARENT_PHASE}): resolve UAT gaps and debug sessions after ${PHASE_NUMBER} gap closure" --files .planning/phases/*${PARENT_PHASE}*/*-UAT.md .planning/debug/resolved/*.md
519
+ ```
520
+ </step>
521
+
522
+ <step name="regression_gate">
523
+ Run prior phases' test suites to catch cross-phase regressions BEFORE verification.
524
+
525
+ **Skip if:** This is the first phase (no prior phases), or no prior VERIFICATION.md files exist.
526
+
527
+ **Step 1: Discover prior phases' test files**
528
+ ```bash
529
+ # Find all VERIFICATION.md files from prior phases in current milestone
530
+ PRIOR_VERIFICATIONS=$(find .planning/phases/ -name "*-VERIFICATION.md" ! -path "*${PHASE_NUMBER}*" 2>/dev/null)
531
+ ```
532
+
533
+ **Step 2: Extract test file lists from prior verifications**
534
+
535
+ For each VERIFICATION.md found, look for test file references:
536
+ - Lines containing `test`, `spec`, or `__tests__` paths
537
+ - The "Test Suite" or "Automated Checks" section
538
+ - File patterns from `key-files.created` in corresponding SUMMARY.md files that match `*.test.*` or `*.spec.*`
539
+
540
+ Collect all unique test file paths into `REGRESSION_FILES`.
541
+
542
+ **Step 3: Run regression tests (if any found)**
543
+
544
+ ```bash
545
+ # Detect test runner and run prior phase tests
546
+ if [ -f "package.json" ]; then
547
+ # Node.js — use project's test runner
548
+ npx jest ${REGRESSION_FILES} --passWithNoTests --no-coverage -q 2>&1 || npx vitest run ${REGRESSION_FILES} 2>&1
549
+ elif [ -f "Cargo.toml" ]; then
550
+ cargo test 2>&1
551
+ elif [ -f "requirements.txt" ] || [ -f "pyproject.toml" ]; then
552
+ python -m pytest ${REGRESSION_FILES} -q --tb=short 2>&1
553
+ fi
554
+ ```
555
+
556
+ **Step 4: Report results**
557
+
558
+ If all tests pass:
559
+ ```
560
+ ✓ Regression gate: {N} prior-phase test files passed — no regressions detected
561
+ ```
562
+ → Proceed to verify_phase_goal
563
+
564
+ If any tests fail:
565
+ ```
566
+ ## ⚠ Cross-Phase Regression Detected
567
+
568
+ Phase {X} execution may have broken functionality from prior phases.
569
+
570
+ | Test File | Phase | Status | Detail |
571
+ |-----------|-------|--------|--------|
572
+ | {file} | {origin_phase} | FAILED | {first_failure_line} |
573
+
574
+ Options:
575
+ 1. Fix regressions before verification (recommended)
576
+ 2. Continue to verification anyway (regressions will compound)
577
+ 3. Abort phase — roll back and re-plan
578
+ ```
579
+
580
+ Use AskUserQuestion to present the options.
581
+ </step>
582
+
583
+ <step name="verify_phase_goal">
584
+ Verify phase achieved its GOAL, not just completed tasks.
585
+
586
+ ```bash
587
+ VERIFIER_SKILLS=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-verifier 2>/dev/null)
588
+ ```
589
+
590
+ ```
591
+ Task(
592
+ prompt="Verify phase {phase_number} goal achievement.
593
+ Phase directory: {phase_dir}
594
+ Phase goal: {goal from ROADMAP.md}
595
+ Phase requirement IDs: {phase_req_ids}
596
+ Check must_haves against actual codebase.
597
+ Cross-reference requirement IDs from PLAN frontmatter against REQUIREMENTS.md — every ID MUST be accounted for.
598
+ Create VERIFICATION.md.
599
+ ${VERIFIER_SKILLS}",
600
+ subagent_type="gsd-verifier",
601
+ model="{verifier_model}"
602
+ )
603
+ ```
604
+
605
+ Read status:
606
+ ```bash
607
+ grep "^status:" "$PHASE_DIR"/*-VERIFICATION.md | cut -d: -f2 | tr -d ' '
608
+ ```
609
+
610
+ | Status | Action |
611
+ |--------|--------|
612
+ | `passed` | → update_roadmap |
613
+ | `human_needed` | Present items for human testing, get approval or feedback |
614
+ | `gaps_found` | Present gap summary, offer `/gsd:plan-phase {phase} --gaps ${GSD_WS}` |
615
+
616
+ **If human_needed:**
617
+
618
+ **Step A: Persist human verification items as UAT file.**
619
+
620
+ Create `{phase_dir}/{phase_num}-HUMAN-UAT.md` using UAT template format:
621
+
622
+ ```markdown
623
+ ---
624
+ status: partial
625
+ phase: {phase_num}-{phase_name}
626
+ source: [{phase_num}-VERIFICATION.md]
627
+ started: [now ISO]
628
+ updated: [now ISO]
629
+ ---
630
+
631
+ ## Current Test
632
+
633
+ [awaiting human testing]
634
+
635
+ ## Tests
636
+
637
+ {For each human_verification item from VERIFICATION.md:}
638
+
639
+ ### {N}. {item description}
640
+ expected: {expected behavior from VERIFICATION.md}
641
+ result: [pending]
642
+
643
+ ## Summary
644
+
645
+ total: {count}
646
+ passed: 0
647
+ issues: 0
648
+ pending: {count}
649
+ skipped: 0
650
+ blocked: 0
651
+
652
+ ## Gaps
653
+ ```
654
+
655
+ Commit the file:
656
+ ```bash
657
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "test({phase_num}): persist human verification items as UAT" --files "{phase_dir}/{phase_num}-HUMAN-UAT.md"
658
+ ```
659
+
660
+ **Step B: Present to user:**
661
+
662
+ ```
663
+ ## ✓ Phase {X}: {Name} — Human Verification Required
664
+
665
+ All automated checks passed. {N} items need human testing:
666
+
667
+ {From VERIFICATION.md human_verification section}
668
+
669
+ Items saved to `{phase_num}-HUMAN-UAT.md` — they will appear in `/gsd:progress` and `/gsd:audit-uat`.
670
+
671
+ "approved" → continue | Report issues → gap closure
672
+ ```
673
+
674
+ **If user says "approved":** Proceed to `update_roadmap`. The HUMAN-UAT.md file persists with `status: partial` and will surface in future progress checks until the user runs `/gsd:verify-work` on it.
675
+
676
+ **If user reports issues:** Proceed to gap closure as currently implemented.
677
+
678
+ **If gaps_found:**
679
+ ```
680
+ ## ⚠ Phase {X}: {Name} — Gaps Found
681
+
682
+ **Score:** {N}/{M} must-haves verified
683
+ **Report:** {phase_dir}/{phase_num}-VERIFICATION.md
684
+
685
+ ### What's Missing
686
+ {Gap summaries from VERIFICATION.md}
687
+
688
+ ---
689
+ ## ▶ Next Up
690
+
691
+ `/gsd:plan-phase {X} --gaps ${GSD_WS}`
692
+
693
+ <sub>`/clear` first → fresh context window</sub>
694
+
695
+ Also: `cat {phase_dir}/{phase_num}-VERIFICATION.md` — full report
696
+ Also: `/gsd:verify-work {X} ${GSD_WS}` — manual testing first
697
+ ```
698
+
699
+ Gap closure cycle: `/gsd:plan-phase {X} --gaps ${GSD_WS}` reads VERIFICATION.md → creates gap plans with `gap_closure: true` → user runs `/gsd:execute-phase {X} --gaps-only ${GSD_WS}` → verifier re-runs.
700
+ </step>
701
+
702
+ <step name="update_roadmap">
703
+ **Mark phase complete and update all tracking files:**
704
+
705
+ ```bash
706
+ COMPLETION=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phase complete "${PHASE_NUMBER}")
707
+ ```
708
+
709
+ The CLI handles:
710
+ - Marking phase checkbox `[x]` with completion date
711
+ - Updating Progress table (Status → Complete, date)
712
+ - Updating plan count to final
713
+ - Advancing STATE.md to next phase
714
+ - Updating REQUIREMENTS.md traceability
715
+ - Scanning for verification debt (returns `warnings` array)
716
+
717
+ Extract from result: `next_phase`, `next_phase_name`, `is_last_phase`, `warnings`, `has_warnings`.
718
+
719
+ **If has_warnings is true:**
720
+ ```
721
+ ## Phase {X} marked complete with {N} warnings:
722
+
723
+ {list each warning}
724
+
725
+ These items are tracked and will appear in `/gsd:progress` and `/gsd:audit-uat`.
726
+ ```
727
+
728
+ ```bash
729
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(phase-{X}): complete phase execution" --files .planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md {phase_dir}/*-VERIFICATION.md
730
+ ```
731
+ </step>
732
+
733
+ <step name="update_project_md">
734
+ **Evolve PROJECT.md to reflect phase completion (prevents planning document drift — #956):**
735
+
736
+ PROJECT.md tracks validated requirements, decisions, and current state. Without this step,
737
+ PROJECT.md falls behind silently over multiple phases.
738
+
739
+ 1. Read `.planning/PROJECT.md`
740
+ 2. If the file exists and has a `## Validated Requirements` or `## Requirements` section:
741
+ - Move any requirements validated by this phase from Active → Validated
742
+ - Add a brief note: `Validated in Phase {X}: {Name}`
743
+ 3. If the file has a `## Current State` or similar section:
744
+ - Update it to reflect this phase's completion (e.g., "Phase {X} complete — {one-liner}")
745
+ 4. Update the `Last updated:` footer to today's date
746
+ 5. Commit the change:
747
+
748
+ ```bash
749
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(phase-{X}): evolve PROJECT.md after phase completion" --files .planning/PROJECT.md
750
+ ```
751
+
752
+ **Skip this step if** `.planning/PROJECT.md` does not exist.
753
+ </step>
754
+
755
+ <step name="offer_next">
756
+
757
+ **Exception:** If `gaps_found`, the `verify_phase_goal` step already presents the gap-closure path (`/gsd:plan-phase {X} --gaps`). No additional routing needed — skip auto-advance.
758
+
759
+ **No-transition check (spawned by auto-advance chain):**
760
+
761
+ Parse `--no-transition` flag from $ARGUMENTS.
762
+
763
+ **If `--no-transition` flag present:**
764
+
765
+ Execute-phase was spawned by plan-phase's auto-advance. Do NOT run transition.md.
766
+ After verification passes and roadmap is updated, return completion status to parent:
767
+
768
+ ```
769
+ ## PHASE COMPLETE
770
+
771
+ Phase: ${PHASE_NUMBER} - ${PHASE_NAME}
772
+ Plans: ${completed_count}/${total_count}
773
+ Verification: {Passed | Gaps Found}
774
+
775
+ [Include aggregate_results output]
776
+ ```
777
+
778
+ STOP. Do not proceed to auto-advance or transition.
779
+
780
+ **If `--no-transition` flag is NOT present:**
781
+
782
+ **Auto-advance detection:**
783
+
784
+ 1. Parse `--auto` flag from $ARGUMENTS
785
+ 2. Read both the chain flag and user preference (chain flag already synced in init step):
786
+ ```bash
787
+ AUTO_CHAIN=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false")
788
+ AUTO_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
789
+ ```
790
+
791
+ **If `--auto` flag present OR `AUTO_CHAIN` is true OR `AUTO_CFG` is true (AND verification passed with no gaps):**
792
+
793
+ ```
794
+ ╔══════════════════════════════════════════╗
795
+ ║ AUTO-ADVANCING → TRANSITION ║
796
+ ║ Phase {X} verified, continuing chain ║
797
+ ╚══════════════════════════════════════════╝
798
+ ```
799
+
800
+ Execute the transition workflow inline (do NOT use Task — orchestrator context is ~10-15%, transition needs phase completion data already in context):
801
+
802
+ Read and follow `~/.claude/get-shit-done/workflows/transition.md`, passing through the `--auto` flag so it propagates to the next phase invocation.
803
+
804
+ **If none of `--auto`, `AUTO_CHAIN`, or `AUTO_CFG` is true:**
805
+
806
+ **STOP. Do not auto-advance. Do not execute transition. Do not plan next phase. Present options to the user and wait.**
807
+
808
+ **IMPORTANT: There is NO `/gsd:transition` command. Never suggest it. The transition workflow is internal only.**
809
+
810
+ ```
811
+ ## ✓ Phase {X}: {Name} Complete
812
+
813
+ /gsd:progress ${GSD_WS} — see updated roadmap
814
+ /gsd:discuss-phase {next} ${GSD_WS} — discuss next phase before planning
815
+ /gsd:plan-phase {next} ${GSD_WS} — plan next phase
816
+ /gsd:execute-phase {next} ${GSD_WS} — execute next phase
817
+ ```
818
+
819
+ Only suggest the commands listed above. Do not invent or hallucinate command names.
820
+ </step>
821
+
822
+ </process>
823
+
824
+ <context_efficiency>
825
+ Orchestrator: ~10-15% context for 200k windows, can use more for 1M+ windows.
826
+ Subagents: fresh context each (200k-1M depending on model). No polling (Task blocks). No context bleed.
827
+
828
+ For 1M+ context models, consider:
829
+ - Passing richer context (code snippets, dependency outputs) directly to executors instead of just file paths
830
+ - Running small phases (≤3 plans, no dependencies) inline without subagent spawning overhead
831
+ - Relaxing /clear recommendations — context rot onset is much further out with 5x window
832
+ </context_efficiency>
833
+
834
+ <failure_handling>
835
+ - **classifyHandoffIfNeeded false failure:** Agent reports "failed" but error is `classifyHandoffIfNeeded is not defined` → Claude Code bug, not GSD. Spot-check (SUMMARY exists, commits present) → if pass, treat as success
836
+ - **Agent fails mid-plan:** Missing SUMMARY.md → report, ask user how to proceed
837
+ - **Dependency chain breaks:** Wave 1 fails → Wave 2 dependents likely fail → user chooses attempt or skip
838
+ - **All agents in wave fail:** Systemic issue → stop, report for investigation
839
+ - **Checkpoint unresolvable:** "Skip this plan?" or "Abort phase execution?" → record partial progress in STATE.md
840
+ </failure_handling>
841
+
842
+ <resumption>
843
+ Re-run `/gsd:execute-phase {phase}` → discover_plans finds completed SUMMARYs → skips them → resumes from first incomplete plan → continues wave execution.
844
+
845
+ STATE.md tracks: last completed plan, current wave, pending checkpoints.
846
+ </resumption>