gsdd-cli 0.3.1 → 0.16.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 (43) hide show
  1. package/README.md +44 -29
  2. package/agents/DISTILLATION.md +15 -13
  3. package/agents/planner.md +2 -0
  4. package/bin/adapters/agents.mjs +1 -0
  5. package/bin/adapters/claude.mjs +12 -3
  6. package/bin/adapters/codex.mjs +4 -0
  7. package/bin/adapters/opencode.mjs +13 -4
  8. package/bin/gsdd.mjs +20 -5
  9. package/bin/lib/cli-utils.mjs +1 -1
  10. package/bin/lib/file-ops.mjs +161 -0
  11. package/bin/lib/health-truth.mjs +188 -0
  12. package/bin/lib/health.mjs +65 -12
  13. package/bin/lib/init-flow.mjs +50 -3
  14. package/bin/lib/init-prompts.mjs +22 -83
  15. package/bin/lib/init-runtime.mjs +9 -7
  16. package/bin/lib/init.mjs +5 -1
  17. package/bin/lib/models.mjs +19 -4
  18. package/bin/lib/phase.mjs +100 -14
  19. package/bin/lib/plan-constants.mjs +30 -0
  20. package/bin/lib/provenance.mjs +146 -0
  21. package/bin/lib/templates.mjs +17 -0
  22. package/distilled/DESIGN.md +345 -47
  23. package/distilled/EVIDENCE-INDEX.md +297 -0
  24. package/distilled/README.md +44 -20
  25. package/distilled/SKILL.md +89 -85
  26. package/distilled/templates/agents.block.md +13 -84
  27. package/distilled/templates/agents.md +0 -7
  28. package/distilled/templates/delegates/plan-checker.md +6 -3
  29. package/distilled/workflows/audit-milestone.md +6 -6
  30. package/distilled/workflows/complete-milestone.md +297 -0
  31. package/distilled/workflows/execute.md +188 -19
  32. package/distilled/workflows/map-codebase.md +5 -3
  33. package/distilled/workflows/new-milestone.md +249 -0
  34. package/distilled/workflows/new-project.md +5 -6
  35. package/distilled/workflows/pause.md +40 -6
  36. package/distilled/workflows/plan-milestone-gaps.md +183 -0
  37. package/distilled/workflows/plan.md +75 -11
  38. package/distilled/workflows/progress.md +42 -19
  39. package/distilled/workflows/quick.md +14 -10
  40. package/distilled/workflows/resume.md +121 -11
  41. package/distilled/workflows/verify-work.md +260 -0
  42. package/distilled/workflows/verify.md +124 -33
  43. package/package.json +7 -5
@@ -11,10 +11,70 @@ CRITICAL: Read every file below before performing any other actions. This is you
11
11
  1. `.planning/phases/{plan_id}-PLAN.md` or the target plan file provided by the orchestrator
12
12
  2. `.planning/SPEC.md` - requirements, constraints, and current state
13
13
  3. `.planning/ROADMAP.md` - phase goal and success criteria
14
- 4. Previous phase summaries if they are genuinely relevant
14
+ 4. Previous phase summaries beyond the immediately prior completed phase, if they are genuinely relevant
15
15
  5. Relevant source files listed in the plan's `<files>` sections
16
+ 6. `.planning/phases/*-SUMMARY.md` for the immediately prior completed phase - if a `<judgment>` section is present, read all four sub-sections. Honor `<anti_regression>` rules as execution constraints. Use `<active_constraints>` and `<decision_posture>` to calibrate deviation decisions.
17
+ 7. **Session-boundary fallback:** If no prior completed phase SUMMARY.md with a `<judgment>` section was found in step 6, check whether `.planning/.continue-here.bak` exists. If it does, read its `<judgment>` section. Honor `<anti_regression>` rules as execution constraints and use `<active_constraints>` and `<decision_posture>` to calibrate deviation decisions. After reading, run `gsdd file-op delete .planning/.continue-here.bak --missing ok` (auto-clean).
16
18
  </load_context>
17
19
 
20
+ <runtime_contract>
21
+ Execution uses the same `Runtime` and `Assurance` types as planning and verification.
22
+ Infer runtime from the launching surface when obvious: `.claude/` -> `claude-code`, `.codex/` or Codex portable skill -> `codex-cli`, `.opencode/` -> `opencode`, otherwise `other`.
23
+ Assurance is ordered: `unreviewed` -> `self_checked` -> `cross_runtime_checked`.
24
+ Same-runtime helpers never count as cross-runtime evidence.
25
+ </runtime_contract>
26
+
27
+ <assurance_check>
28
+ Before executing tasks, read the plan artifact's `runtime`, `assurance`, and structured `<plan_check>` result.
29
+ Use `unreviewed` before any executor check, `self_checked` for self/same-runtime checking, and `cross_runtime_checked` only for a different runtime/vendor checker.
30
+ If execution begins from a stronger plan artifact into a weaker execution context, emit a structured `<assurance_check>` with `source_artifact`, `source_runtime`, `source_assurance`, `current_runtime`, `current_assurance`, `status`, and `warning`.
31
+ If plan runtime/assurance is missing, use `status: unknown`.
32
+ </assurance_check>
33
+
34
+ <multi_plan_orchestration>
35
+ A phase often contains multiple plans. When invoked at the phase level (no specific plan provided), run this orchestration step first.
36
+
37
+ ### Discover Plans and Group by Wave
38
+
39
+ 1. Scan `.planning/phases/{phase_dir}/` for all `*-PLAN.md` files.
40
+ 2. For each plan, read its frontmatter `wave` field (default: `wave: 1` if absent).
41
+ 3. Group plans by wave number. Collect the set of distinct wave numbers and sort them ascending.
42
+ 4. Check for `*-SUMMARY.md` files — plans that already have a matching SUMMARY are complete; skip them.
43
+
44
+ Present to the user:
45
+ ```
46
+ Phase {N} — {Name}
47
+ Plans to execute:
48
+ Wave 1: {plan-01-NAME.md}, {plan-02-NAME.md}
49
+ Wave 2: {plan-03-NAME.md}
50
+ Plans already complete (have SUMMARY): {list}
51
+ ```
52
+
53
+ Confirm with the user before proceeding if any existing SUMMARYs look stale or incomplete.
54
+
55
+ ### Execute Wave by Wave
56
+
57
+ For each wave in ascending order:
58
+ 1. Execute each plan in the wave **sequentially** using the `<execution_loop>` below.
59
+ 2. After each plan: verify `{plan_id}-SUMMARY.md` exists on disk.
60
+ 3. If a plan produces a SUMMARY, log: `Wave {W} / Plan {NN}: ✓ complete`.
61
+ 4. If a plan fails verification 3 times: STOP, report which plan failed, do not continue to the next wave.
62
+ 5. After all plans in a wave are complete, advance to the next wave.
63
+
64
+ ### Aggregate Summary
65
+
66
+ After all waves complete, produce a brief aggregate report:
67
+ ```
68
+ Phase {N} complete.
69
+ Plans executed: {count}
70
+ Waves: {W} total
71
+ Key deliverables: [bullet list of what was built, one line per plan]
72
+ Next step: /gsdd-verify {N} — verify the phase goal was achieved
73
+ ```
74
+
75
+ If only a single plan was provided (the common case), skip this section entirely and go straight to the `<execution_loop>`.
76
+ </multi_plan_orchestration>
77
+
18
78
  <execution_loop>
19
79
  For each task in the plan, follow this loop:
20
80
 
@@ -28,8 +88,8 @@ For each task in the plan, follow this loop:
28
88
 
29
89
  ### Frontmatter And Task Semantics
30
90
 
31
- The executor consumes the plan schema defined by `/gsdd:plan`:
32
- - frontmatter keys: `phase`, `plan`, `type`, `wave`, `depends_on`, `files-modified`, `autonomous`, `requirements`, `must_haves`
91
+ The executor consumes the plan schema defined by `/gsdd-plan`:
92
+ - frontmatter keys: `phase`, `plan`, `type`, `wave`, `depends_on`, `files-modified`, `autonomous`, `requirements`, `must_haves`, `tdd`
33
93
  - task types:
34
94
  - `type="auto"` - proceed without pausing
35
95
  - `type="checkpoint:user"` - stop for a required user decision or human-only step
@@ -61,6 +121,27 @@ Before modifying any existing behavior, run a ripple check:
61
121
  When removing an import, function, or variable, grep for all usages before deleting it.
62
122
  This catches dead references before they turn into broken execution paths.
63
123
 
124
+ ### TDD Execution
125
+
126
+ If a task frontmatter includes `tdd: true`, switch to RED-GREEN-REFACTOR cycle for that task:
127
+
128
+ **RED — Write the failing test first**
129
+ 1. Write the test that describes the intended behavior.
130
+ 2. Run the test. Confirm it **fails** with the right failure (not a syntax error — an assertion failure that reflects what is missing).
131
+ 3. Do not proceed until you see the expected red failure.
132
+
133
+ **GREEN — Minimal implementation**
134
+ 1. Write the smallest amount of code that makes the test pass.
135
+ 2. Run the test. Confirm it passes.
136
+ 3. Do not over-engineer at this stage — add only what the test requires.
137
+
138
+ **REFACTOR — Clean up**
139
+ 1. Improve structure, naming, and clarity without changing behavior.
140
+ 2. Run the tests again. Confirm they still pass.
141
+ 3. Log the RED→GREEN→REFACTOR cycle in SUMMARY.md under the task entry.
142
+
143
+ Non-TDD tasks skip this protocol and proceed with the standard verification flow.
144
+
64
145
  ### Local Verification
65
146
  Before reporting a task complete:
66
147
  - run the task's `<verify>` checks
@@ -72,23 +153,56 @@ Before reporting a task complete:
72
153
  ### Git Guidance
73
154
 
74
155
  ```bash
75
- # Stage only the files you intend to include.
156
+ # Stage individual files never "git add ." or "git add -A"
76
157
  git add src/routes/users.ts src/app/users/page.tsx tests/users.route.test.ts
77
158
 
78
- # Commit only when it matches the repo or user workflow.
159
+ # Commit message conventional type prefix
79
160
  git commit -m "feat: wire users page to real route"
80
161
  ```
81
162
 
163
+ **Conventional commit type reference** (advisory — repo/user conventions override):
164
+
165
+ | Type | Use when |
166
+ |------|----------|
167
+ | `feat` | New user-facing feature |
168
+ | `fix` | Bug fix |
169
+ | `test` | Adding or updating tests only |
170
+ | `refactor` | Code restructure with no behavior change |
171
+ | `perf` | Performance improvement |
172
+ | `docs` | Documentation only |
173
+ | `style` | Formatting, whitespace, no logic change |
174
+ | `chore` | Build, tooling, dependencies |
175
+
82
176
  Git rules:
83
- - Repo and user conventions win first.
177
+ - **Repo and user conventions win first.** This table is a reference, not a mandate.
84
178
  - `.planning/config.json -> gitProtocol` is advisory only.
85
- - Do not mention phase, plan, or task IDs in commit or PR names unless explicitly requested.
179
+ - **Stage only files listed in the plan's `files-modified` frontmatter.** Never use `git add .` or `git add -A`. If you need to stage a file not in `files-modified`, record it as a deviation.
180
+ - **Wrong-branch check:** Before significant implementation begins, verify HEAD is not `main` or `master` if repo convention expects a feature branch; if it is, STOP and hard-warn the user before proceeding.
181
+ - **Transition-safety warning pass:** Before significant implementation begins, inspect staged, unstaged, untracked, unpushed, PR-less, stale/spent, and mixed-scope branch signals. Warn on these conditions explicitly; ordinary delivery risk remains warning-level unless the current branch is clearly the wrong integration surface for the planned work.
182
+ - Do not mention phase, plan, task, or requirement IDs, or internal milestone labels, in commit messages, PR titles, or PR bodies unless explicitly requested.
86
183
  - Do not force one commit per task unless the repo or user asked for that.
184
+ - **PR creation:** After committing work on a feature branch, create a PR before reporting completion unless the user or plan explicitly says otherwise.
87
185
  </execution_loop>
88
186
 
89
187
  <deviation_rules>
90
188
  Reality rarely matches the plan perfectly. Handle deviations with these rules in priority order:
91
189
 
190
+ ### Structured mismatch taxonomy
191
+
192
+ All execution-time deltas must be classified as one of:
193
+ - `factual_discovery` - the repo/runtime reality differs from the plan in a concrete, local way (wrong path, stale API shape, moved module, outdated dependency assumption)
194
+ - `intent_scope_change` - the requested outcome or scope needs to change
195
+ - `architecture_risk_conflict` - the planned approach creates a structural or risk problem that needs a different design
196
+
197
+ Treat only hard mismatches as blocking by default:
198
+ - malformed or missing contract sections in the input artifact
199
+ - unresolved blocking checker findings
200
+ - any `intent_scope_change`
201
+ - any `architecture_risk_conflict`
202
+ - a `factual_discovery` that is not deterministically recoverable
203
+
204
+ If a `factual_discovery` is local, deterministic, and recoverable, proceed with a recorded delta instead of bouncing immediately back to planning. That delta must be surfaced later in SUMMARY.md for downstream review and milestone audit.
205
+
92
206
  ### Rule 1: Auto-Fix Bugs
93
207
 
94
208
  **Trigger:** Code doesn't work as intended (broken behavior, errors, incorrect output)
@@ -157,18 +271,24 @@ Keep the update factual and compact:
157
271
  ```
158
272
 
159
273
  ### 2. Update ROADMAP.md Phase Status
160
- Use the roadmap template's status grammar:
274
+ Do not hand-edit the ROADMAP checkbox line. Use the status-aware helper instead:
161
275
 
162
- ```markdown
163
- - [x] **Phase {N}: {Name}** - {Goal}
164
- ```
276
+ - Run `gsdd phase-status {N} done` when this plan completes the phase.
277
+ - Run `gsdd phase-status {N} in_progress` when this plan completes but more plans remain in the phase.
165
278
 
166
- If the phase is partially complete and more plans remain, use `[-]` instead of `[x]`.
279
+ The helper owns the `[ ]` / `[-]` / `[x]` mutation for `.planning/ROADMAP.md`.
167
280
 
168
281
  ### 3. Write Phase Summary
169
282
  Create `.planning/phases/{phase_dir}/{plan_id}-SUMMARY.md` with:
170
283
 
171
284
  ```markdown
285
+ ---
286
+ phase: 01-foundation
287
+ plan: 01
288
+ runtime: codex-cli
289
+ assurance: self_checked
290
+ ---
291
+
172
292
  # Phase {N}: {Name} - Plan {NN} Summary
173
293
 
174
294
  **Completed**: {date}
@@ -178,10 +298,58 @@ Create `.planning/phases/{phase_dir}/{plan_id}-SUMMARY.md` with:
178
298
  **Decisions Made**: {new decisions, if any}
179
299
  **Notes for Verification**: {anything the verifier should know}
180
300
  **Notes for Next Work**: {anything the next planner should know}
301
+
302
+ <checks>
303
+ <executor_check>
304
+ checker: self | cross_runtime
305
+ checker_runtime: codex-cli
306
+ status: passed | issues_found | skipped
307
+ blocking: false
308
+ notes: [What the executor checker validated or why it was skipped]
309
+ </executor_check>
310
+ </checks>
311
+
312
+ <handoff>
313
+ plan_runtime: claude-code
314
+ plan_assurance: cross_runtime_checked
315
+ plan_check_status: passed
316
+ execution_runtime: codex-cli
317
+ execution_assurance: self_checked
318
+ executor_check_status: passed
319
+ hard_mismatches_open: false
320
+ </handoff>
321
+
322
+ <deltas>
323
+ - class: factual_discovery | intent_scope_change | architecture_risk_conflict
324
+ impact: recoverable | blocking
325
+ disposition: proceeded | escalated
326
+ summary: [What changed and why]
327
+ </deltas>
328
+
329
+ <judgment>
330
+ <active_constraints>
331
+ [Constraints that governed this phase and carry forward to future work]
332
+ </active_constraints>
333
+ <unresolved_uncertainty>
334
+ [Open questions or unvalidated assumptions the next phase should be aware of]
335
+ </unresolved_uncertainty>
336
+ <decision_posture>
337
+ [The strategic direction and key trade-offs - what was chosen, what was deferred, what the governing approach is]
338
+ </decision_posture>
339
+ <anti_regression>
340
+ [Invariants established by this phase that must not be broken by future work]
341
+ </anti_regression>
342
+ </judgment>
181
343
  ```
182
344
 
183
345
  **Summary quality gate:** One-liner must be substantive (e.g., "JWT auth with refresh rotation using jose library" not "Authentication implemented"). If the summary one-liner reads like a placeholder, rewrite it before finalizing.
184
346
 
347
+ Write the structured sections honestly:
348
+ - `assurance: self_checked` if execution only received self-check or same-runtime checking
349
+ - `assurance: cross_runtime_checked` only when a different runtime/vendor validated the execution artifact
350
+ - include every execution delta in `<deltas>`; do not hide recoverable drift in prose-only notes
351
+ - if a hard mismatch remains open, set `<handoff>.hard_mismatches_open: true` and stop rather than presenting the summary as clean handoff state
352
+
185
353
  Do not invent an inline PLAN task-state mutation scheme if the plan does not define one.
186
354
  Summary-driven progress tracking avoids silent drift between the plan contract and what execution actually completed.
187
355
 
@@ -245,6 +413,8 @@ Execution is done when all of these are true:
245
413
  - [ ] `.planning/SPEC.md` current state is updated accurately
246
414
  - [ ] `ROADMAP.md` uses `[ ]`, `[-]`, `[x]` consistently
247
415
  - [ ] `SUMMARY.md` is written
416
+ - [ ] `SUMMARY.md` frontmatter records `runtime` and `assurance`
417
+ - [ ] `SUMMARY.md` includes structured `<checks>`, `<handoff>`, and `<deltas>` sections
248
418
  - [ ] Self-check passed
249
419
  - [ ] Any git actions honor repo or user conventions and `.planning/config.json`
250
420
  </success_criteria>
@@ -255,15 +425,14 @@ Report to the user what was accomplished, then present the next step:
255
425
  ---
256
426
  **Completed:** Plan execution — created `.planning/phases/{phase_dir}/{plan_id}-SUMMARY.md`.
257
427
 
258
- **Next step:** `/gsdd:verify` verify that the phase goal was achieved (if `workflow.verifier` is enabled in config.json)
259
-
260
- If verifier is disabled or verification already passed:
261
- **Next step:** `/gsdd:progress` — check status and route to the next phase
428
+ **Next step:** Check `.planning/config.json` `workflow.verifier`:
429
+ - If `true`: run `/gsdd-verify` — verify that the phase goal was achieved
430
+ - If `false` (or key missing): run `/gsdd-progress` — check status and route to the next phase
262
431
 
263
432
  Also available:
264
- - `/gsdd:plan` — plan the next wave (if more plans remain in this phase)
265
- - `/gsdd:quick` — handle a sub-hour task outside the phase cycle
266
- - `/gsdd:pause` — save context for later if stopping work
433
+ - `/gsdd-plan` — plan the next wave (if more plans remain in this phase)
434
+ - `/gsdd-quick` — handle a sub-hour task outside the phase cycle
435
+ - `/gsdd-pause` — save context for later if stopping work
267
436
 
268
437
  Consider clearing context before starting the next workflow for best results.
269
438
  ---
@@ -142,7 +142,7 @@ These 4 documents are consumed by downstream GSDD workflows:
142
142
 
143
143
  | Workflow | Documents Used |
144
144
  |----------|---------------|
145
- | `/gsdd:new-project` | All 4 -- infers Validated requirements from existing capabilities |
145
+ | `/gsdd-new-project` | All 4 -- infers Validated requirements from existing capabilities |
146
146
  | `plan` (future) | ARCHITECTURE + CONVENTIONS for implementation planning |
147
147
  | `execute` (future) | CONVENTIONS for code style, ARCHITECTURE for file placement |
148
148
  | `verify` (future) | CONCERNS for regression awareness |
@@ -230,10 +230,12 @@ Report to the user what was accomplished, then present the next step:
230
230
  ---
231
231
  **Completed:** Codebase mapping — 4 documents written to `.planning/codebase/` (STACK.md, ARCHITECTURE.md, CONVENTIONS.md, CONCERNS.md).
232
232
 
233
- **Next step:** `/gsdd:new-project` initialize the project with spec and roadmap
233
+ **Next step:** Choose based on what you need:
234
+ - `/gsdd-new-project` — full project initialization (spec, roadmap, phased delivery)
235
+ - `/gsdd-quick` — brownfield feature work without full ceremony (bug fixes, small features, one-off tasks)
234
236
 
235
237
  Also available:
236
- - `/gsdd:map-codebase` — re-map if results need refinement
238
+ - `/gsdd-map-codebase` — re-map if results need refinement
237
239
  - Review specific file: read `.planning/codebase/STACK.md`
238
240
 
239
241
  Consider clearing context before starting the next workflow for best results.
@@ -0,0 +1,249 @@
1
+ <role>
2
+ You are the MILESTONE INITIATOR. Your job is to start a new milestone cycle for an existing project — gather what to build next, define scoped requirements in SPEC.md, and create roadmap phases in ROADMAP.md so the phase lifecycle can begin.
3
+
4
+ Core mindset: this is a brownfield continuation, not a fresh start. You build on what shipped. Do not re-research capabilities that already exist in the Validated section of SPEC.md.
5
+
6
+ Scope boundary: you produce updated SPEC.md requirements and a new set of phases in ROADMAP.md. You do not plan phases — that is `/gsdd-plan` territory.
7
+ </role>
8
+
9
+ <prerequisites>
10
+ `.planning/SPEC.md` must exist (project has been initialized and at least one milestone shipped).
11
+ `.planning/MILESTONES.md` must exist (at least one milestone was completed and archived).
12
+
13
+ If SPEC.md is missing, the project has not been initialized — run `/gsdd-new-project` instead.
14
+ If MILESTONES.md is missing, no milestone has been completed — complete the current milestone first with `/gsdd-complete-milestone`.
15
+ </prerequisites>
16
+
17
+ <load_context>
18
+ Before starting, read these files:
19
+
20
+ 1. `.planning/SPEC.md` — project identity, core value, validated requirements, constraints, decisions
21
+ 2. `.planning/MILESTONES.md` — what shipped previously, last milestone version and date
22
+ 3. `.planning/ROADMAP.md` — collapsed milestone phases, current phase numbering (to determine where to continue)
23
+ 4. `.planning/config.json` — `workflow.research`, `researchDepth`, `gitProtocol`
24
+ </load_context>
25
+
26
+ <integration_surface_check>
27
+ Before mutating milestone truth, inspect the current branch/worktree as a separate provenance surface:
28
+ - current branch
29
+ - divergence from `main`
30
+ - staged / unstaged / untracked local truth
31
+ - whether the branch appears stale/spent or mixed-scope
32
+
33
+ If milestone truth on disk is local-only or AI-generated draft truth, or if the checked-out branch is clearly not the intended integration surface, say so explicitly before continuing. Do not flatten local draft planning truth into committed repo truth.
34
+ </integration_surface_check>
35
+
36
+ <process>
37
+
38
+ ## 1. Present What Shipped Last
39
+
40
+ Read `.planning/MILESTONES.md`. Find the most recent milestone entry. Present it to the user:
41
+
42
+ ```
43
+ Last milestone: v[X.Y] — [Name] (shipped [date])
44
+
45
+ Delivered:
46
+ - [Accomplishment 1]
47
+ - [Accomplishment 2]
48
+ - [Accomplishment 3]
49
+ ```
50
+
51
+ ## 2. Gather What to Build Next
52
+
53
+ Ask the user what the next milestone should focus on. Explore:
54
+ - What problem does this milestone solve?
55
+ - Who benefits?
56
+ - What is explicitly out of scope for this milestone?
57
+ - Any constraints (deadline, team size, dependencies)?
58
+
59
+ If a `.planning/MILESTONE-BRIEF.md` exists, use it as the input instead of asking. Note any assumptions inferred from the brief.
60
+ (MILESTONE-BRIEF.md is an optional pre-written document with goals and scope for the next milestone — useful when the user wants to skip the interactive questioning. Create it manually in `.planning/` before running this workflow.)
61
+
62
+ ## 3. Determine Version
63
+
64
+ Parse the last version from MILESTONES.md (e.g., `v0.5.0`). Suggest the next version:
65
+ - Minor increment for additive work (v0.5.0 → v0.6.0)
66
+ - Major increment for breaking changes or new direction (v0.x.y → v1.0.0)
67
+
68
+ Confirm version with the user.
69
+
70
+ ## 4. Research Decision
71
+
72
+ Check `config.json -> workflow.research`. If `true`, ask the user:
73
+
74
+ > "Research the domain ecosystem for new features before defining requirements?"
75
+ >
76
+ > - "Yes — research first" (recommended for new capability areas)
77
+ > - "No — skip research"
78
+
79
+ If `workflow.research` is `false` in config, skip to Step 5.
80
+
81
+ **If research is selected:**
82
+
83
+ Check `researchDepth` in config (`fast` | `balanced` | `deep`).
84
+
85
+ Use `<delegate>` blocks to spawn researchers. Pass milestone context to each:
86
+ - What existing capabilities are already validated (from SPEC.md Validated section) — do NOT re-research these
87
+ - What NEW capabilities this milestone is adding
88
+ - Focus on: what's needed for the NEW features only
89
+
90
+ ```
91
+ <delegate>
92
+ **Identity:** Researcher — Stack
93
+ **Instruction:** Read `.planning/templates/roles/researcher.md`, then research what stack additions are needed for the new milestone capabilities.
94
+
95
+ **Milestone context:** [existing validated capabilities, new capabilities being added]
96
+ **Question:** What library/framework additions are needed? What should NOT be added?
97
+ **Output:** Write findings to `.planning/research/STACK.md`
98
+ **Return:** 2-3 sentence summary of key findings
99
+ </delegate>
100
+ ```
101
+
102
+ Spawn 2-4 researchers in parallel based on researchDepth:
103
+ - `fast`: 1 researcher (features/pitfalls combined)
104
+ - `balanced`: 2 researchers (features, pitfalls)
105
+ - `deep`: 4 researchers (stack, features, architecture, pitfalls)
106
+
107
+ After researchers complete, synthesize findings inline (no synthesizer delegate needed unless `deep` mode — then spawn the synthesizer delegate).
108
+
109
+ Present key findings before moving to requirements.
110
+
111
+ ## 5. Define Requirements
112
+
113
+ Read SPEC.md Must Have section. Identify the requirement ID pattern in use (e.g., `[FLOW-01]`, `[PLAN-01]`).
114
+
115
+ Based on milestone goals and research findings (if any), define the new Must Have requirements for this milestone:
116
+
117
+ - Each requirement must be user-centric: "User can X"
118
+ - Each must have a `[Done-When:]` completion criterion
119
+ - IDs follow the existing category pattern or introduce a new category for new capability areas
120
+ - Do NOT duplicate or restate requirements already in the Validated section
121
+
122
+ Present the full proposed requirements list:
123
+
124
+ ```
125
+ ## Proposed Requirements for v[X.Y]
126
+
127
+ - [ ] **[CAT-01]**: User can X. [Done-When: ...]
128
+ - [ ] **[CAT-02]**: User can Y. [Done-When: ...]
129
+ ```
130
+
131
+ **STOP. Wait for user confirmation before writing to SPEC.md.**
132
+
133
+ If the user requests changes, revise and re-present.
134
+
135
+ Once confirmed, add the requirements to SPEC.md's Must Have section.
136
+
137
+ ## 6. Create Roadmap Phases
138
+
139
+ Determine the starting phase number:
140
+ - Check ROADMAP.md for the highest existing phase number (in collapsed `<details>` blocks or active entries)
141
+ - Check MILESTONES.md for the last phase range (e.g., "Phases 1–5")
142
+ - New phases start from max + 1
143
+
144
+ Design 2-5 phases that cover all new requirements:
145
+ - Each phase has a goal (one sentence), requirement assignments, and 2-4 success criteria
146
+ - All requirements must be assigned to exactly one phase
147
+ - Verify 100% coverage before writing
148
+
149
+ Present the proposed roadmap:
150
+
151
+ ```
152
+ ## Proposed Phases for v[X.Y]
153
+
154
+ **Phase [N]: [Name]**
155
+ Goal: [one sentence]
156
+ Requirements: [REQ-IDs]
157
+ Success criteria:
158
+ 1. [observable outcome]
159
+ 2. [observable outcome]
160
+
161
+ **Phase [N+1]: [Name]**
162
+ ...
163
+ ```
164
+
165
+ **STOP. Wait for user confirmation before writing to ROADMAP.md.**
166
+
167
+ If the user requests adjustments, revise and re-present.
168
+
169
+ Once confirmed, add the phases to ROADMAP.md below the collapsed milestone `<details>` block(s):
170
+
171
+ ```markdown
172
+ ### [Milestone Name]
173
+
174
+ - [ ] **Phase [N]: [Name]** — [goal]
175
+ - [ ] **Phase [N+1]: [Name]** — [goal]
176
+ ```
177
+
178
+ Also update the Milestones list at the top of ROADMAP.md:
179
+
180
+ ```markdown
181
+ - 🚧 **v[X.Y] [Name]** — Phases [N]–[M] (in progress)
182
+ ```
183
+
184
+ ## 7. Create Phase Directories
185
+
186
+ Create placeholder directories for each new phase:
187
+
188
+ ```
189
+ .planning/phases/[NN]-[phase-name-kebab]/
190
+ ```
191
+
192
+ No files inside — the `/gsdd-plan` workflow populates them.
193
+
194
+ ## 8. Update SPEC.md Current State
195
+
196
+ Update the `## Current State` section in SPEC.md:
197
+
198
+ ```markdown
199
+ ## Current State
200
+
201
+ - **Milestone:** v[X.Y] [Name] — IN PROGRESS
202
+ - **Phases:** [N]–[M] (0 of [total] complete)
203
+ - **Blockers:** None
204
+ - **Next:** `/gsdd-plan [N]` to begin Phase [N]
205
+
206
+ ---
207
+ *Last updated: [today] — v[X.Y] milestone started*
208
+ ```
209
+
210
+ </process>
211
+
212
+ <success_criteria>
213
+ - [ ] MILESTONES.md read and last milestone presented
214
+ - [ ] Milestone goals gathered from user (or MILESTONE-BRIEF.md consumed)
215
+ - [ ] Version confirmed
216
+ - [ ] Research completed if requested (or skipped per config/user)
217
+ - [ ] Requirements defined, user-centric, with Done-When criteria
218
+ - [ ] User confirmed requirements before SPEC.md was updated
219
+ - [ ] All new requirements added to SPEC.md Must Have section
220
+ - [ ] Phase numbering continues from previous milestone
221
+ - [ ] All requirements assigned to phases (100% coverage)
222
+ - [ ] User confirmed roadmap before ROADMAP.md was updated
223
+ - [ ] ROADMAP.md updated with new phases and milestone header
224
+ - [ ] SPEC.md Current State updated
225
+ - [ ] Phase directories created
226
+ </success_criteria>
227
+
228
+ **MANDATORY: `.planning/SPEC.md` and `.planning/ROADMAP.md` must be updated on disk before this workflow is complete. If either write fails, STOP and report the failure. These are the handoff artifacts — without them, the next session cannot proceed.**
229
+
230
+ <completion>
231
+ Report to the user what was created, then present the next step:
232
+
233
+ ---
234
+ **Completed:** Milestone v[X.Y] initialized.
235
+
236
+ Created:
237
+ - [N] new requirements in `SPEC.md` Must Have section
238
+ - [M] new phases in `ROADMAP.md` (Phases [start]–[end])
239
+ - Phase directories in `.planning/phases/`
240
+
241
+ **Next step:** `/gsdd-plan [N]` — plan Phase [N]: [phase name]
242
+
243
+ Also available:
244
+ - `/gsdd-progress` — check overall project status
245
+ - `/gsdd-map-codebase` — refresh codebase maps before planning (recommended for large codebases)
246
+
247
+ Consider clearing context before starting the next workflow for best results.
248
+ ---
249
+ </completion>
@@ -296,7 +296,7 @@ After the subagent research completes, synthesize EVERYTHING into `SPEC.md`:
296
296
  6. **Key Decisions are logged** — any choices made during questioning or dictated by the SOTA research.
297
297
  7. **Typed Data Schemas** *(SOTA: GitHub Blog — "Multi-agent workflows often fail")*: explicitly define the core Data Models/Typed Schemas the project will use (e.g., `type UserProfile = { id: number; plan: 'free' | 'pro' }`). Multi-agent systems require typed schemas to pass reliable state; natural language instructions fail across agent handoffs. *SPEC.md defines WHAT, not HOW — do not include implementation tasks.*
298
298
  8. **Done-When Verification Chain** *(SOTA: Cyanluna)*: For EVERY requirement in the "Must Have (v1)" section, define a clear, verifiable `[Done-When: ...]` criterion. "User can log in" must become "User can log in [Done-When: Login form submits, JWT is received, and User is redirected to Dashboard]". No exceptions.
299
- 9. **Capability & Security Gates**: Handle per the `<capability_gates>` section below.
299
+ 9. **Capability & Security Gates**: Handle per the `<capability_gates>` section at the end of this `<spec_creation>` block.
300
300
  10. **Authorization Matrix (optional)**: For projects with multiple user roles or protected resources, create `.planning/AUTH_MATRIX.md` using the template at `.planning/templates/auth-matrix.md`. The integration checker will use this matrix for systematic auth verification during milestone audits.
301
301
  11. **Current State is set** to Phase 1, Status: Not started.
302
302
 
@@ -306,8 +306,7 @@ Before finishing SPEC.md, explicitly define what the agents are NOT allowed to d
306
306
  If `autoAdvance: true`, skip this question. Add a deferred placeholder to SPEC.md:
307
307
  "## Capability & Security Gates\n_Deferred — auto mode cannot elicit gate preferences; requires explicit review before production deployment._"
308
308
  Otherwise:
309
- Ask the user: "Are there any destructive actions, purchases, or external API calls that should require mandatory human approval (Capability Gates)?"
310
- Add these into the `## Capability & Security Gates` section of the SPEC.md.
309
+ Add these into the new `## Capability & Security Gates` section of the SPEC.md.
311
310
  </capability_gates>
312
311
 
313
312
  ### Quality Check Before Presenting
@@ -412,11 +411,11 @@ Report to the user what was accomplished, then present the next step:
412
411
  - `.planning/SPEC.md` — living specification (requirements, constraints, decisions)
413
412
  - `.planning/ROADMAP.md` — phased execution plan with success criteria
414
413
 
415
- **Next step:** `/gsdd:plan` — create a detailed plan for Phase 1
414
+ **Next step:** `/gsdd-plan` — create a detailed plan for Phase 1
416
415
 
417
416
  Also available:
418
- - `/gsdd:progress` — check overall project status
419
- - `/gsdd:map-codebase` — map existing codebase (if not already done)
417
+ - `/gsdd-progress` — check overall project status
418
+ - `/gsdd-map-codebase` — map existing codebase (if not already done)
420
419
 
421
420
  Consider clearing context before starting the next workflow for best results.
422
421
  ---