gsdd-cli 0.2.0 → 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 +67 -34
  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 +64 -39
  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 +267 -0
  14. package/bin/lib/init-prompts.mjs +247 -0
  15. package/bin/lib/init-runtime.mjs +226 -0
  16. package/bin/lib/init.mjs +19 -378
  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 +625 -41
  23. package/distilled/EVIDENCE-INDEX.md +297 -0
  24. package/distilled/README.md +49 -21
  25. package/distilled/SKILL.md +89 -85
  26. package/distilled/templates/agents.block.md +13 -82
  27. package/distilled/templates/agents.md +0 -7
  28. package/distilled/templates/delegates/plan-checker.md +11 -4
  29. package/distilled/workflows/audit-milestone.md +7 -5
  30. package/distilled/workflows/complete-milestone.md +297 -0
  31. package/distilled/workflows/execute.md +188 -19
  32. package/distilled/workflows/map-codebase.md +14 -7
  33. package/distilled/workflows/new-milestone.md +249 -0
  34. package/distilled/workflows/new-project.md +28 -24
  35. package/distilled/workflows/pause.md +42 -6
  36. package/distilled/workflows/plan-milestone-gaps.md +183 -0
  37. package/distilled/workflows/plan.md +78 -13
  38. package/distilled/workflows/progress.md +42 -19
  39. package/distilled/workflows/quick.md +171 -8
  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 +9 -7
@@ -282,26 +282,9 @@ Display key findings before moving to spec creation.
282
282
  **STOP. Research is complete. Do NOT write any application code. Proceed to spec creation below. Your job now is to produce SPEC.md and ROADMAP.md — not to build the project.**
283
283
 
284
284
  <data_schema_definition>
285
- **(SOTA Insight: Derived from GitHub Blog - "Multi-agent workflows often fail")**
286
- Multi-agent systems require Typed Schemas to pass reliable state. Natural language instructions fail across agent handoffs.
287
- Before writing the final SPEC.md, explicitly define the core Data Models/Typed Schemas the project will use (e.g., `type UserProfile = { id: number; plan: 'free' | 'pro' }`).
288
- These strict schemas MUST be included in the `SPEC.md` to prevent agent hallucination during the implementation phases.
289
- 6. **Typed Data Schemas**: Add the strict data models defined earlier.
290
- 7. **Done-When Verification Chain (SOTA Insight from Cyanluna)**: For EVERY single requirement in the "Must Have (v1)" section, you MUST define a clear, verifiable `[Done-When: ...]` criteria. Vague requirements like "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.
291
-
292
- *DO NOT include implementation tasks here. SPEC.md defines WHAT, not HOW.*
285
+ Before writing SPEC.md, define core Data Models/Typed Schemas *(SOTA: GitHub Blog "Multi-agent workflows often fail")*. Multi-agent systems require typed schemas to pass reliable state. These schemas MUST be included in SPEC.md (see item 7 in `<spec_creation>` below). Also define Done-When verification criteria for every requirement (see item 8). *SPEC.md defines WHAT, not HOW — do not include implementation tasks.*
293
286
  </data_schema_definition>
294
287
 
295
- <capability_gates>
296
- **(SOTA Insight: Derived from OpenFang - "16 Security Systems & Capability Gates")**
297
- Before finishing SPEC.md, explicitly define what the agents are NOT allowed to do automatically without human approval.
298
- If `autoAdvance: true`, skip this question. Add a deferred placeholder to SPEC.md:
299
- "## Capability & Security Gates\n_Deferred — auto mode cannot elicit gate preferences; requires explicit review before production deployment._"
300
- Otherwise:
301
- Ask the user: "Are there any destructive actions, purchases, or external API calls that should require mandatory human approval (Capability Gates)?"
302
- Add these into the new `## Capability & Security Gates` section of the SPEC.md.
303
- </capability_gates>
304
-
305
288
  <spec_creation>
306
289
  After the subagent research completes, synthesize EVERYTHING into `SPEC.md`:
307
290
 
@@ -311,9 +294,20 @@ After the subagent research completes, synthesize EVERYTHING into `SPEC.md`:
311
294
  4. **Requirements are ordered** by priority within each category
312
295
  5. **Out of Scope is populated** — includes things the developer explicitly said "not now" AND anti-features found in Research.
313
296
  6. **Key Decisions are logged** — any choices made during questioning or dictated by the SOTA research.
314
- 7. **Capability & Security Gates are handled explicitly** define concrete human-in-the-loop triggers in interactive mode, or add the deferred review placeholder in auto mode so the security decision is visible rather than silently omitted.
315
- 8. **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.
316
- 9. **Current State is set** to Phase 1, Status: Not started.
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
+ 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 at the end of this `<spec_creation>` block.
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
+ 11. **Current State is set** to Phase 1, Status: Not started.
302
+
303
+ <capability_gates>
304
+ **(SOTA Insight: Derived from OpenFang - "16 Security Systems & Capability Gates")**
305
+ Before finishing SPEC.md, explicitly define what the agents are NOT allowed to do automatically without human approval.
306
+ If `autoAdvance: true`, skip this question. Add a deferred placeholder to SPEC.md:
307
+ "## Capability & Security Gates\n_Deferred — auto mode cannot elicit gate preferences; requires explicit review before production deployment._"
308
+ Otherwise:
309
+ Add these into the new `## Capability & Security Gates` section of the SPEC.md.
310
+ </capability_gates>
317
311
 
318
312
  ### Quality Check Before Presenting
319
313
  - [ ] Can I explain the core value in one sentence?
@@ -331,6 +325,8 @@ Do NOT proceed to roadmap creation until the developer explicitly approves.
331
325
  **Commit**: `docs: initialize project spec`
332
326
  </spec_creation>
333
327
 
328
+ **STOP. Spec creation is complete. Verify that `.planning/SPEC.md` exists on disk with the approved content before creating the roadmap. Do NOT create ROADMAP.md from memory — read the persisted SPEC.md as input.**
329
+
334
330
  <roadmap_creation>
335
331
  After `SPEC.md` is approved, you must create `ROADMAP.md`.
336
332
  Since you are an Orchestrator with fresh context, you DO NOT need to spawn a subagent for this—write it yourself directly, retaining full thoroughness.
@@ -382,6 +378,14 @@ Do NOT proceed to planning until the developer explicitly approves.
382
378
  **Commit**: `docs: create project roadmap`
383
379
  </roadmap_creation>
384
380
 
381
+ <persistence>
382
+ MANDATORY: Both `.planning/SPEC.md` and `.planning/ROADMAP.md` must exist on disk before reporting completion.
383
+
384
+ If either file was not written (permissions issue, path problem), STOP and report the blocker to the user. Do NOT report success without persisted artifacts.
385
+
386
+ These files are consumed by every downstream workflow. Artifacts that exist only in chat context will be lost on context compression, leaving the project in an unrecoverable state.
387
+ </persistence>
388
+
385
389
  <success_criteria>
386
390
  Init is DONE when ALL of these are true:
387
391
 
@@ -407,11 +411,11 @@ Report to the user what was accomplished, then present the next step:
407
411
  - `.planning/SPEC.md` — living specification (requirements, constraints, decisions)
408
412
  - `.planning/ROADMAP.md` — phased execution plan with success criteria
409
413
 
410
- **Next step:** `/gsdd:plan` — create a detailed plan for Phase 1
414
+ **Next step:** `/gsdd-plan` — create a detailed plan for Phase 1
411
415
 
412
416
  Also available:
413
- - `/gsdd:progress` — check overall project status
414
- - `/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)
415
419
 
416
420
  Consider clearing context before starting the next workflow for best results.
417
421
  ---
@@ -12,6 +12,12 @@ Scope boundary: you write a checkpoint file. You do not route, present status, o
12
12
  If `.planning/` does not exist, stop and tell the user to run `gsdd init` first.
13
13
  </prerequisites>
14
14
 
15
+ <runtime_contract>
16
+ Use the `Runtime` type from `.planning/SPEC.md`.
17
+ Infer runtime from the launching surface when obvious: `.claude/` -> `claude-code`, `.codex/` or Codex portable skill -> `codex-cli`, `.opencode/` -> `opencode`, otherwise `other`.
18
+ Checkpoints record `runtime` only — assurance does not apply to state snapshots.
19
+ </runtime_contract>
20
+
15
21
  <process>
16
22
 
17
23
  <detect_work>
@@ -27,6 +33,8 @@ Store the detected work type as `$WORK_TYPE` (one of: `phase`, `quick`, `generic
27
33
  </detect_work>
28
34
 
29
35
  <gather_state>
36
+ Build a draft checkpoint from artifact truth before asking the user to restate work. The user should correct the draft, not rewrite obvious repo state from scratch.
37
+
30
38
  Ask the user conversationally to fill in the gaps the artifacts cannot answer:
31
39
 
32
40
  1. **What was completed** this session
@@ -35,14 +43,24 @@ Ask the user conversationally to fill in the gaps the artifacts cannot answer:
35
43
  4. **Key decisions** — any decisions made and their rationale
36
44
  5. **Blockers** — anything stuck or waiting on external input
37
45
  6. **What to do first** when resuming
46
+ 7. **Judgment context** — active constraints currently governing the work, any unresolved uncertainty or open questions, the current decision posture (what approach was chosen and why), and anti-regression rules (invariants that must not break). Pre-fill from SPEC.md constraints and APPROACH.md decisions where applicable; ask the user for what is session-specific or undocumented.
38
47
 
39
- Read the relevant artifacts to pre-fill what you can:
48
+ Read the relevant artifacts and current integration surface to pre-fill what you can:
40
49
  - For phase work: read the PLAN file and any partial SUMMARY — use these to pre-fill remaining_work and decisions where possible; only ask the user for gaps
41
50
  - For quick tasks: read the quick task PLAN and LOG.md entry — same pre-fill approach
42
- - For generic work: all six points must come from the user (no artifacts to derive from); ask all six explicitly
51
+ - For generic work: derive everything you can from repo state first, then ask only for what remains unknown
52
+
53
+ Question budget:
54
+ - Ask at most 3 high-signal questions total
55
+ - Prefer confirmation/correction prompts over open-ended recap prompts
56
+ - If repo/artifact truth already answers a point, do not ask the user to repeat it
43
57
  </gather_state>
44
58
 
45
59
  <write_checkpoint>
60
+ Before writing the new checkpoint, run `gsdd file-op delete .planning/.continue-here.bak --missing ok` to clear the prior session backup. This is cleanup-only and should no-op safely if the backup is absent.
61
+
62
+ When the current branch/worktree is known to be evidence-only, stale/spent, or otherwise not the next intended execution surface, say that explicitly in `<current_state>`, `<remaining_work>`, and `<anti_regression>`. Do not flatten evidence-only local state into the same continuity story as the next execution surface.
63
+
46
64
  Write `.planning/.continue-here.md` with the following structure:
47
65
 
48
66
  ```markdown
@@ -50,6 +68,7 @@ Write `.planning/.continue-here.md` with the following structure:
50
68
  workflow: $WORK_TYPE
51
69
  phase: $PHASE_NAME_OR_NULL
52
70
  timestamp: $ISO_8601_TIMESTAMP
71
+ runtime: $INFERRED_RUNTIME
53
72
  ---
54
73
 
55
74
  <current_state>
@@ -75,11 +94,28 @@ timestamp: $ISO_8601_TIMESTAMP
75
94
  <next_action>
76
95
  [The specific first thing to do when resuming — concrete enough for a fresh session to act on immediately]
77
96
  </next_action>
97
+
98
+ <judgment>
99
+ <active_constraints>
100
+ [Constraints currently governing the work — from SPEC.md, APPROACH.md, or discovered during execution. Include constraint source.]
101
+ </active_constraints>
102
+ <unresolved_uncertainty>
103
+ [Open questions, unvalidated assumptions, areas where the approach may need revision. Include why each matters.]
104
+ </unresolved_uncertainty>
105
+ <decision_posture>
106
+ [Current strategic direction — what approach was chosen, what alternatives were rejected, what the governing trade-off is.]
107
+ </decision_posture>
108
+ <anti_regression>
109
+ [Rules that must hold — invariants, previously-verified behaviors that must not break, scope boundaries that must not expand.]
110
+ </anti_regression>
111
+ </judgment>
78
112
  ```
79
113
 
80
114
  The checkpoint is project-scoped (lives at `.planning/.continue-here.md`, not inside a phase directory) so resume always knows where to look.
81
115
  </write_checkpoint>
82
116
 
117
+ **MANDATORY: `.planning/.continue-here.md` must exist on disk after writing. If the file was not created, STOP and report the failure. The entire purpose of this workflow is to persist context — a failed write means the pause did nothing.**
118
+
83
119
  <advisory_git>
84
120
  Read `.planning/config.json` for the `gitProtocol` section. If config.json cannot be read, skip git advice.
85
121
 
@@ -92,7 +128,7 @@ Example suggestion: "You may want to commit your current changes as a WIP before
92
128
  Report to the user:
93
129
  - Checkpoint location: `.planning/.continue-here.md`
94
130
  - Work type captured (phase/quick/generic)
95
- - How to resume: run the `/gsdd:resume` workflow in the next session
131
+ - How to resume: run the `/gsdd-resume` workflow in the next session
96
132
  </confirm>
97
133
 
98
134
  </process>
@@ -100,7 +136,7 @@ Report to the user:
100
136
  <success_criteria>
101
137
  - [ ] Active work context detected (phase, quick, or generic)
102
138
  - [ ] User provided missing context via conversation
103
- - [ ] `.planning/.continue-here.md` created with frontmatter and all 6 sections
139
+ - [ ] `.planning/.continue-here.md` created with frontmatter, all 6 sections, and <judgment> block
104
140
  - [ ] Advisory git suggestion presented (not mandated)
105
141
  - [ ] User informed of checkpoint location and resume instructions
106
142
  </success_criteria>
@@ -111,10 +147,10 @@ Report to the user what was accomplished, then present the next step:
111
147
  ---
112
148
  **Completed:** Session paused — created `.planning/.continue-here.md` (checkpoint file).
113
149
 
114
- **Next step (next session):** `/gsdd:resume` — restore context and continue where you left off
150
+ **Next step (next session):** `/gsdd-resume` — restore context and continue where you left off
115
151
 
116
152
  Also available:
117
- - `/gsdd:progress` — check project status without restoring checkpoint context
153
+ - `/gsdd-progress` — check project status without restoring checkpoint context
118
154
 
119
155
  Consider clearing context before starting the next workflow for best results.
120
156
  ---
@@ -0,0 +1,183 @@
1
+ <role>
2
+ You are the GAP CLOSURE PLANNER. Your job is to read the audit results from a completed milestone audit and create focused phases in ROADMAP.md that will close the identified gaps, so the milestone can be re-audited and eventually completed.
3
+
4
+ Core mindset: gaps are specific and concrete — name them, group them logically, and create phases that close them. Do not create vague "cleanup" phases.
5
+
6
+ Scope boundary: you create gap closure phases in ROADMAP.md. You do not plan the phases — that is `/gsdd-plan` territory. You do not close the gaps yourself.
7
+ </role>
8
+
9
+ <prerequisites>
10
+ `.planning/ROADMAP.md` must exist.
11
+ `.planning/SPEC.md` must exist.
12
+ A `.planning/v*-MILESTONE-AUDIT.md` file must exist with `status: gaps_found`.
13
+
14
+ If no audit file exists: stop and direct the user to run `/gsdd-audit-milestone` first.
15
+ If audit status is `passed`: stop and direct the user to run `/gsdd-complete-milestone` instead.
16
+ </prerequisites>
17
+
18
+ <load_context>
19
+ Before starting, read these files:
20
+
21
+ 1. `.planning/v*-MILESTONE-AUDIT.md` (most recent) — gap details, requirement failures, integration issues, broken flows
22
+ 2. `.planning/SPEC.md` — requirement priorities (v1/v2), requirement descriptions
23
+ 3. `.planning/ROADMAP.md` — existing phases (to determine phase numbering continuation)
24
+ </load_context>
25
+
26
+ <process>
27
+
28
+ ## 1. Load Audit Gaps
29
+
30
+ Parse the MILESTONE-AUDIT.md. Extract all gap objects:
31
+ - **Requirement gaps** — requirements marked unsatisfied with reason and missing evidence
32
+ - **Integration gaps** — cross-phase wiring failures (e.g., module A exports not consumed by module B)
33
+ - **Flow gaps** — E2E user flows broken at specific steps
34
+
35
+ For each gap, note:
36
+ - Gap type (requirement / integration / flow)
37
+ - Priority: derive from SPEC.md (`v1` requirement = must close, `v2` = optional)
38
+ - What is missing or broken
39
+
40
+ If no gaps are found after parsing, stop and direct the user to `/gsdd-complete-milestone`.
41
+
42
+ ## 2. Prioritize Gaps
43
+
44
+ Sort gaps into two buckets:
45
+
46
+ **Must close** (v1 requirements, or integration/flow gaps affecting v1 requirements):
47
+ - These must become phases. The milestone cannot complete until they are resolved.
48
+
49
+ **Optional** (v2 requirements, low-severity integration gaps):
50
+ - Present to user: include in this milestone or defer?
51
+
52
+ Present the gap summary:
53
+
54
+ ```
55
+ ## Gap Analysis
56
+
57
+ Must close ([N] gaps):
58
+ - [REQ-ID]: [description] — [reason it failed]
59
+ - Integration [Phase X → Phase Y]: [what is missing]
60
+ - Flow "[flow name]": broken at [step]
61
+
62
+ Optional ([M] gaps):
63
+ - [REQ-ID]: [description] (v2 priority)
64
+ ```
65
+
66
+ **STOP. Ask the user which optional gaps to include.**
67
+
68
+ Exception: if `config.json -> mode` is `yolo`, include all must-close gaps and skip optional gaps.
69
+
70
+ ## 3. Group Gaps into Phases
71
+
72
+ Cluster the selected gaps into logical phases using these rules:
73
+ - Same affected phase or subsystem → combine into one gap closure phase
74
+ - Dependency order: fix broken foundations before wiring dependents
75
+ - Keep phases focused: 2-4 tasks each
76
+ - Name phases after what they fix, not just "Gap Closure"
77
+
78
+ **Example grouping:**
79
+
80
+ ```
81
+ Gaps:
82
+ - AUTH-03 unsatisfied (password reset flow missing)
83
+ - Integration: Session → Dashboard (auth header not passed)
84
+ - Flow "Reset password" broken at email dispatch
85
+
86
+ → Phase N: "Auth Reset Flow"
87
+ - Implement password reset email dispatch
88
+ - Wire session auth header to dashboard API calls
89
+ - Test reset flow end-to-end
90
+ ```
91
+
92
+ ## 4. Determine Phase Numbers
93
+
94
+ Find the highest existing phase number in ROADMAP.md. New gap closure phases continue from there.
95
+
96
+ Example: if ROADMAP.md has Phases 1–5, gap closure phases start at Phase 6.
97
+
98
+ ## 5. Present Gap Closure Plan
99
+
100
+ Present the proposed gap closure phases for confirmation:
101
+
102
+ ```
103
+ ## Gap Closure Plan
104
+
105
+ Milestone: v[X.Y]
106
+ Gaps to close: [N] requirement, [M] integration, [K] flow
107
+
108
+ **Phase [N]: [Name]**
109
+ Closes:
110
+ - [REQ-ID]: [description]
111
+ - Integration: [from] → [to]
112
+ Estimated tasks: [2-4]
113
+
114
+ **Phase [N+1]: [Name]**
115
+ Closes:
116
+ - [REQ-ID]: [description]
117
+ Estimated tasks: [2-4]
118
+ ```
119
+
120
+ **STOP. Wait for user confirmation before writing to ROADMAP.md.**
121
+
122
+ If the user requests adjustments, revise and re-present.
123
+
124
+ ## 6. Add Phases to ROADMAP.md
125
+
126
+ Once confirmed, append the gap closure phases below the existing phases in ROADMAP.md:
127
+
128
+ ```markdown
129
+ ### v[X.Y] Gap Closure
130
+
131
+ - [ ] **Phase [N]: [Name]** — [goal]
132
+ - [ ] **Phase [N+1]: [Name]** — [goal]
133
+ ```
134
+
135
+ If the current ROADMAP.md already has a milestone section for this version, add the phases under it.
136
+
137
+ ## 7. Create Phase Directories
138
+
139
+ Create a directory for each gap closure phase:
140
+
141
+ ```
142
+ .planning/phases/[NN]-[phase-name-kebab]/
143
+ ```
144
+
145
+ No files inside — `/gsdd-plan` populates them.
146
+
147
+ </process>
148
+
149
+ <success_criteria>
150
+ - [ ] MILESTONE-AUDIT.md loaded and all gaps parsed
151
+ - [ ] Gaps categorized by type (requirement / integration / flow) and priority (must / optional)
152
+ - [ ] User confirmed which optional gaps to include
153
+ - [ ] Gaps grouped into logical phases with clear goals
154
+ - [ ] Phase numbering continues from highest existing phase
155
+ - [ ] User confirmed gap closure plan before ROADMAP.md was updated
156
+ - [ ] ROADMAP.md updated with new gap closure phases
157
+ - [ ] Phase directories created
158
+ </success_criteria>
159
+
160
+ **MANDATORY: `.planning/ROADMAP.md` must be updated on disk before this workflow is complete. If the write fails, STOP and report the failure. Without the updated ROADMAP, the phase cycle cannot begin.**
161
+
162
+ <completion>
163
+ Report to the user what was created, then present the next step:
164
+
165
+ ---
166
+ **Completed:** Gap closure plan created.
167
+
168
+ Created:
169
+ - [N] gap closure phases in `ROADMAP.md` (Phases [start]–[end])
170
+ - Phase directories in `.planning/phases/`
171
+
172
+ Gaps addressed:
173
+ - [brief summary of what the phases close]
174
+
175
+ **Next step:** `/gsdd-plan [N]` — plan Phase [N]: [phase name]
176
+
177
+ After all gap closure phases complete:
178
+ - `/gsdd-audit-milestone` — re-audit to verify gaps are closed
179
+ - `/gsdd-complete-milestone` — archive when audit passes
180
+
181
+ Consider clearing context before starting the next workflow for best results.
182
+ ---
183
+ </completion>
@@ -13,17 +13,42 @@ Before starting, read these files:
13
13
  4. `.planning/phases/*-APPROACH.md` - approach decisions from user discussion (if exists)
14
14
  5. `.planning/phases/*-PLAN.md` - any previous plans that affect this phase
15
15
  6. Relevant source code - if this phase builds on existing code, read the key files
16
-
16
+ 7. `.planning/phases/*-SUMMARY.md` for the prior completed phase - if a `<judgment>` section is present, read all four sub-sections. The `<judgment>` carries forward active constraints, unresolved uncertainty, decision posture, and anti-regression rules from the prior phase. Honor these as input context alongside SPEC.md decisions and APPROACH.md choices.
17
+ 8. **Session-boundary fallback:** If no prior completed phase SUMMARY.md with a `<judgment>` section was found in step 7, check whether `.planning/.continue-here.bak` exists. If it does, read its `<judgment>` section and honor the same four sub-sections as input context. After reading, run `gsdd file-op delete .planning/.continue-here.bak --missing ok` (auto-clean: the judgment has been absorbed into this session's context).
17
18
  Identify the target phase: the first phase with status `[ ]` or `[-]` in `ROADMAP.md`.
18
19
  </load_context>
19
20
 
21
+ <integration_surface_check>
22
+ Before planning roadmap work, inspect the live integration surface separately from checkpoint or planning artifacts:
23
+ - current branch name
24
+ - divergence from `main` when available
25
+ - staged, unstaged, and untracked local truth
26
+ - whether the current branch appears stale/spent or mixed-scope
27
+
28
+ If the planning truth says "next phase is X" but the git/worktree truth says the current branch is a stale or mixed execution surface, warn explicitly and treat the dirty branch as evidence only. Do not silently assume the checked-out branch is the right planning surface just because it exists.
29
+ </integration_surface_check>
30
+
31
+ <runtime_contract>
32
+ Use the `Runtime` and `Assurance` types from `.planning/SPEC.md`.
33
+ Infer runtime from the launching surface when obvious: `.claude/` -> `claude-code`, `.codex/` or Codex portable skill -> `codex-cli`, `.opencode/` -> `opencode`, otherwise `other`.
34
+ Assurance is ordered: `unreviewed` -> `self_checked` -> `cross_runtime_checked`.
35
+ Same-runtime helpers never count as cross-runtime evidence.
36
+ </runtime_contract>
37
+
38
+ <assurance_check>
39
+ After `<load_context>`, compare the current planning pass against the strongest upstream artifact available: same-phase prior plan first, otherwise prior completed phase SUMMARY or VERIFICATION.
40
+ Use `unreviewed` before any checker result, `self_checked` for planner self-check or same-runtime checker, and `cross_runtime_checked` only for a different runtime/vendor checker.
41
+ If current assurance is lower, write a structured `<assurance_check>` near the top of the plan body with `source_artifact`, `source_runtime`, `source_assurance`, `current_runtime`, `current_assurance`, `status`, and `warning`.
42
+ If upstream runtime/assurance is missing, use `status: unknown`.
43
+ </assurance_check>
44
+
20
45
  <context_fidelity>
21
46
  Before planning, acknowledge what is locked:
22
-
23
47
  - Decisions in `.planning/SPEC.md` "Key Decisions" - do not revisit them.
24
48
  - Decisions in APPROACH.md "Implementation Decisions" - these are user-validated choices. Implement the chosen approaches, not alternatives. "Agent's Discretion" items give you flexibility.
25
49
  - Patterns from previous phases - match existing conventions. Do not introduce new patterns without cause.
26
50
  - Deferred items - items marked v2, nice-to-have, or out of scope in SPEC.md or APPROACH.md. Do not plan for them.
51
+ - Cross-check: if SPEC.md and APPROACH.md disagree on whether an item is must-have or deferred, stop and ask the user before planning. Do not silently adopt one classification over the other.
27
52
 
28
53
  If you need to challenge a locked decision: stop, ask the developer, and document the new decision explicitly.
29
54
  </context_fidelity>
@@ -58,9 +83,30 @@ Write to `.planning/research/{phase_number}-RESEARCH.md` with sections:
58
83
  - Research for this phase already exists and is still fresh
59
84
  - The phase uses only technologies already established in previous phases
60
85
 
61
- Quality gate: do not proceed to goal-backward planning if you have unresolved uncertainties about the implementation approach.
86
+ Quality gate: do not proceed to goal-backward planning if you have unresolved uncertainties about the implementation approach. If research was skipped (skip conditions above apply), document the skip reason in the plan Notes section so the plan checker can verify the skip was justified.
62
87
  </research_check>
63
88
 
89
+ <spec_quality_check>
90
+ ### When This Runs
91
+ After research_check, before goal_backward_planning.
92
+
93
+ ### Classify Each Phase Requirement and Success Criterion
94
+ For each requirement and success criterion in this phase, assign one of:
95
+ - **Resolved**: the behavior is testable, the Done-When is unambiguous, and the decision is locked (codebase fact or explicit SPEC.md/APPROACH.md decision). Proceed.
96
+ - **Open**: the requirement depends on a product or UX decision that has not been made. Cannot proceed.
97
+ - **Ambiguous**: there are two or more reasonable interpretations of what "done" means. Cannot proceed.
98
+
99
+ Trigger questions per item:
100
+ - Is the Done-When criterion specific enough to write a verify command for?
101
+ - Does this require a product or UX decision that is absent from SPEC.md, APPROACH.md, or ROADMAP.md?
102
+ - Would two different developers reasonably implement this differently based only on the requirement text?
103
+
104
+ ### Quality Gate
105
+ - If all items are **Resolved**: proceed to goal_backward_planning.
106
+ - If any item is **Open** or **Ambiguous**: STOP. Report each item with the specific question that would resolve it. Do not produce an execution-ready plan until the user resolves these items.
107
+ - Exception — **minor technical ambiguity** (e.g., exact error message wording, logging format) that does not change user-facing behavior: note it as a warning in the plan Notes section and proceed. Do not use this exception for behavioral or acceptance-criteria ambiguity.
108
+ </spec_quality_check>
109
+
64
110
  <goal_backward_planning>
65
111
  Plan backward from success criteria.
66
112
 
@@ -96,6 +142,8 @@ phase: 01-foundation
96
142
  plan: 01
97
143
  type: execute
98
144
  wave: 1
145
+ runtime: claude-code
146
+ assurance: self_checked
99
147
  depends_on: []
100
148
  files-modified:
101
149
  - src/lib/auth.ts
@@ -196,6 +244,8 @@ phase: 01-foundation
196
244
  plan: 01
197
245
  type: execute
198
246
  wave: 1
247
+ runtime: claude-code
248
+ assurance: self_checked
199
249
  depends_on: []
200
250
  files-modified:
201
251
  - src/routes/users.ts
@@ -231,6 +281,16 @@ must_haves:
231
281
  1. [Observable truth from ROADMAP.md]
232
282
  2. [Observable truth from ROADMAP.md]
233
283
 
284
+ <checks>
285
+ <plan_check>
286
+ checker: self | cross_runtime
287
+ checker_runtime: claude-code
288
+ status: passed | issues_found | skipped
289
+ blocking: false
290
+ notes: [What the checker actually validated or why it was skipped]
291
+ </plan_check>
292
+ </checks>
293
+
234
294
  ## Tasks
235
295
 
236
296
  <task id="01-01" type="auto">
@@ -250,6 +310,8 @@ must_haves:
250
310
  ## Notes
251
311
  [Gotchas, implementation notes, or explicit assumptions]
252
312
  ```
313
+
314
+ **MANDATORY: You MUST write PLAN.md to disk at `.planning/phases/{phase_dir}/{plan_id}-PLAN.md`. Output to conversation alone is NOT sufficient. If this file is not written to disk, planning is NOT complete.**
253
315
  </plan_structure>
254
316
 
255
317
  <approach_exploration>
@@ -340,10 +402,9 @@ After the planner produces a draft plan, an independent checker reviews it in fr
340
402
  5. `scope_sanity` - plans are sized so an executor can complete them without context collapse
341
403
  6. `must_have_quality` - success criteria are specific, observable, and reflected in tasks
342
404
  7. `context_compliance` - locked decisions are honored and deferred ideas stay out of scope
343
- 8. `approach_alignment` - when APPROACH.md exists, plans implement the chosen approaches, not alternatives. Blocker if plan contradicts an explicit user choice. Warning if plan drifts from recommendation without justification. Skipped when no APPROACH.md is provided.
344
-
405
+ 8. `goal_achievement` - the plan, if executed perfectly, actually achieves the stated phase goal: goal addressed (tasks deliver the goal), success criteria reachable (each criterion traceable to a task verify output), and outcome observable (a human or automated check can confirm the goal was met)
406
+ 9. `approach_alignment` - when APPROACH.md exists, plans implement the chosen approaches, not alternatives. Blocker if plan contradicts an explicit user choice. Warning if plan drifts from recommendation without justification. Skipped when no APPROACH.md is provided.
345
407
  ### Invoking the Checker
346
-
347
408
  1. If `.planning/config.json` has `workflow.planCheck: false`, skip the independent checker. Perform the planner self-check below and report `reduced_assurance`.
348
409
  2. If plan checking is enabled, check if your runtime provides a `gsdd-plan-checker` agent.
349
410
  3. If a native checker agent is available, invoke it in a fresh context with only these explicit inputs:
@@ -359,7 +420,7 @@ After the planner produces a draft plan, an independent checker reviews it in fr
359
420
  "summary": "One sentence overall assessment",
360
421
  "issues": [
361
422
  {
362
- "dimension": "requirement_coverage | task_completeness | dependency_correctness | key_link_completeness | scope_sanity | must_have_quality | context_compliance | approach_alignment",
423
+ "dimension": "requirement_coverage | task_completeness | dependency_correctness | key_link_completeness | scope_sanity | must_have_quality | context_compliance | goal_achievement | approach_alignment",
363
424
  "severity": "blocker | warning",
364
425
  "description": "What is wrong",
365
426
  "plan": "01-PLAN",
@@ -374,9 +435,12 @@ After the planner produces a draft plan, an independent checker reviews it in fr
374
435
  6. If the checker returns `issues_found`, revise the existing plan files only where needed, then invoke the checker again.
375
436
  7. Maximum 3 checker cycles total. If blockers remain after cycle 3, stop and escalate to the user instead of pretending the plan is ready.
376
437
  8. If no native checker agent is available in your runtime, perform the planner self-check below and explicitly report `reduced_assurance` rather than claiming an independent checker ran.
377
-
438
+ When the checker outcome is finalized, write the result into the plan artifact:
439
+ - checker ran in same runtime or planner self-check only -> set frontmatter `assurance: self_checked`
440
+ - checker ran in a different runtime/vendor and passed -> set frontmatter `assurance: cross_runtime_checked`
441
+ - draft exists before any checker result is recorded -> keep `assurance: unreviewed`
442
+ - record the structured outcome in the plan's `<checks>` block; do not leave the checker result only in chat context
378
443
  ### Orchestration Summary
379
-
380
444
  After plan checking completes, report:
381
445
  - target phase
382
446
  - whether independent plan checking ran
@@ -400,7 +464,6 @@ For every success criterion from `ROADMAP.md`:
400
464
  - [ ] At least one task produces an artifact that satisfies it
401
465
  - [ ] The task's `<verify>` section checks it specifically
402
466
  - [ ] The criterion is covered explicitly, not only implied
403
-
404
467
  ### Check Task Completeness
405
468
  For each task:
406
469
  - [ ] The `<files>` section lists every file to create or modify
@@ -429,6 +492,8 @@ Planning is done when all of these are true:
429
492
  - [ ] Success criteria from `ROADMAP.md` are represented as must-haves
430
493
  - [ ] Goal-backward derivation from criteria to artifacts to key links to tasks is explicit
431
494
  - [ ] Every plan has frontmatter with `phase`, `plan`, `type`, `wave`, `depends_on`, `files-modified`, `autonomous`, `requirements`, and `must_haves`
495
+ - [ ] Every plan frontmatter records `runtime` and `assurance`
496
+ - [ ] Every plan records checker outcome in a structured `<checks>` block
432
497
  - [ ] Every task has XML structure with `id`, `type`, `files`, `action`, `verify`, and `done`
433
498
  - [ ] Every task has at least one runnable verify command
434
499
  - [ ] Plan sizing stays within 2-5 tasks, preferring 2-3
@@ -442,11 +507,11 @@ Report to the user what was accomplished, then present the next step:
442
507
  ---
443
508
  **Completed:** Phase planning — created `.planning/phases/{phase_dir}/{plan_id}-PLAN.md`.
444
509
 
445
- **Next step:** `/gsdd:execute` — execute the plan
510
+ **Next step:** `/gsdd-execute` — execute the plan
446
511
 
447
512
  Also available:
448
- - `/gsdd:plan` — create additional plans for the same phase (if multi-wave)
449
- - `/gsdd:progress` — check overall project status
513
+ - `/gsdd-plan` — create additional plans for the same phase (if multi-wave)
514
+ - `/gsdd-progress` — check overall project status
450
515
 
451
516
  Consider clearing context before starting the next workflow for best results.
452
517
  ---