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,891 @@
1
+ <purpose>
2
+
3
+ Drive all remaining milestone phases autonomously. For each incomplete phase: discuss → plan → execute using Skill() flat invocations. Pauses only for explicit user decisions (grey area acceptance, blockers, validation requests). Re-reads ROADMAP.md after each phase to catch dynamically inserted phases.
4
+
5
+ </purpose>
6
+
7
+ <required_reading>
8
+
9
+ Read all files referenced by the invoking prompt's execution_context before starting.
10
+
11
+ </required_reading>
12
+
13
+ <process>
14
+
15
+ <step name="initialize" priority="first">
16
+
17
+ ## 1. Initialize
18
+
19
+ Parse `$ARGUMENTS` for `--from N` flag:
20
+
21
+ ```bash
22
+ FROM_PHASE=""
23
+ if echo "$ARGUMENTS" | grep -qE '\-\-from\s+[0-9]'; then
24
+ FROM_PHASE=$(echo "$ARGUMENTS" | grep -oE '\-\-from\s+[0-9]+\.?[0-9]*' | awk '{print $2}')
25
+ fi
26
+ ```
27
+
28
+ Bootstrap via milestone-level init:
29
+
30
+ ```bash
31
+ INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init milestone-op)
32
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
33
+ ```
34
+
35
+ Parse JSON for: `milestone_version`, `milestone_name`, `phase_count`, `completed_phases`, `roadmap_exists`, `state_exists`, `commit_docs`.
36
+
37
+ **If `roadmap_exists` is false:** Error — "No ROADMAP.md found. Run `/gsd:new-milestone` first."
38
+ **If `state_exists` is false:** Error — "No STATE.md found. Run `/gsd:new-milestone` first."
39
+
40
+ Display startup banner:
41
+
42
+ ```
43
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
44
+ GSD ► AUTONOMOUS
45
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
46
+
47
+ Milestone: {milestone_version} — {milestone_name}
48
+ Phases: {phase_count} total, {completed_phases} complete
49
+ ```
50
+
51
+ If `FROM_PHASE` is set, display: `Starting from phase ${FROM_PHASE}`
52
+
53
+ </step>
54
+
55
+ <step name="discover_phases">
56
+
57
+ ## 2. Discover Phases
58
+
59
+ Run phase discovery:
60
+
61
+ ```bash
62
+ ROADMAP=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap analyze)
63
+ ```
64
+
65
+ Parse the JSON `phases` array.
66
+
67
+ **Filter to incomplete phases:** Keep only phases where `disk_status !== "complete"` OR `roadmap_complete === false`.
68
+
69
+ **Apply `--from N` filter:** If `FROM_PHASE` was provided, additionally filter out phases where `number < FROM_PHASE` (use numeric comparison — handles decimal phases like "5.1").
70
+
71
+ **Sort by `number`** in numeric ascending order.
72
+
73
+ **If no incomplete phases remain:**
74
+
75
+ ```
76
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
77
+ GSD ► AUTONOMOUS ▸ COMPLETE 🎉
78
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
79
+
80
+ All phases complete! Nothing left to do.
81
+ ```
82
+
83
+ Exit cleanly.
84
+
85
+ **Display phase plan:**
86
+
87
+ ```
88
+ ## Phase Plan
89
+
90
+ | # | Phase | Status |
91
+ |---|-------|--------|
92
+ | 5 | Skill Scaffolding & Phase Discovery | In Progress |
93
+ | 6 | Smart Discuss | Not Started |
94
+ | 7 | Auto-Chain Refinements | Not Started |
95
+ | 8 | Lifecycle Orchestration | Not Started |
96
+ ```
97
+
98
+ **Fetch details for each phase:**
99
+
100
+ ```bash
101
+ DETAIL=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase ${PHASE_NUM})
102
+ ```
103
+
104
+ Extract `phase_name`, `goal`, `success_criteria` from each. Store for use in execute_phase and transition messages.
105
+
106
+ </step>
107
+
108
+ <step name="execute_phase">
109
+
110
+ ## 3. Execute Phase
111
+
112
+ For the current phase, display the progress banner:
113
+
114
+ ```
115
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
116
+ GSD ► AUTONOMOUS ▸ Phase {N}/{T}: {Name} [████░░░░] {P}%
117
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
118
+ ```
119
+
120
+ Where N = current phase number (from the ROADMAP, e.g., 6), T = total milestone phases (from `phase_count` parsed in initialize step, e.g., 8), P = percentage of all milestone phases completed so far. Calculate P as: (number of phases with `disk_status` "complete" from the latest `roadmap analyze` / T × 100). Use █ for filled and ░ for empty segments in the progress bar (8 characters wide).
121
+
122
+ **3a. Smart Discuss**
123
+
124
+ Check if CONTEXT.md already exists for this phase:
125
+
126
+ ```bash
127
+ PHASE_STATE=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op ${PHASE_NUM})
128
+ ```
129
+
130
+ Parse `has_context` from JSON.
131
+
132
+ **If has_context is true:** Skip discuss — context already gathered. Display:
133
+
134
+ ```
135
+ Phase ${PHASE_NUM}: Context exists — skipping discuss.
136
+ ```
137
+
138
+ Proceed to 3b.
139
+
140
+ **If has_context is false:** Check if discuss is disabled via settings:
141
+
142
+ ```bash
143
+ SKIP_DISCUSS=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.skip_discuss 2>/dev/null || echo "false")
144
+ ```
145
+
146
+ **If SKIP_DISCUSS is `true`:** Skip discuss entirely — the ROADMAP phase description is the spec. Display:
147
+
148
+ ```
149
+ Phase ${PHASE_NUM}: Discuss skipped (workflow.skip_discuss=true) — using ROADMAP phase goal as spec.
150
+ ```
151
+
152
+ Write a minimal CONTEXT.md so downstream plan-phase has valid input. Get phase details:
153
+
154
+ ```bash
155
+ DETAIL=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase ${PHASE_NUM})
156
+ ```
157
+
158
+ Extract `goal` and `requirements` from JSON. Write `${phase_dir}/${padded_phase}-CONTEXT.md` with:
159
+
160
+ ```markdown
161
+ # Phase {PHASE_NUM}: {Phase Name} - Context
162
+
163
+ **Gathered:** {date}
164
+ **Status:** Ready for planning
165
+ **Mode:** Auto-generated (discuss skipped via workflow.skip_discuss)
166
+
167
+ <domain>
168
+ ## Phase Boundary
169
+
170
+ {goal from ROADMAP phase description}
171
+
172
+ </domain>
173
+
174
+ <decisions>
175
+ ## Implementation Decisions
176
+
177
+ ### Claude's Discretion
178
+ All implementation choices are at Claude's discretion — discuss phase was skipped per user setting. Use ROADMAP phase goal, success criteria, and codebase conventions to guide decisions.
179
+
180
+ </decisions>
181
+
182
+ <code_context>
183
+ ## Existing Code Insights
184
+
185
+ Codebase context will be gathered during plan-phase research.
186
+
187
+ </code_context>
188
+
189
+ <specifics>
190
+ ## Specific Ideas
191
+
192
+ No specific requirements — discuss phase skipped. Refer to ROADMAP phase description and success criteria.
193
+
194
+ </specifics>
195
+
196
+ <deferred>
197
+ ## Deferred Ideas
198
+
199
+ None — discuss phase skipped.
200
+
201
+ </deferred>
202
+ ```
203
+
204
+ Commit the minimal context:
205
+
206
+ ```bash
207
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(${PADDED_PHASE}): auto-generated context (discuss skipped)" --files "${phase_dir}/${padded_phase}-CONTEXT.md"
208
+ ```
209
+
210
+ Proceed to 3b.
211
+
212
+ **If SKIP_DISCUSS is `false` (or unset):** Execute the smart_discuss step for this phase.
213
+
214
+ After smart_discuss completes, verify context was written:
215
+
216
+ ```bash
217
+ PHASE_STATE=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op ${PHASE_NUM})
218
+ ```
219
+
220
+ Check `has_context`. If false → go to handle_blocker: "Smart discuss for phase ${PHASE_NUM} did not produce CONTEXT.md."
221
+
222
+ **3a.5. UI Design Contract (Frontend Phases)**
223
+
224
+ Check if this phase has frontend indicators and whether a UI-SPEC already exists:
225
+
226
+ ```bash
227
+ PHASE_SECTION=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase ${PHASE_NUM} 2>/dev/null)
228
+ echo "$PHASE_SECTION" | grep -iE "UI|interface|frontend|component|layout|page|screen|view|form|dashboard|widget" > /dev/null 2>&1
229
+ HAS_UI=$?
230
+ UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1)
231
+ ```
232
+
233
+ Check if UI phase workflow is enabled:
234
+
235
+ ```bash
236
+ UI_PHASE_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.ui_phase 2>/dev/null || echo "true")
237
+ ```
238
+
239
+ **If `HAS_UI` is 0 (frontend indicators found) AND `UI_SPEC_FILE` is empty (no UI-SPEC exists) AND `UI_PHASE_CFG` is not `false`:**
240
+
241
+ Display:
242
+
243
+ ```
244
+ Phase ${PHASE_NUM}: Frontend phase detected — generating UI design contract...
245
+ ```
246
+
247
+ ```
248
+ Skill(skill="gsd:ui-phase", args="${PHASE_NUM}")
249
+ ```
250
+
251
+ Verify UI-SPEC was created:
252
+
253
+ ```bash
254
+ UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1)
255
+ ```
256
+
257
+ **If `UI_SPEC_FILE` is still empty after ui-phase:** Display warning `Phase ${PHASE_NUM}: UI-SPEC generation did not produce output — continuing without design contract.` and proceed to 3b.
258
+
259
+ **If `HAS_UI` is 1 (no frontend indicators) OR `UI_SPEC_FILE` is not empty (UI-SPEC already exists) OR `UI_PHASE_CFG` is `false`:** Skip silently to 3b.
260
+
261
+ **3b. Plan**
262
+
263
+ ```
264
+ Skill(skill="gsd:plan-phase", args="${PHASE_NUM}")
265
+ ```
266
+
267
+ Verify plan produced output — re-run `init phase-op` and check `has_plans`. If false → go to handle_blocker: "Plan phase ${PHASE_NUM} did not produce any plans."
268
+
269
+ **3c. Execute**
270
+
271
+ ```
272
+ Skill(skill="gsd:execute-phase", args="${PHASE_NUM} --no-transition")
273
+ ```
274
+
275
+ **3d. Post-Execution Routing**
276
+
277
+ After execute-phase returns, read the verification result:
278
+
279
+ ```bash
280
+ VERIFY_STATUS=$(grep "^status:" "${PHASE_DIR}"/*-VERIFICATION.md 2>/dev/null | head -1 | cut -d: -f2 | tr -d ' ')
281
+ ```
282
+
283
+ Where `PHASE_DIR` comes from the `init phase-op` call already made in step 3a. If the variable is not in scope, re-fetch:
284
+
285
+ ```bash
286
+ PHASE_STATE=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op ${PHASE_NUM})
287
+ ```
288
+
289
+ Parse `phase_dir` from the JSON.
290
+
291
+ **If VERIFY_STATUS is empty** (no VERIFICATION.md or no status field):
292
+
293
+ Go to handle_blocker: "Execute phase ${PHASE_NUM} did not produce verification results."
294
+
295
+ **If `passed`:**
296
+
297
+ Display:
298
+ ```
299
+ Phase ${PHASE_NUM} ✅ ${PHASE_NAME} — Verification passed
300
+ ```
301
+
302
+ Proceed to iterate step.
303
+
304
+ **If `human_needed`:**
305
+
306
+ Read the human_verification section from VERIFICATION.md to get the count and items requiring manual testing.
307
+
308
+ Display the items, then ask user via AskUserQuestion:
309
+ - **question:** "Phase ${PHASE_NUM} has items needing manual verification. Validate now or continue to next phase?"
310
+ - **options:** "Validate now" / "Continue without validation"
311
+
312
+ On **"Validate now"**: Present the specific items from VERIFICATION.md's human_verification section. After user reviews, ask:
313
+ - **question:** "Validation result?"
314
+ - **options:** "All good — continue" / "Found issues"
315
+
316
+ On "All good — continue": Display `Phase ${PHASE_NUM} ✅ Human validation passed` and proceed to iterate step.
317
+
318
+ On "Found issues": Go to handle_blocker with the user's reported issues as the description.
319
+
320
+ On **"Continue without validation"**: Display `Phase ${PHASE_NUM} ⏭ Human validation deferred` and proceed to iterate step.
321
+
322
+ **If `gaps_found`:**
323
+
324
+ Read gap summary from VERIFICATION.md (score and missing items). Display:
325
+ ```
326
+ ⚠ Phase ${PHASE_NUM}: ${PHASE_NAME} — Gaps Found
327
+ Score: {N}/{M} must-haves verified
328
+ ```
329
+
330
+ Ask user via AskUserQuestion:
331
+ - **question:** "Gaps found in phase ${PHASE_NUM}. How to proceed?"
332
+ - **options:** "Run gap closure" / "Continue without fixing" / "Stop autonomous mode"
333
+
334
+ On **"Run gap closure"**: Execute gap closure cycle (limit: 1 attempt):
335
+
336
+ ```
337
+ Skill(skill="gsd:plan-phase", args="${PHASE_NUM} --gaps")
338
+ ```
339
+
340
+ Verify gap plans were created — re-run `init phase-op ${PHASE_NUM}` and check `has_plans`. If no new gap plans → go to handle_blocker: "Gap closure planning for phase ${PHASE_NUM} did not produce plans."
341
+
342
+ Re-execute:
343
+ ```
344
+ Skill(skill="gsd:execute-phase", args="${PHASE_NUM} --no-transition")
345
+ ```
346
+
347
+ Re-read verification status:
348
+ ```bash
349
+ VERIFY_STATUS=$(grep "^status:" "${PHASE_DIR}"/*-VERIFICATION.md 2>/dev/null | head -1 | cut -d: -f2 | tr -d ' ')
350
+ ```
351
+
352
+ If `passed` or `human_needed`: Route normally (continue or ask user as above).
353
+
354
+ If still `gaps_found` after this retry: Display "Gaps persist after closure attempt." and ask via AskUserQuestion:
355
+ - **question:** "Gap closure did not fully resolve issues. How to proceed?"
356
+ - **options:** "Continue anyway" / "Stop autonomous mode"
357
+
358
+ On "Continue anyway": Proceed to iterate step.
359
+ On "Stop autonomous mode": Go to handle_blocker.
360
+
361
+ This limits gap closure to 1 automatic retry to prevent infinite loops.
362
+
363
+ On **"Continue without fixing"**: Display `Phase ${PHASE_NUM} ⏭ Gaps deferred` and proceed to iterate step.
364
+
365
+ On **"Stop autonomous mode"**: Go to handle_blocker with "User stopped — gaps remain in phase ${PHASE_NUM}".
366
+
367
+ **3d.5. UI Review (Frontend Phases)**
368
+
369
+ > Run after any successful execution routing (passed, human_needed accepted, or gaps deferred/accepted) — before proceeding to the iterate step.
370
+
371
+ Check if this phase had a UI-SPEC (created in step 3a.5 or pre-existing):
372
+
373
+ ```bash
374
+ UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1)
375
+ ```
376
+
377
+ Check if UI review is enabled:
378
+
379
+ ```bash
380
+ UI_REVIEW_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.ui_review 2>/dev/null || echo "true")
381
+ ```
382
+
383
+ **If `UI_SPEC_FILE` is not empty AND `UI_REVIEW_CFG` is not `false`:**
384
+
385
+ Display:
386
+
387
+ ```
388
+ Phase ${PHASE_NUM}: Frontend phase with UI-SPEC — running UI review audit...
389
+ ```
390
+
391
+ ```
392
+ Skill(skill="gsd:ui-review", args="${PHASE_NUM}")
393
+ ```
394
+
395
+ Display the review result summary (score from UI-REVIEW.md if produced). Continue to iterate step regardless of score — UI review is advisory, not blocking.
396
+
397
+ **If `UI_SPEC_FILE` is empty OR `UI_REVIEW_CFG` is `false`:** Skip silently to iterate step.
398
+
399
+ </step>
400
+
401
+ <step name="smart_discuss">
402
+
403
+ ## Smart Discuss
404
+
405
+ Run smart discuss for the current phase. Proposes grey area answers in batch tables — the user accepts or overrides per area. Produces identical CONTEXT.md output to regular discuss-phase.
406
+
407
+ > **Note:** Smart discuss is an autonomous-optimized variant of the `gsd:discuss-phase` skill. It produces identical CONTEXT.md output but uses batch table proposals instead of sequential questioning. The original `discuss-phase` skill remains unchanged (per CTRL-03). Future milestones may extract this to a separate skill file.
408
+
409
+ **Inputs:** `PHASE_NUM` from execute_phase. Run init to get phase paths:
410
+
411
+ ```bash
412
+ PHASE_STATE=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op ${PHASE_NUM})
413
+ ```
414
+
415
+ Parse from JSON: `phase_dir`, `phase_slug`, `padded_phase`, `phase_name`.
416
+
417
+ ---
418
+
419
+ ### Sub-step 1: Load prior context
420
+
421
+ Read project-level and prior phase context to avoid re-asking decided questions.
422
+
423
+ **Read project files:**
424
+
425
+ ```bash
426
+ cat .planning/PROJECT.md 2>/dev/null || true
427
+ cat .planning/REQUIREMENTS.md 2>/dev/null || true
428
+ cat .planning/STATE.md 2>/dev/null || true
429
+ ```
430
+
431
+ Extract from these:
432
+ - **PROJECT.md** — Vision, principles, non-negotiables, user preferences
433
+ - **REQUIREMENTS.md** — Acceptance criteria, constraints, must-haves vs nice-to-haves
434
+ - **STATE.md** — Current progress, decisions logged so far
435
+
436
+ **Read all prior CONTEXT.md files:**
437
+
438
+ ```bash
439
+ (find .planning/phases -name "*-CONTEXT.md" 2>/dev/null || true) | sort
440
+ ```
441
+
442
+ For each CONTEXT.md where phase number < current phase:
443
+ - Read the `<decisions>` section — these are locked preferences
444
+ - Read `<specifics>` — particular references or "I want it like X" moments
445
+ - Note patterns (e.g., "user consistently prefers minimal UI", "user rejected verbose output")
446
+
447
+ **Build internal prior_decisions context** (do not write to file):
448
+
449
+ ```
450
+ <prior_decisions>
451
+ ## Project-Level
452
+ - [Key principle or constraint from PROJECT.md]
453
+ - [Requirement affecting this phase from REQUIREMENTS.md]
454
+
455
+ ## From Prior Phases
456
+ ### Phase N: [Name]
457
+ - [Decision relevant to current phase]
458
+ - [Preference that establishes a pattern]
459
+ </prior_decisions>
460
+ ```
461
+
462
+ If no prior context exists, continue without — expected for early phases.
463
+
464
+ ---
465
+
466
+ ### Sub-step 2: Scout Codebase
467
+
468
+ Lightweight codebase scan to inform grey area identification and proposals. Keep under ~5% context.
469
+
470
+ **Check for existing codebase maps:**
471
+
472
+ ```bash
473
+ ls .planning/codebase/*.md 2>/dev/null || true
474
+ ```
475
+
476
+ **If codebase maps exist:** Read the most relevant ones (CONVENTIONS.md, STRUCTURE.md, STACK.md based on phase type). Extract reusable components, established patterns, integration points. Skip to building context below.
477
+
478
+ **If no codebase maps, do targeted grep:**
479
+
480
+ Extract key terms from the phase goal. Search for related files:
481
+
482
+ ```bash
483
+ grep -rl "{term1}\|{term2}" src/ app/ --include="*.ts" --include="*.tsx" --include="*.js" --include="*.jsx" 2>/dev/null | head -10 || true
484
+ ls src/components/ src/hooks/ src/lib/ src/utils/ 2>/dev/null || true
485
+ ```
486
+
487
+ Read the 3-5 most relevant files to understand existing patterns.
488
+
489
+ **Build internal codebase_context** (do not write to file):
490
+ - **Reusable assets** — existing components, hooks, utilities usable in this phase
491
+ - **Established patterns** — how the codebase does state management, styling, data fetching
492
+ - **Integration points** — where new code connects (routes, nav, providers)
493
+
494
+ ---
495
+
496
+ ### Sub-step 3: Analyze Phase and Generate Proposals
497
+
498
+ **Get phase details:**
499
+
500
+ ```bash
501
+ DETAIL=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase ${PHASE_NUM})
502
+ ```
503
+
504
+ Extract `goal`, `requirements`, `success_criteria` from the JSON response.
505
+
506
+ **Infrastructure detection — check FIRST before generating grey areas:**
507
+
508
+ A phase is pure infrastructure when ALL of these are true:
509
+ 1. Goal keywords match: "scaffolding", "plumbing", "setup", "configuration", "migration", "refactor", "rename", "restructure", "upgrade", "infrastructure"
510
+ 2. AND success criteria are all technical: "file exists", "test passes", "config valid", "command runs"
511
+ 3. AND no user-facing behavior is described (no "users can", "displays", "shows", "presents")
512
+
513
+ **If infrastructure-only:** Skip Sub-step 4. Jump directly to Sub-step 5 with minimal CONTEXT.md. Display:
514
+
515
+ ```
516
+ Phase ${PHASE_NUM}: Infrastructure phase — skipping discuss, writing minimal context.
517
+ ```
518
+
519
+ Use these defaults for the CONTEXT.md:
520
+ - `<domain>`: Phase boundary from ROADMAP goal
521
+ - `<decisions>`: Single "### Claude's Discretion" subsection — "All implementation choices are at Claude's discretion — pure infrastructure phase"
522
+ - `<code_context>`: Whatever the codebase scout found
523
+ - `<specifics>`: "No specific requirements — infrastructure phase"
524
+ - `<deferred>`: "None"
525
+
526
+ **If NOT infrastructure — generate grey area proposals:**
527
+
528
+ Determine domain type from the phase goal:
529
+ - Something users **SEE** → visual: layout, interactions, states, density
530
+ - Something users **CALL** → interface: contracts, responses, errors, auth
531
+ - Something users **RUN** → execution: invocation, output, behavior modes, flags
532
+ - Something users **READ** → content: structure, tone, depth, flow
533
+ - Something being **ORGANIZED** → organization: criteria, grouping, exceptions, naming
534
+
535
+ Check prior_decisions — skip grey areas already decided in prior phases.
536
+
537
+ Generate **3-4 grey areas** with **~4 questions each**. For each question:
538
+ - **Pre-select a recommended answer** based on: prior decisions (consistency), codebase patterns (reuse), domain conventions (standard approaches), ROADMAP success criteria
539
+ - Generate **1-2 alternatives** per question
540
+ - **Annotate** with prior decision context ("You decided X in Phase N") and code context ("Component Y exists with Z variants") where relevant
541
+
542
+ ---
543
+
544
+ ### Sub-step 4: Present Proposals Per Area
545
+
546
+ Present grey areas **one at a time**. For each area (M of N):
547
+
548
+ Display a table:
549
+
550
+ ```
551
+ ### Grey Area {M}/{N}: {Area Name}
552
+
553
+ | # | Question | ✅ Recommended | Alternative(s) |
554
+ |---|----------|---------------|-----------------|
555
+ | 1 | {question} | {answer} — {rationale} | {alt1}; {alt2} |
556
+ | 2 | {question} | {answer} — {rationale} | {alt1} |
557
+ | 3 | {question} | {answer} — {rationale} | {alt1}; {alt2} |
558
+ | 4 | {question} | {answer} — {rationale} | {alt1} |
559
+ ```
560
+
561
+ Then prompt the user via **AskUserQuestion**:
562
+ - **header:** "Area {M}/{N}"
563
+ - **question:** "Accept these answers for {Area Name}?"
564
+ - **options:** Build dynamically — always "Accept all" first, then "Change Q1" through "Change QN" for each question (up to 4), then "Discuss deeper" last. Cap at 6 explicit options max (AskUserQuestion adds "Other" automatically).
565
+
566
+ **On "Accept all":** Record all recommended answers for this area. Move to next area.
567
+
568
+ **On "Change QN":** Use AskUserQuestion with the alternatives for that specific question:
569
+ - **header:** "{Area Name}"
570
+ - **question:** "Q{N}: {question text}"
571
+ - **options:** List the 1-2 alternatives plus "You decide" (maps to Claude's Discretion)
572
+
573
+ Record the user's choice. Re-display the updated table with the change reflected. Re-present the full acceptance prompt so the user can make additional changes or accept.
574
+
575
+ **On "Discuss deeper":** Switch to interactive mode for this area only — ask questions one at a time using AskUserQuestion with 2-3 concrete options per question plus "You decide". After 4 questions, prompt:
576
+ - **header:** "{Area Name}"
577
+ - **question:** "More questions about {area name}, or move to next?"
578
+ - **options:** "More questions" / "Next area"
579
+
580
+ If "More questions", ask 4 more. If "Next area", display final summary table of captured answers for this area and move on.
581
+
582
+ **On "Other" (free text):** Interpret as either a specific change request or general feedback. Incorporate into the area's decisions, re-display updated table, re-present acceptance prompt.
583
+
584
+ **Scope creep handling:** If user mentions something outside the phase domain:
585
+
586
+ ```
587
+ "{Feature} sounds like a new capability — that belongs in its own phase.
588
+ I'll note it as a deferred idea.
589
+
590
+ Back to {current area}: {return to current question}"
591
+ ```
592
+
593
+ Track deferred ideas internally for inclusion in CONTEXT.md.
594
+
595
+ ---
596
+
597
+ ### Sub-step 5: Write CONTEXT.md
598
+
599
+ After all areas are resolved (or infrastructure skip), write the CONTEXT.md file.
600
+
601
+ **File path:** `${phase_dir}/${padded_phase}-CONTEXT.md`
602
+
603
+ Use **exactly** this structure (identical to discuss-phase output):
604
+
605
+ ```markdown
606
+ # Phase {PHASE_NUM}: {Phase Name} - Context
607
+
608
+ **Gathered:** {date}
609
+ **Status:** Ready for planning
610
+
611
+ <domain>
612
+ ## Phase Boundary
613
+
614
+ {Domain boundary statement from analysis — what this phase delivers}
615
+
616
+ </domain>
617
+
618
+ <decisions>
619
+ ## Implementation Decisions
620
+
621
+ ### {Area 1 Name}
622
+ - {Accepted/chosen answer for Q1}
623
+ - {Accepted/chosen answer for Q2}
624
+ - {Accepted/chosen answer for Q3}
625
+ - {Accepted/chosen answer for Q4}
626
+
627
+ ### {Area 2 Name}
628
+ - {Accepted/chosen answer for Q1}
629
+ - {Accepted/chosen answer for Q2}
630
+ ...
631
+
632
+ ### Claude's Discretion
633
+ {Any "You decide" answers collected — note Claude has flexibility here}
634
+
635
+ </decisions>
636
+
637
+ <code_context>
638
+ ## Existing Code Insights
639
+
640
+ ### Reusable Assets
641
+ - {From codebase scout — components, hooks, utilities}
642
+
643
+ ### Established Patterns
644
+ - {From codebase scout — state management, styling, data fetching}
645
+
646
+ ### Integration Points
647
+ - {From codebase scout — where new code connects}
648
+
649
+ </code_context>
650
+
651
+ <specifics>
652
+ ## Specific Ideas
653
+
654
+ {Any specific references or "I want it like X" from discussion}
655
+ {If none: "No specific requirements — open to standard approaches"}
656
+
657
+ </specifics>
658
+
659
+ <deferred>
660
+ ## Deferred Ideas
661
+
662
+ {Ideas captured but out of scope for this phase}
663
+ {If none: "None — discussion stayed within phase scope"}
664
+
665
+ </deferred>
666
+ ```
667
+
668
+ Write the file.
669
+
670
+ **Commit:**
671
+
672
+ ```bash
673
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(${PADDED_PHASE}): smart discuss context" --files "${phase_dir}/${padded_phase}-CONTEXT.md"
674
+ ```
675
+
676
+ Display confirmation:
677
+
678
+ ```
679
+ Created: {path}
680
+ Decisions captured: {count} across {area_count} areas
681
+ ```
682
+
683
+ </step>
684
+
685
+ <step name="iterate">
686
+
687
+ ## 4. Iterate
688
+
689
+ After each phase completes, re-read ROADMAP.md to catch phases inserted mid-execution (decimal phases like 5.1):
690
+
691
+ ```bash
692
+ ROADMAP=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap analyze)
693
+ ```
694
+
695
+ Re-filter incomplete phases using the same logic as discover_phases:
696
+ - Keep phases where `disk_status !== "complete"` OR `roadmap_complete === false`
697
+ - Apply `--from N` filter if originally provided
698
+ - Sort by number ascending
699
+
700
+ Read STATE.md fresh:
701
+
702
+ ```bash
703
+ cat .planning/STATE.md
704
+ ```
705
+
706
+ Check for blockers in the Blockers/Concerns section. If blockers are found, go to handle_blocker with the blocker description.
707
+
708
+ If incomplete phases remain: proceed to next phase, loop back to execute_phase.
709
+
710
+ If all phases complete, proceed to lifecycle step.
711
+
712
+ </step>
713
+
714
+ <step name="lifecycle">
715
+
716
+ ## 5. Lifecycle
717
+
718
+ After all phases complete, run the milestone lifecycle sequence: audit → complete → cleanup.
719
+
720
+ Display lifecycle transition banner:
721
+
722
+ ```
723
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
724
+ GSD ► AUTONOMOUS ▸ LIFECYCLE
725
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
726
+
727
+ All phases complete → Starting lifecycle: audit → complete → cleanup
728
+ Milestone: {milestone_version} — {milestone_name}
729
+ ```
730
+
731
+ **5a. Audit**
732
+
733
+ ```
734
+ Skill(skill="gsd:audit-milestone")
735
+ ```
736
+
737
+ After audit completes, detect the result:
738
+
739
+ ```bash
740
+ AUDIT_FILE=".planning/v${milestone_version}-MILESTONE-AUDIT.md"
741
+ AUDIT_STATUS=$(grep "^status:" "${AUDIT_FILE}" 2>/dev/null | head -1 | cut -d: -f2 | tr -d ' ')
742
+ ```
743
+
744
+ **If AUDIT_STATUS is empty** (no audit file or no status field):
745
+
746
+ Go to handle_blocker: "Audit did not produce results — audit file missing or malformed."
747
+
748
+ **If `passed`:**
749
+
750
+ Display:
751
+ ```
752
+ Audit ✅ passed — proceeding to complete milestone
753
+ ```
754
+
755
+ Proceed to 5b (no user pause — per CTRL-01).
756
+
757
+ **If `gaps_found`:**
758
+
759
+ Read the gaps summary from the audit file. Display:
760
+ ```
761
+ ⚠ Audit: Gaps Found
762
+ ```
763
+
764
+ Ask user via AskUserQuestion:
765
+ - **question:** "Milestone audit found gaps. How to proceed?"
766
+ - **options:** "Continue anyway — accept gaps" / "Stop — fix gaps manually"
767
+
768
+ On **"Continue anyway"**: Display `Audit ⏭ Gaps accepted — proceeding to complete milestone` and proceed to 5b.
769
+
770
+ On **"Stop"**: Go to handle_blocker with "User stopped — audit gaps remain. Run /gsd:audit-milestone to review, then /gsd:complete-milestone when ready."
771
+
772
+ **If `tech_debt`:**
773
+
774
+ Read the tech debt summary from the audit file. Display:
775
+ ```
776
+ ⚠ Audit: Tech Debt Identified
777
+ ```
778
+
779
+ Show the summary, then ask user via AskUserQuestion:
780
+ - **question:** "Milestone audit found tech debt. How to proceed?"
781
+ - **options:** "Continue with tech debt" / "Stop — address debt first"
782
+
783
+ On **"Continue with tech debt"**: Display `Audit ⏭ Tech debt acknowledged — proceeding to complete milestone` and proceed to 5b.
784
+
785
+ On **"Stop"**: Go to handle_blocker with "User stopped — tech debt to address. Run /gsd:audit-milestone to review details."
786
+
787
+ **5b. Complete Milestone**
788
+
789
+ ```
790
+ Skill(skill="gsd:complete-milestone", args="${milestone_version}")
791
+ ```
792
+
793
+ After complete-milestone returns, verify it produced output:
794
+
795
+ ```bash
796
+ ls .planning/milestones/v${milestone_version}-ROADMAP.md 2>/dev/null || true
797
+ ```
798
+
799
+ If the archive file does not exist, go to handle_blocker: "Complete milestone did not produce expected archive files."
800
+
801
+ **5c. Cleanup**
802
+
803
+ ```
804
+ Skill(skill="gsd:cleanup")
805
+ ```
806
+
807
+ Cleanup shows its own dry-run and asks user for approval internally — this is an acceptable pause per CTRL-01 since it's an explicit decision about file deletion.
808
+
809
+ **5d. Final Completion**
810
+
811
+ Display final completion banner:
812
+
813
+ ```
814
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
815
+ GSD ► AUTONOMOUS ▸ COMPLETE 🎉
816
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
817
+
818
+ Milestone: {milestone_version} — {milestone_name}
819
+ Status: Complete ✅
820
+ Lifecycle: audit ✅ → complete ✅ → cleanup ✅
821
+
822
+ Ship it! 🚀
823
+ ```
824
+
825
+ </step>
826
+
827
+ <step name="handle_blocker">
828
+
829
+ ## 6. Handle Blocker
830
+
831
+ When any phase operation fails or a blocker is detected, present 3 options via AskUserQuestion:
832
+
833
+ **Prompt:** "Phase {N} ({Name}) encountered an issue: {description}"
834
+
835
+ **Options:**
836
+ 1. **"Fix and retry"** — Re-run the failed step (discuss, plan, or execute) for this phase
837
+ 2. **"Skip this phase"** — Mark phase as skipped, continue to the next incomplete phase
838
+ 3. **"Stop autonomous mode"** — Display summary of progress so far and exit cleanly
839
+
840
+ **On "Fix and retry":** Loop back to the failed step within execute_phase. If the same step fails again after retry, re-present these options.
841
+
842
+ **On "Skip this phase":** Log `Phase {N} ⏭ {Name} — Skipped by user` and proceed to iterate.
843
+
844
+ **On "Stop autonomous mode":** Display progress summary:
845
+
846
+ ```
847
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
848
+ GSD ► AUTONOMOUS ▸ STOPPED
849
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
850
+
851
+ Completed: {list of completed phases}
852
+ Skipped: {list of skipped phases}
853
+ Remaining: {list of remaining phases}
854
+
855
+ Resume with: /gsd:autonomous --from {next_phase}
856
+ ```
857
+
858
+ </step>
859
+
860
+ </process>
861
+
862
+ <success_criteria>
863
+ - [ ] All incomplete phases executed in order (smart discuss → ui-phase → plan → execute → ui-review each)
864
+ - [ ] Smart discuss proposes grey area answers in tables, user accepts or overrides per area
865
+ - [ ] Progress banners displayed between phases
866
+ - [ ] Execute-phase invoked with --no-transition (autonomous manages transitions)
867
+ - [ ] Post-execution verification reads VERIFICATION.md and routes on status
868
+ - [ ] Passed verification → automatic continue to next phase
869
+ - [ ] Human-needed verification → user prompted to validate or skip
870
+ - [ ] Gaps-found → user offered gap closure, continue, or stop
871
+ - [ ] Gap closure limited to 1 retry (prevents infinite loops)
872
+ - [ ] Plan-phase and execute-phase failures route to handle_blocker
873
+ - [ ] ROADMAP.md re-read after each phase (catches inserted phases)
874
+ - [ ] STATE.md checked for blockers before each phase
875
+ - [ ] Blockers handled via user choice (retry / skip / stop)
876
+ - [ ] Final completion or stop summary displayed
877
+ - [ ] After all phases complete, lifecycle step is invoked (not manual suggestion)
878
+ - [ ] Lifecycle transition banner displayed before audit
879
+ - [ ] Audit invoked via Skill(skill="gsd:audit-milestone")
880
+ - [ ] Audit result routing: passed → auto-continue, gaps_found → user decides, tech_debt → user decides
881
+ - [ ] Audit technical failure (no file/no status) routes to handle_blocker
882
+ - [ ] Complete-milestone invoked via Skill() with ${milestone_version} arg
883
+ - [ ] Cleanup invoked via Skill() — internal confirmation is acceptable (CTRL-01)
884
+ - [ ] Final completion banner displayed after lifecycle
885
+ - [ ] Progress bar uses phase number / total milestone phases (not position among incomplete)
886
+ - [ ] Smart discuss documents relationship to discuss-phase with CTRL-03 note
887
+ - [ ] Frontend phases get UI-SPEC generated before planning (step 3a.5) if not already present
888
+ - [ ] Frontend phases get UI review audit after successful execution (step 3d.5) if UI-SPEC exists
889
+ - [ ] UI phase and UI review respect workflow.ui_phase and workflow.ui_review config toggles
890
+ - [ ] UI review is advisory (non-blocking) — phase proceeds to iterate regardless of score
891
+ </success_criteria>