gsd-opencode 1.20.4 → 1.22.1

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 (110) hide show
  1. package/agents/gsd-codebase-mapper.md +10 -1
  2. package/agents/gsd-debugger.md +67 -10
  3. package/agents/gsd-executor.md +37 -16
  4. package/agents/gsd-integration-checker.md +3 -0
  5. package/agents/gsd-nyquist-auditor.md +179 -0
  6. package/agents/gsd-phase-researcher.md +29 -34
  7. package/agents/gsd-plan-checker.md +43 -78
  8. package/agents/gsd-planner.md +140 -24
  9. package/agents/gsd-project-researcher.md +12 -1
  10. package/agents/gsd-research-synthesizer.md +14 -3
  11. package/agents/gsd-roadmapper.md +26 -15
  12. package/agents/gsd-verifier.md +30 -6
  13. package/bin/dm/lib/constants.js +6 -1
  14. package/bin/dm/src/services/file-ops.js +14 -1
  15. package/commands/gsd/gsd-add-phase.md +6 -6
  16. package/commands/gsd/gsd-add-tests.md +41 -0
  17. package/commands/gsd/gsd-add-todo.md +7 -7
  18. package/commands/gsd/gsd-audit-milestone.md +9 -9
  19. package/commands/gsd/gsd-check-profile.md +3 -3
  20. package/commands/gsd/gsd-check-todos.md +7 -7
  21. package/commands/gsd/gsd-cleanup.md +2 -2
  22. package/commands/gsd/gsd-complete-milestone.md +6 -6
  23. package/commands/gsd/gsd-debug.md +11 -7
  24. package/commands/gsd/gsd-discuss-phase.md +26 -19
  25. package/commands/gsd/gsd-execute-phase.md +13 -13
  26. package/commands/gsd/gsd-health.md +7 -7
  27. package/commands/gsd/gsd-help.md +2 -2
  28. package/commands/gsd/gsd-insert-phase.md +6 -6
  29. package/commands/gsd/gsd-join-discord.md +1 -1
  30. package/commands/gsd/gsd-list-phase-assumptions.md +6 -6
  31. package/commands/gsd/gsd-map-codebase.md +8 -8
  32. package/commands/gsd/gsd-new-milestone.md +12 -12
  33. package/commands/gsd/gsd-new-project.md +12 -12
  34. package/commands/gsd/gsd-pause-work.md +6 -6
  35. package/commands/gsd/gsd-plan-milestone-gaps.md +9 -9
  36. package/commands/gsd/gsd-plan-phase.md +14 -13
  37. package/commands/gsd/gsd-progress.md +8 -8
  38. package/commands/gsd/gsd-quick.md +17 -13
  39. package/commands/gsd/gsd-reapply-patches.md +20 -9
  40. package/commands/gsd/gsd-remove-phase.md +7 -7
  41. package/commands/gsd/gsd-research-phase.md +12 -11
  42. package/commands/gsd/gsd-resume-work.md +8 -8
  43. package/commands/gsd/gsd-set-profile.md +6 -6
  44. package/commands/gsd/gsd-settings.md +7 -7
  45. package/commands/gsd/gsd-update.md +5 -5
  46. package/commands/gsd/gsd-validate-phase.md +35 -0
  47. package/commands/gsd/gsd-verify-work.md +11 -11
  48. package/get-shit-done/bin/gsd-tools.cjs +45 -6
  49. package/get-shit-done/bin/lib/commands.cjs +11 -19
  50. package/get-shit-done/bin/lib/config.cjs +8 -1
  51. package/get-shit-done/bin/lib/core.cjs +131 -16
  52. package/get-shit-done/bin/lib/init.cjs +28 -12
  53. package/get-shit-done/bin/lib/milestone.cjs +34 -8
  54. package/get-shit-done/bin/lib/phase.cjs +74 -50
  55. package/get-shit-done/bin/lib/roadmap.cjs +7 -7
  56. package/get-shit-done/bin/lib/state.cjs +294 -63
  57. package/get-shit-done/bin/lib/template.cjs +3 -3
  58. package/get-shit-done/bin/lib/verify.cjs +56 -8
  59. package/get-shit-done/references/checkpoints.md +1 -1
  60. package/get-shit-done/references/decimal-phase-calculation.md +6 -6
  61. package/get-shit-done/references/git-integration.md +3 -3
  62. package/get-shit-done/references/git-planning-commit.md +2 -2
  63. package/get-shit-done/references/model-profile-resolution.md +1 -1
  64. package/get-shit-done/references/model-profiles.md +1 -0
  65. package/get-shit-done/references/phase-argument-parsing.md +4 -4
  66. package/get-shit-done/references/planning-config.md +10 -6
  67. package/get-shit-done/references/questioning.md +17 -0
  68. package/get-shit-done/references/verification-patterns.md +1 -1
  69. package/get-shit-done/templates/DEBUG.md +7 -2
  70. package/get-shit-done/templates/VALIDATION.md +18 -46
  71. package/get-shit-done/templates/codebase/structure.md +3 -3
  72. package/get-shit-done/templates/config.json +2 -2
  73. package/get-shit-done/templates/context.md +14 -0
  74. package/get-shit-done/templates/phase-prompt.md +10 -10
  75. package/get-shit-done/templates/retrospective.md +54 -0
  76. package/get-shit-done/templates/roadmap.md +1 -1
  77. package/get-shit-done/workflows/add-phase.md +3 -2
  78. package/get-shit-done/workflows/add-tests.md +351 -0
  79. package/get-shit-done/workflows/add-todo.md +4 -3
  80. package/get-shit-done/workflows/audit-milestone.md +40 -5
  81. package/get-shit-done/workflows/check-todos.md +3 -2
  82. package/get-shit-done/workflows/cleanup.md +1 -1
  83. package/get-shit-done/workflows/complete-milestone.md +69 -5
  84. package/get-shit-done/workflows/diagnose-issues.md +2 -2
  85. package/get-shit-done/workflows/discovery-phase.md +6 -6
  86. package/get-shit-done/workflows/discuss-phase.md +194 -58
  87. package/get-shit-done/workflows/execute-phase.md +29 -23
  88. package/get-shit-done/workflows/execute-plan.md +22 -18
  89. package/get-shit-done/workflows/health.md +5 -2
  90. package/get-shit-done/workflows/help.md +4 -1
  91. package/get-shit-done/workflows/insert-phase.md +3 -2
  92. package/get-shit-done/workflows/map-codebase.md +3 -2
  93. package/get-shit-done/workflows/new-milestone.md +12 -10
  94. package/get-shit-done/workflows/new-project.md +44 -49
  95. package/get-shit-done/workflows/pause-work.md +2 -2
  96. package/get-shit-done/workflows/plan-milestone-gaps.md +3 -3
  97. package/get-shit-done/workflows/plan-phase.md +155 -73
  98. package/get-shit-done/workflows/progress.md +8 -7
  99. package/get-shit-done/workflows/quick.md +158 -10
  100. package/get-shit-done/workflows/remove-phase.md +5 -4
  101. package/get-shit-done/workflows/research-phase.md +5 -4
  102. package/get-shit-done/workflows/resume-project.md +3 -2
  103. package/get-shit-done/workflows/set-profile.md +3 -2
  104. package/get-shit-done/workflows/settings.md +6 -6
  105. package/get-shit-done/workflows/transition.md +5 -5
  106. package/get-shit-done/workflows/update.md +45 -19
  107. package/get-shit-done/workflows/validate-phase.md +167 -0
  108. package/get-shit-done/workflows/verify-phase.md +10 -9
  109. package/get-shit-done/workflows/verify-work.md +18 -4
  110. package/package.json +1 -1
@@ -40,7 +40,7 @@ When a milestone completes:
40
40
  **Use `roadmap analyze` for comprehensive readiness check:**
41
41
 
42
42
  ```bash
43
- ROADMAP=$(node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs roadmap analyze)
43
+ ROADMAP=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" roadmap analyze)
44
44
  ```
45
45
 
46
46
  This returns all phases with plan/summary counts and disk status. Use this to verify:
@@ -154,7 +154,7 @@ Extract one-liners from SUMMARY.md files using summary-extract:
154
154
  ```bash
155
155
  # For each phase in milestone, extract one-liner
156
156
  for summary in .planning/phases/*-*/*-SUMMARY.md; do
157
- node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs summary-extract "$summary" --fields one_liner | jq -r '.one_liner'
157
+ node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" summary-extract "$summary" --fields one_liner | jq -r '.one_liner'
158
158
  done
159
159
  ```
160
160
 
@@ -367,7 +367,7 @@ Update `.planning/ROADMAP.md` — group completed milestone phases:
367
367
  **Delegate archival to gsd-tools:**
368
368
 
369
369
  ```bash
370
- ARCHIVE=$(node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs milestone complete "v[X.Y]" --name "[Milestone Name]")
370
+ ARCHIVE=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" milestone complete "v[X.Y]" --name "[Milestone Name]")
371
371
  ```
372
372
 
373
373
  The CLI handles:
@@ -438,6 +438,67 @@ rm .planning/REQUIREMENTS.md
438
438
 
439
439
  </step>
440
440
 
441
+ <step name="write_retrospective">
442
+
443
+ **Append to living retrospective:**
444
+
445
+ Check for existing retrospective:
446
+ ```bash
447
+ ls .planning/RETROSPECTIVE.md 2>/dev/null
448
+ ```
449
+
450
+ **If exists:** read the file, append new milestone section before the "## Cross-Milestone Trends" section.
451
+
452
+ **If doesn't exist:** Create from template at `$HOME/.config/opencode/get-shit-done/templates/retrospective.md`.
453
+
454
+ **Gather retrospective data:**
455
+
456
+ 1. From SUMMARY.md files: Extract key deliverables, one-liners, tech decisions
457
+ 2. From VERIFICATION.md files: Extract verification scores, gaps found
458
+ 3. From UAT.md files: Extract test results, issues found
459
+ 4. From git log: Count commits, calculate timeline
460
+ 5. From the milestone work: Reflect on what worked and what didn't
461
+
462
+ **write the milestone section:**
463
+
464
+ ```markdown
465
+ ## Milestone: v{version} — {name}
466
+
467
+ **Shipped:** {date}
468
+ **Phases:** {phase_count} | **Plans:** {plan_count}
469
+
470
+ ### What Was Built
471
+ {Extract from SUMMARY.md one-liners}
472
+
473
+ ### What Worked
474
+ {Patterns that led to smooth execution}
475
+
476
+ ### What Was Inefficient
477
+ {Missed opportunities, rework, bottlenecks}
478
+
479
+ ### Patterns Established
480
+ {New conventions discovered during this milestone}
481
+
482
+ ### Key Lessons
483
+ {Specific, actionable takeaways}
484
+
485
+ ### Cost Observations
486
+ - Model mix: {X}% opus, {Y}% sonnet, {Z}% haiku
487
+ - Sessions: {count}
488
+ - Notable: {efficiency observation}
489
+ ```
490
+
491
+ **Update cross-milestone trends:**
492
+
493
+ If the "## Cross-Milestone Trends" section exists, update the tables with new data from this milestone.
494
+
495
+ **Commit:**
496
+ ```bash
497
+ node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" commit "docs: update retrospective for v${VERSION}" --files .planning/RETROSPECTIVE.md
498
+ ```
499
+
500
+ </step>
501
+
441
502
  <step name="update_state">
442
503
 
443
504
  Most STATE.md updates were handled by `milestone complete`, but verify and update remaining fields:
@@ -467,7 +528,8 @@ Check branching strategy and offer merge options.
467
528
  Use `init milestone-op` for context, or load config directly:
468
529
 
469
530
  ```bash
470
- INIT=$(node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs init execute-phase "1")
531
+ INIT=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" init execute-phase "1")
532
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
471
533
  ```
472
534
 
473
535
  Extract `branching_strategy`, `phase_branch_template`, `milestone_branch_template`, and `commit_docs` from init JSON.
@@ -615,7 +677,7 @@ git push origin v[X.Y]
615
677
  Commit milestone completion.
616
678
 
617
679
  ```bash
618
- node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs commit "chore: complete v[X.Y] milestone" --files .planning/milestones/v[X.Y]-ROADMAP.md .planning/milestones/v[X.Y]-REQUIREMENTS.md .planning/milestones/v[X.Y]-MILESTONE-AUDIT.md .planning/MILESTONES.md .planning/PROJECT.md .planning/STATE.md
680
+ node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" commit "chore: complete v[X.Y] milestone" --files .planning/milestones/v[X.Y]-ROADMAP.md .planning/milestones/v[X.Y]-REQUIREMENTS.md .planning/milestones/v[X.Y]-MILESTONE-AUDIT.md .planning/MILESTONES.md .planning/PROJECT.md .planning/STATE.md
619
681
  ```
620
682
  ```
621
683
 
@@ -695,6 +757,8 @@ Milestone completion is successful when:
695
757
  - [ ] Requirements completion checked against REQUIREMENTS.md traceability table
696
758
  - [ ] Incomplete requirements surfaced with proceed/audit/abort options
697
759
  - [ ] Known gaps recorded in MILESTONES.md if user proceeded with incomplete requirements
760
+ - [ ] RETROSPECTIVE.md updated with milestone section
761
+ - [ ] Cross-milestone trends updated
698
762
  - [ ] User knows next step (/gsd-new-milestone)
699
763
 
700
764
  </success_criteria>
@@ -80,7 +80,7 @@ For each gap, fill the debug-subagent-prompt template and spawn:
80
80
  ```
81
81
  task(
82
82
  prompt=filled_debug_subagent_prompt + "\n\n<files_to_read>\n- {phase_dir}/{phase_num}-UAT.md\n- .planning/STATE.md\n</files_to_read>",
83
- subagent_type="general",
83
+ subagent_type="gsd-debugger",
84
84
  description="Debug: {truth_short}"
85
85
  )
86
86
  ```
@@ -158,7 +158,7 @@ Update status in frontmatter to "diagnosed".
158
158
 
159
159
  Commit the updated UAT.md:
160
160
  ```bash
161
- node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs commit "docs({phase_num}): add root causes from diagnosis" --files ".planning/phases/XX-name/{phase_num}-UAT.md"
161
+ node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" commit "docs({phase_num}): add root causes from diagnosis" --files ".planning/phases/XX-name/{phase_num}-UAT.md"
162
162
  ```
163
163
  </step>
164
164
 
@@ -28,7 +28,7 @@ OpenCode's training data is 6-18 months stale. Always verify.
28
28
  2. **Official docs** - When Context7 lacks coverage
29
29
  3. **websearch LAST** - For comparisons and trends only
30
30
 
31
- See ~/.config/opencode/get-shit-done/templates/discovery.md `<discovery_protocol>` for full protocol.
31
+ See $HOME/.config/opencode/get-shit-done/templates/discovery.md `<discovery_protocol>` for full protocol.
32
32
  </source_hierarchy>
33
33
 
34
34
  <process>
@@ -93,7 +93,7 @@ For: Choosing between options, new external integration.
93
93
 
94
94
  ```
95
95
  For each library/framework:
96
- - mcp__context7__resolve-library-id
96
+ - mcp__context7__resolve-library-id
97
97
  - mcp__context7__get-library-docs (mode: "code" for API, "info" for concepts)
98
98
  ```
99
99
 
@@ -107,7 +107,7 @@ For: Choosing between options, new external integration.
107
107
 
108
108
  5. **Cross-verify:** Any websearch finding → confirm with Context7/official docs.
109
109
 
110
- 6. **Create DISCOVERY.md** using ~/.config/opencode/get-shit-done/templates/discovery.md structure:
110
+ 6. **Create DISCOVERY.md** using $HOME/.config/opencode/get-shit-done/templates/discovery.md structure:
111
111
 
112
112
  - Summary with recommendation
113
113
  - Key findings per option
@@ -126,7 +126,7 @@ For: Architectural decisions, novel problems, high-risk choices.
126
126
 
127
127
  **Process:**
128
128
 
129
- 1. **Scope the discovery** using ~/.config/opencode/get-shit-done/templates/discovery.md:
129
+ 1. **Scope the discovery** using $HOME/.config/opencode/get-shit-done/templates/discovery.md:
130
130
 
131
131
  - Define clear scope
132
132
  - Define include/exclude boundaries
@@ -160,7 +160,7 @@ For: Architectural decisions, novel problems, high-risk choices.
160
160
 
161
161
  6. **Create comprehensive DISCOVERY.md:**
162
162
 
163
- - Full structure from ~/.config/opencode/get-shit-done/templates/discovery.md
163
+ - Full structure from $HOME/.config/opencode/get-shit-done/templates/discovery.md
164
164
  - Quality report with source attribution
165
165
  - Confidence by finding
166
166
  - If LOW confidence on any critical finding → add validation checkpoints
@@ -184,7 +184,7 @@ Ask: What do we need to learn before we can plan this phase?
184
184
  </step>
185
185
 
186
186
  <step name="create_discovery_scope">
187
- Use ~/.config/opencode/get-shit-done/templates/discovery.md.
187
+ Use $HOME/.config/opencode/get-shit-done/templates/discovery.md.
188
188
 
189
189
  Include:
190
190
 
@@ -107,11 +107,14 @@ Phase: "API documentation"
107
107
 
108
108
  <process>
109
109
 
110
+ **Express path available:** If you already have a PRD or acceptance criteria document, use `/gsd-plan-phase {phase} --prd path/to/prd.md` to skip this discussion and go straight to planning.
111
+
110
112
  <step name="initialize" priority="first">
111
113
  Phase number from argument (required).
112
114
 
113
115
  ```bash
114
- INIT=$(node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs init phase-op "${PHASE}")
116
+ INIT=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" init phase-op "${PHASE}")
117
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
115
118
  ```
116
119
 
117
120
  Parse JSON for: `commit_docs`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`, `has_research`, `has_context`, `has_plans`, `has_verification`, `plan_count`, `roadmap_exists`, `planning_exists`.
@@ -163,44 +166,152 @@ If "Continue and replan after": Continue to analyze_phase.
163
166
  If "View existing plans": Display plan files, then offer "Continue" / "Cancel".
164
167
  If "Cancel": Exit workflow.
165
168
 
166
- **If `has_plans` is false:** Continue to analyze_phase.
169
+ **If `has_plans` is false:** Continue to load_prior_context.
170
+ </step>
171
+
172
+ <step name="load_prior_context">
173
+ read project-level and prior phase context to avoid re-asking decided questions and maintain consistency.
174
+
175
+ **Step 1: read project-level files**
176
+ ```bash
177
+ # Core project files
178
+ cat .planning/PROJECT.md 2>/dev/null
179
+ cat .planning/REQUIREMENTS.md 2>/dev/null
180
+ cat .planning/STATE.md 2>/dev/null
181
+ ```
182
+
183
+ Extract from these:
184
+ - **PROJECT.md** — Vision, principles, non-negotiables, user preferences
185
+ - **REQUIREMENTS.md** — Acceptance criteria, constraints, must-haves vs nice-to-haves
186
+ - **STATE.md** — Current progress, any flags or session notes
187
+
188
+ **Step 2: read all prior CONTEXT.md files**
189
+ ```bash
190
+ # Find all CONTEXT.md files from phases before current
191
+ find .planning/phases -name "*-CONTEXT.md" 2>/dev/null | sort
192
+ ```
193
+
194
+ For each CONTEXT.md where phase number < current phase:
195
+ - read the `<decisions>` section — these are locked preferences
196
+ - read `<specifics>` — particular references or "I want it like X" moments
197
+ - Note any patterns (e.g., "user consistently prefers minimal UI", "user rejected single-key shortcuts")
198
+
199
+ **Step 3: Build internal `<prior_decisions>` context**
200
+
201
+ Structure the extracted information:
202
+ ```
203
+ <prior_decisions>
204
+ ## Project-Level
205
+ - [Key principle or constraint from PROJECT.md]
206
+ - [Requirement that affects this phase from REQUIREMENTS.md]
207
+
208
+ ## From Prior Phases
209
+ ### Phase N: [Name]
210
+ - [Decision that may be relevant to current phase]
211
+ - [Preference that establishes a pattern]
212
+
213
+ ### Phase M: [Name]
214
+ - [Another relevant decision]
215
+ </prior_decisions>
216
+ ```
217
+
218
+ **Usage in subsequent steps:**
219
+ - `analyze_phase`: Skip gray areas already decided in prior phases
220
+ - `present_gray_areas`: Annotate options with prior decisions ("You chose X in Phase 5")
221
+ - `discuss_areas`: Pre-fill answers or flag conflicts ("This contradicts Phase 3 — same here or different?")
222
+
223
+ **If no prior context exists:** Continue without — this is expected for early phases.
224
+ </step>
225
+
226
+ <step name="scout_codebase">
227
+ Lightweight scan of existing code to inform gray area identification and discussion. Uses ~10% context — acceptable for an interactive session.
228
+
229
+ **Step 1: Check for existing codebase maps**
230
+ ```bash
231
+ ls .planning/codebase/*.md 2>/dev/null
232
+ ```
233
+
234
+ **If codebase maps exist:** read the most relevant ones (CONVENTIONS.md, STRUCTURE.md, STACK.md based on phase type). Extract:
235
+ - Reusable components/hooks/utilities
236
+ - Established patterns (state management, styling, data fetching)
237
+ - Integration points (where new code would connect)
238
+
239
+ Skip to Step 3 below.
240
+
241
+ **Step 2: If no codebase maps, do targeted grep**
242
+
243
+ Extract key terms from the phase goal (e.g., "feed" → "post", "card", "list"; "auth" → "login", "session", "token").
244
+
245
+ ```bash
246
+ # Find files related to phase goal terms
247
+ grep -rl "{term1}\|{term2}" src/ app/ --include="*.ts" --include="*.tsx" --include="*.js" --include="*.jsx" 2>/dev/null | head -10
248
+
249
+ # Find existing components/hooks
250
+ ls src/components/ 2>/dev/null
251
+ ls src/hooks/ 2>/dev/null
252
+ ls src/lib/ src/utils/ 2>/dev/null
253
+ ```
254
+
255
+ read the 3-5 most relevant files to understand existing patterns.
256
+
257
+ **Step 3: Build internal codebase_context**
258
+
259
+ From the scan, identify:
260
+ - **Reusable assets** — existing components, hooks, utilities that could be used in this phase
261
+ - **Established patterns** — how the codebase does state management, styling, data fetching
262
+ - **Integration points** — where new code would connect (routes, nav, providers)
263
+ - **Creative options** — approaches the existing architecture enables or constrains
264
+
265
+ Store as internal `<codebase_context>` for use in analyze_phase and present_gray_areas. This is NOT written to a file — it's used within this session only.
167
266
  </step>
168
267
 
169
268
  <step name="analyze_phase">
170
- Analyze the phase to identify gray areas worth discussing.
269
+ Analyze the phase to identify gray areas worth discussing. **Use both `prior_decisions` and `codebase_context` to ground the analysis.**
171
270
 
172
271
  **read the phase description from ROADMAP.md and determine:**
173
272
 
174
273
  1. **Domain boundary** — What capability is this phase delivering? State it clearly.
175
274
 
176
- 2. **Gray areas by category** — For each relevant category (UI, UX, Behavior, Empty States, Content), identify 1-2 specific ambiguities that would change implementation.
275
+ 2. **Check prior decisions** — Before generating gray areas, check if any were already decided:
276
+ - Scan `<prior_decisions>` for relevant choices (e.g., "Ctrl+C only, no single-key shortcuts")
277
+ - These are **pre-answered** — don't re-ask unless this phase has conflicting needs
278
+ - Note applicable prior decisions for use in presentation
279
+
280
+ 3. **Gray areas by category** — For each relevant category (UI, UX, Behavior, Empty States, Content), identify 1-2 specific ambiguities that would change implementation. **Annotate with code context where relevant** (e.g., "You already have a Card component" or "No existing pattern for this").
177
281
 
178
- 3. **Skip assessment** — If no meaningful gray areas exist (pure infrastructure, clear-cut implementation), the phase may not need discussion.
282
+ 4. **Skip assessment** — If no meaningful gray areas exist (pure infrastructure, clear-cut implementation, or all already decided in prior phases), the phase may not need discussion.
179
283
 
180
284
  **Output your analysis internally, then present to user.**
181
285
 
182
- Example analysis for "Post Feed" phase:
286
+ Example analysis for "Post Feed" phase (with code and prior context):
183
287
  ```
184
288
  Domain: Displaying posts from followed users
289
+ Existing: Card component (src/components/ui/Card.tsx), useInfiniteQuery hook, Tailwind CSS
290
+ Prior decisions: "Minimal UI preferred" (Phase 2), "No pagination — always infinite scroll" (Phase 4)
185
291
  Gray areas:
186
- - UI: Layout style (cards vs timeline vs grid)
187
- - UI: Information density (full posts vs previews)
188
- - Behavior: Loading pattern (infinite scroll vs pagination)
189
- - Empty State: What shows when no posts exist
292
+ - UI: Layout style (cards vs timeline vs grid) — Card component exists with shadow/rounded variants
293
+ - UI: Information density (full posts vs previews) — no existing density patterns
294
+ - Behavior: Loading pattern — ALREADY DECIDED: infinite scroll (Phase 4)
295
+ - Empty State: What shows when no posts exist — EmptyState component exists in ui/
190
296
  - Content: What metadata displays (time, author, reactions count)
191
297
  ```
192
298
  </step>
193
299
 
194
300
  <step name="present_gray_areas">
195
- Present the domain boundary and gray areas to user.
301
+ Present the domain boundary, prior decisions, and gray areas to user.
196
302
 
197
- **First, state the boundary:**
303
+ **First, state the boundary and any prior decisions that apply:**
198
304
  ```
199
305
  Phase [X]: [Name]
200
306
  Domain: [What this phase delivers — from your analysis]
201
307
 
202
308
  We'll clarify HOW to implement this.
203
309
  (New capabilities belong in other phases.)
310
+
311
+ [If prior decisions apply:]
312
+ **Carrying forward from earlier phases:**
313
+ - [Decision from Phase N that applies here]
314
+ - [Decision from Phase M that applies here]
204
315
  ```
205
316
 
206
317
  **Then use question (multiSelect: true):**
@@ -208,17 +319,35 @@ We'll clarify HOW to implement this.
208
319
  - question: "Which areas do you want to discuss for [phase name]?"
209
320
  - options: Generate 3-4 phase-specific gray areas, each with:
210
321
  - "[Specific area]" (label) — concrete, not generic
211
- - [1-2 questions this covers] (description)
322
+ - [1-2 questions this covers + code context annotation] (description)
212
323
  - **Highlight the recommended choice with brief explanation why**
213
324
 
325
+ **Prior decision annotations:** When a gray area was already decided in a prior phase, annotate it:
326
+ ```
327
+ ☐ Exit shortcuts — How should users quit?
328
+ (You decided "Ctrl+C only, no single-key shortcuts" in Phase 5 — revisit or keep?)
329
+ ```
330
+
331
+ **Code context annotations:** When the scout found relevant existing code, annotate the gray area description:
332
+ ```
333
+ ☐ Layout style — Cards vs list vs timeline?
334
+ (You already have a Card component with shadow/rounded variants. Reusing it keeps the app consistent.)
335
+ ```
336
+
337
+ **Combining both:** When both prior decisions and code context apply:
338
+ ```
339
+ ☐ Loading behavior — Infinite scroll or pagination?
340
+ (You chose infinite scroll in Phase 4. useInfiniteQuery hook already set up.)
341
+ ```
342
+
214
343
  **Do NOT include a "skip" or "you decide" option.** User ran this command to discuss — give them real choices.
215
344
 
216
- **Examples by domain:**
345
+ **Examples by domain (with code context):**
217
346
 
218
347
  For "Post Feed" (visual feature):
219
348
  ```
220
- ☐ Layout style — Cards vs list vs timeline? Information density?
221
- ☐ Loading behavior — Infinite scroll or pagination? Pull to refresh?
349
+ ☐ Layout style — Cards vs list vs timeline? (Card component exists with variants)
350
+ ☐ Loading behavior — Infinite scroll or pagination? (useInfiniteQuery hook available)
222
351
  ☐ Content ordering — Chronological, algorithmic, or user choice?
223
352
  ☐ Post metadata — What info per post? Timestamps, reactions, author?
224
353
  ```
@@ -260,7 +389,15 @@ Ask 4 questions per area before offering to continue or move on. Each answer oft
260
389
  - header: "[Area]" (max 12 chars — abbreviate if needed)
261
390
  - question: Specific decision for this area
262
391
  - options: 2-3 concrete choices (question adds "Other" automatically), with the recommended choice highlighted and brief explanation why
392
+ - **Annotate options with code context** when relevant:
393
+ ```
394
+ "How should posts be displayed?"
395
+ - Cards (reuses existing Card component — consistent with Messages)
396
+ - List (simpler, would be a new pattern)
397
+ - Timeline (needs new Timeline component — none exists yet)
398
+ ```
263
399
  - Include "You decide" as an option when reasonable — captures OpenCode discretion
400
+ - **Context7 for library choices:** When a gray area involves library selection (e.g., "magic links" → query next-auth docs) or API approach decisions, use `mcp__context7__*` tools to fetch current documentation and inform the options. Don't use Context7 for every question — only when library-specific knowledge improves the options.
264
401
 
265
402
  3. **After 4 questions, check:**
266
403
  - header: "[Area]" (max 12 chars)
@@ -286,7 +423,7 @@ Ask 4 questions per area before offering to continue or move on. Each answer oft
286
423
  **question design:**
287
424
  - Options should be concrete, not abstract ("Cards" not "Option A")
288
425
  - Each answer should inform the next question
289
- - If user picks "Other", receive their input, reflect it back, confirm
426
+ - If user picks "Other" to provide freeform input (e.g., "let me describe it", "something else", or an open-ended reply), ask your follow-up as plain text — NOT another question. Wait for them to type at the normal prompt, then reflect their input back and confirm before resuming question for the next question.
290
427
 
291
428
  **Scope creep handling:**
292
429
  If user mentions something outside the phase domain:
@@ -344,6 +481,20 @@ mkdir -p ".planning/phases/${padded_phase}-${phase_slug}"
344
481
 
345
482
  </decisions>
346
483
 
484
+ <code_context>
485
+ ## Existing Code Insights
486
+
487
+ ### Reusable Assets
488
+ - [Component/hook/utility]: [How it could be used in this phase]
489
+
490
+ ### Established Patterns
491
+ - [Pattern]: [How it constrains/enables this phase]
492
+
493
+ ### Integration Points
494
+ - [Where new code connects to existing system]
495
+
496
+ </code_context>
497
+
347
498
  <specifics>
348
499
  ## Specific Ideas
349
500
 
@@ -413,7 +564,7 @@ Created: .planning/phases/${PADDED_PHASE}-${SLUG}/${PADDED_PHASE}-CONTEXT.md
413
564
  Commit phase context (uses `commit_docs` from init internally):
414
565
 
415
566
  ```bash
416
- node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs commit "docs(${padded_phase}): capture phase context" --files "${phase_dir}/${padded_phase}-CONTEXT.md"
567
+ node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" commit "docs(${padded_phase}): capture phase context" --files "${phase_dir}/${padded_phase}-CONTEXT.md"
417
568
  ```
418
569
 
419
570
  Confirm: "Committed: docs(${padded_phase}): capture phase context"
@@ -423,7 +574,7 @@ Confirm: "Committed: docs(${padded_phase}): capture phase context"
423
574
  Update STATE.md with session info:
424
575
 
425
576
  ```bash
426
- node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs state record-session \
577
+ node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" state record-session \
427
578
  --stopped-at "Phase ${PHASE} context gathered" \
428
579
  --resume-file "${phase_dir}/${padded_phase}-CONTEXT.md"
429
580
  ```
@@ -431,7 +582,7 @@ node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs state record-session \
431
582
  Commit STATE.md:
432
583
 
433
584
  ```bash
434
- node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs commit "docs(state): record phase ${PHASE} context session" --files .planning/STATE.md
585
+ node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" commit "docs(state): record phase ${PHASE} context session" --files .planning/STATE.md
435
586
  ```
436
587
  </step>
437
588
 
@@ -439,17 +590,24 @@ node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs commit "docs(state): rec
439
590
  Check for auto-advance trigger:
440
591
 
441
592
  1. Parse `--auto` flag from $ARGUMENTS
442
- 2. read `workflow.auto_advance` from config:
593
+ 2. **Sync chain flag with intent** — if user invoked manually (no `--auto`), clear the ephemeral chain flag from any previous interrupted `--auto` chain. This does NOT touch `workflow.auto_advance` (the user's persistent settings preference):
594
+ ```bash
595
+ if [[ ! "$ARGUMENTS" =~ --auto ]]; then
596
+ node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active false 2>/dev/null
597
+ fi
598
+ ```
599
+ 3. read both the chain flag and user preference:
443
600
  ```bash
444
- AUTO_CFG=$(node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs config-get workflow.auto_advance 2>/dev/null || echo "false")
601
+ AUTO_CHAIN=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false")
602
+ AUTO_CFG=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
445
603
  ```
446
604
 
447
- **If `--auto` flag present AND `AUTO_CFG` is not true:** Persist auto-advance to config (handles direct `--auto` usage without new-project):
605
+ **If `--auto` flag present AND `AUTO_CHAIN` is not true:** Persist chain flag to config (handles direct `--auto` usage without new-project):
448
606
  ```bash
449
- node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs config-set workflow.auto_advance true
607
+ node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active true
450
608
  ```
451
609
 
452
- **If `--auto` flag present OR `AUTO_CFG` is true:**
610
+ **If `--auto` flag present OR `AUTO_CHAIN` is true OR `AUTO_CFG` is true:**
453
611
 
454
612
  Display banner:
455
613
  ```
@@ -457,42 +615,16 @@ Display banner:
457
615
  GSD ► AUTO-ADVANCING TO PLAN
458
616
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
459
617
 
460
- Context captured. Spawning plan-phase...
618
+ Context captured. Launching plan-phase...
461
619
  ```
462
620
 
463
- Spawn plan-phase as task with direct workflow file reference (do NOT use skill tool Skills don't resolve inside task subagents):
621
+ Launch plan-phase using the skill tool to avoid nested task sessions (which cause runtime freezes due to deep agent nesting see #686):
464
622
  ```
465
- task(
466
- prompt="
467
- <objective>
468
- You are the plan-phase orchestrator. Create executable plans for Phase ${PHASE}: ${PHASE_NAME}, then auto-advance to execution.
469
- </objective>
470
-
471
- <execution_context>
472
- @~/.config/opencode/get-shit-done/workflows/plan-phase.md
473
- @~/.config/opencode/get-shit-done/references/ui-brand.md
474
- @~/.config/opencode/get-shit-done/references/model-profile-resolution.md
475
- </execution_context>
476
-
477
- <arguments>
478
- PHASE=${PHASE}
479
- ARGUMENTS='${PHASE} --auto'
480
- </arguments>
481
-
482
- <instructions>
483
- 1. read plan-phase.md from execution_context for your complete workflow
484
- 2. Follow ALL steps: initialize, validate, load context, research, plan, verify, auto-advance
485
- 3. When spawning agents (gsd-phase-researcher, gsd-planner, gsd-plan-checker), use task with specified subagent_type and model
486
- 4. For step 14 (auto-advance to execute): spawn execute-phase as a task with DIRECT file reference — tell it to read execute-phase.md. Include @file refs to execute-phase.md, checkpoints.md, tdd.md, model-profile-resolution.md. Pass --no-transition flag so execute-phase returns results instead of chaining further.
487
- 5. Do NOT use the skill tool or /gsd- commands. read workflow .md files directly.
488
- 6. Return: PHASE COMPLETE (full pipeline success), PLANNING COMPLETE (planning done but execute failed/skipped), PLANNING INCONCLUSIVE, or GAPS FOUND
489
- </instructions>
490
- ",
491
- subagent_type="general",
492
- description="Plan Phase ${PHASE}"
493
- )
623
+ skill(skill="gsd-plan-phase", args="${PHASE} --auto")
494
624
  ```
495
625
 
626
+ This keeps the auto-advance chain flat — discuss, plan, and execute all run at the same nesting level rather than spawning increasingly deep task agents.
627
+
496
628
  **Handle plan-phase return:**
497
629
  - **PHASE COMPLETE** → Full chain succeeded. Display:
498
630
  ```
@@ -529,11 +661,15 @@ Route to `confirm_creation` step (existing behavior — show manual next steps).
529
661
 
530
662
  <success_criteria>
531
663
  - Phase validated against roadmap
532
- - Gray areas identified through intelligent analysis (not generic questions)
664
+ - Prior context loaded (PROJECT.md, REQUIREMENTS.md, STATE.md, prior CONTEXT.md files)
665
+ - Already-decided questions not re-asked (carried forward from prior phases)
666
+ - Codebase scouted for reusable assets, patterns, and integration points
667
+ - Gray areas identified through intelligent analysis with code and prior decision annotations
533
668
  - User selected which areas to discuss
534
- - Each selected area explored until user satisfied
669
+ - Each selected area explored until user satisfied (with code-informed and prior-decision-informed options)
535
670
  - Scope creep redirected to deferred ideas
536
671
  - CONTEXT.md captures actual decisions, not vague vision
672
+ - CONTEXT.md includes code_context section with reusable assets and patterns
537
673
  - Deferred ideas preserved for future phases
538
674
  - STATE.md updated with session info
539
675
  - User knows next steps