gsd-opencode 1.22.1 → 1.33.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 (188) hide show
  1. package/agents/gsd-advisor-researcher.md +112 -0
  2. package/agents/gsd-assumptions-analyzer.md +110 -0
  3. package/agents/gsd-codebase-mapper.md +0 -2
  4. package/agents/gsd-debugger.md +117 -2
  5. package/agents/gsd-doc-verifier.md +207 -0
  6. package/agents/gsd-doc-writer.md +608 -0
  7. package/agents/gsd-executor.md +45 -4
  8. package/agents/gsd-integration-checker.md +0 -2
  9. package/agents/gsd-nyquist-auditor.md +0 -2
  10. package/agents/gsd-phase-researcher.md +191 -5
  11. package/agents/gsd-plan-checker.md +152 -5
  12. package/agents/gsd-planner.md +131 -157
  13. package/agents/gsd-project-researcher.md +28 -3
  14. package/agents/gsd-research-synthesizer.md +0 -2
  15. package/agents/gsd-roadmapper.md +29 -2
  16. package/agents/gsd-security-auditor.md +129 -0
  17. package/agents/gsd-ui-auditor.md +485 -0
  18. package/agents/gsd-ui-checker.md +305 -0
  19. package/agents/gsd-ui-researcher.md +368 -0
  20. package/agents/gsd-user-profiler.md +173 -0
  21. package/agents/gsd-verifier.md +207 -22
  22. package/commands/gsd/gsd-add-backlog.md +76 -0
  23. package/commands/gsd/gsd-analyze-dependencies.md +34 -0
  24. package/commands/gsd/gsd-audit-uat.md +24 -0
  25. package/commands/gsd/gsd-autonomous.md +45 -0
  26. package/commands/gsd/gsd-cleanup.md +5 -0
  27. package/commands/gsd/gsd-debug.md +29 -21
  28. package/commands/gsd/gsd-discuss-phase.md +15 -36
  29. package/commands/gsd/gsd-do.md +30 -0
  30. package/commands/gsd/gsd-docs-update.md +48 -0
  31. package/commands/gsd/gsd-execute-phase.md +24 -2
  32. package/commands/gsd/gsd-fast.md +30 -0
  33. package/commands/gsd/gsd-forensics.md +56 -0
  34. package/commands/gsd/gsd-help.md +2 -0
  35. package/commands/gsd/gsd-join-discord.md +2 -1
  36. package/commands/gsd/gsd-list-workspaces.md +19 -0
  37. package/commands/gsd/gsd-manager.md +40 -0
  38. package/commands/gsd/gsd-milestone-summary.md +51 -0
  39. package/commands/gsd/gsd-new-project.md +4 -0
  40. package/commands/gsd/gsd-new-workspace.md +44 -0
  41. package/commands/gsd/gsd-next.md +24 -0
  42. package/commands/gsd/gsd-note.md +34 -0
  43. package/commands/gsd/gsd-plan-phase.md +8 -1
  44. package/commands/gsd/gsd-plant-seed.md +28 -0
  45. package/commands/gsd/gsd-pr-branch.md +25 -0
  46. package/commands/gsd/gsd-profile-user.md +46 -0
  47. package/commands/gsd/gsd-quick.md +7 -3
  48. package/commands/gsd/gsd-reapply-patches.md +178 -45
  49. package/commands/gsd/gsd-remove-workspace.md +26 -0
  50. package/commands/gsd/gsd-research-phase.md +7 -12
  51. package/commands/gsd/gsd-review-backlog.md +62 -0
  52. package/commands/gsd/gsd-review.md +38 -0
  53. package/commands/gsd/gsd-secure-phase.md +35 -0
  54. package/commands/gsd/gsd-session-report.md +19 -0
  55. package/commands/gsd/gsd-set-profile.md +24 -23
  56. package/commands/gsd/gsd-ship.md +23 -0
  57. package/commands/gsd/gsd-stats.md +18 -0
  58. package/commands/gsd/gsd-thread.md +127 -0
  59. package/commands/gsd/gsd-ui-phase.md +34 -0
  60. package/commands/gsd/gsd-ui-review.md +32 -0
  61. package/commands/gsd/gsd-workstreams.md +71 -0
  62. package/get-shit-done/bin/gsd-tools.cjs +450 -90
  63. package/get-shit-done/bin/lib/commands.cjs +489 -24
  64. package/get-shit-done/bin/lib/config.cjs +329 -48
  65. package/get-shit-done/bin/lib/core.cjs +1143 -102
  66. package/get-shit-done/bin/lib/docs.cjs +267 -0
  67. package/get-shit-done/bin/lib/frontmatter.cjs +125 -43
  68. package/get-shit-done/bin/lib/init.cjs +918 -106
  69. package/get-shit-done/bin/lib/milestone.cjs +65 -33
  70. package/get-shit-done/bin/lib/model-profiles.cjs +70 -0
  71. package/get-shit-done/bin/lib/phase.cjs +434 -404
  72. package/get-shit-done/bin/lib/profile-output.cjs +1048 -0
  73. package/get-shit-done/bin/lib/profile-pipeline.cjs +539 -0
  74. package/get-shit-done/bin/lib/roadmap.cjs +156 -101
  75. package/get-shit-done/bin/lib/schema-detect.cjs +238 -0
  76. package/get-shit-done/bin/lib/security.cjs +384 -0
  77. package/get-shit-done/bin/lib/state.cjs +711 -79
  78. package/get-shit-done/bin/lib/template.cjs +2 -2
  79. package/get-shit-done/bin/lib/uat.cjs +282 -0
  80. package/get-shit-done/bin/lib/verify.cjs +254 -42
  81. package/get-shit-done/bin/lib/workstream.cjs +495 -0
  82. package/get-shit-done/references/agent-contracts.md +79 -0
  83. package/get-shit-done/references/artifact-types.md +113 -0
  84. package/get-shit-done/references/checkpoints.md +12 -10
  85. package/get-shit-done/references/context-budget.md +49 -0
  86. package/get-shit-done/references/continuation-format.md +15 -15
  87. package/get-shit-done/references/decimal-phase-calculation.md +2 -3
  88. package/get-shit-done/references/domain-probes.md +125 -0
  89. package/get-shit-done/references/gate-prompts.md +100 -0
  90. package/get-shit-done/references/git-integration.md +47 -0
  91. package/get-shit-done/references/model-profile-resolution.md +2 -0
  92. package/get-shit-done/references/model-profiles.md +62 -16
  93. package/get-shit-done/references/phase-argument-parsing.md +2 -2
  94. package/get-shit-done/references/planner-gap-closure.md +62 -0
  95. package/get-shit-done/references/planner-reviews.md +39 -0
  96. package/get-shit-done/references/planner-revision.md +87 -0
  97. package/get-shit-done/references/planning-config.md +18 -1
  98. package/get-shit-done/references/revision-loop.md +97 -0
  99. package/get-shit-done/references/ui-brand.md +2 -2
  100. package/get-shit-done/references/universal-anti-patterns.md +58 -0
  101. package/get-shit-done/references/user-profiling.md +681 -0
  102. package/get-shit-done/references/workstream-flag.md +111 -0
  103. package/get-shit-done/templates/SECURITY.md +61 -0
  104. package/get-shit-done/templates/UAT.md +21 -3
  105. package/get-shit-done/templates/UI-SPEC.md +100 -0
  106. package/get-shit-done/templates/VALIDATION.md +3 -3
  107. package/get-shit-done/templates/claude-md.md +145 -0
  108. package/get-shit-done/templates/config.json +14 -3
  109. package/get-shit-done/templates/context.md +61 -6
  110. package/get-shit-done/templates/debug-subagent-prompt.md +2 -6
  111. package/get-shit-done/templates/dev-preferences.md +21 -0
  112. package/get-shit-done/templates/discussion-log.md +63 -0
  113. package/get-shit-done/templates/phase-prompt.md +46 -5
  114. package/get-shit-done/templates/planner-subagent-prompt.md +2 -10
  115. package/get-shit-done/templates/project.md +2 -0
  116. package/get-shit-done/templates/state.md +2 -2
  117. package/get-shit-done/templates/user-profile.md +146 -0
  118. package/get-shit-done/workflows/add-phase.md +4 -4
  119. package/get-shit-done/workflows/add-tests.md +4 -4
  120. package/get-shit-done/workflows/add-todo.md +4 -4
  121. package/get-shit-done/workflows/analyze-dependencies.md +96 -0
  122. package/get-shit-done/workflows/audit-milestone.md +20 -16
  123. package/get-shit-done/workflows/audit-uat.md +109 -0
  124. package/get-shit-done/workflows/autonomous.md +1036 -0
  125. package/get-shit-done/workflows/check-todos.md +4 -4
  126. package/get-shit-done/workflows/cleanup.md +4 -4
  127. package/get-shit-done/workflows/complete-milestone.md +22 -10
  128. package/get-shit-done/workflows/diagnose-issues.md +21 -7
  129. package/get-shit-done/workflows/discovery-phase.md +2 -2
  130. package/get-shit-done/workflows/discuss-phase-assumptions.md +671 -0
  131. package/get-shit-done/workflows/discuss-phase-power.md +291 -0
  132. package/get-shit-done/workflows/discuss-phase.md +558 -47
  133. package/get-shit-done/workflows/do.md +104 -0
  134. package/get-shit-done/workflows/docs-update.md +1093 -0
  135. package/get-shit-done/workflows/execute-phase.md +741 -58
  136. package/get-shit-done/workflows/execute-plan.md +77 -12
  137. package/get-shit-done/workflows/fast.md +105 -0
  138. package/get-shit-done/workflows/forensics.md +265 -0
  139. package/get-shit-done/workflows/health.md +28 -6
  140. package/get-shit-done/workflows/help.md +127 -7
  141. package/get-shit-done/workflows/insert-phase.md +4 -4
  142. package/get-shit-done/workflows/list-phase-assumptions.md +2 -2
  143. package/get-shit-done/workflows/list-workspaces.md +56 -0
  144. package/get-shit-done/workflows/manager.md +363 -0
  145. package/get-shit-done/workflows/map-codebase.md +83 -44
  146. package/get-shit-done/workflows/milestone-summary.md +223 -0
  147. package/get-shit-done/workflows/new-milestone.md +133 -25
  148. package/get-shit-done/workflows/new-project.md +216 -54
  149. package/get-shit-done/workflows/new-workspace.md +237 -0
  150. package/get-shit-done/workflows/next.md +97 -0
  151. package/get-shit-done/workflows/node-repair.md +92 -0
  152. package/get-shit-done/workflows/note.md +156 -0
  153. package/get-shit-done/workflows/pause-work.md +132 -15
  154. package/get-shit-done/workflows/plan-milestone-gaps.md +6 -7
  155. package/get-shit-done/workflows/plan-phase.md +513 -62
  156. package/get-shit-done/workflows/plant-seed.md +169 -0
  157. package/get-shit-done/workflows/pr-branch.md +129 -0
  158. package/get-shit-done/workflows/profile-user.md +450 -0
  159. package/get-shit-done/workflows/progress.md +154 -29
  160. package/get-shit-done/workflows/quick.md +285 -111
  161. package/get-shit-done/workflows/remove-phase.md +2 -2
  162. package/get-shit-done/workflows/remove-workspace.md +90 -0
  163. package/get-shit-done/workflows/research-phase.md +13 -9
  164. package/get-shit-done/workflows/resume-project.md +37 -18
  165. package/get-shit-done/workflows/review.md +281 -0
  166. package/get-shit-done/workflows/secure-phase.md +154 -0
  167. package/get-shit-done/workflows/session-report.md +146 -0
  168. package/get-shit-done/workflows/set-profile.md +2 -2
  169. package/get-shit-done/workflows/settings.md +91 -11
  170. package/get-shit-done/workflows/ship.md +237 -0
  171. package/get-shit-done/workflows/stats.md +60 -0
  172. package/get-shit-done/workflows/transition.md +150 -23
  173. package/get-shit-done/workflows/ui-phase.md +292 -0
  174. package/get-shit-done/workflows/ui-review.md +183 -0
  175. package/get-shit-done/workflows/update.md +262 -30
  176. package/get-shit-done/workflows/validate-phase.md +14 -17
  177. package/get-shit-done/workflows/verify-phase.md +143 -11
  178. package/get-shit-done/workflows/verify-work.md +141 -39
  179. package/package.json +1 -1
  180. package/skills/gsd-audit-milestone/SKILL.md +29 -0
  181. package/skills/gsd-cleanup/SKILL.md +19 -0
  182. package/skills/gsd-complete-milestone/SKILL.md +131 -0
  183. package/skills/gsd-discuss-phase/SKILL.md +54 -0
  184. package/skills/gsd-execute-phase/SKILL.md +49 -0
  185. package/skills/gsd-plan-phase/SKILL.md +37 -0
  186. package/skills/gsd-ui-phase/SKILL.md +24 -0
  187. package/skills/gsd-ui-review/SKILL.md +24 -0
  188. package/skills/gsd-verify-work/SKILL.md +30 -0
@@ -1,10 +1,15 @@
1
- <purpose>
1
+ <objective>
2
2
  Orchestrate parallel codebase mapper agents to analyze codebase and produce structured documents in .planning/codebase/
3
3
 
4
4
  Each agent has fresh context, explores a specific focus area, and **writes documents directly**. The orchestrator only receives confirmation + line counts, then writes a summary.
5
5
 
6
6
  Output: .planning/codebase/ folder with 7 structured documents about the codebase state.
7
- </purpose>
7
+ </objective>
8
+
9
+ <available_agent_types>
10
+ Valid GSD subagent types (use exact names — do not fall back to 'general'):
11
+ - gsd-codebase-mapper — Maps project structure and dependencies
12
+ </available_agent_types>
8
13
 
9
14
  <philosophy>
10
15
  **Why dedicated mapper agents:**
@@ -28,9 +33,10 @@ Load codebase mapping context:
28
33
  ```bash
29
34
  INIT=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" init map-codebase)
30
35
  if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
36
+ AGENT_SKILLS_MAPPER=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-codebase-mapper 2>/dev/null)
31
37
  ```
32
38
 
33
- Extract from init JSON: `mapper_model`, `commit_docs`, `codebase_dir`, `existing_maps`, `has_maps`, `codebase_dir_exists`.
39
+ Extract from init JSON: `mapper_model`, `commit_docs`, `codebase_dir`, `existing_maps`, `has_maps`, `codebase_dir_exists`, `subagent_timeout`.
34
40
  </step>
35
41
 
36
42
  <step name="check_existing">
@@ -82,22 +88,27 @@ mkdir -p .planning/codebase
82
88
  Continue to spawn_agents.
83
89
  </step>
84
90
 
85
- <step name="spawn_agents">
91
+ <step name="detect_runtime_capabilities">
92
+ Before spawning agents, detect whether the current runtime supports the `task` tool for subagent delegation.
93
+
94
+ **How to detect:** Check if you have access to a `task` tool (may be capitalized as `task` or lowercase as `task` depending on runtime). If you do NOT have a `task`/`task` tool (or only have tools like `browser_subagent` which is for web browsing, NOT code analysis):
95
+
96
+ → **Skip `spawn_agents` and `collect_confirmations`** — go directly to `sequential_mapping` instead.
97
+
98
+ **CRITICAL:** Never use `browser_subagent` or `Explore` as a substitute for `task`. The `browser_subagent` tool is exclusively for web page interaction and will fail for codebase analysis. If `task` is unavailable, perform the mapping sequentially in-context.
99
+ </step>
100
+
101
+ <step name="spawn_agents" condition="task tool is available">
86
102
  Spawn 4 parallel gsd-codebase-mapper agents.
87
103
 
88
104
  Use task tool with `subagent_type="gsd-codebase-mapper"`, `model="{mapper_model}"`, and `run_in_background=true` for parallel execution.
89
105
 
90
- **CRITICAL:** Use the dedicated `gsd-codebase-mapper` agent, NOT `Explore`. The mapper agent writes documents directly.
106
+ **CRITICAL:** Use the dedicated `gsd-codebase-mapper` agent, NOT `Explore` or `browser_subagent`. The mapper agent writes documents directly.
91
107
 
92
108
  **Agent 1: Tech Focus**
93
109
 
94
110
  ```
95
- task(
96
- subagent_type="gsd-codebase-mapper",
97
- model="{mapper_model}",
98
- run_in_background=true,
99
- description="Map codebase tech stack",
100
- prompt="Focus: tech
111
+ @gsd-codebase-mapper "Focus: tech
101
112
 
102
113
  Analyze this codebase for technology stack and external integrations.
103
114
 
@@ -105,19 +116,14 @@ write these documents to .planning/codebase/:
105
116
  - STACK.md - Languages, runtime, frameworks, dependencies, configuration
106
117
  - INTEGRATIONS.md - External APIs, databases, auth providers, webhooks
107
118
 
108
- Explore thoroughly. write documents directly using templates. Return confirmation only."
109
- )
119
+ Explore thoroughly. write documents directly using templates. Return confirmation only.
120
+ ${AGENT_SKILLS_MAPPER}"
110
121
  ```
111
122
 
112
123
  **Agent 2: Architecture Focus**
113
124
 
114
125
  ```
115
- task(
116
- subagent_type="gsd-codebase-mapper",
117
- model="{mapper_model}",
118
- run_in_background=true,
119
- description="Map codebase architecture",
120
- prompt="Focus: arch
126
+ @gsd-codebase-mapper "Focus: arch
121
127
 
122
128
  Analyze this codebase architecture and directory structure.
123
129
 
@@ -125,19 +131,14 @@ write these documents to .planning/codebase/:
125
131
  - ARCHITECTURE.md - Pattern, layers, data flow, abstractions, entry points
126
132
  - STRUCTURE.md - Directory layout, key locations, naming conventions
127
133
 
128
- Explore thoroughly. write documents directly using templates. Return confirmation only."
129
- )
134
+ Explore thoroughly. write documents directly using templates. Return confirmation only.
135
+ ${AGENT_SKILLS_MAPPER}"
130
136
  ```
131
137
 
132
138
  **Agent 3: Quality Focus**
133
139
 
134
140
  ```
135
- task(
136
- subagent_type="gsd-codebase-mapper",
137
- model="{mapper_model}",
138
- run_in_background=true,
139
- description="Map codebase conventions",
140
- prompt="Focus: quality
141
+ @gsd-codebase-mapper "Focus: quality
141
142
 
142
143
  Analyze this codebase for coding conventions and testing patterns.
143
144
 
@@ -145,36 +146,43 @@ write these documents to .planning/codebase/:
145
146
  - CONVENTIONS.md - Code style, naming, patterns, error handling
146
147
  - TESTING.md - Framework, structure, mocking, coverage
147
148
 
148
- Explore thoroughly. write documents directly using templates. Return confirmation only."
149
- )
149
+ Explore thoroughly. write documents directly using templates. Return confirmation only.
150
+ ${AGENT_SKILLS_MAPPER}"
150
151
  ```
151
152
 
152
153
  **Agent 4: Concerns Focus**
153
154
 
154
155
  ```
155
- task(
156
- subagent_type="gsd-codebase-mapper",
157
- model="{mapper_model}",
158
- run_in_background=true,
159
- description="Map codebase concerns",
160
- prompt="Focus: concerns
156
+ @gsd-codebase-mapper "Focus: concerns
161
157
 
162
158
  Analyze this codebase for technical debt, known issues, and areas of concern.
163
159
 
164
160
  write this document to .planning/codebase/:
165
161
  - CONCERNS.md - Tech debt, bugs, security, performance, fragile areas
166
162
 
167
- Explore thoroughly. write document directly using template. Return confirmation only."
168
- )
163
+ Explore thoroughly. write document directly using template. Return confirmation only.
164
+ ${AGENT_SKILLS_MAPPER}"
169
165
  ```
170
166
 
171
167
  Continue to collect_confirmations.
172
168
  </step>
173
169
 
174
170
  <step name="collect_confirmations">
175
- Wait for all 4 agents to complete.
171
+ Wait for all 4 agents to complete using TaskOutput tool.
176
172
 
177
- read each agent's output file to collect confirmations.
173
+ **For each agent task_id returned by the Agent tool calls above:**
174
+ ```
175
+ TaskOutput tool:
176
+ task_id: "{task_id from Agent result}"
177
+ block: true
178
+ timeout: {subagent_timeout from init context, default 300000}
179
+ ```
180
+
181
+ > The timeout is configurable via `workflow.subagent_timeout` in `.planning/config.json` (milliseconds). Default: 300000 (5 minutes). Increase for large codebases or slower models.
182
+
183
+ Call TaskOutput for all 4 agents in parallel (single message with 4 TaskOutput calls).
184
+
185
+ Once all TaskOutput calls return, read each agent's output file to collect confirmations.
178
186
 
179
187
  **Expected confirmation format from each agent:**
180
188
  ```
@@ -195,6 +203,37 @@ If any agent failed, note the failure and continue with successful documents.
195
203
  Continue to verify_output.
196
204
  </step>
197
205
 
206
+ <step name="sequential_mapping" condition="task tool is NOT available (e.g. Antigravity, Gemini CLI, Codex)">
207
+ When the `task` tool is unavailable, perform codebase mapping sequentially in the current context. This replaces `spawn_agents` and `collect_confirmations`.
208
+
209
+ **IMPORTANT:** Do NOT use `browser_subagent`, `Explore`, or any browser-based tool. Use only file system tools (read, bash, write, grep, glob, list_dir, view_file, grep_search, or equivalent tools available in your runtime).
210
+
211
+ Perform all 4 mapping passes sequentially:
212
+
213
+ **Pass 1: Tech Focus**
214
+ - Explore package.json/Cargo.toml/go.mod/requirements.txt, config files, dependency trees
215
+ - write `.planning/codebase/STACK.md` — Languages, runtime, frameworks, dependencies, configuration
216
+ - write `.planning/codebase/INTEGRATIONS.md` — External APIs, databases, auth providers, webhooks
217
+
218
+ **Pass 2: Architecture Focus**
219
+ - Explore directory structure, entry points, module boundaries, data flow
220
+ - write `.planning/codebase/ARCHITECTURE.md` — Pattern, layers, data flow, abstractions, entry points
221
+ - write `.planning/codebase/STRUCTURE.md` — Directory layout, key locations, naming conventions
222
+
223
+ **Pass 3: Quality Focus**
224
+ - Explore code style, error handling patterns, test files, CI config
225
+ - write `.planning/codebase/CONVENTIONS.md` — Code style, naming, patterns, error handling
226
+ - write `.planning/codebase/TESTING.md` — Framework, structure, mocking, coverage
227
+
228
+ **Pass 4: Concerns Focus**
229
+ - Explore TODOs, known issues, fragile areas, security patterns
230
+ - write `.planning/codebase/CONCERNS.md` — Tech debt, bugs, security, performance, fragile areas
231
+
232
+ Use the same document templates as the `gsd-codebase-mapper` agent. Include actual file paths formatted with backticks.
233
+
234
+ Continue to verify_output.
235
+ </step>
236
+
198
237
  <step name="verify_output">
199
238
  Verify all documents created successfully:
200
239
 
@@ -286,9 +325,9 @@ Created .planning/codebase/:
286
325
 
287
326
  **Initialize project** — use codebase context for planning
288
327
 
289
- `/gsd-new-project`
328
+ `/new` then:
290
329
 
291
- *`/new` first → fresh context window*
330
+ `/gsd-new-project`
292
331
 
293
332
  ---
294
333
 
@@ -307,10 +346,10 @@ End workflow.
307
346
 
308
347
  <success_criteria>
309
348
  - .planning/codebase/ directory created
310
- - 4 parallel gsd-codebase-mapper agents spawned with run_in_background=true
311
- - Agents write documents directly (orchestrator doesn't receive document contents)
312
- - read agent output files to collect confirmations
349
+ - If task tool available: 4 parallel gsd-codebase-mapper agents spawned with run_in_background=true
350
+ - If task tool NOT available: 4 sequential mapping passes performed inline (never using browser_subagent)
313
351
  - All 7 codebase documents exist
352
+ - No empty documents (each should have >20 lines)
314
353
  - Clear completion summary with line counts
315
354
  - User offered clear next steps in GSD style
316
355
  </success_criteria>
@@ -0,0 +1,223 @@
1
+ # Milestone Summary Workflow
2
+
3
+ Generate a comprehensive, human-friendly project summary from completed milestone artifacts.
4
+ Designed for team onboarding — a new contributor can read the output and understand the entire project.
5
+
6
+ ---
7
+
8
+ ## Step 1: Resolve Version
9
+
10
+ ```bash
11
+ VERSION="$ARGUMENTS"
12
+ ```
13
+
14
+ If `$ARGUMENTS` is empty:
15
+ 1. Check `.planning/STATE.md` for current milestone version
16
+ 2. Check `.planning/milestones/` for the latest archived version
17
+ 3. If neither found, check if `.planning/ROADMAP.md` exists (project may be mid-milestone)
18
+ 4. If nothing found: error "No milestone found. Run /gsd-new-project or /gsd-new-milestone first."
19
+
20
+ Set `VERSION` to the resolved version (e.g., "1.0").
21
+
22
+ ## Step 2: Locate Artifacts
23
+
24
+ Determine whether the milestone is **archived** or **current**:
25
+
26
+ **Archived milestone** (`.planning/milestones/v{VERSION}-ROADMAP.md` exists):
27
+ ```
28
+ ROADMAP_PATH=".planning/milestones/v${VERSION}-ROADMAP.md"
29
+ REQUIREMENTS_PATH=".planning/milestones/v${VERSION}-REQUIREMENTS.md"
30
+ AUDIT_PATH=".planning/milestones/v${VERSION}-MILESTONE-AUDIT.md"
31
+ ```
32
+
33
+ **Current/in-progress milestone** (no archive yet):
34
+ ```
35
+ ROADMAP_PATH=".planning/ROADMAP.md"
36
+ REQUIREMENTS_PATH=".planning/REQUIREMENTS.md"
37
+ AUDIT_PATH=".planning/v${VERSION}-MILESTONE-AUDIT.md"
38
+ ```
39
+
40
+ Note: The audit file moves to `.planning/milestones/` on archive (per `complete-milestone` workflow). Check both locations as a fallback.
41
+
42
+ **Always available:**
43
+ ```
44
+ PROJECT_PATH=".planning/PROJECT.md"
45
+ RETRO_PATH=".planning/RETROSPECTIVE.md"
46
+ STATE_PATH=".planning/STATE.md"
47
+ ```
48
+
49
+ read all files that exist. Missing files are fine — the summary adapts to what's available.
50
+
51
+ ## Step 3: Discover Phase Artifacts
52
+
53
+ Find all phase directories:
54
+
55
+ ```bash
56
+ gsd-tools.cjs init progress
57
+ ```
58
+
59
+ This returns phase metadata. For each phase in the milestone scope:
60
+
61
+ - read `{phase_dir}/{padded}-SUMMARY.md` if it exists — extract `one_liner`, `accomplishments`, `decisions`
62
+ - read `{phase_dir}/{padded}-VERIFICATION.md` if it exists — extract status, gaps, deferred items
63
+ - read `{phase_dir}/{padded}-CONTEXT.md` if it exists — extract key decisions from `<decisions>` section
64
+ - read `{phase_dir}/{padded}-RESEARCH.md` if it exists — note what was researched
65
+
66
+ Track which phases have which artifacts.
67
+
68
+ **If no phase directories exist** (empty milestone or pre-build state): skip to Step 5 and generate a minimal summary noting "No phases have been executed yet." Do not error — the summary should still capture PROJECT.md and ROADMAP.md content.
69
+
70
+ ## Step 4: Gather Git Statistics
71
+
72
+ Try each method in order until one succeeds:
73
+
74
+ **Method 1 — Tagged milestone** (check first):
75
+ ```bash
76
+ git tag -l "v${VERSION}" | head -1
77
+ ```
78
+ If the tag exists:
79
+ ```bash
80
+ git log v${VERSION} --oneline | wc -l
81
+ git diff --stat $(git log --format=%H --reverse v${VERSION} | head -1)..v${VERSION}
82
+ ```
83
+
84
+ **Method 2 — STATE.md date range** (if no tag):
85
+ read STATE.md and extract the `started_at` or earliest session date. Use it as the `--since` boundary:
86
+ ```bash
87
+ git log --oneline --since="<started_at_date>" | wc -l
88
+ ```
89
+
90
+ **Method 3 — Earliest phase commit** (if STATE.md has no date):
91
+ Find the earliest `.planning/phases/` commit:
92
+ ```bash
93
+ git log --oneline --diff-filter=A -- ".planning/phases/" | tail -1
94
+ ```
95
+ Use that commit's date as the start boundary.
96
+
97
+ **Method 4 — Skip stats** (if none of the above work):
98
+ Report "Git statistics unavailable — no tag or date range could be determined." This is not an error — the summary continues without the Stats section.
99
+
100
+ Extract (when available):
101
+ - Total commits in milestone
102
+ - Files changed, insertions, deletions
103
+ - Timeline (start date → end date)
104
+ - Contributors (from git log authors)
105
+
106
+ ## Step 5: Generate Summary Document
107
+
108
+ write to `.planning/reports/MILESTONE_SUMMARY-v${VERSION}.md`:
109
+
110
+ ```markdown
111
+ # Milestone v{VERSION} — Project Summary
112
+
113
+ **Generated:** {date}
114
+ **Purpose:** Team onboarding and project review
115
+
116
+ ---
117
+
118
+ ## 1. Project Overview
119
+
120
+ {From PROJECT.md: "What This Is", core value proposition, target users}
121
+ {If mid-milestone: note which phases are complete vs in-progress}
122
+
123
+ ## 2. Architecture & Technical Decisions
124
+
125
+ {From CONTEXT.md files across phases: key technical choices}
126
+ {From SUMMARY.md decisions: patterns, libraries, frameworks chosen}
127
+ {From PROJECT.md: tech stack if documented}
128
+
129
+ Present as a bulleted list of decisions with brief rationale:
130
+ - **Decision:** {what was chosen}
131
+ - **Why:** {rationale from CONTEXT.md}
132
+ - **Phase:** {which phase made this decision}
133
+
134
+ ## 3. Phases Delivered
135
+
136
+ | Phase | Name | Status | One-Liner |
137
+ |-------|------|--------|-----------|
138
+ {For each phase: number, name, status (complete/in-progress/planned), one_liner from SUMMARY.md}
139
+
140
+ ## 4. Requirements Coverage
141
+
142
+ {From REQUIREMENTS.md: list each requirement with status}
143
+ - ✅ {Requirement met}
144
+ - ⚠️ {Requirement partially met — note gap}
145
+ - ❌ {Requirement not met — note reason}
146
+
147
+ {If MILESTONE-AUDIT.md exists: include audit verdict}
148
+
149
+ ## 5. Key Decisions Log
150
+
151
+ {Aggregate from all CONTEXT.md <decisions> sections}
152
+ {Each decision with: ID, description, phase, rationale}
153
+
154
+ ## 6. Tech Debt & Deferred Items
155
+
156
+ {From VERIFICATION.md files: gaps found, anti-patterns noted}
157
+ {From RETROSPECTIVE.md: lessons learned, what to improve}
158
+ {From CONTEXT.md <deferred> sections: ideas parked for later}
159
+
160
+ ## 7. Getting Started
161
+
162
+ {Entry points for new contributors:}
163
+ - **Run the project:** {from PROJECT.md or SUMMARY.md}
164
+ - **Key directories:** {from codebase structure}
165
+ - **Tests:** {test command from PROJECT.md or AGENTS.md}
166
+ - **Where to look first:** {main entry points, core modules}
167
+
168
+ ---
169
+
170
+ ## Stats
171
+
172
+ - **Timeline:** {start} → {end} ({duration})
173
+ - **Phases:** {count complete} / {count total}
174
+ - **Commits:** {count}
175
+ - **Files changed:** {count} (+{insertions} / -{deletions})
176
+ - **Contributors:** {list}
177
+ ```
178
+
179
+ ## Step 6: write and Commit
180
+
181
+ **Overwrite guard:** If `.planning/reports/MILESTONE_SUMMARY-v${VERSION}.md` already exists, ask the user:
182
+ > "A milestone summary for v{VERSION} already exists. Overwrite it, or view the existing one?"
183
+ If "view": display existing file and skip to Step 8 (interactive mode). If "overwrite": proceed.
184
+
185
+ Create the reports directory if needed:
186
+ ```bash
187
+ mkdir -p .planning/reports
188
+ ```
189
+
190
+ write the summary, then commit:
191
+ ```bash
192
+ gsd-tools.cjs commit "docs(v${VERSION}): generate milestone summary for onboarding" \
193
+ --files ".planning/reports/MILESTONE_SUMMARY-v${VERSION}.md"
194
+ ```
195
+
196
+ ## Step 7: Present Summary
197
+
198
+ Display the full summary document inline.
199
+
200
+ ## Step 8: Offer Interactive Mode
201
+
202
+ After presenting the summary:
203
+
204
+ > "Summary written to `.planning/reports/MILESTONE_SUMMARY-v{VERSION}.md`.
205
+ >
206
+ > I have full context from the build artifacts. Want to ask anything about the project?
207
+ > Architecture decisions, specific phases, requirements, tech debt — ask away."
208
+
209
+ If the user asks questions:
210
+ - Answer from the artifacts already loaded (CONTEXT.md, SUMMARY.md, VERIFICATION.md, etc.)
211
+ - Reference specific files and decisions
212
+ - Stay grounded in what was actually built (not speculation)
213
+
214
+ If the user is done:
215
+ - Suggest next steps: `/gsd-new-milestone`, `/gsd-progress`, or sharing the summary with the team
216
+
217
+ ## Step 9: Update STATE.md
218
+
219
+ ```bash
220
+ gsd-tools.cjs state record-session \
221
+ --stopped-at "Milestone v${VERSION} summary generated" \
222
+ --resume-file ".planning/reports/MILESTONE_SUMMARY-v${VERSION}.md"
223
+ ```