gsd-opencode 1.30.0 → 1.33.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 (113) hide show
  1. package/agents/gsd-debugger.md +0 -1
  2. package/agents/gsd-doc-verifier.md +207 -0
  3. package/agents/gsd-doc-writer.md +608 -0
  4. package/agents/gsd-executor.md +22 -1
  5. package/agents/gsd-phase-researcher.md +41 -0
  6. package/agents/gsd-plan-checker.md +82 -0
  7. package/agents/gsd-planner.md +123 -194
  8. package/agents/gsd-security-auditor.md +129 -0
  9. package/agents/gsd-ui-auditor.md +40 -0
  10. package/agents/gsd-user-profiler.md +2 -2
  11. package/agents/gsd-verifier.md +84 -18
  12. package/commands/gsd/gsd-add-backlog.md +1 -1
  13. package/commands/gsd/gsd-analyze-dependencies.md +34 -0
  14. package/commands/gsd/gsd-autonomous.md +6 -2
  15. package/commands/gsd/gsd-cleanup.md +5 -0
  16. package/commands/gsd/gsd-debug.md +24 -21
  17. package/commands/gsd/gsd-discuss-phase.md +7 -2
  18. package/commands/gsd/gsd-docs-update.md +48 -0
  19. package/commands/gsd/gsd-execute-phase.md +4 -0
  20. package/commands/gsd/gsd-help.md +2 -0
  21. package/commands/gsd/gsd-join-discord.md +2 -1
  22. package/commands/gsd/gsd-manager.md +1 -0
  23. package/commands/gsd/gsd-new-project.md +4 -0
  24. package/commands/gsd/gsd-plan-phase.md +5 -0
  25. package/commands/gsd/gsd-quick.md +5 -3
  26. package/commands/gsd/gsd-reapply-patches.md +171 -39
  27. package/commands/gsd/gsd-research-phase.md +2 -12
  28. package/commands/gsd/gsd-review-backlog.md +1 -0
  29. package/commands/gsd/gsd-review.md +3 -2
  30. package/commands/gsd/gsd-secure-phase.md +35 -0
  31. package/commands/gsd/gsd-set-profile.md +0 -1
  32. package/commands/gsd/gsd-thread.md +1 -1
  33. package/commands/gsd/gsd-workstreams.md +7 -2
  34. package/get-shit-done/bin/gsd-tools.cjs +42 -8
  35. package/get-shit-done/bin/lib/commands.cjs +68 -14
  36. package/get-shit-done/bin/lib/config.cjs +18 -10
  37. package/get-shit-done/bin/lib/core.cjs +383 -80
  38. package/get-shit-done/bin/lib/docs.cjs +267 -0
  39. package/get-shit-done/bin/lib/frontmatter.cjs +47 -2
  40. package/get-shit-done/bin/lib/init.cjs +85 -5
  41. package/get-shit-done/bin/lib/milestone.cjs +21 -0
  42. package/get-shit-done/bin/lib/model-profiles.cjs +2 -0
  43. package/get-shit-done/bin/lib/phase.cjs +232 -189
  44. package/get-shit-done/bin/lib/profile-output.cjs +97 -1
  45. package/get-shit-done/bin/lib/roadmap.cjs +137 -113
  46. package/get-shit-done/bin/lib/schema-detect.cjs +238 -0
  47. package/get-shit-done/bin/lib/security.cjs +5 -3
  48. package/get-shit-done/bin/lib/state.cjs +366 -44
  49. package/get-shit-done/bin/lib/verify.cjs +158 -14
  50. package/get-shit-done/bin/lib/workstream.cjs +6 -2
  51. package/get-shit-done/references/agent-contracts.md +79 -0
  52. package/get-shit-done/references/artifact-types.md +113 -0
  53. package/get-shit-done/references/context-budget.md +49 -0
  54. package/get-shit-done/references/continuation-format.md +15 -15
  55. package/get-shit-done/references/domain-probes.md +125 -0
  56. package/get-shit-done/references/gate-prompts.md +100 -0
  57. package/get-shit-done/references/model-profiles.md +2 -2
  58. package/get-shit-done/references/planner-gap-closure.md +62 -0
  59. package/get-shit-done/references/planner-reviews.md +39 -0
  60. package/get-shit-done/references/planner-revision.md +87 -0
  61. package/get-shit-done/references/planning-config.md +15 -0
  62. package/get-shit-done/references/revision-loop.md +97 -0
  63. package/get-shit-done/references/ui-brand.md +2 -2
  64. package/get-shit-done/references/universal-anti-patterns.md +58 -0
  65. package/get-shit-done/references/workstream-flag.md +56 -3
  66. package/get-shit-done/templates/SECURITY.md +61 -0
  67. package/get-shit-done/templates/VALIDATION.md +3 -3
  68. package/get-shit-done/templates/claude-md.md +27 -4
  69. package/get-shit-done/templates/config.json +4 -0
  70. package/get-shit-done/templates/debug-subagent-prompt.md +2 -6
  71. package/get-shit-done/templates/planner-subagent-prompt.md +2 -10
  72. package/get-shit-done/workflows/add-phase.md +2 -2
  73. package/get-shit-done/workflows/add-todo.md +1 -1
  74. package/get-shit-done/workflows/analyze-dependencies.md +96 -0
  75. package/get-shit-done/workflows/audit-milestone.md +8 -12
  76. package/get-shit-done/workflows/autonomous.md +158 -13
  77. package/get-shit-done/workflows/check-todos.md +2 -2
  78. package/get-shit-done/workflows/complete-milestone.md +13 -4
  79. package/get-shit-done/workflows/diagnose-issues.md +8 -6
  80. package/get-shit-done/workflows/discovery-phase.md +1 -1
  81. package/get-shit-done/workflows/discuss-phase-assumptions.md +24 -6
  82. package/get-shit-done/workflows/discuss-phase-power.md +291 -0
  83. package/get-shit-done/workflows/discuss-phase.md +153 -20
  84. package/get-shit-done/workflows/docs-update.md +1093 -0
  85. package/get-shit-done/workflows/execute-phase.md +362 -66
  86. package/get-shit-done/workflows/execute-plan.md +1 -1
  87. package/get-shit-done/workflows/help.md +9 -6
  88. package/get-shit-done/workflows/insert-phase.md +2 -2
  89. package/get-shit-done/workflows/manager.md +27 -26
  90. package/get-shit-done/workflows/map-codebase.md +10 -32
  91. package/get-shit-done/workflows/new-milestone.md +14 -8
  92. package/get-shit-done/workflows/new-project.md +48 -25
  93. package/get-shit-done/workflows/next.md +1 -1
  94. package/get-shit-done/workflows/note.md +1 -1
  95. package/get-shit-done/workflows/pause-work.md +73 -10
  96. package/get-shit-done/workflows/plan-milestone-gaps.md +2 -2
  97. package/get-shit-done/workflows/plan-phase.md +184 -32
  98. package/get-shit-done/workflows/progress.md +20 -20
  99. package/get-shit-done/workflows/quick.md +102 -84
  100. package/get-shit-done/workflows/research-phase.md +2 -6
  101. package/get-shit-done/workflows/resume-project.md +4 -4
  102. package/get-shit-done/workflows/review.md +56 -3
  103. package/get-shit-done/workflows/secure-phase.md +154 -0
  104. package/get-shit-done/workflows/settings.md +13 -2
  105. package/get-shit-done/workflows/ship.md +13 -4
  106. package/get-shit-done/workflows/transition.md +6 -6
  107. package/get-shit-done/workflows/ui-phase.md +4 -14
  108. package/get-shit-done/workflows/ui-review.md +25 -7
  109. package/get-shit-done/workflows/update.md +165 -16
  110. package/get-shit-done/workflows/validate-phase.md +1 -11
  111. package/get-shit-done/workflows/verify-phase.md +127 -6
  112. package/get-shit-done/workflows/verify-work.md +69 -21
  113. package/package.json +1 -1
@@ -9,14 +9,28 @@ read all files referenced by the invoking prompt's execution_context before star
9
9
  <process>
10
10
 
11
11
  <step name="detect">
12
- Find current phase directory from most recently modified files:
12
+ ## Context Detection
13
+
14
+ Determine what kind of work is being paused and set the handoff destination accordingly:
13
15
 
14
16
  ```bash
15
- # Find most recent phase directory with work
16
- (ls -lt .planning/phases/*/PLAN.md 2>/dev/null || true) | head -1 | grep -oP 'phases/\K[^/]+' || true
17
+ # Check for active phase
18
+ phase=$(( ls -lt .planning/phases/*/PLAN.md 2>/dev/null || true ) | head -1 | grep -oP 'phases/\K[^/]+' || true)
19
+
20
+ # Check for active spike
21
+ spike=$(( ls -lt .planning/spikes/*/SPIKE.md .planning/spikes/*/DESIGN.md 2>/dev/null || true ) | head -1 | grep -oP 'spikes/\K[^/]+' || true)
22
+
23
+ # Check for active deliberation
24
+ deliberation=$(ls .planning/deliberations/*.md 2>/dev/null | head -1 || true)
17
25
  ```
18
26
 
19
- If no active phase detected, ask user which phase they're pausing work on.
27
+ - **Phase work**: active phase directory handoff to `.planning/phases/XX-name/.continue-here.md`
28
+ - **Spike work**: active spike directory or spike-related files (no active phase) → handoff to `.planning/spikes/SPIKE-NNN/.continue-here.md` (create directory if needed)
29
+ - **Deliberation work**: active deliberation file (no phase/spike) → handoff to `.planning/deliberations/.continue-here.md`
30
+ - **Research work**: research notes exist but no phase/spike/deliberation → handoff to `.planning/.continue-here.md`
31
+ - **Default**: no detectable context → handoff to `.planning/.continue-here.md`, note the ambiguity in `<current_state>`
32
+
33
+ If phase is detected, proceed with phase handoff path. Otherwise use the first matching non-phase path above.
20
34
  </step>
21
35
 
22
36
  <step name="gather">
@@ -30,6 +44,9 @@ If no active phase detected, ask user which phase they're pausing work on.
30
44
  6. **Human actions pending**: Things that need manual intervention (MCP setup, API keys, approvals, manual testing)
31
45
  7. **Background processes**: Any running servers/watchers that were part of the workflow
32
46
  8. **Files modified**: What's changed but not committed
47
+ 9. **Blocking constraints**: Anti-patterns or methodological failures encountered during this session that a resuming agent MUST be aware of before proceeding. Only include items discovered through actual failure — not warnings or predictions. Assign each constraint a `severity`:
48
+ - `blocking` — The resuming agent MUST demonstrate understanding before proceeding. The discuss-phase and execute-phase workflows will enforce a mandatory understanding check.
49
+ - `advisory` — Important context but does not gate resumption.
33
50
 
34
51
  Ask user for clarifications if needed via conversational questions.
35
52
 
@@ -85,10 +102,11 @@ timestamp=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" curren
85
102
  </step>
86
103
 
87
104
  <step name="write">
88
- **write handoff to `.planning/phases/XX-name/.continue-here.md`:**
105
+ **write handoff to the path determined in the detect step** (e.g. `.planning/phases/XX-name/.continue-here.md`, `.planning/spikes/SPIKE-NNN/.continue-here.md`, or `.planning/.continue-here.md`):
89
106
 
90
107
  ```markdown
91
108
  ---
109
+ context: [phase|spike|deliberation|research|default]
92
110
  phase: XX-name
93
111
  task: 3
94
112
  total_tasks: 7
@@ -96,12 +114,35 @@ status: in_progress
96
114
  last_updated: [timestamp from current-timestamp]
97
115
  ---
98
116
 
117
+ # BLOCKING CONSTRAINTS — read Before Anything Else
118
+
119
+ > These are not suggestions. Each constraint below was discovered through failure.
120
+ > Acknowledge each one explicitly before proceeding.
121
+
122
+ - [ ] CONSTRAINT: [name] — [what it is] — [structural mitigation required]
123
+
124
+ **Do not proceed until all boxes are checked.**
125
+
126
+ _If no constraints have been identified yet, remove this section._
127
+
128
+ ## Critical Anti-Patterns
129
+
130
+ | Pattern | Description | Severity | Prevention Mechanism |
131
+ |---------|-------------|----------|---------------------|
132
+ | [pattern name] | [what it is and how it manifested] | blocking | [structural step that prevents recurrence — not acknowledgment] |
133
+ | [pattern name] | [what it is and how it manifested] | advisory | [guidance for avoiding it] |
134
+
135
+ **Severity values:** `blocking` — resuming agent must pass understanding check before proceeding. `advisory` — important context, does not gate resumption.
136
+
137
+ _Remove rows that do not apply. The discuss-phase and execute-phase workflows parse this table and enforce a mandatory understanding check for any `blocking` rows._
138
+
99
139
  <current_state>
100
140
  [Where exactly are we? Immediate context]
101
141
  </current_state>
102
142
 
103
143
  <completed_work>
104
144
 
145
+ Completed Tasks:
105
146
  - task 1: [name] - Done
106
147
  - task 2: [name] - Done
107
148
  - task 3: [name] - In progress, [what's done]
@@ -124,6 +165,25 @@ last_updated: [timestamp from current-timestamp]
124
165
  - [Blocker 1]: [status/workaround]
125
166
  </blockers>
126
167
 
168
+ ## Required Reading (in order)
169
+ <!-- List documents the resuming agent must read before acting -->
170
+ 1. [document] — [why it matters]
171
+ 1. `.planning/METHODOLOGY.md` (if it exists) — project analytical lenses; apply before any assumption analysis
172
+
173
+ ## Critical Anti-Patterns (do NOT repeat these)
174
+ <!-- Mistakes discovered this session that must be structurally avoided -->
175
+ - [ANTI-PATTERN]: [what it is] → [structural mitigation]
176
+
177
+ ## Infrastructure State
178
+ <!-- Running services, external state, environment specifics -->
179
+ - [service/env]: [current state]
180
+
181
+ ## Pre-Execution Critique Required
182
+ <!-- Fill in ONLY if pausing between design and execution (e.g. spike design done, not yet run) -->
183
+ - Design artifact: [path]
184
+ - Critique focus: [key questions the critic should probe]
185
+ - Gate: Do NOT begin execution until critique is complete and design is revised
186
+
127
187
  <context>
128
188
  [Mental state, what were you thinking, the plan]
129
189
  </context>
@@ -143,7 +203,7 @@ timestamp=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" curren
143
203
 
144
204
  <step name="commit">
145
205
  ```bash
146
- node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" commit "wip: [phase-name] paused at task [X]/[Y]" --files .planning/phases/*/.continue-here.md .planning/HANDOFF.json
206
+ node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" commit "wip: [context-name] paused at [X]/[Y]" --files [handoff-path] .planning/HANDOFF.json
147
207
  ```
148
208
  </step>
149
209
 
@@ -151,11 +211,12 @@ node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" commit "wip: [phas
151
211
  ```
152
212
  ✓ Handoff created:
153
213
  - .planning/HANDOFF.json (structured, machine-readable)
154
- - .planning/phases/[XX-name]/.continue-here.md (human-readable)
214
+ - [handoff-path] (human-readable)
155
215
 
156
216
  Current state:
157
217
 
158
- - Phase: [XX-name]
218
+ - Context: [phase|spike|deliberation|research]
219
+ - Location: [XX-name or SPIKE-NNN]
159
220
  - task: [X] of [Y]
160
221
  - Status: [in_progress/blocked]
161
222
  - Blockers: [count] ({human_actions_pending count} need human action)
@@ -169,8 +230,10 @@ To resume: /gsd-resume-work
169
230
  </process>
170
231
 
171
232
  <success_criteria>
172
- - [ ] .continue-here.md created in correct phase directory
173
- - [ ] All sections filled with specific content
233
+ - [ ] Context detected (phase/spike/deliberation/research/default)
234
+ - [ ] .continue-here.md created at correct path for detected context
235
+ - [ ] Required Reading, Anti-Patterns, and Infrastructure State sections filled
236
+ - [ ] Pre-Execution Critique section filled if pausing between design and execution
174
237
  - [ ] Committed as WIP
175
238
  - [ ] User knows location and how to resume
176
239
  </success_criteria>
@@ -163,9 +163,9 @@ node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" commit "docs(roadm
163
163
 
164
164
  **Plan first gap closure phase**
165
165
 
166
- `/gsd-plan-phase {N}`
166
+ `/new` then:
167
167
 
168
- *`/new` first → fresh context window*
168
+ `/gsd-plan-phase {N}`
169
169
 
170
170
  ---
171
171
 
@@ -6,6 +6,9 @@ Create executable phase prompts (PLAN.md files) for a roadmap phase with integra
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
 
11
14
  <available_agent_types>
@@ -27,9 +30,14 @@ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
27
30
  AGENT_SKILLS_RESEARCHER=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-researcher 2>/dev/null)
28
31
  AGENT_SKILLS_PLANNER=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-planner 2>/dev/null)
29
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")
30
34
  ```
31
35
 
32
- 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`.
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).
37
+
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.
33
41
 
34
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.
35
43
 
@@ -317,12 +325,7 @@ write to: {phase_dir}/{phase_num}-RESEARCH.md
317
325
  ```
318
326
 
319
327
  ```
320
- task(
321
- prompt=research_prompt,
322
- subagent_type="gsd-phase-researcher",
323
- model="{researcher_model}",
324
- description="Research Phase {phase}"
325
- )
328
+ @gsd-phase-researcher research_prompt
326
329
  ```
327
330
 
328
331
  ### Handle Researcher Return
@@ -360,6 +363,32 @@ test -f "${PHASE_DIR}/${PADDED_PHASE}-VALIDATION.md" && echo "VALIDATION_CREATED
360
363
 
361
364
  **If not found:** Warn and continue — plans may fail Dimension 8.
362
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
+
363
392
  ## 5.6. UI Design Contract Gate
364
393
 
365
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.
@@ -390,6 +419,26 @@ UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1)
390
419
 
391
420
  **If UI-SPEC.md missing AND `UI_GATE_CFG` is `true`:**
392
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
+
393
442
  If `TEXT_MODE` is true, present as a plain-text numbered list:
394
443
  ```
395
444
  Phase {N} has frontend indicators but no UI-SPEC.md. Generate a design contract before planning?
@@ -409,7 +458,69 @@ Otherwise use question:
409
458
  - "Continue without UI-SPEC" → Continue to step 6.
410
459
  - "Not a frontend phase" → Continue to step 6.
411
460
 
412
- **If `HAS_UI` is 1 (no frontend indicators):** Skip silently to step 6.
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.
413
524
 
414
525
  ## 6. Check Existing Plans
415
526
 
@@ -488,6 +599,11 @@ Planner prompt:
488
599
  - {uat_path} (UAT Gaps - if --gaps)
489
600
  - {reviews_path} (Cross-AI Review Feedback - if --reviews)
490
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
+ ` : ''}
491
607
  </files_to_read>
492
608
 
493
609
  ${AGENT_SKILLS_PLANNER}
@@ -496,6 +612,7 @@ ${AGENT_SKILLS_PLANNER}
496
612
 
497
613
  **Project instructions:** read ./AGENTS.md if exists — follow project-specific guidelines
498
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
+
499
616
  </planning_context>
500
617
 
501
618
  <downstream_consumer>
@@ -549,20 +666,48 @@ Every task MUST include these fields — they are NOT optional:
549
666
  ```
550
667
 
551
668
  ```
552
- task(
553
- prompt=filled_prompt,
554
- subagent_type="gsd-planner",
555
- model="{planner_model}",
556
- description="Plan Phase {phase}"
557
- )
669
+ @gsd-planner filled_prompt
558
670
  ```
559
671
 
560
672
  ## 9. Handle Planner Return
561
673
 
562
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.
563
676
  - **`## CHECKPOINT REACHED`:** Present to user, get response, spawn continuation (step 12)
564
677
  - **`## PLANNING INCONCLUSIVE`:** Show attempts, offer: Add context / Retry / Manual
565
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
+
566
711
  ## 10. Spawn gsd-plan-checker Agent
567
712
 
568
713
  Display banner:
@@ -604,12 +749,7 @@ ${AGENT_SKILLS_CHECKER}
604
749
  ```
605
750
 
606
751
  ```
607
- task(
608
- prompt=checker_prompt,
609
- subagent_type="gsd-plan-checker",
610
- model="{checker_model}",
611
- description="Verify Phase {phase} plans"
612
- )
752
+ @gsd-plan-checker checker_prompt
613
753
  ```
614
754
 
615
755
  ## 11. Handle Checker Return
@@ -650,12 +790,7 @@ Return what changed.
650
790
  ```
651
791
 
652
792
  ```
653
- task(
654
- prompt=revision_prompt,
655
- subagent_type="gsd-planner",
656
- model="{planner_model}",
657
- description="Revise Phase {phase} plans"
658
- )
793
+ @gsd-planner revision_prompt
659
794
  ```
660
795
 
661
796
  After planner returns -> spawn checker again (step 10), increment iteration_count.
@@ -717,6 +852,16 @@ Options:
717
852
 
718
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.
719
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
+
720
865
  ## 14. Present Final Status
721
866
 
722
867
  Route to `<offer_next>` OR `auto_advance` depending on flags/config.
@@ -725,10 +870,10 @@ Route to `<offer_next>` OR `auto_advance` depending on flags/config.
725
870
 
726
871
  Check for auto-advance trigger:
727
872
 
728
- 1. Parse `--auto` flag from $ARGUMENTS
729
- 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):
730
875
  ```bash
731
- if [[ ! "$ARGUMENTS" =~ --auto ]]; then
876
+ if [[ ! "$ARGUMENTS" =~ --auto ]] && [[ ! "$ARGUMENTS" =~ --chain ]]; then
732
877
  node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active false 2>/dev/null
733
878
  fi
734
879
  ```
@@ -738,7 +883,14 @@ Check for auto-advance trigger:
738
883
  AUTO_CFG=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false")
739
884
  ```
740
885
 
741
- **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:**
742
894
 
743
895
  Display banner:
744
896
  ```
@@ -803,9 +955,9 @@ Verification: {Passed | Passed with override | Skipped}
803
955
 
804
956
  **Execute Phase {X}** — run all {N} plans
805
957
 
806
- /gsd-execute-phase {X} ${GSD_WS}
958
+ /new then:
807
959
 
808
- */new first → fresh context window*
960
+ /gsd-execute-phase {X} ${GSD_WS}
809
961
 
810
962
  ───────────────────────────────────────────────────────────────
811
963
 
@@ -215,9 +215,9 @@ read its `<objective>` section.
215
215
 
216
216
  **{phase}-{plan}: [Plan Name]** — [objective summary from PLAN.md]
217
217
 
218
- `/gsd-execute-phase {phase} ${GSD_WS}`
218
+ `/new` then:
219
219
 
220
- *`/new` first → fresh context window*
220
+ `/gsd-execute-phase {phase} ${GSD_WS}`
221
221
 
222
222
  ---
223
223
  ```
@@ -245,9 +245,9 @@ PHASE_HAS_UI=$(echo "$PHASE_SECTION" | grep -qi "UI hint.*yes" && echo "true" ||
245
245
  **Phase {N}: {Name}** — {Goal from ROADMAP.md}
246
246
  *✓ Context gathered, ready to plan*
247
247
 
248
- `/gsd-plan-phase {phase-number} ${GSD_WS}`
248
+ `/new` then:
249
249
 
250
- *`/new` first → fresh context window*
250
+ `/gsd-plan-phase {phase-number} ${GSD_WS}`
251
251
 
252
252
  ---
253
253
  ```
@@ -261,9 +261,9 @@ PHASE_HAS_UI=$(echo "$PHASE_SECTION" | grep -qi "UI hint.*yes" && echo "true" ||
261
261
 
262
262
  **Phase {N}: {Name}** — {Goal from ROADMAP.md}
263
263
 
264
- `/gsd-discuss-phase {phase}` — gather context and clarify approach
264
+ `/new` then:
265
265
 
266
- *`/new` first fresh context window*
266
+ `/gsd-discuss-phase {phase}` gather context and clarify approach
267
267
 
268
268
  ---
269
269
 
@@ -284,9 +284,9 @@ PHASE_HAS_UI=$(echo "$PHASE_SECTION" | grep -qi "UI hint.*yes" && echo "true" ||
284
284
 
285
285
  **Phase {N}: {Name}** — {Goal from ROADMAP.md}
286
286
 
287
- `/gsd-discuss-phase {phase} ${GSD_WS}` — gather context and clarify approach
287
+ `/new` then:
288
288
 
289
- *`/new` first fresh context window*
289
+ `/gsd-discuss-phase {phase} ${GSD_WS}` gather context and clarify approach
290
290
 
291
291
  ---
292
292
 
@@ -310,9 +310,9 @@ UAT.md exists with gaps (diagnosed issues). User needs to plan fixes.
310
310
 
311
311
  **{phase_num}-UAT.md** has {N} gaps requiring fixes.
312
312
 
313
- `/gsd-plan-phase {phase} --gaps ${GSD_WS}`
313
+ `/new` then:
314
314
 
315
- *`/new` first fresh context window*
315
+ `/gsd-plan-phase {phase} --gaps ${GSD_WS}`
316
316
 
317
317
  ---
318
318
 
@@ -336,9 +336,9 @@ UAT.md exists with `status: partial` — testing session ended before all items
336
336
 
337
337
  **{phase_num}-UAT.md** has {N} unresolved tests (pending, blocked, or skipped).
338
338
 
339
- `/gsd-verify-work {phase} ${GSD_WS}` — resume testing from where you left off
339
+ `/new` then:
340
340
 
341
- *`/new` first fresh context window*
341
+ `/gsd-verify-work {phase} ${GSD_WS}` resume testing from where you left off
342
342
 
343
343
  ---
344
344
 
@@ -392,9 +392,9 @@ NEXT_HAS_UI=$(echo "$NEXT_PHASE_SECTION" | grep -qi "UI hint.*yes" && echo "true
392
392
 
393
393
  **Phase {Z+1}: {Name}** — {Goal from ROADMAP.md}
394
394
 
395
- `/gsd-discuss-phase {Z+1}` — gather context and clarify approach
395
+ `/new` then:
396
396
 
397
- *`/new` first fresh context window*
397
+ `/gsd-discuss-phase {Z+1}` gather context and clarify approach
398
398
 
399
399
  ---
400
400
 
@@ -417,9 +417,9 @@ NEXT_HAS_UI=$(echo "$NEXT_PHASE_SECTION" | grep -qi "UI hint.*yes" && echo "true
417
417
 
418
418
  **Phase {Z+1}: {Name}** — {Goal from ROADMAP.md}
419
419
 
420
- `/gsd-discuss-phase {Z+1} ${GSD_WS}` — gather context and clarify approach
420
+ `/new` then:
421
421
 
422
- *`/new` first fresh context window*
422
+ `/gsd-discuss-phase {Z+1} ${GSD_WS}` gather context and clarify approach
423
423
 
424
424
  ---
425
425
 
@@ -445,9 +445,9 @@ All {N} phases finished!
445
445
 
446
446
  **Complete Milestone** — archive and prepare for next
447
447
 
448
- `/gsd-complete-milestone ${GSD_WS}`
448
+ `/new` then:
449
449
 
450
- *`/new` first → fresh context window*
450
+ `/gsd-complete-milestone ${GSD_WS}`
451
451
 
452
452
  ---
453
453
 
@@ -476,9 +476,9 @@ Ready to plan the next milestone.
476
476
 
477
477
  **Start Next Milestone** — questioning → research → requirements → roadmap
478
478
 
479
- `/gsd-new-milestone ${GSD_WS}`
479
+ `/new` then:
480
480
 
481
- *`/new` first → fresh context window*
481
+ `/gsd-new-milestone ${GSD_WS}`
482
482
 
483
483
  ---
484
484
  ```