gsd-opencode 1.30.0 → 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 (112) 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-thread.md +1 -1
  32. package/commands/gsd/gsd-workstreams.md +7 -2
  33. package/get-shit-done/bin/gsd-tools.cjs +42 -8
  34. package/get-shit-done/bin/lib/commands.cjs +68 -14
  35. package/get-shit-done/bin/lib/config.cjs +18 -10
  36. package/get-shit-done/bin/lib/core.cjs +383 -80
  37. package/get-shit-done/bin/lib/docs.cjs +267 -0
  38. package/get-shit-done/bin/lib/frontmatter.cjs +47 -2
  39. package/get-shit-done/bin/lib/init.cjs +85 -5
  40. package/get-shit-done/bin/lib/milestone.cjs +21 -0
  41. package/get-shit-done/bin/lib/model-profiles.cjs +2 -0
  42. package/get-shit-done/bin/lib/phase.cjs +232 -189
  43. package/get-shit-done/bin/lib/profile-output.cjs +97 -1
  44. package/get-shit-done/bin/lib/roadmap.cjs +137 -113
  45. package/get-shit-done/bin/lib/schema-detect.cjs +238 -0
  46. package/get-shit-done/bin/lib/security.cjs +5 -3
  47. package/get-shit-done/bin/lib/state.cjs +366 -44
  48. package/get-shit-done/bin/lib/verify.cjs +158 -14
  49. package/get-shit-done/bin/lib/workstream.cjs +6 -2
  50. package/get-shit-done/references/agent-contracts.md +79 -0
  51. package/get-shit-done/references/artifact-types.md +113 -0
  52. package/get-shit-done/references/context-budget.md +49 -0
  53. package/get-shit-done/references/continuation-format.md +15 -15
  54. package/get-shit-done/references/domain-probes.md +125 -0
  55. package/get-shit-done/references/gate-prompts.md +100 -0
  56. package/get-shit-done/references/model-profiles.md +2 -2
  57. package/get-shit-done/references/planner-gap-closure.md +62 -0
  58. package/get-shit-done/references/planner-reviews.md +39 -0
  59. package/get-shit-done/references/planner-revision.md +87 -0
  60. package/get-shit-done/references/planning-config.md +15 -0
  61. package/get-shit-done/references/revision-loop.md +97 -0
  62. package/get-shit-done/references/ui-brand.md +2 -2
  63. package/get-shit-done/references/universal-anti-patterns.md +58 -0
  64. package/get-shit-done/references/workstream-flag.md +56 -3
  65. package/get-shit-done/templates/SECURITY.md +61 -0
  66. package/get-shit-done/templates/VALIDATION.md +3 -3
  67. package/get-shit-done/templates/claude-md.md +27 -4
  68. package/get-shit-done/templates/config.json +4 -0
  69. package/get-shit-done/templates/debug-subagent-prompt.md +2 -6
  70. package/get-shit-done/templates/planner-subagent-prompt.md +2 -10
  71. package/get-shit-done/workflows/add-phase.md +2 -2
  72. package/get-shit-done/workflows/add-todo.md +1 -1
  73. package/get-shit-done/workflows/analyze-dependencies.md +96 -0
  74. package/get-shit-done/workflows/audit-milestone.md +8 -12
  75. package/get-shit-done/workflows/autonomous.md +158 -13
  76. package/get-shit-done/workflows/check-todos.md +2 -2
  77. package/get-shit-done/workflows/complete-milestone.md +13 -4
  78. package/get-shit-done/workflows/diagnose-issues.md +8 -6
  79. package/get-shit-done/workflows/discovery-phase.md +1 -1
  80. package/get-shit-done/workflows/discuss-phase-assumptions.md +22 -4
  81. package/get-shit-done/workflows/discuss-phase-power.md +291 -0
  82. package/get-shit-done/workflows/discuss-phase.md +149 -11
  83. package/get-shit-done/workflows/docs-update.md +1093 -0
  84. package/get-shit-done/workflows/execute-phase.md +362 -66
  85. package/get-shit-done/workflows/execute-plan.md +1 -1
  86. package/get-shit-done/workflows/help.md +9 -6
  87. package/get-shit-done/workflows/insert-phase.md +2 -2
  88. package/get-shit-done/workflows/manager.md +27 -26
  89. package/get-shit-done/workflows/map-codebase.md +10 -32
  90. package/get-shit-done/workflows/new-milestone.md +14 -8
  91. package/get-shit-done/workflows/new-project.md +48 -25
  92. package/get-shit-done/workflows/next.md +1 -1
  93. package/get-shit-done/workflows/note.md +1 -1
  94. package/get-shit-done/workflows/pause-work.md +73 -10
  95. package/get-shit-done/workflows/plan-milestone-gaps.md +2 -2
  96. package/get-shit-done/workflows/plan-phase.md +184 -32
  97. package/get-shit-done/workflows/progress.md +20 -20
  98. package/get-shit-done/workflows/quick.md +102 -84
  99. package/get-shit-done/workflows/research-phase.md +2 -6
  100. package/get-shit-done/workflows/resume-project.md +4 -4
  101. package/get-shit-done/workflows/review.md +56 -3
  102. package/get-shit-done/workflows/secure-phase.md +154 -0
  103. package/get-shit-done/workflows/settings.md +13 -2
  104. package/get-shit-done/workflows/ship.md +13 -4
  105. package/get-shit-done/workflows/transition.md +6 -6
  106. package/get-shit-done/workflows/ui-phase.md +4 -14
  107. package/get-shit-done/workflows/ui-review.md +25 -7
  108. package/get-shit-done/workflows/update.md +165 -16
  109. package/get-shit-done/workflows/validate-phase.md +1 -11
  110. package/get-shit-done/workflows/verify-phase.md +127 -6
  111. package/get-shit-done/workflows/verify-work.md +69 -21
  112. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  <objective>
2
2
 
3
- Drive all remaining milestone phases autonomously. For each incomplete phase: discuss → plan → execute using skill() flat invocations. Pauses only for explicit user decisions (grey area acceptance, blockers, validation requests). Re-reads ROADMAP.md after each phase to catch dynamically inserted phases.
3
+ Drive milestone phases autonomously — all remaining phases, a range via `--from N`/`--to N`, or a single phase via `--only N`. For each incomplete phase: discuss → plan → execute using skill() flat invocations. Pauses only for explicit user decisions (grey area acceptance, blockers, validation requests). Re-reads ROADMAP.md after each phase to catch dynamically inserted phases.
4
4
 
5
5
  </objective>
6
6
 
@@ -16,15 +16,35 @@ read all files referenced by the invoking prompt's execution_context before star
16
16
 
17
17
  ## 1. Initialize
18
18
 
19
- Parse `$ARGUMENTS` for `--from N` flag:
19
+ Parse `$ARGUMENTS` for `--from N`, `--to N`, `--only N`, and `--interactive` flags:
20
20
 
21
21
  ```bash
22
22
  FROM_PHASE=""
23
23
  if echo "$ARGUMENTS" | grep -qE '\-\-from\s+[0-9]'; then
24
24
  FROM_PHASE=$(echo "$ARGUMENTS" | grep -oE '\-\-from\s+[0-9]+\.?[0-9]*' | awk '{print $2}')
25
25
  fi
26
+
27
+ TO_PHASE=""
28
+ if echo "$ARGUMENTS" | grep -qE '\-\-to\s+[0-9]'; then
29
+ TO_PHASE=$(echo "$ARGUMENTS" | grep -oE '\-\-to\s+[0-9]+\.?[0-9]*' | awk '{print $2}')
30
+ fi
31
+
32
+ ONLY_PHASE=""
33
+ if echo "$ARGUMENTS" | grep -qE '\-\-only\s+[0-9]'; then
34
+ ONLY_PHASE=$(echo "$ARGUMENTS" | grep -oE '\-\-only\s+[0-9]+\.?[0-9]*' | awk '{print $2}')
35
+ FROM_PHASE="$ONLY_PHASE"
36
+ fi
37
+
38
+ INTERACTIVE=""
39
+ if echo "$ARGUMENTS" | grep -q '\-\-interactive'; then
40
+ INTERACTIVE="true"
41
+ fi
26
42
  ```
27
43
 
44
+ When `--only` is set, also set `FROM_PHASE` to the same value so existing filter logic applies.
45
+
46
+ When `--interactive` is set, discuss runs inline with questions (not auto-answered), while plan and execute are dispatched as background agents. This keeps the main context lean — only discuss conversations accumulate — while preserving user input on all design decisions.
47
+
28
48
  Bootstrap via milestone-level init:
29
49
 
30
50
  ```bash
@@ -48,7 +68,10 @@ Display startup banner:
48
68
  Phases: {phase_count} total, {completed_phases} complete
49
69
  ```
50
70
 
51
- If `FROM_PHASE` is set, display: `Starting from phase ${FROM_PHASE}`
71
+ If `ONLY_PHASE` is set, display: `Single phase mode: Phase ${ONLY_PHASE}`
72
+ Else if `FROM_PHASE` is set, display: `Starting from phase ${FROM_PHASE}`
73
+ If `TO_PHASE` is set, display: `Stopping after phase ${TO_PHASE}`
74
+ If `INTERACTIVE` is set, display: `Mode: Interactive (discuss inline, plan+execute in background)`
52
75
 
53
76
  </step>
54
77
 
@@ -68,6 +91,26 @@ Parse the JSON `phases` array.
68
91
 
69
92
  **Apply `--from N` filter:** If `FROM_PHASE` was provided, additionally filter out phases where `number < FROM_PHASE` (use numeric comparison — handles decimal phases like "5.1").
70
93
 
94
+ **Apply `--to N` filter:** If `TO_PHASE` was provided, additionally filter out phases where `number > TO_PHASE` (use numeric comparison). This limits execution to phases up through the target phase.
95
+
96
+ **Apply `--only N` filter:** If `ONLY_PHASE` was provided, additionally filter OUT phases where `number != ONLY_PHASE`. This means the phase list will contain exactly one phase (or zero if already complete).
97
+
98
+ **If `TO_PHASE` is set and no phases remain** (all phases up to N are already completed):
99
+
100
+ ```
101
+ All phases through ${TO_PHASE} are already completed. Nothing to do.
102
+ ```
103
+
104
+ Exit cleanly.
105
+
106
+ **If `ONLY_PHASE` is set and no phases remain** (phase already complete):
107
+
108
+ ```
109
+ Phase ${ONLY_PHASE} is already complete. Nothing to do.
110
+ ```
111
+
112
+ Exit cleanly.
113
+
71
114
  **Sort by `number`** in numeric ascending order.
72
115
 
73
116
  **If no incomplete phases remain:**
@@ -117,7 +160,9 @@ For the current phase, display the progress banner:
117
160
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
118
161
  ```
119
162
 
120
- Where N = current phase number (from the ROADMAP, e.g., 6), T = total milestone phases (from `phase_count` parsed in initialize step, e.g., 8), P = percentage of all milestone phases completed so far. Calculate P as: (number of phases with `disk_status` "complete" from the latest `roadmap analyze` / T × 100). Use █ for filled and ░ for empty segments in the progress bar (8 characters wide).
163
+ Where N = current phase number (from the ROADMAP, e.g., 63), T = total milestone phases (from `phase_count` parsed in initialize step, e.g., 67). **Important:** T must be `phase_count` (the total number of phases in this milestone), NOT the count of remaining/incomplete phases. When phases are numbered 61-67, T=7 and the banner should read `Phase 63/7` (phase 63, 7 total in milestone), not `Phase 63/3` (which would confuse 3 remaining with 3 total). P = percentage of all milestone phases completed so far. Calculate P as: (number of phases with `disk_status` "complete" from the latest `roadmap analyze` / T × 100). Use █ for filled and ░ for empty segments in the progress bar (8 characters wide).
164
+
165
+ **Alternative display when phase numbers exceed total** (e.g., multi-milestone projects where phases are numbered globally): If N > T (phase number exceeds milestone phase count), use the format `Phase {N} ({position}/{T})` where `position` is the 1-based index of this phase among incomplete phases being processed. This prevents confusing displays like "Phase 63/5".
121
166
 
122
167
  **3a. Smart Discuss**
123
168
 
@@ -209,15 +254,26 @@ node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" commit "docs(${PAD
209
254
 
210
255
  Proceed to 3b.
211
256
 
212
- **If SKIP_DISCUSS is `false` (or unset):** Execute the smart_discuss step for this phase.
257
+ **If SKIP_DISCUSS is `false` (or unset):**
258
+
259
+ **IMPORTANT — Discuss must be single-pass in autonomous mode.**
260
+ The discuss step in `--auto` mode MUST NOT loop. If CONTEXT.md already exists after discuss completes, do NOT re-invoke discuss for the same phase. The `has_context` check below is authoritative — once true, discuss is done for this phase regardless of perceived "gaps" in the context file.
213
261
 
214
- After smart_discuss completes, verify context was written:
262
+ **If `INTERACTIVE` is set:** Run the standard discuss-phase skill inline (asks interactive questions, waits for user answers). This preserves user input on all design decisions while keeping plan+execute out of the main context:
263
+
264
+ ```
265
+ skill(skill="gsd-discuss-phase", args="${PHASE_NUM}")
266
+ ```
267
+
268
+ **If `INTERACTIVE` is NOT set:** Execute the smart_discuss step for this phase (batch table proposals, auto-optimized).
269
+
270
+ After discuss completes (either mode), verify context was written:
215
271
 
216
272
  ```bash
217
273
  PHASE_STATE=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" init phase-op ${PHASE_NUM})
218
274
  ```
219
275
 
220
- Check `has_context`. If false → go to handle_blocker: "Smart discuss for phase ${PHASE_NUM} did not produce CONTEXT.md."
276
+ Check `has_context`. If false → go to handle_blocker: "Discuss for phase ${PHASE_NUM} did not produce CONTEXT.md."
221
277
 
222
278
  **3a.5. UI Design Contract (Frontend Phases)**
223
279
 
@@ -260,6 +316,20 @@ UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1)
260
316
 
261
317
  **3b. Plan**
262
318
 
319
+ **If `INTERACTIVE` is set:** Dispatch plan as a background agent to keep the main context lean. While plan runs, the workflow can immediately start discussing the next phase (see step 4).
320
+
321
+ ```
322
+ Agent(
323
+ description="Plan phase ${PHASE_NUM}: ${PHASE_NAME}",
324
+ run_in_background=true,
325
+ prompt="Run plan-phase for phase ${PHASE_NUM}: skill(skill=\"gsd:plan-phase\", args=\"${PHASE_NUM}\")"
326
+ )
327
+ ```
328
+
329
+ Store the agent task_id. After discuss for the next phase completes (or if no next phase), wait for the plan agent to finish before proceeding to execute.
330
+
331
+ **If `INTERACTIVE` is NOT set (default):** Run plan inline as before.
332
+
263
333
  ```
264
334
  skill(skill="gsd-plan-phase", args="${PHASE_NUM}")
265
335
  ```
@@ -268,13 +338,29 @@ Verify plan produced output — re-run `init phase-op` and check `has_plans`. If
268
338
 
269
339
  **3c. Execute**
270
340
 
341
+ **If `INTERACTIVE` is set:** Wait for the plan agent to complete (if not already), verify plans exist, then dispatch execute as a background agent:
342
+
343
+ ```
344
+ Agent(
345
+ description="Execute phase ${PHASE_NUM}: ${PHASE_NAME}",
346
+ run_in_background=true,
347
+ prompt="Run execute-phase for phase ${PHASE_NUM}: skill(skill=\"gsd:execute-phase\", args=\"${PHASE_NUM} --no-transition\")"
348
+ )
349
+ ```
350
+
351
+ Store the agent task_id. The workflow can now start discussing the next phase while this phase executes in the background. Before starting post-execution routing for this phase, wait for the execute agent to complete.
352
+
353
+ **If `INTERACTIVE` is NOT set (default):** Run execute inline as before.
354
+
271
355
  ```
272
356
  skill(skill="gsd-execute-phase", args="${PHASE_NUM} --no-transition")
273
357
  ```
274
358
 
275
359
  **3d. Post-Execution Routing**
276
360
 
277
- After execute-phase returns, read the verification result:
361
+ **If `INTERACTIVE` is set:** Wait for the execute agent to complete before reading verification results.
362
+
363
+ After execute-phase returns (or the execute agent completes), read the verification result:
278
364
 
279
365
  ```bash
280
366
  VERIFY_STATUS=$(grep "^status:" "${PHASE_DIR}"/*-VERIFICATION.md 2>/dev/null | head -1 | cut -d: -f2 | tr -d ' ')
@@ -404,7 +490,7 @@ Display the review result summary (score from UI-REVIEW.md if produced). Continu
404
490
 
405
491
  Run smart discuss for the current phase. Proposes grey area answers in batch tables — the user accepts or overrides per area. Produces identical CONTEXT.md output to regular discuss-phase.
406
492
 
407
- > **Note:** Smart discuss is an autonomous-optimized variant of the `gsd-discuss-phase` skill. It produces identical CONTEXT.md output but uses batch table proposals instead of sequential questioning. The original `discuss-phase` skill remains unchanged (per CTRL-03). Future milestones may extract this to a separate skill file.
493
+ > **Note:** Smart discuss is an autonomous-optimized variant of the `gsd-discuss-phase` skill. It produces identical CONTEXT.md output but uses batch table proposals instead of sequential questioning. The original `gsd-discuss-phase` skill remains unchanged (per CTRL-03). Future milestones may extract this to a separate skill file.
408
494
 
409
495
  **Inputs:** `PHASE_NUM` from execute_phase. Run init to get phase paths:
410
496
 
@@ -686,7 +772,24 @@ Decisions captured: {count} across {area_count} areas
686
772
 
687
773
  ## 4. Iterate
688
774
 
689
- After each phase completes, re-read ROADMAP.md to catch phases inserted mid-execution (decimal phases like 5.1):
775
+ **If `ONLY_PHASE` is set:** Do not iterate. Proceed directly to lifecycle step (which exits cleanly per single-phase mode).
776
+
777
+ **If `TO_PHASE` is set and current phase number >= `TO_PHASE`:** The target phase has been reached. Do not iterate further. Display:
778
+
779
+ ```
780
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
781
+ GSD ► AUTONOMOUS ▸ --to ${TO_PHASE} REACHED
782
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
783
+
784
+ Completed through phase ${TO_PHASE} as requested.
785
+ Remaining phases were not executed.
786
+
787
+ Resume with: /gsd-autonomous --from ${next_incomplete_phase}
788
+ ```
789
+
790
+ Proceed directly to lifecycle step (which handles partial completion — skips audit/complete/cleanup since not all phases are done). Exit cleanly.
791
+
792
+ **Otherwise:** After each phase completes, re-read ROADMAP.md to catch phases inserted mid-execution (decimal phases like 5.1):
690
793
 
691
794
  ```bash
692
795
  ROADMAP=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" roadmap analyze)
@@ -695,6 +798,7 @@ ROADMAP=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" roadmap
695
798
  Re-filter incomplete phases using the same logic as discover_phases:
696
799
  - Keep phases where `disk_status !== "complete"` OR `roadmap_complete === false`
697
800
  - Apply `--from N` filter if originally provided
801
+ - Apply `--to N` filter if originally provided
698
802
  - Sort by number ascending
699
803
 
700
804
  read STATE.md fresh:
@@ -707,6 +811,13 @@ Check for blockers in the Blockers/Concerns section. If blockers are found, go t
707
811
 
708
812
  If incomplete phases remain: proceed to next phase, loop back to execute_phase.
709
813
 
814
+ **Interactive mode overlap:** When `INTERACTIVE` is set, the iterate step enables pipeline parallelism:
815
+ 1. After discuss completes for Phase N, dispatch plan+execute as background agents
816
+ 2. Immediately start discuss for Phase N+1 (the next incomplete phase) while Phase N builds
817
+ 3. Before starting plan for Phase N+1, wait for Phase N's execute agent to complete and handle its post-execution routing (verification, gap closure, etc.)
818
+
819
+ This means the user is always answering discuss questions (lightweight, interactive) while the heavy work (planning, code generation) runs in the background. The main context only accumulates discuss conversations — plan and execute contexts are isolated in their agents.
820
+
710
821
  If all phases complete, proceed to lifecycle step.
711
822
 
712
823
  </step>
@@ -715,7 +826,23 @@ If all phases complete, proceed to lifecycle step.
715
826
 
716
827
  ## 5. Lifecycle
717
828
 
718
- After all phases complete, run the milestone lifecycle sequence: audit completecleanup.
829
+ **If `ONLY_PHASE` is set:** Skip lifecycle. A single phase does not trigger audit/complete/cleanup. Display:
830
+
831
+ ```
832
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
833
+ GSD ► AUTONOMOUS ▸ PHASE ${ONLY_PHASE} COMPLETE ✓
834
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
835
+
836
+ Phase ${ONLY_PHASE}: ${PHASE_NAME} — Done
837
+ Mode: Single phase (--only)
838
+
839
+ Lifecycle skipped — run /gsd-autonomous without --only
840
+ after all phases complete to trigger audit/complete/cleanup.
841
+ ```
842
+
843
+ Exit cleanly.
844
+
845
+ **Otherwise:** After all phases complete, run the milestone lifecycle sequence: audit → complete → cleanup.
719
846
 
720
847
  Display lifecycle transition banner:
721
848
 
@@ -852,7 +979,7 @@ When any phase operation fails or a blocker is detected, present 3 options via q
852
979
  Skipped: {list of skipped phases}
853
980
  Remaining: {list of remaining phases}
854
981
 
855
- Resume with: /gsd-autonomous --from {next_phase}
982
+ Resume with: /gsd-autonomous ${ONLY_PHASE ? "--only " + ONLY_PHASE : "--from " + next_phase}${TO_PHASE ? " --to " + TO_PHASE : ""}
856
983
  ```
857
984
 
858
985
  </step>
@@ -882,10 +1009,28 @@ When any phase operation fails or a blocker is detected, present 3 options via q
882
1009
  - [ ] Complete-milestone invoked via skill() with ${milestone_version} arg
883
1010
  - [ ] Cleanup invoked via skill() — internal confirmation is acceptable (CTRL-01)
884
1011
  - [ ] Final completion banner displayed after lifecycle
885
- - [ ] Progress bar uses phase number / total milestone phases (not position among incomplete)
1012
+ - [ ] Progress bar uses phase number / total milestone phases (not position among incomplete), with fallback display when phase numbers exceed total
886
1013
  - [ ] Smart discuss documents relationship to discuss-phase with CTRL-03 note
887
1014
  - [ ] Frontend phases get UI-SPEC generated before planning (step 3a.5) if not already present
888
1015
  - [ ] Frontend phases get UI review audit after successful execution (step 3d.5) if UI-SPEC exists
889
1016
  - [ ] UI phase and UI review respect workflow.ui_phase and workflow.ui_review config toggles
890
1017
  - [ ] UI review is advisory (non-blocking) — phase proceeds to iterate regardless of score
1018
+ - [ ] `--only N` restricts execution to exactly one phase
1019
+ - [ ] `--only N` skips lifecycle step (audit/complete/cleanup)
1020
+ - [ ] `--only N` exits cleanly after single phase completes
1021
+ - [ ] `--only N` on already-complete phase exits with message
1022
+ - [ ] `--only N` handle_blocker resume message uses --only flag
1023
+ - [ ] `--to N` stops execution after phase N completes (halts at iterate step)
1024
+ - [ ] `--to N` filters out phases with number > N during discovery
1025
+ - [ ] `--to N` displays "Stopping after phase N" in startup banner
1026
+ - [ ] `--to N` on already completed target exits with "already completed" message
1027
+ - [ ] `--to N` compatible with `--from N` (run phases from M to N)
1028
+ - [ ] `--to N` handle_blocker resume message preserves --to flag
1029
+ - [ ] `--to N` skips lifecycle when not all milestone phases complete
1030
+ - [ ] `--interactive` runs discuss inline via gsd:discuss-phase (asks questions, waits for user)
1031
+ - [ ] `--interactive` dispatches plan and execute as background agents (context isolation)
1032
+ - [ ] `--interactive` enables pipeline parallelism: discuss Phase N+1 while Phase N builds
1033
+ - [ ] `--interactive` main context only accumulates discuss conversations (lean)
1034
+ - [ ] `--interactive` waits for background agents before post-execution routing
1035
+ - [ ] `--interactive` compatible with `--only`, `--from`, and `--to` flags
891
1036
  </success_criteria>
@@ -126,7 +126,7 @@ Use question:
126
126
  <step name="execute_action">
127
127
  **Work on it now:**
128
128
  ```bash
129
- mv ".planning/todos/pending/[filename]" ".planning/todos/done/"
129
+ mv ".planning/todos/pending/[filename]" ".planning/todos/completed/"
130
130
  ```
131
131
  Update STATE.md todo count. Present problem/solution context. Begin work or ask how to proceed.
132
132
 
@@ -155,7 +155,7 @@ If todo was moved to done/, commit the change:
155
155
 
156
156
  ```bash
157
157
  git rm --cached .planning/todos/pending/[filename] 2>/dev/null || true
158
- node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" commit "docs: start work on todo - [title]" --files .planning/todos/done/[filename] .planning/STATE.md
158
+ node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" commit "docs: start work on todo - [title]" --files .planning/todos/completed/[filename] .planning/STATE.md
159
159
  ```
160
160
 
161
161
  Tool respects `commit_docs` config and gitignore automatically.
@@ -537,6 +537,15 @@ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
537
537
 
538
538
  Extract `branching_strategy`, `phase_branch_template`, `milestone_branch_template`, and `commit_docs` from init JSON.
539
539
 
540
+ Detect base branch:
541
+ ```bash
542
+ BASE_BRANCH=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get git.base_branch 2>/dev/null || echo "")
543
+ if [ -z "$BASE_BRANCH" ] || [ "$BASE_BRANCH" = "null" ]; then
544
+ BASE_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's|^refs/remotes/origin/||')
545
+ BASE_BRANCH="${BASE_BRANCH:-main}"
546
+ fi
547
+ ```
548
+
540
549
  **If "none":** Skip to git_tag.
541
550
 
542
551
  **For "phase" strategy:**
@@ -575,7 +584,7 @@ question with options: Squash merge (Recommended), Merge with history, Delete wi
575
584
 
576
585
  ```bash
577
586
  CURRENT_BRANCH=$(git branch --show-current)
578
- git checkout main
587
+ git checkout ${BASE_BRANCH}
579
588
 
580
589
  if [ "$BRANCHING_STRATEGY" = "phase" ]; then
581
590
  for branch in $PHASE_BRANCHES; do
@@ -604,7 +613,7 @@ git checkout "$CURRENT_BRANCH"
604
613
 
605
614
  ```bash
606
615
  CURRENT_BRANCH=$(git branch --show-current)
607
- git checkout main
616
+ git checkout ${BASE_BRANCH}
608
617
 
609
618
  if [ "$BRANCHING_STRATEGY" = "phase" ]; then
610
619
  for branch in $PHASE_BRANCHES; do
@@ -710,9 +719,9 @@ Tag: v[X.Y]
710
719
 
711
720
  **Start Next Milestone** — questioning → research → requirements → roadmap
712
721
 
713
- `/gsd-new-milestone`
722
+ `/new` then:
714
723
 
715
- *`/new` first → fresh context window*
724
+ `/gsd-new-milestone`
716
725
 
717
726
  ---
718
727
  ```
@@ -55,6 +55,12 @@ gaps = [
55
55
  </step>
56
56
 
57
57
  <step name="report_plan">
58
+ **read worktree config:**
59
+
60
+ ```bash
61
+ USE_WORKTREES=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get workflow.use_worktrees 2>/dev/null || echo "true")
62
+ ```
63
+
58
64
  **Report diagnosis plan to user:**
59
65
 
60
66
  ```
@@ -82,6 +88,7 @@ This runs in parallel - all gaps investigated simultaneously.
82
88
 
83
89
  ```bash
84
90
  AGENT_SKILLS_DEBUGGER=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-debugger 2>/dev/null)
91
+ EXPECTED_BASE=$(git rev-parse HEAD)
85
92
  ```
86
93
 
87
94
  **Spawn debug agents in parallel:**
@@ -89,12 +96,7 @@ AGENT_SKILLS_DEBUGGER=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools
89
96
  For each gap, fill the debug-subagent-prompt template and spawn:
90
97
 
91
98
  ```
92
- task(
93
- prompt=filled_debug_subagent_prompt + "\n\n<files_to_read>\n- {phase_dir}/{phase_num}-UAT.md\n- .planning/STATE.md\n</files_to_read>\n${AGENT_SKILLS_DEBUGGER}",
94
- subagent_type="gsd-debugger",
95
- isolation="worktree",
96
- description="Debug: {truth_short}"
97
- )
99
+ @gsd-debugger filled_debug_subagent_prompt + "\n\n<worktree_branch_check>\nFIRST ACTION: run git merge-base HEAD {EXPECTED_BASE} — if result differs from {EXPECTED_BASE}, run git reset --soft {EXPECTED_BASE} to correct the branch base (fixes Windows EnterWorktree creating branches from main).\n</worktree_branch_check>\n\n<files_to_read>\n- {phase_dir}/{phase_num}-UAT.md\n- .planning/STATE.md\n</files_to_read>\n${AGENT_SKILLS_DEBUGGER}"
98
100
  ```
99
101
 
100
102
  **All agents spawn in single message** (parallel execution).
@@ -93,7 +93,7 @@ For: Choosing between options, new external integration.
93
93
 
94
94
  ```
95
95
  For each library/framework:
96
- - mcp__context7__resolve-library-id
96
+ - mcp__context7__resolve-library-id
97
97
  - mcp__context7__get-library-docs (mode: "code" for API, "info" for concepts)
98
98
  ```
99
99
 
@@ -186,6 +186,24 @@ Parse JSON for: `todo_count`, `matches[]`.
186
186
  **Auto mode (`--auto`):** Fold all todos with score >= 0.4 automatically. Log the selection.
187
187
  </step>
188
188
 
189
+ <step name="load_methodology">
190
+ read the project-level methodology file if it exists. This must happen before assumption analysis
191
+ so that active lenses shape how assumptions are generated and evaluated.
192
+
193
+ ```bash
194
+ cat .planning/METHODOLOGY.md 2>/dev/null || true
195
+ ```
196
+
197
+ **If METHODOLOGY.md exists:**
198
+ - Parse each named lens: its diagnoses, recommendations, and triggering conditions
199
+ - Store as internal `<active_lenses>` for use in deep_codebase_analysis and present_assumptions
200
+ - When spawning the gsd-assumptions-analyzer, pass the lens list so it can flag which lenses apply
201
+ - When presenting assumptions, append a "Methodology" section showing which lenses were applied
202
+ and what they flagged (if anything)
203
+
204
+ **If METHODOLOGY.md does not exist:** Skip silently. This artifact is optional.
205
+ </step>
206
+
189
207
  <step name="scout_codebase">
190
208
  Lightweight scan of existing code to inform assumption generation.
191
209
 
@@ -236,7 +254,7 @@ If no USER-PROFILE.md: calibration_tier = "standard"
236
254
  **Spawn Explore subagent:**
237
255
 
238
256
  ```
239
- task(subagent_type="gsd-assumptions-analyzer", prompt="""
257
+ @gsd-assumptions-analyzer """
240
258
  Analyze the codebase for Phase {PHASE}: {phase_name}.
241
259
 
242
260
  Phase goal: {roadmap_description}
@@ -273,7 +291,7 @@ Return EXACTLY this structure:
273
291
  ecosystem best practices, etc. Leave empty if codebase provides enough evidence.]
274
292
 
275
293
  ${AGENT_SKILLS_ANALYZER}
276
- """)
294
+ """
277
295
  ```
278
296
 
279
297
  Parse the subagent's response. Extract:
@@ -579,9 +597,9 @@ Created: .planning/phases/${PADDED_PHASE}-${SLUG}/${PADDED_PHASE}-CONTEXT.md
579
597
 
580
598
  **Phase ${PHASE}: {phase_name}** — {Goal from ROADMAP.md}
581
599
 
582
- `/gsd-plan-phase ${PHASE}`
600
+ `/new` then:
583
601
 
584
- *`/new` first → fresh context window*
602
+ `/gsd-plan-phase ${PHASE}`
585
603
 
586
604
  ---
587
605