gsd-opencode 1.20.3 → 1.22.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 (114) hide show
  1. package/agents/gsd-codebase-mapper.md +9 -1
  2. package/agents/gsd-debugger.md +66 -10
  3. package/agents/gsd-executor.md +36 -16
  4. package/agents/gsd-integration-checker.md +2 -0
  5. package/agents/gsd-nyquist-auditor.md +178 -0
  6. package/agents/gsd-phase-researcher.md +28 -34
  7. package/agents/gsd-plan-checker.md +42 -78
  8. package/agents/gsd-planner.md +139 -24
  9. package/agents/gsd-project-researcher.md +11 -1
  10. package/agents/gsd-research-synthesizer.md +13 -3
  11. package/agents/gsd-roadmapper.md +25 -15
  12. package/agents/gsd-verifier.md +29 -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 +19 -11
  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-oc-commands/allow-read-config.cjs +235 -0
  49. package/get-shit-done/bin/gsd-oc-tools.cjs +11 -5
  50. package/get-shit-done/bin/gsd-tools.cjs +45 -6
  51. package/get-shit-done/bin/lib/commands.cjs +11 -19
  52. package/get-shit-done/bin/lib/config.cjs +8 -1
  53. package/get-shit-done/bin/lib/core.cjs +131 -16
  54. package/get-shit-done/bin/lib/init.cjs +28 -12
  55. package/get-shit-done/bin/lib/milestone.cjs +34 -8
  56. package/get-shit-done/bin/lib/phase.cjs +74 -50
  57. package/get-shit-done/bin/lib/roadmap.cjs +7 -7
  58. package/get-shit-done/bin/lib/state.cjs +294 -63
  59. package/get-shit-done/bin/lib/template.cjs +3 -3
  60. package/get-shit-done/bin/lib/verify.cjs +56 -8
  61. package/get-shit-done/bin/test/allow-read-config.test.cjs +262 -0
  62. package/get-shit-done/references/checkpoints.md +1 -1
  63. package/get-shit-done/references/decimal-phase-calculation.md +6 -6
  64. package/get-shit-done/references/git-integration.md +3 -3
  65. package/get-shit-done/references/git-planning-commit.md +2 -2
  66. package/get-shit-done/references/model-profile-resolution.md +1 -1
  67. package/get-shit-done/references/model-profiles.md +1 -0
  68. package/get-shit-done/references/phase-argument-parsing.md +4 -4
  69. package/get-shit-done/references/planning-config.md +10 -6
  70. package/get-shit-done/references/questioning.md +17 -0
  71. package/get-shit-done/references/verification-patterns.md +1 -1
  72. package/get-shit-done/templates/DEBUG.md +7 -2
  73. package/get-shit-done/templates/VALIDATION.md +18 -46
  74. package/get-shit-done/templates/codebase/structure.md +3 -3
  75. package/get-shit-done/templates/config.json +2 -2
  76. package/get-shit-done/templates/context.md +14 -0
  77. package/get-shit-done/templates/phase-prompt.md +10 -10
  78. package/get-shit-done/templates/retrospective.md +54 -0
  79. package/get-shit-done/templates/roadmap.md +1 -1
  80. package/get-shit-done/workflows/add-phase.md +3 -2
  81. package/get-shit-done/workflows/add-tests.md +351 -0
  82. package/get-shit-done/workflows/add-todo.md +4 -3
  83. package/get-shit-done/workflows/audit-milestone.md +40 -5
  84. package/get-shit-done/workflows/check-todos.md +3 -2
  85. package/get-shit-done/workflows/cleanup.md +1 -1
  86. package/get-shit-done/workflows/complete-milestone.md +69 -5
  87. package/get-shit-done/workflows/diagnose-issues.md +2 -2
  88. package/get-shit-done/workflows/discovery-phase.md +6 -6
  89. package/get-shit-done/workflows/discuss-phase.md +194 -58
  90. package/get-shit-done/workflows/execute-phase.md +29 -23
  91. package/get-shit-done/workflows/execute-plan.md +22 -18
  92. package/get-shit-done/workflows/health.md +5 -2
  93. package/get-shit-done/workflows/help.md +4 -1
  94. package/get-shit-done/workflows/insert-phase.md +3 -2
  95. package/get-shit-done/workflows/map-codebase.md +3 -2
  96. package/get-shit-done/workflows/new-milestone.md +12 -10
  97. package/get-shit-done/workflows/new-project.md +44 -49
  98. package/get-shit-done/workflows/oc-set-profile.md +24 -0
  99. package/get-shit-done/workflows/pause-work.md +2 -2
  100. package/get-shit-done/workflows/plan-milestone-gaps.md +3 -3
  101. package/get-shit-done/workflows/plan-phase.md +155 -73
  102. package/get-shit-done/workflows/progress.md +8 -7
  103. package/get-shit-done/workflows/quick.md +158 -10
  104. package/get-shit-done/workflows/remove-phase.md +5 -4
  105. package/get-shit-done/workflows/research-phase.md +5 -4
  106. package/get-shit-done/workflows/resume-project.md +3 -2
  107. package/get-shit-done/workflows/set-profile.md +3 -2
  108. package/get-shit-done/workflows/settings.md +6 -6
  109. package/get-shit-done/workflows/transition.md +5 -5
  110. package/get-shit-done/workflows/update.md +45 -19
  111. package/get-shit-done/workflows/validate-phase.md +167 -0
  112. package/get-shit-done/workflows/verify-phase.md +10 -9
  113. package/get-shit-done/workflows/verify-work.md +18 -4
  114. package/package.json +1 -1
@@ -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
@@ -16,16 +16,24 @@ read STATE.md before any operation to load project context.
16
16
  Load all context in one call:
17
17
 
18
18
  ```bash
19
- INIT=$(node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs init execute-phase "${PHASE_ARG}")
19
+ INIT=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" init execute-phase "${PHASE_ARG}")
20
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
20
21
  ```
21
22
 
22
- Parse JSON for: `executor_model`, `verifier_model`, `commit_docs`, `parallelization`, `branching_strategy`, `branch_name`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `plans`, `incomplete_plans`, `plan_count`, `incomplete_count`, `state_exists`, `roadmap_exists`.
23
+ Parse JSON for: `executor_model`, `verifier_model`, `commit_docs`, `parallelization`, `branching_strategy`, `branch_name`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `plans`, `incomplete_plans`, `plan_count`, `incomplete_count`, `state_exists`, `roadmap_exists`, `phase_req_ids`.
23
24
 
24
25
  **If `phase_found` is false:** Error — phase directory not found.
25
26
  **If `plan_count` is 0:** Error — no plans found in phase.
26
27
  **If `state_exists` is false but `.planning/` exists:** Offer reconstruct or continue.
27
28
 
28
29
  When `parallelization` is false, plans within a wave execute sequentially.
30
+
31
+ **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). Must happen before any config reads (checkpoint handling also reads auto-advance flags):
32
+ ```bash
33
+ if [[ ! "$ARGUMENTS" =~ --auto ]]; then
34
+ node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active false 2>/dev/null
35
+ fi
36
+ ```
29
37
  </step>
30
38
 
31
39
  <step name="handle_branching">
@@ -51,7 +59,7 @@ Report: "Found {plan_count} plans in {phase_dir} ({incomplete_count} incomplete)
51
59
  Load plan inventory with wave grouping in one call:
52
60
 
53
61
  ```bash
54
- PLAN_INDEX=$(node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs phase-plan-index "${PHASE_NUMBER}")
62
+ PLAN_INDEX=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" phase-plan-index "${PHASE_NUMBER}")
55
63
  ```
56
64
 
57
65
  Parse JSON for: `phase`, `plans[]` (each with `id`, `wave`, `autonomous`, `objective`, `files_modified`, `task_count`, `has_summary`), `waves` (map of wave number → plan IDs), `incomplete`, `has_checkpoints`.
@@ -110,10 +118,10 @@ Execute each wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`
110
118
  </objective>
111
119
 
112
120
  <execution_context>
113
- @~/.config/opencode/get-shit-done/workflows/execute-plan.md
114
- @~/.config/opencode/get-shit-done/templates/summary.md
115
- @~/.config/opencode/get-shit-done/references/checkpoints.md
116
- @~/.config/opencode/get-shit-done/references/tdd.md
121
+ @$HOME/.config/opencode/get-shit-done/workflows/execute-plan.md
122
+ @$HOME/.config/opencode/get-shit-done/templates/summary.md
123
+ @$HOME/.config/opencode/get-shit-done/references/checkpoints.md
124
+ @$HOME/.config/opencode/get-shit-done/references/tdd.md
117
125
  </execution_context>
118
126
 
119
127
  <files_to_read>
@@ -122,7 +130,7 @@ Execute each wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`
122
130
  - .planning/STATE.md (State)
123
131
  - .planning/config.json (Config, if exists)
124
132
  - ./AGENTS.md (Project instructions, if exists — follow project-specific guidelines and coding conventions)
125
- - .agents/skills/ (Project skills, if exists — list skills, read SKILL.md for each, follow relevant rules during implementation)
133
+ - .OpenCode/skills/ or .agents/skills/ (Project skills, if either exists — list skills, read SKILL.md for each, follow relevant rules during implementation)
126
134
  </files_to_read>
127
135
 
128
136
  <success_criteria>
@@ -179,12 +187,13 @@ Plans with `autonomous: false` require user interaction.
179
187
 
180
188
  **Auto-mode checkpoint handling:**
181
189
 
182
- read auto-advance config:
190
+ read auto-advance config (chain flag + user preference):
183
191
  ```bash
184
- AUTO_CFG=$(node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs config-get workflow.auto_advance 2>/dev/null || echo "false")
192
+ AUTO_CHAIN=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false")
193
+ AUTO_CFG=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
185
194
  ```
186
195
 
187
- When executor returns a checkpoint AND `AUTO_CFG` is `"true"`:
196
+ When executor returns a checkpoint AND (`AUTO_CHAIN` is `"true"` OR `AUTO_CFG` is `"true"`):
188
197
  - **human-verify** → Auto-spawn continuation agent with `{user_response}` = `"approved"`. Log `⚡ Auto-approved checkpoint`.
189
198
  - **decision** → Auto-spawn continuation agent with `{user_response}` = first option from checkpoint details. Log `⚡ Auto-selected: [option]`.
190
199
  - **human-action** → Present to user (existing behavior below). Auth gates cannot be automated.
@@ -256,7 +265,7 @@ fi
256
265
 
257
266
  **2. Find parent UAT file:**
258
267
  ```bash
259
- PARENT_INFO=$(node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs find-phase "${PARENT_PHASE}" --raw)
268
+ PARENT_INFO=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" find-phase "${PARENT_PHASE}" --raw)
260
269
  # Extract directory from PARENT_INFO JSON, then find UAT file in that directory
261
270
  ```
262
271
 
@@ -287,17 +296,13 @@ mv .planning/debug/{slug}.md .planning/debug/resolved/
287
296
 
288
297
  **6. Commit updated artifacts:**
289
298
  ```bash
290
- node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs commit "docs(phase-${PARENT_PHASE}): resolve UAT gaps and debug sessions after ${PHASE_NUMBER} gap closure" --files .planning/phases/*${PARENT_PHASE}*/*-UAT.md .planning/debug/resolved/*.md
299
+ node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" commit "docs(phase-${PARENT_PHASE}): resolve UAT gaps and debug sessions after ${PHASE_NUMBER} gap closure" --files .planning/phases/*${PARENT_PHASE}*/*-UAT.md .planning/debug/resolved/*.md
291
300
  ```
292
301
  </step>
293
302
 
294
303
  <step name="verify_phase_goal">
295
304
  Verify phase achieved its GOAL, not just completed tasks.
296
305
 
297
- ```bash
298
- PHASE_REQ_IDS=$(node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs roadmap get-phase "${PHASE_NUMBER}" | jq -r '.section' | grep -i "Requirements:" | sed 's/.*Requirements:\*\*\s*//' | sed 's/[\[\]]//g')
299
- ```
300
-
301
306
  ```
302
307
  task(
303
308
  prompt="Verify phase {phase_number} goal achievement.
@@ -362,7 +367,7 @@ Gap closure cycle: `/gsd-plan-phase {X} --gaps` reads VERIFICATION.md → create
362
367
  **Mark phase complete and update all tracking files:**
363
368
 
364
369
  ```bash
365
- COMPLETION=$(node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs phase complete "${PHASE_NUMBER}")
370
+ COMPLETION=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" phase complete "${PHASE_NUMBER}")
366
371
  ```
367
372
 
368
373
  The CLI handles:
@@ -375,7 +380,7 @@ The CLI handles:
375
380
  Extract from result: `next_phase`, `next_phase_name`, `is_last_phase`.
376
381
 
377
382
  ```bash
378
- node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs commit "docs(phase-{X}): complete phase execution" --files .planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md {phase_dir}/*-VERIFICATION.md
383
+ node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" commit "docs(phase-{X}): complete phase execution" --files .planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md {phase_dir}/*-VERIFICATION.md
379
384
  ```
380
385
  </step>
381
386
 
@@ -409,12 +414,13 @@ STOP. Do not proceed to auto-advance or transition.
409
414
  **Auto-advance detection:**
410
415
 
411
416
  1. Parse `--auto` flag from $ARGUMENTS
412
- 2. read `workflow.auto_advance` from config:
417
+ 2. read both the chain flag and user preference (chain flag already synced in init step):
413
418
  ```bash
414
- AUTO_CFG=$(node ~/.config/opencode/get-shit-done/bin/gsd-tools.cjs config-get workflow.auto_advance 2>/dev/null || echo "false")
419
+ AUTO_CHAIN=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false")
420
+ AUTO_CFG=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
415
421
  ```
416
422
 
417
- **If `--auto` flag present OR `AUTO_CFG` is true (AND verification passed with no gaps):**
423
+ **If `--auto` flag present OR `AUTO_CHAIN` is true OR `AUTO_CFG` is true (AND verification passed with no gaps):**
418
424
 
419
425
  ```
420
426
  ╔══════════════════════════════════════════╗
@@ -425,7 +431,7 @@ STOP. Do not proceed to auto-advance or transition.
425
431
 
426
432
  Execute the transition workflow inline (do NOT use task — orchestrator context is ~10-15%, transition needs phase completion data already in context):
427
433
 
428
- read and follow `~/.config/opencode/get-shit-done/workflows/transition.md`, passing through the `--auto` flag so it propagates to the next phase invocation.
434
+ read and follow `$HOME/.config/opencode/get-shit-done/workflows/transition.md`, passing through the `--auto` flag so it propagates to the next phase invocation.
429
435
 
430
436
  **If neither `--auto` nor `AUTO_CFG` is true:**
431
437