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,653 @@
1
+ <purpose>
2
+ Extract implementation decisions that downstream agents need — using codebase-first analysis
3
+ and assumption surfacing instead of interview-style questioning.
4
+
5
+ You are a thinking partner, not an interviewer. Analyze the codebase deeply, surface what you
6
+ believe based on evidence, and ask the user only to correct what's wrong.
7
+ </purpose>
8
+
9
+ <available_agent_types>
10
+ Valid GSD subagent types (use exact names — do not fall back to 'general-purpose'):
11
+ - gsd-assumptions-analyzer — Analyzes codebase to surface implementation assumptions
12
+ </available_agent_types>
13
+
14
+ <downstream_awareness>
15
+ **CONTEXT.md feeds into:**
16
+
17
+ 1. **gsd-phase-researcher** — Reads CONTEXT.md to know WHAT to research
18
+ 2. **gsd-planner** — Reads CONTEXT.md to know WHAT decisions are locked
19
+
20
+ **Your job:** Capture decisions clearly enough that downstream agents can act on them
21
+ without asking the user again. Output is identical to discuss mode — same CONTEXT.md format.
22
+ </downstream_awareness>
23
+
24
+ <philosophy>
25
+ **Assumptions mode philosophy:**
26
+
27
+ The user is a visionary, not a codebase archaeologist. They need enough context to evaluate
28
+ whether your assumptions match their intent — not to answer questions you could figure out
29
+ by reading the code.
30
+
31
+ - Read the codebase FIRST, form opinions SECOND, ask ONLY about what's genuinely unclear
32
+ - Every assumption must cite evidence (file paths, patterns found)
33
+ - Every assumption must state consequences if wrong
34
+ - Minimize user interactions: ~2-4 corrections vs ~15-20 questions
35
+ </philosophy>
36
+
37
+ <scope_guardrail>
38
+ **CRITICAL: No scope creep.**
39
+
40
+ The phase boundary comes from ROADMAP.md and is FIXED. Discussion clarifies HOW to implement
41
+ what's scoped, never WHETHER to add new capabilities.
42
+
43
+ When user suggests scope creep:
44
+ "[Feature X] would be a new capability — that's its own phase.
45
+ Want me to note it for the roadmap backlog? For now, let's focus on [phase domain]."
46
+
47
+ Capture the idea in "Deferred Ideas". Don't lose it, don't act on it.
48
+ </scope_guardrail>
49
+
50
+ <answer_validation>
51
+ **IMPORTANT: Answer validation** — After every AskUserQuestion call, check if the response
52
+ is empty or whitespace-only. If so:
53
+ 1. Retry the question once with the same parameters
54
+ 2. If still empty, present the options as a plain-text numbered list
55
+
56
+ **Text mode (`workflow.text_mode: true` in config or `--text` flag):**
57
+ When text mode is active, do not use AskUserQuestion at all. Present every question as a
58
+ plain-text numbered list and ask the user to type their choice number.
59
+ </answer_validation>
60
+
61
+ <process>
62
+
63
+ <step name="initialize" priority="first">
64
+ Phase number from argument (required).
65
+
66
+ ```bash
67
+ INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op "${PHASE}")
68
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
69
+ AGENT_SKILLS_ANALYZER=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-assumptions-analyzer 2>/dev/null)
70
+ ```
71
+
72
+ Parse JSON for: `commit_docs`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`,
73
+ `phase_slug`, `padded_phase`, `has_research`, `has_context`, `has_plans`, `has_verification`,
74
+ `plan_count`, `roadmap_exists`, `planning_exists`.
75
+
76
+ **If `phase_found` is false:**
77
+ ```
78
+ Phase [X] not found in roadmap.
79
+
80
+ Use /gsd:progress to see available phases.
81
+ ```
82
+ Exit workflow.
83
+
84
+ **If `phase_found` is true:** Continue to check_existing.
85
+
86
+ **Auto mode** — If `--auto` is present in ARGUMENTS:
87
+ - In `check_existing`: auto-select "Update it" (if context exists) or continue without prompting
88
+ - In `present_assumptions`: skip confirmation gate, proceed directly to write CONTEXT.md
89
+ - In `correct_assumptions`: auto-select recommended option for each correction
90
+ - Log each auto-selected choice inline
91
+ - After completion, auto-advance to plan-phase
92
+ </step>
93
+
94
+ <step name="check_existing">
95
+ Check if CONTEXT.md already exists using `has_context` from init.
96
+
97
+ ```bash
98
+ ls ${phase_dir}/*-CONTEXT.md 2>/dev/null || true
99
+ ```
100
+
101
+ **If exists:**
102
+
103
+ **If `--auto`:** Auto-select "Update it". Log: `[auto] Context exists — updating with assumption-based analysis.`
104
+
105
+ **Otherwise:** Use AskUserQuestion:
106
+ - header: "Context"
107
+ - question: "Phase [X] already has context. What do you want to do?"
108
+ - options:
109
+ - "Update it" — Re-analyze codebase and refresh assumptions
110
+ - "View it" — Show me what's there
111
+ - "Skip" — Use existing context as-is
112
+
113
+ If "Update": Load existing, continue to load_prior_context
114
+ If "View": Display CONTEXT.md, then offer update/skip
115
+ If "Skip": Exit workflow
116
+
117
+ **If doesn't exist:**
118
+
119
+ Check `has_plans` and `plan_count` from init. **If `has_plans` is true:**
120
+
121
+ **If `--auto`:** Auto-select "Continue and replan after". Log: `[auto] Plans exist — continuing with assumption analysis, will replan after.`
122
+
123
+ **Otherwise:** Use AskUserQuestion:
124
+ - header: "Plans exist"
125
+ - question: "Phase [X] already has {plan_count} plan(s) created without user context. Your decisions here won't affect existing plans unless you replan."
126
+ - options:
127
+ - "Continue and replan after"
128
+ - "View existing plans"
129
+ - "Cancel"
130
+
131
+ If "Continue and replan after": Continue to load_prior_context.
132
+ If "View existing plans": Display plan files, then offer "Continue" / "Cancel".
133
+ If "Cancel": Exit workflow.
134
+
135
+ **If `has_plans` is false:** Continue to load_prior_context.
136
+ </step>
137
+
138
+ <step name="load_prior_context">
139
+ Read project-level and prior phase context to avoid re-asking decided questions.
140
+
141
+ **Step 1: Read project-level files**
142
+ ```bash
143
+ cat .planning/PROJECT.md 2>/dev/null || true
144
+ cat .planning/REQUIREMENTS.md 2>/dev/null || true
145
+ cat .planning/STATE.md 2>/dev/null || true
146
+ ```
147
+
148
+ Extract from these:
149
+ - **PROJECT.md** — Vision, principles, non-negotiables, user preferences
150
+ - **REQUIREMENTS.md** — Acceptance criteria, constraints
151
+ - **STATE.md** — Current progress, any flags
152
+
153
+ **Step 2: Read all prior CONTEXT.md files**
154
+ ```bash
155
+ (find .planning/phases -name "*-CONTEXT.md" 2>/dev/null || true) | sort
156
+ ```
157
+
158
+ For each CONTEXT.md where phase number < current phase:
159
+ - Read the `<decisions>` section — these are locked preferences
160
+ - Read `<specifics>` — particular references or "I want it like X" moments
161
+ - Note patterns (e.g., "user consistently prefers minimal UI")
162
+
163
+ **Step 3: Build internal `<prior_decisions>` context**
164
+
165
+ Structure the extracted information for use in assumption generation.
166
+
167
+ **If no prior context exists:** Continue without — expected for early phases.
168
+ </step>
169
+
170
+ <step name="cross_reference_todos">
171
+ Check if any pending todos are relevant to this phase's scope.
172
+
173
+ ```bash
174
+ TODO_MATCHES=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" todo match-phase "${PHASE_NUMBER}")
175
+ ```
176
+
177
+ Parse JSON for: `todo_count`, `matches[]`.
178
+
179
+ **If `todo_count` is 0:** Skip silently.
180
+
181
+ **If matches found:** Present matched todos, use AskUserQuestion (multiSelect) to fold relevant ones into scope.
182
+
183
+ **For selected (folded) todos:** Store as `<folded_todos>` for CONTEXT.md `<decisions>` section.
184
+ **For unselected:** Store as `<reviewed_todos>` for CONTEXT.md `<deferred>` section.
185
+
186
+ **Auto mode (`--auto`):** Fold all todos with score >= 0.4 automatically. Log the selection.
187
+ </step>
188
+
189
+ <step name="scout_codebase">
190
+ Lightweight scan of existing code to inform assumption generation.
191
+
192
+ **Step 1: Check for existing codebase maps**
193
+ ```bash
194
+ ls .planning/codebase/*.md 2>/dev/null || true
195
+ ```
196
+
197
+ **If codebase maps exist:** Read relevant ones (CONVENTIONS.md, STRUCTURE.md, STACK.md). Extract reusable components, patterns, integration points. Skip to Step 3.
198
+
199
+ **Step 2: If no codebase maps, do targeted grep**
200
+
201
+ Extract key terms from phase goal, search for related files.
202
+
203
+ ```bash
204
+ grep -rl "{term1}\|{term2}" src/ app/ --include="*.ts" --include="*.tsx" 2>/dev/null | head -10
205
+ ```
206
+
207
+ Read the 3-5 most relevant files.
208
+
209
+ **Step 3: Build internal `<codebase_context>`**
210
+
211
+ Identify reusable assets, established patterns, integration points, and creative options. Store internally for use in deep_codebase_analysis.
212
+ </step>
213
+
214
+ <step name="deep_codebase_analysis">
215
+ Spawn a `gsd-assumptions-analyzer` agent to deeply analyze the codebase for this phase. This
216
+ keeps raw file contents out of the main context window, protecting token budget.
217
+
218
+ **Resolve calibration tier (if USER-PROFILE.md exists):**
219
+
220
+ ```bash
221
+ PROFILE_PATH="$HOME/.claude/get-shit-done/USER-PROFILE.md"
222
+ ```
223
+
224
+ If file exists at PROFILE_PATH:
225
+ - Priority 1: Read config.json > preferences.vendor_philosophy (project-level override)
226
+ - Priority 2: Read USER-PROFILE.md Vendor Choices/Philosophy rating (global)
227
+ - Priority 3: Default to "standard"
228
+
229
+ Map to calibration tier:
230
+ - conservative OR thorough-evaluator → full_maturity (more alternatives, detailed evidence)
231
+ - opinionated → minimal_decisive (fewer alternatives, decisive recommendations)
232
+ - pragmatic-fast OR any other value → standard
233
+
234
+ If no USER-PROFILE.md: calibration_tier = "standard"
235
+
236
+ **Spawn Explore subagent:**
237
+
238
+ ```
239
+ Task(subagent_type="gsd-assumptions-analyzer", prompt="""
240
+ Analyze the codebase for Phase {PHASE}: {phase_name}.
241
+
242
+ Phase goal: {roadmap_description}
243
+ Prior decisions: {prior_decisions_summary}
244
+ Codebase scout hints: {codebase_context_summary}
245
+ Calibration: {calibration_tier}
246
+
247
+ Your job:
248
+ 1. Read ROADMAP.md phase {PHASE} description
249
+ 2. Read any prior CONTEXT.md files from earlier phases
250
+ 3. Glob/Grep for files related to: {phase_relevant_terms}
251
+ 4. Read 5-15 most relevant source files
252
+ 5. Return structured assumptions
253
+
254
+ ## Output Format
255
+
256
+ Return EXACTLY this structure:
257
+
258
+ ## Assumptions
259
+
260
+ ### [Area Name] (e.g., "Technical Approach")
261
+ - **Assumption:** [Decision statement]
262
+ - **Why this way:** [Evidence from codebase — cite file paths]
263
+ - **If wrong:** [Concrete consequence of this being wrong]
264
+ - **Confidence:** Confident | Likely | Unclear
265
+
266
+ (3-5 areas, calibrated by tier:
267
+ - full_maturity: 3-5 areas, 2-3 alternatives per Likely/Unclear item
268
+ - standard: 3-4 areas, 2 alternatives per Likely/Unclear item
269
+ - minimal_decisive: 2-3 areas, decisive single recommendation per item)
270
+
271
+ ## Needs External Research
272
+ [Topics where codebase alone is insufficient — library version compatibility,
273
+ ecosystem best practices, etc. Leave empty if codebase provides enough evidence.]
274
+
275
+ ${AGENT_SKILLS_ANALYZER}
276
+ """)
277
+ ```
278
+
279
+ Parse the subagent's response. Extract:
280
+ - `assumptions[]` — each with area, statement, evidence, consequence, confidence
281
+ - `needs_research[]` — topics requiring external research (may be empty)
282
+
283
+ **Initialize canonical refs accumulator:**
284
+ - Source 1: Copy `Canonical refs:` from ROADMAP.md for this phase, expand to full paths
285
+ - Source 2: Check REQUIREMENTS.md and PROJECT.md for specs/ADRs referenced
286
+ - Source 3: Add any docs referenced in codebase scout results
287
+ </step>
288
+
289
+ <step name="external_research">
290
+ **Skip if:** `needs_research` from deep_codebase_analysis is empty.
291
+
292
+ If research topics were flagged, spawn a general-purpose research agent:
293
+
294
+ ```
295
+ Task(subagent_type="general-purpose", prompt="""
296
+ Research the following topics for Phase {PHASE}: {phase_name}.
297
+
298
+ Topics needing research:
299
+ {needs_research_content}
300
+
301
+ For each topic, return:
302
+ - **Finding:** [What you learned]
303
+ - **Source:** [URL or library docs reference]
304
+ - **Confidence impact:** [Which assumption this resolves and to what confidence level]
305
+
306
+ Use Context7 (resolve-library-id then query-docs) for library-specific questions.
307
+ Use WebSearch for ecosystem/best-practice questions.
308
+ """)
309
+ ```
310
+
311
+ Merge findings back into assumptions:
312
+ - Update confidence levels where research resolves ambiguity
313
+ - Add source attribution to affected assumptions
314
+ - Store research findings for DISCUSSION-LOG.md
315
+
316
+ **If no gaps flagged:** Skip entirely. Most phases will skip this step.
317
+ </step>
318
+
319
+ <step name="present_assumptions">
320
+ Display all assumptions grouped by area with confidence badges.
321
+
322
+ **Format for display:**
323
+
324
+ ```
325
+ ## Phase {PHASE}: {phase_name} — Assumptions
326
+
327
+ Based on codebase analysis, here's what I'd go with:
328
+
329
+ ### {Area Name}
330
+ {Confidence badge} **{Assumption statement}**
331
+ ↳ Evidence: {file paths cited}
332
+ ↳ If wrong: {consequence}
333
+
334
+ ### {Area Name 2}
335
+ ...
336
+
337
+ [If external research was done:]
338
+ ### External Research Applied
339
+ - {Topic}: {Finding} (Source: {URL})
340
+ ```
341
+
342
+ **If `--auto`:**
343
+ - If all assumptions are Confident or Likely: log assumptions, skip to write_context.
344
+ Log: `[auto] All assumptions Confident/Likely — proceeding to context capture.`
345
+ - If any assumptions are Unclear: log a warning, auto-select recommended alternative for
346
+ each Unclear item. Log: `[auto] {N} Unclear assumptions auto-resolved with recommended defaults.`
347
+ Proceed to write_context.
348
+
349
+ **Otherwise:** Use AskUserQuestion:
350
+ - header: "Assumptions"
351
+ - question: "These all look right?"
352
+ - options:
353
+ - "Yes, proceed" — Write CONTEXT.md with these assumptions as decisions
354
+ - "Let me correct some" — Select which assumptions to change
355
+
356
+ **If "Yes, proceed":** Skip to write_context.
357
+ **If "Let me correct some":** Continue to correct_assumptions.
358
+ </step>
359
+
360
+ <step name="correct_assumptions">
361
+ The assumptions are already displayed above from present_assumptions.
362
+
363
+ Present a multiSelect where each option's label is the assumption statement and description
364
+ is the "If wrong" consequence:
365
+
366
+ Use AskUserQuestion (multiSelect):
367
+ - header: "Corrections"
368
+ - question: "Which assumptions need correcting?"
369
+ - options: [one per assumption, label = assumption statement, description = "If wrong: {consequence}"]
370
+
371
+ For each selected correction, ask ONE focused question:
372
+
373
+ Use AskUserQuestion:
374
+ - header: "{Area Name}"
375
+ - question: "What should we do instead for: {assumption statement}?"
376
+ - options: [2-3 concrete alternatives describing user-visible outcomes, recommended option first]
377
+
378
+ Record each correction:
379
+ - Original assumption
380
+ - User's chosen alternative
381
+ - Reason (if provided via "Other" free text)
382
+
383
+ After all corrections processed, continue to write_context with updated assumptions.
384
+
385
+ **Auto mode:** Should not reach this step (--auto skips from present_assumptions).
386
+ </step>
387
+
388
+ <step name="write_context">
389
+ Create phase directory if needed. Write CONTEXT.md using the standard 6-section format.
390
+
391
+ **File:** `${phase_dir}/${padded_phase}-CONTEXT.md`
392
+
393
+ Map assumptions to CONTEXT.md sections:
394
+ - Assumptions → `<decisions>` (each assumption becomes a locked decision: D-01, D-02, etc.)
395
+ - Corrections → override the original assumption in `<decisions>`
396
+ - Areas where all assumptions were Confident → marked as locked decisions
397
+ - Areas with corrections → include user's chosen alternative as the decision
398
+ - Folded todos → included in `<decisions>` under "### Folded Todos"
399
+
400
+ ```markdown
401
+ # Phase {PHASE}: {phase_name} - Context
402
+
403
+ **Gathered:** {date} (assumptions mode)
404
+ **Status:** Ready for planning
405
+
406
+ <domain>
407
+ ## Phase Boundary
408
+
409
+ {Domain boundary from ROADMAP.md — clear statement of scope anchor}
410
+ </domain>
411
+
412
+ <decisions>
413
+ ## Implementation Decisions
414
+
415
+ ### {Area Name 1}
416
+ - **D-01:** {Decision — from assumption or correction}
417
+ - **D-02:** {Decision}
418
+
419
+ ### {Area Name 2}
420
+ - **D-03:** {Decision}
421
+
422
+ ### Claude's Discretion
423
+ {Any assumptions where the user confirmed "you decide" or left as-is with Likely confidence}
424
+
425
+ ### Folded Todos
426
+ {If any todos were folded into scope}
427
+ </decisions>
428
+
429
+ <canonical_refs>
430
+ ## Canonical References
431
+
432
+ **Downstream agents MUST read these before planning or implementing.**
433
+
434
+ {Accumulated canonical refs from analyze step — full relative paths}
435
+
436
+ [If no external specs: "No external specs — requirements fully captured in decisions above"]
437
+ </canonical_refs>
438
+
439
+ <code_context>
440
+ ## Existing Code Insights
441
+
442
+ ### Reusable Assets
443
+ {From codebase scout + Explore subagent findings}
444
+
445
+ ### Established Patterns
446
+ {Patterns that constrain/enable this phase}
447
+
448
+ ### Integration Points
449
+ {Where new code connects to existing system}
450
+ </code_context>
451
+
452
+ <specifics>
453
+ ## Specific Ideas
454
+
455
+ {Any particular references from corrections or user input}
456
+
457
+ [If none: "No specific requirements — open to standard approaches"]
458
+ </specifics>
459
+
460
+ <deferred>
461
+ ## Deferred Ideas
462
+
463
+ {Ideas mentioned during corrections that are out of scope}
464
+
465
+ ### Reviewed Todos (not folded)
466
+ {Todos reviewed but not folded — with reason}
467
+
468
+ [If none: "None — analysis stayed within phase scope"]
469
+ </deferred>
470
+ ```
471
+
472
+ Write file.
473
+ </step>
474
+
475
+ <step name="write_discussion_log">
476
+ Write audit trail of assumptions and corrections.
477
+
478
+ **File:** `${phase_dir}/${padded_phase}-DISCUSSION-LOG.md`
479
+
480
+ ```markdown
481
+ # Phase {PHASE}: {phase_name} - Discussion Log (Assumptions Mode)
482
+
483
+ > **Audit trail only.** Do not use as input to planning, research, or execution agents.
484
+ > Decisions captured in CONTEXT.md — this log preserves the analysis.
485
+
486
+ **Date:** {ISO date}
487
+ **Phase:** {padded_phase}-{phase_name}
488
+ **Mode:** assumptions
489
+ **Areas analyzed:** {comma-separated area names}
490
+
491
+ ## Assumptions Presented
492
+
493
+ ### {Area Name}
494
+ | Assumption | Confidence | Evidence |
495
+ |------------|-----------|----------|
496
+ | {Statement} | {Confident/Likely/Unclear} | {file paths} |
497
+
498
+ {Repeat for each area}
499
+
500
+ ## Corrections Made
501
+
502
+ {If corrections were made:}
503
+
504
+ ### {Area Name}
505
+ - **Original assumption:** {what Claude assumed}
506
+ - **User correction:** {what the user chose instead}
507
+ - **Reason:** {user's rationale, if provided}
508
+
509
+ {If no corrections: "No corrections — all assumptions confirmed."}
510
+
511
+ ## Auto-Resolved
512
+
513
+ {If --auto and Unclear items existed:}
514
+ - {Assumption}: auto-selected {recommended option}
515
+
516
+ {If not applicable: omit this section}
517
+
518
+ ## External Research
519
+
520
+ {If research was performed:}
521
+ - {Topic}: {Finding} (Source: {URL})
522
+
523
+ {If no research: omit this section}
524
+ ```
525
+
526
+ Write file.
527
+ </step>
528
+
529
+ <step name="git_commit">
530
+ Commit phase context and discussion log:
531
+
532
+ ```bash
533
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(${padded_phase}): capture phase context (assumptions mode)" --files "${phase_dir}/${padded_phase}-CONTEXT.md" "${phase_dir}/${padded_phase}-DISCUSSION-LOG.md"
534
+ ```
535
+
536
+ Confirm: "Committed: docs(${padded_phase}): capture phase context (assumptions mode)"
537
+ </step>
538
+
539
+ <step name="update_state">
540
+ Update STATE.md with session info:
541
+
542
+ ```bash
543
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state record-session \
544
+ --stopped-at "Phase ${PHASE} context gathered (assumptions mode)" \
545
+ --resume-file "${phase_dir}/${padded_phase}-CONTEXT.md"
546
+ ```
547
+
548
+ Commit STATE.md:
549
+
550
+ ```bash
551
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(state): record phase ${PHASE} context session" --files .planning/STATE.md
552
+ ```
553
+ </step>
554
+
555
+ <step name="confirm_creation">
556
+ Present summary and next steps:
557
+
558
+ ```
559
+ Created: .planning/phases/${PADDED_PHASE}-${SLUG}/${PADDED_PHASE}-CONTEXT.md
560
+
561
+ ## Decisions Captured (Assumptions Mode)
562
+
563
+ ### {Area Name}
564
+ - {Key decision} (from assumption / corrected)
565
+
566
+ {Repeat per area}
567
+
568
+ [If corrections were made:]
569
+ ## Corrections Applied
570
+ - {Area}: {original} → {corrected}
571
+
572
+ [If deferred ideas exist:]
573
+ ## Noted for Later
574
+ - {Deferred idea} — future phase
575
+
576
+ ---
577
+
578
+ ## ▶ Next Up
579
+
580
+ **Phase ${PHASE}: {phase_name}** — {Goal from ROADMAP.md}
581
+
582
+ `/gsd:plan-phase ${PHASE}`
583
+
584
+ <sub>`/clear` first → fresh context window</sub>
585
+
586
+ ---
587
+
588
+ **Also available:**
589
+ - `/gsd:plan-phase ${PHASE} --skip-research` — plan without research
590
+ - `/gsd:ui-phase ${PHASE}` — generate UI design contract (if frontend work)
591
+ - Review/edit CONTEXT.md before continuing
592
+
593
+ ---
594
+ ```
595
+ </step>
596
+
597
+ <step name="auto_advance">
598
+ Check for auto-advance trigger:
599
+
600
+ 1. Parse `--auto` flag from $ARGUMENTS
601
+ 2. Sync chain flag:
602
+ ```bash
603
+ if [[ ! "$ARGUMENTS" =~ --auto ]]; then
604
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active false 2>/dev/null
605
+ fi
606
+ ```
607
+ 3. Read chain flag and user preference:
608
+ ```bash
609
+ AUTO_CHAIN=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false")
610
+ AUTO_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
611
+ ```
612
+
613
+ **If `--auto` flag present AND `AUTO_CHAIN` is not true:**
614
+ ```bash
615
+ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active true
616
+ ```
617
+
618
+ **If `--auto` flag present OR `AUTO_CHAIN` is true OR `AUTO_CFG` is true:**
619
+
620
+ Display banner:
621
+ ```
622
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
623
+ GSD ► AUTO-ADVANCING TO PLAN
624
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
625
+
626
+ Context captured (assumptions mode). Launching plan-phase...
627
+ ```
628
+
629
+ Launch: `Skill(skill="gsd:plan-phase", args="${PHASE} --auto")`
630
+
631
+ Handle return: PHASE COMPLETE / PLANNING COMPLETE / INCONCLUSIVE / GAPS FOUND
632
+ (identical handling to discuss-phase.md auto_advance step)
633
+
634
+ **If neither `--auto` nor config enabled:**
635
+ Route to confirm_creation step.
636
+ </step>
637
+
638
+ </process>
639
+
640
+ <success_criteria>
641
+ - Phase validated against roadmap
642
+ - Prior context loaded (no re-asking decided questions)
643
+ - Codebase deeply analyzed via Explore subagent (5-15 files read)
644
+ - Assumptions surfaced with evidence and confidence levels
645
+ - User confirmed or corrected assumptions (~2-4 interactions max)
646
+ - Scope creep redirected to deferred ideas
647
+ - CONTEXT.md captures actual decisions (identical format to discuss mode)
648
+ - CONTEXT.md includes canonical_refs with full file paths (MANDATORY)
649
+ - CONTEXT.md includes code_context from codebase analysis
650
+ - DISCUSSION-LOG.md records assumptions and corrections as audit trail
651
+ - STATE.md updated with session info
652
+ - User knows next steps
653
+ </success_criteria>