gsd-opencode 1.22.1 → 1.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/agents/gsd-advisor-researcher.md +112 -0
  2. package/agents/gsd-assumptions-analyzer.md +110 -0
  3. package/agents/gsd-codebase-mapper.md +0 -2
  4. package/agents/gsd-debugger.md +117 -2
  5. package/agents/gsd-doc-verifier.md +207 -0
  6. package/agents/gsd-doc-writer.md +608 -0
  7. package/agents/gsd-executor.md +45 -4
  8. package/agents/gsd-integration-checker.md +0 -2
  9. package/agents/gsd-nyquist-auditor.md +0 -2
  10. package/agents/gsd-phase-researcher.md +191 -5
  11. package/agents/gsd-plan-checker.md +152 -5
  12. package/agents/gsd-planner.md +131 -157
  13. package/agents/gsd-project-researcher.md +28 -3
  14. package/agents/gsd-research-synthesizer.md +0 -2
  15. package/agents/gsd-roadmapper.md +29 -2
  16. package/agents/gsd-security-auditor.md +129 -0
  17. package/agents/gsd-ui-auditor.md +485 -0
  18. package/agents/gsd-ui-checker.md +305 -0
  19. package/agents/gsd-ui-researcher.md +368 -0
  20. package/agents/gsd-user-profiler.md +173 -0
  21. package/agents/gsd-verifier.md +207 -22
  22. package/commands/gsd/gsd-add-backlog.md +76 -0
  23. package/commands/gsd/gsd-analyze-dependencies.md +34 -0
  24. package/commands/gsd/gsd-audit-uat.md +24 -0
  25. package/commands/gsd/gsd-autonomous.md +45 -0
  26. package/commands/gsd/gsd-cleanup.md +5 -0
  27. package/commands/gsd/gsd-debug.md +29 -21
  28. package/commands/gsd/gsd-discuss-phase.md +15 -36
  29. package/commands/gsd/gsd-do.md +30 -0
  30. package/commands/gsd/gsd-docs-update.md +48 -0
  31. package/commands/gsd/gsd-execute-phase.md +24 -2
  32. package/commands/gsd/gsd-fast.md +30 -0
  33. package/commands/gsd/gsd-forensics.md +56 -0
  34. package/commands/gsd/gsd-help.md +2 -0
  35. package/commands/gsd/gsd-join-discord.md +2 -1
  36. package/commands/gsd/gsd-list-workspaces.md +19 -0
  37. package/commands/gsd/gsd-manager.md +40 -0
  38. package/commands/gsd/gsd-milestone-summary.md +51 -0
  39. package/commands/gsd/gsd-new-project.md +4 -0
  40. package/commands/gsd/gsd-new-workspace.md +44 -0
  41. package/commands/gsd/gsd-next.md +24 -0
  42. package/commands/gsd/gsd-note.md +34 -0
  43. package/commands/gsd/gsd-plan-phase.md +8 -1
  44. package/commands/gsd/gsd-plant-seed.md +28 -0
  45. package/commands/gsd/gsd-pr-branch.md +25 -0
  46. package/commands/gsd/gsd-profile-user.md +46 -0
  47. package/commands/gsd/gsd-quick.md +7 -3
  48. package/commands/gsd/gsd-reapply-patches.md +178 -45
  49. package/commands/gsd/gsd-remove-workspace.md +26 -0
  50. package/commands/gsd/gsd-research-phase.md +7 -12
  51. package/commands/gsd/gsd-review-backlog.md +62 -0
  52. package/commands/gsd/gsd-review.md +38 -0
  53. package/commands/gsd/gsd-secure-phase.md +35 -0
  54. package/commands/gsd/gsd-session-report.md +19 -0
  55. package/commands/gsd/gsd-set-profile.md +24 -23
  56. package/commands/gsd/gsd-ship.md +23 -0
  57. package/commands/gsd/gsd-stats.md +18 -0
  58. package/commands/gsd/gsd-thread.md +127 -0
  59. package/commands/gsd/gsd-ui-phase.md +34 -0
  60. package/commands/gsd/gsd-ui-review.md +32 -0
  61. package/commands/gsd/gsd-workstreams.md +71 -0
  62. package/get-shit-done/bin/gsd-tools.cjs +450 -90
  63. package/get-shit-done/bin/lib/commands.cjs +489 -24
  64. package/get-shit-done/bin/lib/config.cjs +329 -48
  65. package/get-shit-done/bin/lib/core.cjs +1143 -102
  66. package/get-shit-done/bin/lib/docs.cjs +267 -0
  67. package/get-shit-done/bin/lib/frontmatter.cjs +125 -43
  68. package/get-shit-done/bin/lib/init.cjs +918 -106
  69. package/get-shit-done/bin/lib/milestone.cjs +65 -33
  70. package/get-shit-done/bin/lib/model-profiles.cjs +70 -0
  71. package/get-shit-done/bin/lib/phase.cjs +434 -404
  72. package/get-shit-done/bin/lib/profile-output.cjs +1048 -0
  73. package/get-shit-done/bin/lib/profile-pipeline.cjs +539 -0
  74. package/get-shit-done/bin/lib/roadmap.cjs +156 -101
  75. package/get-shit-done/bin/lib/schema-detect.cjs +238 -0
  76. package/get-shit-done/bin/lib/security.cjs +384 -0
  77. package/get-shit-done/bin/lib/state.cjs +711 -79
  78. package/get-shit-done/bin/lib/template.cjs +2 -2
  79. package/get-shit-done/bin/lib/uat.cjs +282 -0
  80. package/get-shit-done/bin/lib/verify.cjs +254 -42
  81. package/get-shit-done/bin/lib/workstream.cjs +495 -0
  82. package/get-shit-done/references/agent-contracts.md +79 -0
  83. package/get-shit-done/references/artifact-types.md +113 -0
  84. package/get-shit-done/references/checkpoints.md +12 -10
  85. package/get-shit-done/references/context-budget.md +49 -0
  86. package/get-shit-done/references/continuation-format.md +15 -15
  87. package/get-shit-done/references/decimal-phase-calculation.md +2 -3
  88. package/get-shit-done/references/domain-probes.md +125 -0
  89. package/get-shit-done/references/gate-prompts.md +100 -0
  90. package/get-shit-done/references/git-integration.md +47 -0
  91. package/get-shit-done/references/model-profile-resolution.md +2 -0
  92. package/get-shit-done/references/model-profiles.md +62 -16
  93. package/get-shit-done/references/phase-argument-parsing.md +2 -2
  94. package/get-shit-done/references/planner-gap-closure.md +62 -0
  95. package/get-shit-done/references/planner-reviews.md +39 -0
  96. package/get-shit-done/references/planner-revision.md +87 -0
  97. package/get-shit-done/references/planning-config.md +18 -1
  98. package/get-shit-done/references/revision-loop.md +97 -0
  99. package/get-shit-done/references/ui-brand.md +2 -2
  100. package/get-shit-done/references/universal-anti-patterns.md +58 -0
  101. package/get-shit-done/references/user-profiling.md +681 -0
  102. package/get-shit-done/references/workstream-flag.md +111 -0
  103. package/get-shit-done/templates/SECURITY.md +61 -0
  104. package/get-shit-done/templates/UAT.md +21 -3
  105. package/get-shit-done/templates/UI-SPEC.md +100 -0
  106. package/get-shit-done/templates/VALIDATION.md +3 -3
  107. package/get-shit-done/templates/claude-md.md +145 -0
  108. package/get-shit-done/templates/config.json +14 -3
  109. package/get-shit-done/templates/context.md +61 -6
  110. package/get-shit-done/templates/debug-subagent-prompt.md +2 -6
  111. package/get-shit-done/templates/dev-preferences.md +21 -0
  112. package/get-shit-done/templates/discussion-log.md +63 -0
  113. package/get-shit-done/templates/phase-prompt.md +46 -5
  114. package/get-shit-done/templates/planner-subagent-prompt.md +2 -10
  115. package/get-shit-done/templates/project.md +2 -0
  116. package/get-shit-done/templates/state.md +2 -2
  117. package/get-shit-done/templates/user-profile.md +146 -0
  118. package/get-shit-done/workflows/add-phase.md +4 -4
  119. package/get-shit-done/workflows/add-tests.md +4 -4
  120. package/get-shit-done/workflows/add-todo.md +4 -4
  121. package/get-shit-done/workflows/analyze-dependencies.md +96 -0
  122. package/get-shit-done/workflows/audit-milestone.md +20 -16
  123. package/get-shit-done/workflows/audit-uat.md +109 -0
  124. package/get-shit-done/workflows/autonomous.md +1036 -0
  125. package/get-shit-done/workflows/check-todos.md +4 -4
  126. package/get-shit-done/workflows/cleanup.md +4 -4
  127. package/get-shit-done/workflows/complete-milestone.md +22 -10
  128. package/get-shit-done/workflows/diagnose-issues.md +21 -7
  129. package/get-shit-done/workflows/discovery-phase.md +2 -2
  130. package/get-shit-done/workflows/discuss-phase-assumptions.md +671 -0
  131. package/get-shit-done/workflows/discuss-phase-power.md +291 -0
  132. package/get-shit-done/workflows/discuss-phase.md +558 -47
  133. package/get-shit-done/workflows/do.md +104 -0
  134. package/get-shit-done/workflows/docs-update.md +1093 -0
  135. package/get-shit-done/workflows/execute-phase.md +741 -58
  136. package/get-shit-done/workflows/execute-plan.md +77 -12
  137. package/get-shit-done/workflows/fast.md +105 -0
  138. package/get-shit-done/workflows/forensics.md +265 -0
  139. package/get-shit-done/workflows/health.md +28 -6
  140. package/get-shit-done/workflows/help.md +127 -7
  141. package/get-shit-done/workflows/insert-phase.md +4 -4
  142. package/get-shit-done/workflows/list-phase-assumptions.md +2 -2
  143. package/get-shit-done/workflows/list-workspaces.md +56 -0
  144. package/get-shit-done/workflows/manager.md +363 -0
  145. package/get-shit-done/workflows/map-codebase.md +83 -44
  146. package/get-shit-done/workflows/milestone-summary.md +223 -0
  147. package/get-shit-done/workflows/new-milestone.md +133 -25
  148. package/get-shit-done/workflows/new-project.md +216 -54
  149. package/get-shit-done/workflows/new-workspace.md +237 -0
  150. package/get-shit-done/workflows/next.md +97 -0
  151. package/get-shit-done/workflows/node-repair.md +92 -0
  152. package/get-shit-done/workflows/note.md +156 -0
  153. package/get-shit-done/workflows/pause-work.md +132 -15
  154. package/get-shit-done/workflows/plan-milestone-gaps.md +6 -7
  155. package/get-shit-done/workflows/plan-phase.md +513 -62
  156. package/get-shit-done/workflows/plant-seed.md +169 -0
  157. package/get-shit-done/workflows/pr-branch.md +129 -0
  158. package/get-shit-done/workflows/profile-user.md +450 -0
  159. package/get-shit-done/workflows/progress.md +154 -29
  160. package/get-shit-done/workflows/quick.md +285 -111
  161. package/get-shit-done/workflows/remove-phase.md +2 -2
  162. package/get-shit-done/workflows/remove-workspace.md +90 -0
  163. package/get-shit-done/workflows/research-phase.md +13 -9
  164. package/get-shit-done/workflows/resume-project.md +37 -18
  165. package/get-shit-done/workflows/review.md +281 -0
  166. package/get-shit-done/workflows/secure-phase.md +154 -0
  167. package/get-shit-done/workflows/session-report.md +146 -0
  168. package/get-shit-done/workflows/set-profile.md +2 -2
  169. package/get-shit-done/workflows/settings.md +91 -11
  170. package/get-shit-done/workflows/ship.md +237 -0
  171. package/get-shit-done/workflows/stats.md +60 -0
  172. package/get-shit-done/workflows/transition.md +150 -23
  173. package/get-shit-done/workflows/ui-phase.md +292 -0
  174. package/get-shit-done/workflows/ui-review.md +183 -0
  175. package/get-shit-done/workflows/update.md +262 -30
  176. package/get-shit-done/workflows/validate-phase.md +14 -17
  177. package/get-shit-done/workflows/verify-phase.md +143 -11
  178. package/get-shit-done/workflows/verify-work.md +141 -39
  179. package/package.json +1 -1
  180. package/skills/gsd-audit-milestone/SKILL.md +29 -0
  181. package/skills/gsd-cleanup/SKILL.md +19 -0
  182. package/skills/gsd-complete-milestone/SKILL.md +131 -0
  183. package/skills/gsd-discuss-phase/SKILL.md +54 -0
  184. package/skills/gsd-execute-phase/SKILL.md +49 -0
  185. package/skills/gsd-plan-phase/SKILL.md +37 -0
  186. package/skills/gsd-ui-phase/SKILL.md +24 -0
  187. package/skills/gsd-ui-review/SKILL.md +24 -0
  188. package/skills/gsd-verify-work/SKILL.md +30 -0
@@ -1,13 +1,23 @@
1
- <purpose>
1
+ <objective>
2
2
  Create executable phase prompts (PLAN.md files) for a roadmap phase with integrated research and verification. Default flow: Research (if needed) -> Plan -> Verify -> Done. Orchestrates gsd-phase-researcher, gsd-planner, and gsd-plan-checker agents with a revision loop (max 3 iterations).
3
- </purpose>
3
+ </objective>
4
4
 
5
5
  <required_reading>
6
6
  read all files referenced by the invoking prompt's execution_context before starting.
7
7
 
8
8
  @$HOME/.config/opencode/get-shit-done/references/ui-brand.md
9
+ @$HOME/.config/opencode/get-shit-done/references/revision-loop.md
10
+ @$HOME/.config/opencode/get-shit-done/references/gate-prompts.md
11
+ @$HOME/.config/opencode/get-shit-done/references/agent-contracts.md
9
12
  </required_reading>
10
13
 
14
+ <available_agent_types>
15
+ Valid GSD subagent types (use exact names — do not fall back to 'general'):
16
+ - gsd-phase-researcher — Researches technical approaches for a phase
17
+ - gsd-planner — Creates detailed plans from phase scope
18
+ - gsd-plan-checker — Reviews plan quality before execution
19
+ </available_agent_types>
20
+
11
21
  <process>
12
22
 
13
23
  ## 1. Initialize
@@ -17,17 +27,27 @@ Load all context in one call (paths only to minimize orchestrator context):
17
27
  ```bash
18
28
  INIT=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" init plan-phase "$PHASE")
19
29
  if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
30
+ AGENT_SKILLS_RESEARCHER=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-researcher 2>/dev/null)
31
+ AGENT_SKILLS_PLANNER=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-planner 2>/dev/null)
32
+ AGENT_SKILLS_CHECKER=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-checker 2>/dev/null)
33
+ CONTEXT_WINDOW=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get context_window 2>/dev/null || echo "200000")
20
34
  ```
21
35
 
22
- Parse JSON for: `researcher_model`, `planner_model`, `checker_model`, `research_enabled`, `plan_checker_enabled`, `nyquist_validation_enabled`, `commit_docs`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`, `has_research`, `has_context`, `has_plans`, `plan_count`, `planning_exists`, `roadmap_exists`, `phase_req_ids`.
36
+ When `CONTEXT_WINDOW >= 500000`, the planner prompt includes prior phase CONTEXT.md files so cross-phase decisions are consistent (e.g., "use library X for all data fetching" from Phase 2 is visible to Phase 5's planner).
23
37
 
24
- **File paths (for <files_to_read> blocks):** `state_path`, `roadmap_path`, `requirements_path`, `context_path`, `research_path`, `verification_path`, `uat_path`. These are null if files don't exist.
38
+ Parse JSON for: `researcher_model`, `planner_model`, `checker_model`, `research_enabled`, `plan_checker_enabled`, `nyquist_validation_enabled`, `commit_docs`, `text_mode`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`, `has_research`, `has_context`, `has_reviews`, `has_plans`, `plan_count`, `planning_exists`, `roadmap_exists`, `phase_req_ids`, `response_language`.
39
+
40
+ **If `response_language` is set:** Include `response_language: {value}` in all spawned subagent prompts so any user-facing output stays in the configured language.
41
+
42
+ **File paths (for <files_to_read> blocks):** `state_path`, `roadmap_path`, `requirements_path`, `context_path`, `research_path`, `verification_path`, `uat_path`, `reviews_path`. These are null if files don't exist.
25
43
 
26
44
  **If `planning_exists` is false:** Error — run `/gsd-new-project` first.
27
45
 
28
46
  ## 2. Parse and Normalize Arguments
29
47
 
30
- Extract from $ARGUMENTS: phase number (integer or decimal like `2.1`), flags (`--research`, `--skip-research`, `--gaps`, `--skip-verify`, `--prd <filepath>`).
48
+ Extract from $ARGUMENTS: phase number (integer or decimal like `2.1`), flags (`--research`, `--skip-research`, `--gaps`, `--skip-verify`, `--prd <filepath>`, `--reviews`, `--text`).
49
+
50
+ Set `TEXT_MODE=true` if `--text` is present in $ARGUMENTS OR `text_mode` from init JSON is `true`. When `TEXT_MODE` is active, replace every `question` call with a plain-text numbered list and ask the user to type their choice number. This is required for OpenCode remote sessions (`/rc` mode) where TUI menus don't work through the OpenCode App.
31
51
 
32
52
  Extract `--prd <filepath>` from $ARGUMENTS. If present, set PRD_FILE to the filepath.
33
53
 
@@ -40,6 +60,24 @@ mkdir -p ".planning/phases/${padded_phase}-${phase_slug}"
40
60
 
41
61
  **Existing artifacts from init:** `has_research`, `has_plans`, `plan_count`.
42
62
 
63
+ ## 2.5. Validate `--reviews` Prerequisite
64
+
65
+ **Skip if:** No `--reviews` flag.
66
+
67
+ **If `--reviews` AND `--gaps`:** Error — cannot combine `--reviews` with `--gaps`. These are conflicting modes.
68
+
69
+ **If `--reviews` AND `has_reviews` is false (no REVIEWS.md in phase dir):**
70
+
71
+ Error:
72
+ ```
73
+ No REVIEWS.md found for Phase {N}. Run reviews first:
74
+
75
+ /gsd-review --phase {N}
76
+
77
+ Then re-run /gsd-plan-phase {N} --reviews
78
+ ```
79
+ Exit workflow.
80
+
43
81
  ## 3. Validate Phase
44
82
 
45
83
  ```bash
@@ -77,6 +115,7 @@ Generating CONTEXT.md from requirements...
77
115
  - Extract all requirements, user stories, acceptance criteria, and constraints from the PRD
78
116
  - Map each to a locked decision (everything in the PRD is treated as a locked decision)
79
117
  - Identify any areas the PRD doesn't cover and mark as "OpenCode's Discretion"
118
+ - **Extract canonical refs** from ROADMAP.md for this phase, plus any specs/ADRs referenced in the PRD — expand to full file paths (MANDATORY)
80
119
  - Create CONTEXT.md in the phase directory
81
120
 
82
121
  4. write CONTEXT.md:
@@ -106,6 +145,21 @@ Generating CONTEXT.md from requirements...
106
145
 
107
146
  </decisions>
108
147
 
148
+ <canonical_refs>
149
+ ## Canonical References
150
+
151
+ **Downstream agents MUST read these before planning or implementing.**
152
+
153
+ [MANDATORY. Extract from ROADMAP.md and any docs referenced in the PRD.
154
+ Use full relative paths. Group by topic area.]
155
+
156
+ ### [Topic area]
157
+ - `path/to/spec-or-adr.md` — [What it decides/defines]
158
+
159
+ [If no external specs: "No external specs — requirements fully captured in decisions above"]
160
+
161
+ </canonical_refs>
162
+
109
163
  <specifics>
110
164
  ## Specific Ideas
111
165
 
@@ -146,24 +200,86 @@ If `context_path` is not null, display: `Using phase context from: ${context_pat
146
200
 
147
201
  **If `context_path` is null (no CONTEXT.md exists):**
148
202
 
149
- Use question:
203
+ read discuss mode for context gate label:
204
+ ```bash
205
+ DISCUSS_MODE=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get workflow.discuss_mode 2>/dev/null || echo "discuss")
206
+ ```
207
+
208
+ If `TEXT_MODE` is true, present as a plain-text numbered list:
209
+ ```
210
+ No CONTEXT.md found for Phase {X}. Plans will use research and requirements only — your design preferences won't be included.
211
+
212
+ 1. Continue without context — Plan using research + requirements only
213
+ [If DISCUSS_MODE is "assumptions":]
214
+ 2. Gather context (assumptions mode) — Analyze codebase and surface assumptions before planning
215
+ [If DISCUSS_MODE is "discuss" or unset:]
216
+ 2. Run discuss-phase first — Capture design decisions before planning
217
+
218
+ Enter number:
219
+ ```
220
+
221
+ Otherwise use question:
150
222
  - header: "No context"
151
223
  - question: "No CONTEXT.md found for Phase {X}. Plans will use research and requirements only — your design preferences won't be included. Continue or capture context first?"
152
224
  - options:
153
225
  - "Continue without context" — Plan using research + requirements only
226
+ If `DISCUSS_MODE` is `"assumptions"`:
227
+ - "Gather context (assumptions mode)" — Analyze codebase and surface assumptions before planning
228
+ If `DISCUSS_MODE` is `"discuss"` (or unset):
154
229
  - "Run discuss-phase first" — Capture design decisions before planning
155
230
 
156
231
  If "Continue without context": Proceed to step 5.
157
- If "Run discuss-phase first": Display `/gsd-discuss-phase {X}` and exit workflow.
232
+ If "Run discuss-phase first":
233
+ **IMPORTANT:** Do NOT invoke discuss-phase as a nested skill/task call — question
234
+ does not work correctly in nested subcontexts (#1009). Instead, display the command
235
+ and exit so the user runs it as a top-level command:
236
+ ```
237
+ Run this command first, then re-run /gsd-plan-phase {X} ${GSD_WS}:
238
+
239
+ /gsd-discuss-phase {X} ${GSD_WS}
240
+ ```
241
+ **Exit the plan-phase workflow. Do not continue.**
158
242
 
159
243
  ## 5. Handle Research
160
244
 
161
- **Skip if:** `--gaps` flag, `--skip-research` flag, or `research_enabled` is false (from init) without `--research` override.
245
+ **Skip if:** `--gaps` flag or `--skip-research` flag or `--reviews` flag.
162
246
 
163
247
  **If `has_research` is true (from init) AND no `--research` flag:** Use existing, skip to step 6.
164
248
 
165
249
  **If RESEARCH.md missing OR `--research` flag:**
166
250
 
251
+ **If no explicit flag (`--research` or `--skip-research`) and not `--auto`:**
252
+ Ask the user whether to research, with a contextual recommendation based on the phase:
253
+
254
+ If `TEXT_MODE` is true, present as a plain-text numbered list:
255
+ ```
256
+ Research before planning Phase {X}: {phase_name}?
257
+
258
+ 1. Research first (Recommended) — Investigate domain, patterns, and dependencies before planning. Best for new features, unfamiliar integrations, or architectural changes.
259
+ 2. Skip research — Plan directly from context and requirements. Best for bug fixes, simple refactors, or well-understood tasks.
260
+
261
+ Enter number:
262
+ ```
263
+
264
+ Otherwise use question:
265
+ ```
266
+ question([
267
+ {
268
+ question: "Research before planning Phase {X}: {phase_name}?",
269
+ header: "Research",
270
+ multiSelect: false,
271
+ options: [
272
+ { label: "Research first (Recommended)", description: "Investigate domain, patterns, and dependencies before planning. Best for new features, unfamiliar integrations, or architectural changes." },
273
+ { label: "Skip research", description: "Plan directly from context and requirements. Best for bug fixes, simple refactors, or well-understood tasks." }
274
+ ]
275
+ }
276
+ ])
277
+ ```
278
+
279
+ If user selects "Skip research": skip to step 6.
280
+
281
+ **If `--auto` and `research_enabled` is false:** Skip research silently (preserves automated behavior).
282
+
167
283
  Display banner:
168
284
  ```
169
285
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -176,7 +292,7 @@ Display banner:
176
292
  ### Spawn gsd-phase-researcher
177
293
 
178
294
  ```bash
179
- PHASE_DESC=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase "${PHASE}" | jq -r '.section')
295
+ PHASE_DESC=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase "${PHASE}" --pick section)
180
296
  ```
181
297
 
182
298
  Research prompt:
@@ -193,6 +309,8 @@ Answer: "What do I need to know to PLAN this phase well?"
193
309
  - {state_path} (Project decisions and history)
194
310
  </files_to_read>
195
311
 
312
+ ${AGENT_SKILLS_RESEARCHER}
313
+
196
314
  <additional_context>
197
315
  **Phase description:** {phase_description}
198
316
  **Phase requirement IDs (MUST address):** {phase_req_ids}
@@ -207,12 +325,7 @@ write to: {phase_dir}/{phase_num}-RESEARCH.md
207
325
  ```
208
326
 
209
327
  ```
210
- task(
211
- prompt=research_prompt,
212
- subagent_type="gsd-phase-researcher",
213
- model="{researcher_model}",
214
- description="Research Phase {phase}"
215
- )
328
+ @gsd-phase-researcher research_prompt
216
329
  ```
217
330
 
218
331
  ### Handle Researcher Return
@@ -222,10 +335,19 @@ task(
222
335
 
223
336
  ## 5.5. Create Validation Strategy
224
337
 
225
- MANDATORY unless `nyquist_validation_enabled` is false.
338
+ Skip if `nyquist_validation_enabled` is false OR `research_enabled` is false.
339
+
340
+ If `research_enabled` is false and `nyquist_validation_enabled` is true: warn "Nyquist validation enabled but research disabled — VALIDATION.md cannot be created without RESEARCH.md. Plans will lack validation requirements (Dimension 8)." Continue to step 6.
341
+
342
+ **But Nyquist is not applicable for this run** when all of the following are true:
343
+ - `research_enabled` is false
344
+ - `has_research` is false
345
+ - no `--research` flag was provided
346
+
347
+ In that case: **skip validation-strategy creation entirely**. Do **not** expect `RESEARCH.md` or `VALIDATION.md` for this run, and continue to Step 6.
226
348
 
227
349
  ```bash
228
- grep -l "## Validation Architecture" "${PHASE_DIR}"/*-RESEARCH.md 2>/dev/null
350
+ grep -l "## Validation Architecture" "${PHASE_DIR}"/*-RESEARCH.md 2>/dev/null || true
229
351
  ```
230
352
 
231
353
  **If found:**
@@ -237,43 +359,214 @@ grep -l "## Validation Architecture" "${PHASE_DIR}"/*-RESEARCH.md 2>/dev/null
237
359
  test -f "${PHASE_DIR}/${PADDED_PHASE}-VALIDATION.md" && echo "VALIDATION_CREATED=true" || echo "VALIDATION_CREATED=false"
238
360
  ```
239
361
  5. If `VALIDATION_CREATED=false`: STOP — do not proceed to Step 6
240
- 6. If `commit_docs`: `commit-docs "docs(phase-${PHASE}): add validation strategy"`
362
+ 6. If `commit_docs`: `commit "docs(phase-${PHASE}): add validation strategy"`
241
363
 
242
364
  **If not found:** Warn and continue — plans may fail Dimension 8.
243
365
 
366
+ ## 5.55. Security Threat Model Gate
367
+
368
+ > Skip if `workflow.security_enforcement` is explicitly `false`. Absent = enabled.
369
+
370
+ ```bash
371
+ SECURITY_CFG=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get workflow.security_enforcement --raw 2>/dev/null || echo "true")
372
+ SECURITY_ASVS=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get workflow.security_asvs_level --raw 2>/dev/null || echo "1")
373
+ SECURITY_BLOCK=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get workflow.security_block_on --raw 2>/dev/null || echo "high")
374
+ ```
375
+
376
+ **If `SECURITY_CFG` is `false`:** Skip to step 5.6.
377
+
378
+ **If `SECURITY_CFG` is `true`:** Display banner:
379
+
380
+ ```
381
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
382
+ GSD ► SECURITY THREAT MODEL REQUIRED (ASVS L{SECURITY_ASVS})
383
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
384
+
385
+ Each PLAN.md must include a <threat_model> block.
386
+ Block on: {SECURITY_BLOCK} severity threats.
387
+ Opt out: set security_enforcement: false in .planning/config.json
388
+ ```
389
+
390
+ Continue to step 5.6. Security config is passed to the planner in step 8.
391
+
392
+ ## 5.6. UI Design Contract Gate
393
+
394
+ > Skip if `workflow.ui_phase` is explicitly `false` AND `workflow.ui_safety_gate` is explicitly `false` in `.planning/config.json`. If keys are absent, treat as enabled.
395
+
396
+ ```bash
397
+ UI_PHASE_CFG=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get workflow.ui_phase 2>/dev/null || echo "true")
398
+ UI_GATE_CFG=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get workflow.ui_safety_gate 2>/dev/null || echo "true")
399
+ ```
400
+
401
+ **If both are `false`:** Skip to step 6.
402
+
403
+ Check if phase has frontend indicators:
404
+
405
+ ```bash
406
+ PHASE_SECTION=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase "${PHASE}" 2>/dev/null)
407
+ echo "$PHASE_SECTION" | grep -iE "UI|interface|frontend|component|layout|page|screen|view|form|dashboard|widget" > /dev/null 2>&1
408
+ HAS_UI=$?
409
+ ```
410
+
411
+ **If `HAS_UI` is 0 (frontend indicators found):**
412
+
413
+ Check for existing UI-SPEC:
414
+ ```bash
415
+ UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1)
416
+ ```
417
+
418
+ **If UI-SPEC.md found:** Set `UI_SPEC_PATH=$UI_SPEC_FILE`. Display: `Using UI design contract: ${UI_SPEC_PATH}`
419
+
420
+ **If UI-SPEC.md missing AND `UI_GATE_CFG` is `true`:**
421
+
422
+ read auto-chain state:
423
+ ```bash
424
+ AUTO_CHAIN=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false")
425
+ ```
426
+
427
+ **If `AUTO_CHAIN` is `true` (running inside a `--chain` or `--auto` pipeline):**
428
+
429
+ Auto-generate UI-SPEC without prompting:
430
+ ```
431
+ skill(skill="gsd-ui-phase", args="${PHASE} --auto ${GSD_WS}")
432
+ ```
433
+ After `gsd-ui-phase` returns, re-read:
434
+ ```bash
435
+ UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1)
436
+ UI_SPEC_PATH="${UI_SPEC_FILE}"
437
+ ```
438
+ Continue to step 6.
439
+
440
+ **If `AUTO_CHAIN` is `false` (manual invocation):**
441
+
442
+ If `TEXT_MODE` is true, present as a plain-text numbered list:
443
+ ```
444
+ Phase {N} has frontend indicators but no UI-SPEC.md. Generate a design contract before planning?
445
+
446
+ 1. Generate UI-SPEC first — Run /gsd-ui-phase {N} then re-run /gsd-plan-phase {N}
447
+ 2. Continue without UI-SPEC
448
+ 3. Not a frontend phase
449
+
450
+ Enter number:
451
+ ```
452
+
453
+ Otherwise use question:
454
+ - header: "UI Design Contract"
455
+ - question: "Phase {N} has frontend indicators but no UI-SPEC.md. Generate a design contract before planning?"
456
+ - options:
457
+ - "Generate UI-SPEC first" → Display: "Run `/gsd-ui-phase {N} ${GSD_WS}` then re-run `/gsd-plan-phase {N} ${GSD_WS}`". Exit workflow.
458
+ - "Continue without UI-SPEC" → Continue to step 6.
459
+ - "Not a frontend phase" → Continue to step 6.
460
+
461
+ **If `HAS_UI` is 1 (no frontend indicators):** Skip silently to step 5.7.
462
+
463
+ ## 5.7. Schema Push Detection Gate
464
+
465
+ > Detects schema-relevant files in the phase scope and injects a mandatory `[BLOCKING]` schema push task into the plan. Prevents false-positive verification where build/types pass because TypeScript types come from config, not the live database.
466
+
467
+ Check if any files in the phase scope match schema patterns:
468
+
469
+ ```bash
470
+ PHASE_SECTION=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase "${PHASE}" --pick section 2>/dev/null)
471
+ ```
472
+
473
+ Scan `PHASE_SECTION`, `CONTEXT.md` (if loaded), and `RESEARCH.md` (if exists) for file paths matching these ORM patterns:
474
+
475
+ | ORM | File Patterns |
476
+ |-----|--------------|
477
+ | Payload CMS | `src/collections/**/*.ts`, `src/globals/**/*.ts` |
478
+ | Prisma | `prisma/schema.prisma`, `prisma/schema/*.prisma` |
479
+ | Drizzle | `drizzle/schema.ts`, `src/db/schema.ts`, `drizzle/*.ts` |
480
+ | Supabase | `supabase/migrations/*.sql` |
481
+ | TypeORM | `src/entities/**/*.ts`, `src/migrations/**/*.ts` |
482
+
483
+ Also check if any existing PLAN.md files for this phase already reference these file patterns in `files_modified`.
484
+
485
+ **If schema-relevant files detected:**
486
+
487
+ Set `SCHEMA_PUSH_REQUIRED=true` and `SCHEMA_ORM={detected_orm}`.
488
+
489
+ Determine the push command for the detected ORM:
490
+
491
+ | ORM | Push Command | Non-TTY Workaround |
492
+ |-----|-------------|-------------------|
493
+ | Payload CMS | `npx payload migrate` | `CI=true PAYLOAD_MIGRATING=true npx payload migrate` |
494
+ | Prisma | `npx prisma db push` | `npx prisma db push --accept-data-loss` (if destructive) |
495
+ | Drizzle | `npx drizzle-kit push` | `npx drizzle-kit push` |
496
+ | Supabase | `supabase db push` | Set `SUPABASE_ACCESS_TOKEN` env var |
497
+ | TypeORM | `npx typeorm migration:run` | `npx typeorm migration:run -d src/data-source.ts` |
498
+
499
+ Inject the following into the planner prompt (step 8) as an additional constraint:
500
+
501
+ ```markdown
502
+ <schema_push_requirement>
503
+ **[BLOCKING] Schema Push Required**
504
+
505
+ This phase modifies schema-relevant files ({detected_files}). The planner MUST include
506
+ a `[BLOCKING]` task that runs the database schema push command AFTER all schema file
507
+ modifications are complete but BEFORE verification.
508
+
509
+ - ORM detected: {SCHEMA_ORM}
510
+ - Push command: {push_command}
511
+ - Non-TTY workaround: {env_hint}
512
+ - If push requires interactive prompts that cannot be suppressed, flag the task for
513
+ manual intervention with `autonomous: false`
514
+
515
+ This task is mandatory — the phase CANNOT pass verification without it. Build and
516
+ type checks will pass without the push (types come from config, not the live database),
517
+ creating a false-positive verification state.
518
+ </schema_push_requirement>
519
+ ```
520
+
521
+ Display: `Schema files detected ({SCHEMA_ORM}) — [BLOCKING] push task will be injected into plans`
522
+
523
+ **If no schema-relevant files detected:** Skip silently to step 6.
524
+
244
525
  ## 6. Check Existing Plans
245
526
 
246
527
  ```bash
247
- ls "${PHASE_DIR}"/*-PLAN.md 2>/dev/null
528
+ ls "${PHASE_DIR}"/*-PLAN.md 2>/dev/null || true
248
529
  ```
249
530
 
250
- **If exists:** Offer: 1) Add more plans, 2) View existing, 3) Replan from scratch.
531
+ **If exists AND `--reviews` flag:** Skip prompt go straight to replanning (the purpose of `--reviews` is to replan with review feedback).
532
+
533
+ **If exists AND no `--reviews` flag:** Offer: 1) Add more plans, 2) View existing, 3) Replan from scratch.
251
534
 
252
535
  ## 7. Use Context Paths from INIT
253
536
 
254
537
  Extract from INIT JSON:
255
538
 
256
539
  ```bash
257
- STATE_PATH=$(printf '%s\n' "$INIT" | jq -r '.state_path // empty')
258
- ROADMAP_PATH=$(printf '%s\n' "$INIT" | jq -r '.roadmap_path // empty')
259
- REQUIREMENTS_PATH=$(printf '%s\n' "$INIT" | jq -r '.requirements_path // empty')
260
- RESEARCH_PATH=$(printf '%s\n' "$INIT" | jq -r '.research_path // empty')
261
- VERIFICATION_PATH=$(printf '%s\n' "$INIT" | jq -r '.verification_path // empty')
262
- UAT_PATH=$(printf '%s\n' "$INIT" | jq -r '.uat_path // empty')
263
- CONTEXT_PATH=$(printf '%s\n' "$INIT" | jq -r '.context_path // empty')
540
+ _gsd_field() { node -e "const o=JSON.parse(process.argv[1]); const v=o[process.argv[2]]; process.stdout.write(v==null?'':String(v))" "$1" "$2"; }
541
+ STATE_PATH=$(_gsd_field "$INIT" state_path)
542
+ ROADMAP_PATH=$(_gsd_field "$INIT" roadmap_path)
543
+ REQUIREMENTS_PATH=$(_gsd_field "$INIT" requirements_path)
544
+ RESEARCH_PATH=$(_gsd_field "$INIT" research_path)
545
+ VERIFICATION_PATH=$(_gsd_field "$INIT" verification_path)
546
+ UAT_PATH=$(_gsd_field "$INIT" uat_path)
547
+ CONTEXT_PATH=$(_gsd_field "$INIT" context_path)
548
+ REVIEWS_PATH=$(_gsd_field "$INIT" reviews_path)
264
549
  ```
265
550
 
266
551
  ## 7.5. Verify Nyquist Artifacts
267
552
 
268
- Skip if `nyquist_validation_enabled` is false.
553
+ Skip if `nyquist_validation_enabled` is false OR `research_enabled` is false.
554
+
555
+ Also skip if all of the following are true:
556
+ - `research_enabled` is false
557
+ - `has_research` is false
558
+ - no `--research` flag was provided
559
+
560
+ In that no-research path, Nyquist artifacts are **not required** for this run.
269
561
 
270
562
  ```bash
271
563
  VALIDATION_EXISTS=$(ls "${PHASE_DIR}"/*-VALIDATION.md 2>/dev/null | head -1)
272
564
  ```
273
565
 
274
- If missing and Nyquist enabled — ask user:
275
- 1. Re-run: `/gsd-plan-phase {PHASE} --research`
276
- 2. Disable Nyquist in config
566
+ If missing and Nyquist is still enabled/applicable — ask user:
567
+ 1. Re-run: `/gsd-plan-phase {PHASE} --research ${GSD_WS}`
568
+ 2. Disable Nyquist with the exact command:
569
+ `node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-set workflow.nyquist_validation false`
277
570
  3. Continue anyway (plans fail Dimension 8)
278
571
 
279
572
  Proceed to Step 8 only if user selects 2 or 3.
@@ -294,7 +587,7 @@ Planner prompt:
294
587
  ```markdown
295
588
  <planning_context>
296
589
  **Phase:** {phase_number}
297
- **Mode:** {standard | gap_closure}
590
+ **Mode:** {standard | gap_closure | reviews}
298
591
 
299
592
  <files_to_read>
300
593
  - {state_path} (Project State)
@@ -304,26 +597,68 @@ Planner prompt:
304
597
  - {research_path} (Technical Research)
305
598
  - {verification_path} (Verification Gaps - if --gaps)
306
599
  - {uat_path} (UAT Gaps - if --gaps)
600
+ - {reviews_path} (Cross-AI Review Feedback - if --reviews)
601
+ - {UI_SPEC_PATH} (UI Design Contract — visual/interaction specs, if exists)
602
+ ${CONTEXT_WINDOW >= 500000 ? `
603
+ **Cross-phase context (1M model enrichment):**
604
+ - Prior phase CONTEXT.md files (locked decisions from earlier phases — maintain consistency)
605
+ - Prior phase SUMMARY.md files (what was actually built — reuse patterns, avoid duplication)
606
+ ` : ''}
307
607
  </files_to_read>
308
608
 
609
+ ${AGENT_SKILLS_PLANNER}
610
+
309
611
  **Phase requirement IDs (every ID MUST appear in a plan's `requirements` field):** {phase_req_ids}
310
612
 
311
613
  **Project instructions:** read ./AGENTS.md if exists — follow project-specific guidelines
312
614
  **Project skills:** Check .OpenCode/skills/ or .agents/skills/ directory (if either exists) — read SKILL.md files, plans should account for project skill rules
615
+
313
616
  </planning_context>
314
617
 
315
618
  <downstream_consumer>
316
619
  Output consumed by /gsd-execute-phase. Plans need:
317
620
  - Frontmatter (wave, depends_on, files_modified, autonomous)
318
- - Tasks in XML format
621
+ - Tasks in XML format with read_first and acceptance_criteria fields (MANDATORY on every task)
319
622
  - Verification criteria
320
623
  - must_haves for goal-backward verification
321
624
  </downstream_consumer>
322
625
 
626
+ <deep_work_rules>
627
+ ## Anti-Shallow Execution Rules (MANDATORY)
628
+
629
+ Every task MUST include these fields — they are NOT optional:
630
+
631
+ 1. **`<read_first>`** — Files the executor MUST read before touching anything. Always include:
632
+ - The file being modified (so executor sees current state, not assumptions)
633
+ - Any "source of truth" file referenced in CONTEXT.md (reference implementations, existing patterns, config files, schemas)
634
+ - Any file whose patterns, signatures, types, or conventions must be replicated or respected
635
+
636
+ 2. **`<acceptance_criteria>`** — Verifiable conditions that prove the task was done correctly. Rules:
637
+ - Every criterion must be checkable with grep, file read, test command, or CLI output
638
+ - NEVER use subjective language ("looks correct", "properly configured", "consistent with")
639
+ - ALWAYS include exact strings, patterns, values, or command outputs that must be present
640
+ - Examples:
641
+ - Code: `auth.py contains def verify_token(` / `test_auth.py exits 0`
642
+ - Config: `.env.example contains DATABASE_URL=` / `Dockerfile contains HEALTHCHECK`
643
+ - Docs: `README.md contains '## Installation'` / `API.md lists all endpoints`
644
+ - Infra: `deploy.yml has rollback step` / `docker-compose.yml has healthcheck for db`
645
+
646
+ 3. **`<action>`** — Must include CONCRETE values, not references. Rules:
647
+ - NEVER say "align X with Y", "match X to Y", "update to be consistent" without specifying the exact target state
648
+ - ALWAYS include the actual values: config keys, function signatures, SQL statements, class names, import paths, env vars, etc.
649
+ - If CONTEXT.md has a comparison table or expected values, copy them into the action verbatim
650
+ - The executor should be able to complete the task from the action text alone, without needing to read CONTEXT.md or reference files (read_first is for verification, not discovery)
651
+
652
+ **Why this matters:** Executor agents work from the plan text. Vague instructions like "update the config to match production" produce shallow one-line changes. Concrete instructions like "add DATABASE_URL=postgresql://... , set POOL_SIZE=20, add REDIS_URL=redis://..." produce complete work. The cost of verbose plans is far less than the cost of re-doing shallow execution.
653
+ </deep_work_rules>
654
+
323
655
  <quality_gate>
324
656
  - [ ] PLAN.md files created in phase directory
325
657
  - [ ] Each plan has valid frontmatter
326
658
  - [ ] Tasks are specific and actionable
659
+ - [ ] Every task has `<read_first>` with at least the file being modified
660
+ - [ ] Every task has `<acceptance_criteria>` with grep-verifiable conditions
661
+ - [ ] Every `<action>` contains concrete values (no "align X with Y" without specifying what)
327
662
  - [ ] Dependencies correctly identified
328
663
  - [ ] Waves assigned for parallel execution
329
664
  - [ ] must_haves derived from phase goal
@@ -331,20 +666,48 @@ Output consumed by /gsd-execute-phase. Plans need:
331
666
  ```
332
667
 
333
668
  ```
334
- task(
335
- prompt=filled_prompt,
336
- subagent_type="gsd-planner",
337
- model="{planner_model}",
338
- description="Plan Phase {phase}"
339
- )
669
+ @gsd-planner filled_prompt
340
670
  ```
341
671
 
342
672
  ## 9. Handle Planner Return
343
673
 
344
674
  - **`## PLANNING COMPLETE`:** Display plan count. If `--skip-verify` or `plan_checker_enabled` is false (from init): skip to step 13. Otherwise: step 10.
675
+ - **`## PHASE SPLIT RECOMMENDED`:** The planner determined the phase is too complex to implement all user decisions without simplifying them. Handle in step 9b.
345
676
  - **`## CHECKPOINT REACHED`:** Present to user, get response, spawn continuation (step 12)
346
677
  - **`## PLANNING INCONCLUSIVE`:** Show attempts, offer: Add context / Retry / Manual
347
678
 
679
+ ## 9b. Handle Phase Split Recommendation
680
+
681
+ When the planner returns `## PHASE SPLIT RECOMMENDED`, it means the phase has too many decisions to implement at full fidelity within the plan budget. The planner proposes groupings.
682
+
683
+ **Extract from planner return:**
684
+ - Proposed sub-phases (e.g., "17a: processing core (D-01 to D-19)", "17b: billing + config UX (D-20 to D-27)")
685
+ - Which D-XX decisions go in each sub-phase
686
+ - Why the split is necessary (decision count, complexity estimate)
687
+
688
+ **Present to user:**
689
+ ```
690
+ ## Phase {X} is too complex for full-fidelity implementation
691
+
692
+ The planner found {N} decisions that cannot all be implemented without
693
+ simplifying some. Instead of reducing your decisions, we recommend splitting:
694
+
695
+ **Option 1: Split into sub-phases**
696
+ - Phase {X}a: {name} — {D-XX to D-YY} ({N} decisions)
697
+ - Phase {X}b: {name} — {D-XX to D-YY} ({M} decisions)
698
+
699
+ **Option 2: Proceed anyway** (planner will attempt all, quality may degrade)
700
+
701
+ **Option 3: Prioritize** — you choose which decisions to implement now,
702
+ rest become a follow-up phase
703
+ ```
704
+
705
+ Use question with these 3 options.
706
+
707
+ **If "Split":** Use `/gsd-insert-phase` to create the sub-phases, then replan each.
708
+ **If "Proceed":** Return to planner with instruction to attempt all decisions at full fidelity, accepting more plans/tasks.
709
+ **If "Prioritize":** Use question (multiSelect) to let user pick which D-XX are "now" vs "later". Create CONTEXT.md for each sub-phase with the selected decisions.
710
+
348
711
  ## 10. Spawn gsd-plan-checker Agent
349
712
 
350
713
  Display banner:
@@ -371,6 +734,8 @@ Checker prompt:
371
734
  - {research_path} (Technical Research — includes Validation Architecture)
372
735
  </files_to_read>
373
736
 
737
+ ${AGENT_SKILLS_CHECKER}
738
+
374
739
  **Phase requirement IDs (MUST ALL be covered):** {phase_req_ids}
375
740
 
376
741
  **Project instructions:** read ./AGENTS.md if exists — verify plans honor project guidelines
@@ -384,12 +749,7 @@ Checker prompt:
384
749
  ```
385
750
 
386
751
  ```
387
- task(
388
- prompt=checker_prompt,
389
- subagent_type="gsd-plan-checker",
390
- model="{checker_model}",
391
- description="Verify Phase {phase} plans"
392
- )
752
+ @gsd-plan-checker checker_prompt
393
753
  ```
394
754
 
395
755
  ## 11. Handle Checker Return
@@ -417,6 +777,8 @@ Revision prompt:
417
777
  - {context_path} (USER DECISIONS from /gsd-discuss-phase)
418
778
  </files_to_read>
419
779
 
780
+ ${AGENT_SKILLS_PLANNER}
781
+
420
782
  **Checker issues:** {structured_issues_from_checker}
421
783
  </revision_context>
422
784
 
@@ -428,12 +790,7 @@ Return what changed.
428
790
  ```
429
791
 
430
792
  ```
431
- task(
432
- prompt=revision_prompt,
433
- subagent_type="gsd-planner",
434
- model="{planner_model}",
435
- description="Revise Phase {phase} plans"
436
- )
793
+ @gsd-planner revision_prompt
437
794
  ```
438
795
 
439
796
  After planner returns -> spawn checker again (step 10), increment iteration_count.
@@ -444,18 +801,79 @@ Display: `Max iterations reached. {N} issues remain:` + issue list
444
801
 
445
802
  Offer: 1) Force proceed, 2) Provide guidance and retry, 3) Abandon
446
803
 
447
- ## 13. Present Final Status
804
+ ## 13. Requirements Coverage Gate
805
+
806
+ After plans pass the checker (or checker is skipped), verify that all phase requirements are covered by at least one plan.
807
+
808
+ **Skip if:** `phase_req_ids` is null or TBD (no requirements mapped to this phase).
809
+
810
+ **Step 1: Extract requirement IDs claimed by plans**
811
+ ```bash
812
+ # Collect all requirement IDs from plan frontmatter
813
+ PLAN_REQS=$(grep -h "requirements_addressed\|requirements:" ${PHASE_DIR}/*-PLAN.md 2>/dev/null | tr -d '[]' | tr ',' '\n' | sed 's/^[[:space:]]*//' | sort -u)
814
+ ```
815
+
816
+ **Step 2: Compare against phase requirements from ROADMAP**
817
+
818
+ For each REQ-ID in `phase_req_ids`:
819
+ - If REQ-ID appears in `PLAN_REQS` → covered ✓
820
+ - If REQ-ID does NOT appear in any plan → uncovered ✗
821
+
822
+ **Step 3: Check CONTEXT.md features against plan objectives**
823
+
824
+ read CONTEXT.md `<decisions>` section. Extract feature/capability names. Check each against plan `<objective>` blocks. Features not mentioned in any plan objective → potentially dropped.
825
+
826
+ **Step 4: Report**
827
+
828
+ If all requirements covered and no dropped features:
829
+ ```
830
+ ✓ Requirements coverage: {N}/{N} REQ-IDs covered by plans
831
+ ```
832
+ → Proceed to step 14.
833
+
834
+ If gaps found:
835
+ ```
836
+ ## ⚠ Requirements Coverage Gap
837
+
838
+ {M} of {N} phase requirements are not assigned to any plan:
839
+
840
+ | REQ-ID | Description | Plans |
841
+ |--------|-------------|-------|
842
+ | {id} | {from REQUIREMENTS.md} | None |
843
+
844
+ {K} CONTEXT.md features not found in plan objectives:
845
+ - {feature_name} — described in CONTEXT.md but no plan covers it
846
+
847
+ Options:
848
+ 1. Re-plan to include missing requirements (recommended)
849
+ 2. Move uncovered requirements to next phase
850
+ 3. Proceed anyway — accept coverage gaps
851
+ ```
852
+
853
+ If `TEXT_MODE` is true, present as a plain-text numbered list (options already shown in the block above). Otherwise use question to present the options.
854
+
855
+ ## 13b. Record Planning Completion in STATE.md
856
+
857
+ After plans pass all gates, record that planning is complete so STATE.md reflects the new phase status:
858
+
859
+ ```bash
860
+ node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" state planned-phase --phase "${PHASE_NUMBER}" --name "${PHASE_NAME}" --plans "${PLAN_COUNT}"
861
+ ```
862
+
863
+ This updates STATUS to "Ready to execute", sets the correct plan count, and timestamps Last Activity.
864
+
865
+ ## 14. Present Final Status
448
866
 
449
867
  Route to `<offer_next>` OR `auto_advance` depending on flags/config.
450
868
 
451
- ## 14. Auto-Advance Check
869
+ ## 15. Auto-Advance Check
452
870
 
453
871
  Check for auto-advance trigger:
454
872
 
455
- 1. Parse `--auto` flag from $ARGUMENTS
456
- 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):
873
+ 1. Parse `--auto` and `--chain` flags from $ARGUMENTS
874
+ 2. **Sync chain flag with intent** — if user invoked manually (no `--auto` and no `--chain`), clear the ephemeral chain flag from any previous interrupted `--auto` chain. This does NOT touch `workflow.auto_advance` (the user's persistent settings preference):
457
875
  ```bash
458
- if [[ ! "$ARGUMENTS" =~ --auto ]]; then
876
+ if [[ ! "$ARGUMENTS" =~ --auto ]] && [[ ! "$ARGUMENTS" =~ --chain ]]; then
459
877
  node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active false 2>/dev/null
460
878
  fi
461
879
  ```
@@ -465,7 +883,14 @@ Check for auto-advance trigger:
465
883
  AUTO_CFG=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
466
884
  ```
467
885
 
468
- **If `--auto` flag present OR `AUTO_CHAIN` is true OR `AUTO_CFG` is true:**
886
+ **If `--auto` or `--chain` flag present AND `AUTO_CHAIN` is not true:** Persist chain flag to config (handles direct invocation without prior discuss-phase):
887
+ ```bash
888
+ if ([[ "$ARGUMENTS" =~ --auto ]] || [[ "$ARGUMENTS" =~ --chain ]]) && [[ "$AUTO_CHAIN" != "true" ]]; then
889
+ node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active true
890
+ fi
891
+ ```
892
+
893
+ **If `--auto` or `--chain` flag present OR `AUTO_CHAIN` is true OR `AUTO_CFG` is true:**
469
894
 
470
895
  Display banner:
471
896
  ```
@@ -478,7 +903,7 @@ Plans ready. Launching execute-phase...
478
903
 
479
904
  Launch execute-phase using the skill tool to avoid nested task sessions (which cause runtime freezes due to deep agent nesting):
480
905
  ```
481
- skill(skill="gsd-execute-phase", args="${PHASE} --auto --no-transition")
906
+ skill(skill="gsd-execute-phase", args="${PHASE} --auto --no-transition ${GSD_WS}")
482
907
  ```
483
908
 
484
909
  The `--no-transition` flag tells execute-phase to return status after verification instead of chaining further. This keeps the auto-advance chain flat — each phase runs at the same nesting level rather than spawning deeper task agents.
@@ -492,14 +917,14 @@ The `--no-transition` flag tells execute-phase to return status after verificati
492
917
 
493
918
  Auto-advance pipeline finished.
494
919
 
495
- Next: /gsd-discuss-phase ${NEXT_PHASE} --auto
920
+ Next: /gsd-discuss-phase ${NEXT_PHASE} --auto ${GSD_WS}
496
921
  ```
497
922
  - **GAPS FOUND / VERIFICATION FAILED** → Display result, stop chain:
498
923
  ```
499
924
  Auto-advance stopped: Execution needs review.
500
925
 
501
926
  Review the output above and continue manually:
502
- /gsd-execute-phase ${PHASE}
927
+ /gsd-execute-phase ${PHASE} ${GSD_WS}
503
928
  ```
504
929
 
505
930
  **If neither `--auto` nor config enabled:**
@@ -530,19 +955,45 @@ Verification: {Passed | Passed with override | Skipped}
530
955
 
531
956
  **Execute Phase {X}** — run all {N} plans
532
957
 
533
- /gsd-execute-phase {X}
958
+ /new then:
534
959
 
535
- */new first → fresh context window*
960
+ /gsd-execute-phase {X} ${GSD_WS}
536
961
 
537
962
  ───────────────────────────────────────────────────────────────
538
963
 
539
964
  **Also available:**
540
965
  - cat .planning/phases/{phase-dir}/*-PLAN.md — review plans
541
966
  - /gsd-plan-phase {X} --research — re-research first
967
+ - /gsd-review --phase {X} --all — peer review plans with external AIs
968
+ - /gsd-plan-phase {X} --reviews — replan incorporating review feedback
542
969
 
543
970
  ───────────────────────────────────────────────────────────────
544
971
  </offer_next>
545
972
 
973
+ <windows_troubleshooting>
974
+ **Windows users:** If plan-phase freezes during agent spawning (common on Windows due to
975
+ stdio deadlocks with MCP servers — see OpenCode issue anthropics/OpenCode-code#28126):
976
+
977
+ 1. **Force-kill:** Close the terminal (Ctrl+C may not work)
978
+ 2. **Clean up orphaned processes:**
979
+ ```powershell
980
+ # Kill orphaned node processes from stale MCP servers
981
+ Get-Process node -ErrorAction SilentlyContinue | Where-Object {$_.StartTime -lt (Get-Date).AddHours(-1)} | Stop-Process -Force
982
+ ```
983
+ 3. **Clean up stale task directories:**
984
+ ```powershell
985
+ # Remove stale subagent task dirs (OpenCode never cleans these on crash)
986
+ Remove-Item -Recurse -Force "$env:USERPROFILE\.OpenCode\tasks\*" -ErrorAction SilentlyContinue
987
+ ```
988
+ 4. **Reduce MCP server count:** Temporarily disable non-essential MCP servers in settings.json
989
+ 5. **Retry:** Restart OpenCode and run `/gsd-plan-phase` again
990
+
991
+ If freezes persist, try `--skip-research` to reduce the agent chain from 3 to 2 agents:
992
+ ```
993
+ /gsd-plan-phase N --skip-research
994
+ ```
995
+ </windows_troubleshooting>
996
+
546
997
  <success_criteria>
547
998
  - [ ] .planning/ directory validated
548
999
  - [ ] Phase validated against roadmap