gsd-codex-cli 1.20.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 (160) hide show
  1. package/.codex/prompts/gsd-add-phase.md +44 -0
  2. package/.codex/prompts/gsd-add-todo.md +43 -0
  3. package/.codex/prompts/gsd-audit-milestone.md +43 -0
  4. package/.codex/prompts/gsd-check-todos.md +43 -0
  5. package/.codex/prompts/gsd-complete-milestone.md +43 -0
  6. package/.codex/prompts/gsd-debug.md +46 -0
  7. package/.codex/prompts/gsd-discuss-phase.md +43 -0
  8. package/.codex/prompts/gsd-execute-phase.md +43 -0
  9. package/.codex/prompts/gsd-help.md +43 -0
  10. package/.codex/prompts/gsd-insert-phase.md +43 -0
  11. package/.codex/prompts/gsd-list-phase-assumptions.md +43 -0
  12. package/.codex/prompts/gsd-map-codebase.md +43 -0
  13. package/.codex/prompts/gsd-new-milestone.md +43 -0
  14. package/.codex/prompts/gsd-new-project.md +43 -0
  15. package/.codex/prompts/gsd-pause-work.md +43 -0
  16. package/.codex/prompts/gsd-plan-milestone-gaps.md +43 -0
  17. package/.codex/prompts/gsd-plan-phase.md +43 -0
  18. package/.codex/prompts/gsd-progress.md +43 -0
  19. package/.codex/prompts/gsd-quick.md +43 -0
  20. package/.codex/prompts/gsd-remove-phase.md +43 -0
  21. package/.codex/prompts/gsd-research-phase.md +43 -0
  22. package/.codex/prompts/gsd-resume-work.md +43 -0
  23. package/.codex/prompts/gsd-set-profile.md +43 -0
  24. package/.codex/prompts/gsd-settings.md +43 -0
  25. package/.codex/prompts/gsd-update.md +43 -0
  26. package/.codex/prompts/gsd-verify-work.md +43 -0
  27. package/.codex/skills/get-shit-done-codex/SKILL.md +65 -0
  28. package/.codex/skills/get-shit-done-codex/references/compat.md +32 -0
  29. package/.codex/skills/get-shit-done-codex/references/windows.md +23 -0
  30. package/CHANGELOG.md +1434 -0
  31. package/LICENSE +21 -0
  32. package/README.md +690 -0
  33. package/agents/gsd-codebase-mapper.md +761 -0
  34. package/agents/gsd-debugger.md +1198 -0
  35. package/agents/gsd-executor.md +419 -0
  36. package/agents/gsd-integration-checker.md +423 -0
  37. package/agents/gsd-phase-researcher.md +469 -0
  38. package/agents/gsd-plan-checker.md +622 -0
  39. package/agents/gsd-planner.md +1159 -0
  40. package/agents/gsd-project-researcher.md +618 -0
  41. package/agents/gsd-research-synthesizer.md +236 -0
  42. package/agents/gsd-roadmapper.md +639 -0
  43. package/agents/gsd-verifier.md +541 -0
  44. package/bin/install-codex.js +100 -0
  45. package/bin/install.js +1806 -0
  46. package/commands/gsd/add-phase.md +39 -0
  47. package/commands/gsd/add-todo.md +42 -0
  48. package/commands/gsd/audit-milestone.md +42 -0
  49. package/commands/gsd/check-todos.md +41 -0
  50. package/commands/gsd/cleanup.md +18 -0
  51. package/commands/gsd/complete-milestone.md +136 -0
  52. package/commands/gsd/debug.md +162 -0
  53. package/commands/gsd/discuss-phase.md +87 -0
  54. package/commands/gsd/execute-phase.md +42 -0
  55. package/commands/gsd/health.md +22 -0
  56. package/commands/gsd/help.md +22 -0
  57. package/commands/gsd/insert-phase.md +33 -0
  58. package/commands/gsd/join-discord.md +18 -0
  59. package/commands/gsd/list-phase-assumptions.md +50 -0
  60. package/commands/gsd/map-codebase.md +71 -0
  61. package/commands/gsd/new-milestone.md +51 -0
  62. package/commands/gsd/new-project.md +42 -0
  63. package/commands/gsd/pause-work.md +35 -0
  64. package/commands/gsd/plan-milestone-gaps.md +40 -0
  65. package/commands/gsd/plan-phase.md +44 -0
  66. package/commands/gsd/progress.md +24 -0
  67. package/commands/gsd/quick.md +40 -0
  68. package/commands/gsd/reapply-patches.md +110 -0
  69. package/commands/gsd/remove-phase.md +32 -0
  70. package/commands/gsd/research-phase.md +187 -0
  71. package/commands/gsd/resume-work.md +40 -0
  72. package/commands/gsd/set-profile.md +34 -0
  73. package/commands/gsd/settings.md +36 -0
  74. package/commands/gsd/update.md +37 -0
  75. package/commands/gsd/verify-work.md +39 -0
  76. package/get-shit-done/bin/gsd-tools.cjs +5243 -0
  77. package/get-shit-done/bin/gsd-tools.test.cjs +2273 -0
  78. package/get-shit-done/references/checkpoints.md +775 -0
  79. package/get-shit-done/references/continuation-format.md +249 -0
  80. package/get-shit-done/references/decimal-phase-calculation.md +65 -0
  81. package/get-shit-done/references/git-integration.md +248 -0
  82. package/get-shit-done/references/git-planning-commit.md +38 -0
  83. package/get-shit-done/references/model-profile-resolution.md +34 -0
  84. package/get-shit-done/references/model-profiles.md +92 -0
  85. package/get-shit-done/references/phase-argument-parsing.md +61 -0
  86. package/get-shit-done/references/planning-config.md +196 -0
  87. package/get-shit-done/references/questioning.md +145 -0
  88. package/get-shit-done/references/tdd.md +263 -0
  89. package/get-shit-done/references/ui-brand.md +160 -0
  90. package/get-shit-done/references/verification-patterns.md +612 -0
  91. package/get-shit-done/templates/DEBUG.md +159 -0
  92. package/get-shit-done/templates/UAT.md +247 -0
  93. package/get-shit-done/templates/codebase/architecture.md +255 -0
  94. package/get-shit-done/templates/codebase/concerns.md +310 -0
  95. package/get-shit-done/templates/codebase/conventions.md +307 -0
  96. package/get-shit-done/templates/codebase/integrations.md +280 -0
  97. package/get-shit-done/templates/codebase/stack.md +186 -0
  98. package/get-shit-done/templates/codebase/structure.md +285 -0
  99. package/get-shit-done/templates/codebase/testing.md +480 -0
  100. package/get-shit-done/templates/config.json +36 -0
  101. package/get-shit-done/templates/context.md +283 -0
  102. package/get-shit-done/templates/continue-here.md +78 -0
  103. package/get-shit-done/templates/debug-subagent-prompt.md +91 -0
  104. package/get-shit-done/templates/discovery.md +146 -0
  105. package/get-shit-done/templates/milestone-archive.md +123 -0
  106. package/get-shit-done/templates/milestone.md +115 -0
  107. package/get-shit-done/templates/phase-prompt.md +567 -0
  108. package/get-shit-done/templates/planner-subagent-prompt.md +117 -0
  109. package/get-shit-done/templates/project.md +184 -0
  110. package/get-shit-done/templates/requirements.md +231 -0
  111. package/get-shit-done/templates/research-project/ARCHITECTURE.md +204 -0
  112. package/get-shit-done/templates/research-project/FEATURES.md +147 -0
  113. package/get-shit-done/templates/research-project/PITFALLS.md +200 -0
  114. package/get-shit-done/templates/research-project/STACK.md +120 -0
  115. package/get-shit-done/templates/research-project/SUMMARY.md +170 -0
  116. package/get-shit-done/templates/research.md +552 -0
  117. package/get-shit-done/templates/roadmap.md +202 -0
  118. package/get-shit-done/templates/state.md +176 -0
  119. package/get-shit-done/templates/summary-complex.md +59 -0
  120. package/get-shit-done/templates/summary-minimal.md +41 -0
  121. package/get-shit-done/templates/summary-standard.md +48 -0
  122. package/get-shit-done/templates/summary.md +246 -0
  123. package/get-shit-done/templates/user-setup.md +311 -0
  124. package/get-shit-done/templates/verification-report.md +322 -0
  125. package/get-shit-done/workflows/add-phase.md +111 -0
  126. package/get-shit-done/workflows/add-todo.md +157 -0
  127. package/get-shit-done/workflows/audit-milestone.md +242 -0
  128. package/get-shit-done/workflows/check-todos.md +176 -0
  129. package/get-shit-done/workflows/cleanup.md +152 -0
  130. package/get-shit-done/workflows/complete-milestone.md +674 -0
  131. package/get-shit-done/workflows/diagnose-issues.md +219 -0
  132. package/get-shit-done/workflows/discovery-phase.md +289 -0
  133. package/get-shit-done/workflows/discuss-phase.md +485 -0
  134. package/get-shit-done/workflows/execute-phase.md +408 -0
  135. package/get-shit-done/workflows/execute-plan.md +441 -0
  136. package/get-shit-done/workflows/health.md +156 -0
  137. package/get-shit-done/workflows/help.md +486 -0
  138. package/get-shit-done/workflows/insert-phase.md +129 -0
  139. package/get-shit-done/workflows/list-phase-assumptions.md +178 -0
  140. package/get-shit-done/workflows/map-codebase.md +327 -0
  141. package/get-shit-done/workflows/new-milestone.md +373 -0
  142. package/get-shit-done/workflows/new-project.md +1113 -0
  143. package/get-shit-done/workflows/pause-work.md +122 -0
  144. package/get-shit-done/workflows/plan-milestone-gaps.md +256 -0
  145. package/get-shit-done/workflows/plan-phase.md +448 -0
  146. package/get-shit-done/workflows/progress.md +393 -0
  147. package/get-shit-done/workflows/quick.md +444 -0
  148. package/get-shit-done/workflows/remove-phase.md +154 -0
  149. package/get-shit-done/workflows/research-phase.md +74 -0
  150. package/get-shit-done/workflows/resume-project.md +306 -0
  151. package/get-shit-done/workflows/set-profile.md +80 -0
  152. package/get-shit-done/workflows/settings.md +200 -0
  153. package/get-shit-done/workflows/transition.md +539 -0
  154. package/get-shit-done/workflows/update.md +214 -0
  155. package/get-shit-done/workflows/verify-phase.md +242 -0
  156. package/get-shit-done/workflows/verify-work.md +570 -0
  157. package/hooks/dist/gsd-check-update.js +62 -0
  158. package/hooks/dist/gsd-statusline.js +91 -0
  159. package/package.json +54 -0
  160. package/scripts/build-hooks.js +42 -0
@@ -0,0 +1,408 @@
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
+ <required_reading>
10
+ Read STATE.md before any operation to load project context.
11
+ </required_reading>
12
+
13
+ <process>
14
+
15
+ <step name="initialize" priority="first">
16
+ Load all context in one call:
17
+
18
+ ```bash
19
+ INIT=$(node ~/.claude/get-shit-done/bin/gsd-tools.cjs init execute-phase "${PHASE_ARG}")
20
+ ```
21
+
22
+ 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`.
23
+
24
+ **If `phase_found` is false:** Error — phase directory not found.
25
+ **If `plan_count` is 0:** Error — no plans found in phase.
26
+ **If `state_exists` is false but `.planning/` exists:** Offer reconstruct or continue.
27
+
28
+ When `parallelization` is false, plans within a wave execute sequentially.
29
+ </step>
30
+
31
+ <step name="handle_branching">
32
+ Check `branching_strategy` from init:
33
+
34
+ **"none":** Skip, continue on current branch.
35
+
36
+ **"phase" or "milestone":** Use pre-computed `branch_name` from init:
37
+ ```bash
38
+ git checkout -b "$BRANCH_NAME" 2>/dev/null || git checkout "$BRANCH_NAME"
39
+ ```
40
+
41
+ All subsequent commits go to this branch. User handles merging.
42
+ </step>
43
+
44
+ <step name="validate_phase">
45
+ From init JSON: `phase_dir`, `plan_count`, `incomplete_count`.
46
+
47
+ Report: "Found {plan_count} plans in {phase_dir} ({incomplete_count} incomplete)"
48
+ </step>
49
+
50
+ <step name="discover_and_group_plans">
51
+ Load plan inventory with wave grouping in one call:
52
+
53
+ ```bash
54
+ PLAN_INDEX=$(node ~/.claude/get-shit-done/bin/gsd-tools.cjs phase-plan-index "${PHASE_NUMBER}")
55
+ ```
56
+
57
+ 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`.
58
+
59
+ **Filtering:** Skip plans where `has_summary: true`. If `--gaps-only`: also skip non-gap_closure plans. If all filtered: "No matching incomplete plans" → exit.
60
+
61
+ Report:
62
+ ```
63
+ ## Execution Plan
64
+
65
+ **Phase {X}: {Name}** — {total_plans} plans across {wave_count} waves
66
+
67
+ | Wave | Plans | What it builds |
68
+ |------|-------|----------------|
69
+ | 1 | 01-01, 01-02 | {from plan objectives, 3-8 words} |
70
+ | 2 | 01-03 | ... |
71
+ ```
72
+ </step>
73
+
74
+ <step name="execute_waves">
75
+ Execute each wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`, sequential if `false`.
76
+
77
+ **For each wave:**
78
+
79
+ 1. **Describe what's being built (BEFORE spawning):**
80
+
81
+ Read each plan's `<objective>`. Extract what's being built and why.
82
+
83
+ ```
84
+ ---
85
+ ## Wave {N}
86
+
87
+ **{Plan ID}: {Plan Name}**
88
+ {2-3 sentences: what this builds, technical approach, why it matters}
89
+
90
+ Spawning {count} agent(s)...
91
+ ---
92
+ ```
93
+
94
+ - Bad: "Executing terrain generation plan"
95
+ - Good: "Procedural terrain generator using Perlin noise — creates height maps, biome zones, and collision meshes. Required before vehicle physics can interact with ground."
96
+
97
+ 2. **Spawn executor agents:**
98
+
99
+ Pass paths only — executors read files themselves with their fresh 200k context.
100
+ This keeps orchestrator context lean (~10-15%).
101
+
102
+ ```
103
+ Task(
104
+ subagent_type="gsd-executor",
105
+ model="{executor_model}",
106
+ prompt="
107
+ <objective>
108
+ Execute plan {plan_number} of phase {phase_number}-{phase_name}.
109
+ Commit each task atomically. Create SUMMARY.md. Update STATE.md.
110
+ </objective>
111
+
112
+ <execution_context>
113
+ @~/.claude/get-shit-done/workflows/execute-plan.md
114
+ @~/.claude/get-shit-done/templates/summary.md
115
+ @~/.claude/get-shit-done/references/checkpoints.md
116
+ @~/.claude/get-shit-done/references/tdd.md
117
+ </execution_context>
118
+
119
+ <files_to_read>
120
+ Read these files at execution start using the Read tool:
121
+ - Plan: {phase_dir}/{plan_file}
122
+ - State: .planning/STATE.md
123
+ - Config: .planning/config.json (if exists)
124
+ </files_to_read>
125
+
126
+ <success_criteria>
127
+ - [ ] All tasks executed
128
+ - [ ] Each task committed individually
129
+ - [ ] SUMMARY.md created in plan directory
130
+ - [ ] STATE.md updated with position and decisions
131
+ </success_criteria>
132
+ "
133
+ )
134
+ ```
135
+
136
+ 3. **Wait for all agents in wave to complete.**
137
+
138
+ 4. **Report completion — spot-check claims first:**
139
+
140
+ For each SUMMARY.md:
141
+ - Verify first 2 files from `key-files.created` exist on disk
142
+ - Check `git log --oneline --all --grep="{phase}-{plan}"` returns ≥1 commit
143
+ - Check for `## Self-Check: FAILED` marker
144
+
145
+ If ANY spot-check fails: report which plan failed, route to failure handler — ask "Retry plan?" or "Continue with remaining waves?"
146
+
147
+ If pass:
148
+ ```
149
+ ---
150
+ ## Wave {N} Complete
151
+
152
+ **{Plan ID}: {Plan Name}**
153
+ {What was built — from SUMMARY.md}
154
+ {Notable deviations, if any}
155
+
156
+ {If more waves: what this enables for next wave}
157
+ ---
158
+ ```
159
+
160
+ - Bad: "Wave 2 complete. Proceeding to Wave 3."
161
+ - Good: "Terrain system complete — 3 biome types, height-based texturing, physics collision meshes. Vehicle physics (Wave 3) can now reference ground surfaces."
162
+
163
+ 5. **Handle failures:**
164
+
165
+ **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.
166
+
167
+ For real failures: report which plan failed → ask "Continue?" or "Stop?" → if continue, dependent plans may also fail. If stop, partial completion report.
168
+
169
+ 6. **Execute checkpoint plans between waves** — see `<checkpoint_handling>`.
170
+
171
+ 7. **Proceed to next wave.**
172
+ </step>
173
+
174
+ <step name="checkpoint_handling">
175
+ Plans with `autonomous: false` require user interaction.
176
+
177
+ **Flow:**
178
+
179
+ 1. Spawn agent for checkpoint plan
180
+ 2. Agent runs until checkpoint task or auth gate → returns structured state
181
+ 3. Agent return includes: completed tasks table, current task + blocker, checkpoint type/details, what's awaited
182
+ 4. **Present to user:**
183
+ ```
184
+ ## Checkpoint: [Type]
185
+
186
+ **Plan:** 03-03 Dashboard Layout
187
+ **Progress:** 2/3 tasks complete
188
+
189
+ [Checkpoint Details from agent return]
190
+ [Awaiting section from agent return]
191
+ ```
192
+ 5. User responds: "approved"/"done" | issue description | decision selection
193
+ 6. **Spawn continuation agent (NOT resume)** using continuation-prompt.md template:
194
+ - `{completed_tasks_table}`: From checkpoint return
195
+ - `{resume_task_number}` + `{resume_task_name}`: Current task
196
+ - `{user_response}`: What user provided
197
+ - `{resume_instructions}`: Based on checkpoint type
198
+ 7. Continuation agent verifies previous commits, continues from resume point
199
+ 8. Repeat until plan completes or user stops
200
+
201
+ **Why fresh agent, not resume:** Resume relies on internal serialization that breaks with parallel tool calls. Fresh agents with explicit state are more reliable.
202
+
203
+ **Checkpoints in parallel waves:** Agent pauses and returns while other parallel agents may complete. Present checkpoint, spawn continuation, wait for all before next wave.
204
+ </step>
205
+
206
+ <step name="aggregate_results">
207
+ After all waves:
208
+
209
+ ```markdown
210
+ ## Phase {X}: {Name} Execution Complete
211
+
212
+ **Waves:** {N} | **Plans:** {M}/{total} complete
213
+
214
+ | Wave | Plans | Status |
215
+ |------|-------|--------|
216
+ | 1 | plan-01, plan-02 | ✓ Complete |
217
+ | CP | plan-03 | ✓ Verified |
218
+ | 2 | plan-04 | ✓ Complete |
219
+
220
+ ### Plan Details
221
+ 1. **03-01**: [one-liner from SUMMARY.md]
222
+ 2. **03-02**: [one-liner from SUMMARY.md]
223
+
224
+ ### Issues Encountered
225
+ [Aggregate from SUMMARYs, or "None"]
226
+ ```
227
+ </step>
228
+
229
+ <step name="close_parent_artifacts">
230
+ **For decimal/polish phases only (X.Y pattern):** Close the feedback loop by resolving parent UAT and debug artifacts.
231
+
232
+ **Skip if** phase number has no decimal (e.g., `3`, `04`) — only applies to gap-closure phases like `4.1`, `03.1`.
233
+
234
+ **1. Detect decimal phase and derive parent:**
235
+ ```bash
236
+ # Check if phase_number contains a decimal
237
+ if [[ "$PHASE_NUMBER" == *.* ]]; then
238
+ PARENT_PHASE="${PHASE_NUMBER%%.*}"
239
+ fi
240
+ ```
241
+
242
+ **2. Find parent UAT file:**
243
+ ```bash
244
+ PARENT_INFO=$(node ~/.claude/get-shit-done/bin/gsd-tools.cjs find-phase "${PARENT_PHASE}" --raw)
245
+ # Extract directory from PARENT_INFO JSON, then find UAT file in that directory
246
+ ```
247
+
248
+ **If no parent UAT found:** Skip this step (gap-closure may have been triggered by VERIFICATION.md instead).
249
+
250
+ **3. Update UAT gap statuses:**
251
+
252
+ Read the parent UAT file's `## Gaps` section. For each gap entry with `status: failed`:
253
+ - Update to `status: resolved`
254
+
255
+ **4. Update UAT frontmatter:**
256
+
257
+ If all gaps now have `status: resolved`:
258
+ - Update frontmatter `status: diagnosed` → `status: resolved`
259
+ - Update frontmatter `updated:` timestamp
260
+
261
+ **5. Resolve referenced debug sessions:**
262
+
263
+ For each gap that has a `debug_session:` field:
264
+ - Read the debug session file
265
+ - Update frontmatter `status:` → `resolved`
266
+ - Update frontmatter `updated:` timestamp
267
+ - Move to resolved directory:
268
+ ```bash
269
+ mkdir -p .planning/debug/resolved
270
+ mv .planning/debug/{slug}.md .planning/debug/resolved/
271
+ ```
272
+
273
+ **6. Commit updated artifacts:**
274
+ ```bash
275
+ node ~/.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
276
+ ```
277
+ </step>
278
+
279
+ <step name="verify_phase_goal">
280
+ Verify phase achieved its GOAL, not just completed tasks.
281
+
282
+ ```
283
+ Task(
284
+ prompt="Verify phase {phase_number} goal achievement.
285
+ Phase directory: {phase_dir}
286
+ Phase goal: {goal from ROADMAP.md}
287
+ Check must_haves against actual codebase. Create VERIFICATION.md.",
288
+ subagent_type="gsd-verifier",
289
+ model="{verifier_model}"
290
+ )
291
+ ```
292
+
293
+ Read status:
294
+ ```bash
295
+ grep "^status:" "$PHASE_DIR"/*-VERIFICATION.md | cut -d: -f2 | tr -d ' '
296
+ ```
297
+
298
+ | Status | Action |
299
+ |--------|--------|
300
+ | `passed` | → update_roadmap |
301
+ | `human_needed` | Present items for human testing, get approval or feedback |
302
+ | `gaps_found` | Present gap summary, offer `/gsd:plan-phase {phase} --gaps` |
303
+
304
+ **If human_needed:**
305
+ ```
306
+ ## ✓ Phase {X}: {Name} — Human Verification Required
307
+
308
+ All automated checks passed. {N} items need human testing:
309
+
310
+ {From VERIFICATION.md human_verification section}
311
+
312
+ "approved" → continue | Report issues → gap closure
313
+ ```
314
+
315
+ **If gaps_found:**
316
+ ```
317
+ ## ⚠ Phase {X}: {Name} — Gaps Found
318
+
319
+ **Score:** {N}/{M} must-haves verified
320
+ **Report:** {phase_dir}/{phase_num}-VERIFICATION.md
321
+
322
+ ### What's Missing
323
+ {Gap summaries from VERIFICATION.md}
324
+
325
+ ---
326
+ ## ▶ Next Up
327
+
328
+ `/gsd:plan-phase {X} --gaps`
329
+
330
+ <sub>`/clear` first → fresh context window</sub>
331
+
332
+ Also: `cat {phase_dir}/{phase_num}-VERIFICATION.md` — full report
333
+ Also: `/gsd:verify-work {X}` — manual testing first
334
+ ```
335
+
336
+ Gap closure cycle: `/gsd:plan-phase {X} --gaps` reads VERIFICATION.md → creates gap plans with `gap_closure: true` → user runs `/gsd:execute-phase {X} --gaps-only` → verifier re-runs.
337
+ </step>
338
+
339
+ <step name="update_roadmap">
340
+ **Mark phase complete and update all tracking files:**
341
+
342
+ ```bash
343
+ COMPLETION=$(node ~/.claude/get-shit-done/bin/gsd-tools.cjs phase complete "${PHASE_NUMBER}")
344
+ ```
345
+
346
+ The CLI handles:
347
+ - Marking phase checkbox `[x]` with completion date
348
+ - Updating Progress table (Status → Complete, date)
349
+ - Updating plan count to final
350
+ - Advancing STATE.md to next phase
351
+ - Updating REQUIREMENTS.md traceability
352
+
353
+ Extract from result: `next_phase`, `next_phase_name`, `is_last_phase`.
354
+
355
+ ```bash
356
+ node ~/.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 .planning/phases/{phase_dir}/*-VERIFICATION.md
357
+ ```
358
+ </step>
359
+
360
+ <step name="offer_next">
361
+
362
+ **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.
363
+
364
+ **Auto-advance detection:**
365
+
366
+ 1. Parse `--auto` flag from $ARGUMENTS
367
+ 2. Read `workflow.auto_advance` from config:
368
+ ```bash
369
+ AUTO_CFG=$(node ~/.claude/get-shit-done/bin/gsd-tools.cjs config-get workflow.auto_advance 2>/dev/null || echo "false")
370
+ ```
371
+
372
+ **If `--auto` flag present OR `AUTO_CFG` is true (AND verification passed with no gaps):**
373
+
374
+ ```
375
+ ╔══════════════════════════════════════════╗
376
+ ║ AUTO-ADVANCING → TRANSITION ║
377
+ ║ Phase {X} verified, continuing chain ║
378
+ ╚══════════════════════════════════════════╝
379
+ ```
380
+
381
+ Execute the transition workflow inline (do NOT use Task — orchestrator context is ~10-15%, transition needs phase completion data already in context):
382
+
383
+ Read and follow `~/.claude/get-shit-done/workflows/transition.md`, passing through the `--auto` flag so it propagates to the next phase invocation.
384
+
385
+ **If neither `--auto` nor `AUTO_CFG` is true:**
386
+
387
+ The workflow ends. The user runs `/gsd:progress` or invokes the transition workflow manually.
388
+ </step>
389
+
390
+ </process>
391
+
392
+ <context_efficiency>
393
+ Orchestrator: ~10-15% context. Subagents: fresh 200k each. No polling (Task blocks). No context bleed.
394
+ </context_efficiency>
395
+
396
+ <failure_handling>
397
+ - **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
398
+ - **Agent fails mid-plan:** Missing SUMMARY.md → report, ask user how to proceed
399
+ - **Dependency chain breaks:** Wave 1 fails → Wave 2 dependents likely fail → user chooses attempt or skip
400
+ - **All agents in wave fail:** Systemic issue → stop, report for investigation
401
+ - **Checkpoint unresolvable:** "Skip this plan?" or "Abort phase execution?" → record partial progress in STATE.md
402
+ </failure_handling>
403
+
404
+ <resumption>
405
+ Re-run `/gsd:execute-phase {phase}` → discover_plans finds completed SUMMARYs → skips them → resumes from first incomplete plan → continues wave execution.
406
+
407
+ STATE.md tracks: last completed plan, current wave, pending checkpoints.
408
+ </resumption>