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
@@ -8,7 +8,7 @@ They reuse the same planner, executor, and verifier roles but skip research and
8
8
  <anti_patterns>
9
9
  - Do not execute before the user sees the plan preview (Step 3.7 must complete before Step 4)
10
10
  - Do not proceed past file verification gates if the expected file does not exist on disk — a plan that exists only in conversation context will be lost on compaction
11
- - Do not ask more than 2 approach clarification questions — if 3+ grey areas exist, recommend /gsdd:plan instead
11
+ - Do not ask more than 2 approach clarification questions — if 3+ grey areas exist, recommend /gsdd-plan instead
12
12
  - Do not create APPROACH.md for quick tasks — use inline $APPROACH_CONTEXT only
13
13
  - Do not update ROADMAP.md or SPEC.md from quick tasks — these are phase-level artifacts
14
14
  - Do not skip config.json reads — workflow toggles (discuss, planCheck, verifier) control flow
@@ -37,6 +37,9 @@ Store the response as `$DESCRIPTION`. If empty, re-prompt.
37
37
  2. Scan `.planning/quick/` for existing task directories. Calculate `$NEXT_NUM` as the next 3-digit number (001, 002, ...).
38
38
  3. Generate `$SLUG` from `$DESCRIPTION` (lowercase, hyphens, max 40 chars).
39
39
  4. Create `.planning/quick/$NEXT_NUM-$SLUG/`.
40
+ 5. If `.planning/codebase/` exists, read `.planning/codebase/ARCHITECTURE.md` and `.planning/codebase/STACK.md`. Summarize key findings in <=500 words as `$CODEBASE_CONTEXT`. If `.planning/codebase/` does not exist, set `$CODEBASE_CONTEXT` to empty.
41
+ 6. **Session-boundary fallback:** If `.planning/.continue-here.bak` exists, read its `<judgment>` section. Use `<active_constraints>` and `<anti_regression>` rules as task-scoping context (do not violate active constraints; do not regress on listed invariants). After reading, run `gsdd file-op delete .planning/.continue-here.bak --missing ok` (auto-clean).
42
+ 7. Inspect the live branch/worktree surface separately from checkpoint or planning artifacts. If the current branch appears stale/spent, PR-less with overlapping write scope, or otherwise like the wrong execution surface, warn before proceeding. This is advisory for quick tasks unless the mismatch makes the task description materially misleading.
40
43
 
41
44
  If `.planning/quick/` does not exist, create it along with an empty `LOG.md`:
42
45
 
@@ -98,6 +101,7 @@ Delegate to the planner role in quick mode.
98
101
  **Context to provide:**
99
102
  - Task description: `$DESCRIPTION`
100
103
  - Approach context: `$APPROACH_CONTEXT` (user-confirmed decisions from Step 2.5 — treat as locked constraints, do not revisit)
104
+ - Codebase context: `$CODEBASE_CONTEXT` (existing architecture and stack — use for orientation, not as constraints; empty if no codebase map exists)
101
105
  - Mode: quick (single plan, 1-3 tasks, no research phase)
102
106
  - Output path: `.planning/quick/$NEXT_NUM-$SLUG/$NEXT_NUM-PLAN.md`
103
107
 
@@ -171,9 +175,9 @@ Evaluate the plan against quick-scope boundaries. Read the plan file and check:
171
175
 
172
176
  | Signal | Threshold | `$SCOPE_WARNING` text |
173
177
  |--------|-----------|----------------------|
174
- | Files modified | >8 distinct files in plan | "This task touches {N} files — consider `/gsdd:plan` for full ceremony." |
175
- | Architecture keywords in `$DESCRIPTION` | contains: `refactor`, `migration`, `security`, `auth`, `API design`, `schema`, `database` | "This looks like architectural work — consider `/gsdd:plan` for approach exploration." |
176
- | New public APIs | Plan tasks create new route files, API endpoints, or exported interfaces | "New public surface area detected — consider `/gsdd:plan` for approach exploration." |
178
+ | Files modified | >8 distinct files in plan | "This task touches {N} files — consider `/gsdd-plan` for full ceremony." |
179
+ | Architecture keywords in `$DESCRIPTION` | contains: `refactor`, `migration`, `security`, `auth`, `API design`, `schema`, `database` | "This looks like architectural work — consider `/gsdd-plan` for approach exploration." |
180
+ | New public APIs | Plan tasks create new route files, API endpoints, or exported interfaces | "New public surface area detected — consider `/gsdd-plan` for approach exploration." |
177
181
 
178
182
  If any signal fires, set `$SCOPE_WARNING` to the first matching advisory text. Multiple signals concatenate.
179
183
  If no signals fire, `$SCOPE_WARNING` is empty.
@@ -212,12 +216,12 @@ Plan check issues: {$CHECKER_ISSUES}
212
216
 
213
217
  Present options (default-yes — pressing Enter proceeds):
214
218
  - If `$SCOPE_WARNING` is empty: `[Enter to proceed / edit description / abort]`
215
- - If `$SCOPE_WARNING` is non-empty: `[Enter to proceed / switch to /gsdd:plan / edit description / abort]`
219
+ - If `$SCOPE_WARNING` is non-empty: `[Enter to proceed / switch to /gsdd-plan / edit description / abort]`
216
220
 
217
221
  Handle response:
218
222
  - **Enter (or "yes"):** proceed to Step 4.
219
223
  - **"edit description":** clean up the task directory, then return to Step 1 with `$DESCRIPTION` pre-filled as the starting point.
220
- - **"switch to /gsdd:plan":** clean up the task directory, then stop quick workflow and report: "Use `/gsdd:plan` for full ceremony with approach exploration. Task description: {$DESCRIPTION}"
224
+ - **"switch to /gsdd-plan":** clean up the task directory, then stop quick workflow and report: "Use `/gsdd-plan` for full ceremony with approach exploration. Task description: {$DESCRIPTION}"
221
225
  - **"abort":** clean up the task directory, report cancellation, stop.
222
226
 
223
227
  ---
@@ -334,12 +338,12 @@ Created:
334
338
  - `.planning/quick/{next_num}-{slug}/{next_num}-VERIFICATION.md` (if verifier enabled)
335
339
  - Updated `.planning/quick/LOG.md`
336
340
 
337
- **Next step:** `/gsdd:progress` — check project status and continue phase work
341
+ **Next step:** `/gsdd-progress` — check project status and continue phase work
338
342
 
339
343
  Also available:
340
- - `/gsdd:quick` — run another quick task
341
- - `/gsdd:plan` — plan the next phase
342
- - `/gsdd:pause` — save context for later if stopping work
344
+ - `/gsdd-quick` — run another quick task
345
+ - `/gsdd-plan` — plan the next phase
346
+ - `/gsdd-pause` — save context for later if stopping work
343
347
 
344
348
  Consider clearing context before starting the next workflow for best results.
345
349
  ---
@@ -10,13 +10,19 @@ Scope boundary: unlike progress.md, you have side effects — checkpoint cleanup
10
10
  `.planning/` should exist. If it does not, route the user to `gsdd init`.
11
11
  </prerequisites>
12
12
 
13
+ <runtime_contract>
14
+ Use the `Runtime` type from `.planning/SPEC.md`.
15
+ Infer runtime from the launching surface when obvious: `.claude/` -> `claude-code`, `.codex/` or Codex portable skill -> `codex-cli`, `.opencode/` -> `opencode`, otherwise `other`.
16
+ When a checkpoint's `runtime` differs from the inferred current runtime, surface it as an informational note in `<present_status>` — it is context, not a gate.
17
+ </runtime_contract>
18
+
13
19
  <process>
14
20
 
15
21
  <detect_state>
16
22
  Check for project artifacts in order:
17
23
 
18
24
  1. **No `.planning/` directory** — route user to run `gsdd init`. Stop.
19
- 2. **No `.planning/SPEC.md` or no `.planning/ROADMAP.md`** — `.planning/` exists but the project is not fully initialized (partial init). Route user to run the `/gsdd:new-project` workflow. Stop.
25
+ 2. **No `.planning/SPEC.md` or no `.planning/ROADMAP.md`** — `.planning/` exists but the project is not fully initialized (partial init). Route user to run the `/gsdd-new-project` workflow. Stop.
20
26
  3. **Both exist** — proceed to load state.
21
27
  </detect_state>
22
28
 
@@ -44,7 +50,9 @@ Read `.planning/SPEC.md`. Extract:
44
50
  Check if `.planning/.continue-here.md` exists. If yes, read it and extract:
45
51
  - `workflow` frontmatter (phase/quick/generic)
46
52
  - `phase` frontmatter
53
+ - `runtime` frontmatter (the runtime that wrote the checkpoint; use `unknown` if field absent)
47
54
  - All 6 sections: current_state, completed_work, remaining_work, decisions, blockers, next_action
55
+ - `<judgment>` if present, including `<active_constraints>`, `<unresolved_uncertainty>`, `<decision_posture>`, and `<anti_regression>`
48
56
 
49
57
  **Phase directories:**
50
58
  Scan `.planning/phases/` for:
@@ -53,8 +61,67 @@ Scan `.planning/phases/` for:
53
61
 
54
62
  **Quick task log:**
55
63
  If `.planning/quick/LOG.md` exists, read the last entry. Check if it has a non-terminal status (not `done`/`passed`).
64
+
65
+ **Git/worktree truth:**
66
+ Collect the live integration-surface facts separately from checkpoint narrative truth:
67
+ - current branch name
68
+ - branch divergence from `main` (and tracked remote when available)
69
+ - staged pending truth
70
+ - unstaged local edits
71
+ - untracked local files
72
+ - PR presence/state when available
73
+ - whether the current branch appears stale/spent or the dirty tree appears mixed-scope
56
74
  </load_artifacts>
57
75
 
76
+ <provenance_reconciliation>
77
+ Before routing, reconstruct and compare these truth buckets explicitly:
78
+
79
+ 1. **Checkpoint narrative truth** — what `.planning/.continue-here.md` claims was happening
80
+ 2. **Planning/artifact truth** — what ROADMAP, SPEC, phase files, and quick-task logs say
81
+ 3. **Git/worktree truth** — what the live branch and working tree say now
82
+
83
+ Treat them as separate inputs. Do not flatten them into one continuity story.
84
+
85
+ Material mismatch signals include:
86
+ - checkpoint narrative describes only a narrow slice of a broader dirty tree
87
+ - current branch is stale/spent relative to the next intended integration surface
88
+ - dirty files suggest overlapping write sets or mixed phase scope
89
+
90
+ If git/worktree truth materially disagrees with checkpoint narrative truth:
91
+ - record a mismatch flag
92
+ - keep ordinary git risk warning-level by default
93
+ - require explicit user acknowledgement before routing onward
94
+ - do not allow a quick "continue" shortcut to skip that acknowledgement
95
+ </provenance_reconciliation>
96
+
97
+ <validate_checkpoint>
98
+ Only run this step when `.planning/.continue-here.md` was found in `<load_artifacts>`. If no checkpoint exists, skip this step entirely.
99
+
100
+ Cross-validate checkpoint fields against current roadmap state in this order:
101
+
102
+ 1. Extract the checkpoint `workflow` and `phase` frontmatter fields.
103
+ 2. If `phase` is non-null, look up that exact phase name in `.planning/ROADMAP.md`.
104
+ - If the matching roadmap entry is `[x]`, mark the checkpoint as stale.
105
+ - Record the specific reason in this form: `checkpoint references phase "[phase]" which is already complete [x] in ROADMAP.md`.
106
+ - Stop further staleness checks after recording this reason.
107
+ 3. If `workflow` is `phase` and `phase` is null, mark the checkpoint as potentially stale.
108
+ - Record the reason in this form: `checkpoint workflow is "phase" but checkpoint phase is missing`.
109
+ 4. If `workflow` is `phase` and `phase` is non-null but no matching roadmap entry exists, mark the checkpoint as potentially stale.
110
+ - Record the reason in this form: `checkpoint workflow is "phase" but phase "[phase]" was not found in ROADMAP.md`.
111
+ 5. If `workflow` is `phase` and `phase` matches a roadmap entry with status `[ ]` or `[-]`, do not mark it stale based only on missing execution artifacts. Continue normally.
112
+ 6. If no structural staleness rule applied, skip validation cleanly. This includes `generic` or `quick` checkpoints with null `phase`.
113
+
114
+ When staleness is detected:
115
+ - Record a staleness flag and keep the full reason text.
116
+ - Record only one staleness reason string. Do not append additional reasons after the first matching rule.
117
+ - Do NOT delete the checkpoint.
118
+ - Do NOT suppress the checkpoint contents.
119
+
120
+ The output of this step is either:
121
+ - no staleness flag, or
122
+ - a staleness flag with a specific reason string that flows into `<present_status>` and `<determine_action>`.
123
+ </validate_checkpoint>
124
+
58
125
  <present_status>
59
126
  Present a compact status to the user:
60
127
 
@@ -64,10 +131,43 @@ Phase: [current] of [total] — [phase name]
64
131
  Completed: [N] phases done
65
132
 
66
133
  [If .continue-here.md exists:]
134
+ [If stale checkpoint flag set:]
135
+ ⚠ Stale checkpoint detected
136
+ Reason: [specific staleness reason]
137
+ Review the checkpoint contents below and decide whether to resume from it or continue without it.
138
+
67
139
  Checkpoint found: [workflow type] — [phase name or task description]
68
140
  Last paused: [timestamp from frontmatter]
141
+ Paused by: [runtime from checkpoint, or unknown if field absent]
142
+ Resuming in: [inferred current runtime]
69
143
  Next action: [next_action section content]
70
144
 
145
+ [If <judgment> was present in checkpoint:]
146
+ Judgment context:
147
+ Constraints:
148
+ [Full content of <active_constraints>]
149
+ Uncertainty:
150
+ [Full content of <unresolved_uncertainty>]
151
+ Posture:
152
+ [Full content of <decision_posture>]
153
+ Anti-regression:
154
+ [Full content of <anti_regression>]
155
+
156
+ [If git/worktree truth was collected:]
157
+ Git/worktree truth:
158
+ Branch: [current branch]
159
+ Divergence: [ahead/behind or unknown]
160
+ Staged: [count]
161
+ Unstaged: [count]
162
+ Untracked: [count]
163
+ PR: [open|closed|merged|none|unknown]
164
+ Integration surface: [clean | warning | stale/spent | mixed-scope]
165
+
166
+ [If material checkpoint/worktree mismatch flag set:]
167
+ ⚠ Checkpoint/worktree mismatch
168
+ The checkpoint narrative no longer matches the live branch/worktree scope.
169
+ Review both truth surfaces before choosing the next action.
170
+
71
171
  [If incomplete phase execution found:]
72
172
  Incomplete execution: Phase [N] has a PLAN but no SUMMARY
73
173
 
@@ -76,6 +176,8 @@ Incomplete quick task: [description from LOG.md]
76
176
  ```
77
177
 
78
178
  No ASCII art, no progress bars. Keep it scannable.
179
+
180
+ Only show the staleness banner when `<validate_checkpoint>` produced a staleness flag. Even when flagged, still show the checkpoint details immediately below the banner.
79
181
  </present_status>
80
182
 
81
183
  <determine_action>
@@ -83,21 +185,25 @@ Evaluate in priority order and present the primary recommendation:
83
185
 
84
186
  **Checkpoint exists (`.continue-here.md`):**
85
187
  Route based on the `workflow` frontmatter:
86
- - `phase` — route to `/gsdd:execute` (or `/gsdd:plan`/`/gsdd:verify` based on checkpoint context)
87
- - `quick` — route to `/gsdd:quick` to complete the task
188
+ - `phase` — route to `/gsdd-execute` (or `/gsdd-plan`/`/gsdd-verify` based on checkpoint context)
189
+ - `quick` — route to `/gsdd-quick` to complete the task
88
190
  - `generic` — present the next_action and let the user decide
89
191
 
192
+ If `<validate_checkpoint>` marked the checkpoint as stale, keep the same routing logic. The user may still choose to resume from the checkpoint after reviewing the warning. If the user chooses a different path, leave the checkpoint in place and continue without it.
193
+
194
+ If `<provenance_reconciliation>` marked a material checkpoint/worktree mismatch, keep the same routing logic but require explicit acknowledgement before continuing. The workflow should not silently route onward from a materially misleading checkpoint narrative.
195
+
90
196
  **Incomplete plan execution (PLAN without SUMMARY):**
91
- Route to `/gsdd:execute` for that phase.
197
+ Route to `/gsdd-execute` for that phase.
92
198
 
93
199
  **Phase needs planning (next `[ ]` phase, no PLAN file exists):**
94
- Route to `/gsdd:plan` for that phase.
200
+ Route to `/gsdd-plan` for that phase.
95
201
 
96
202
  **Phase needs verification (SUMMARY exists but no VERIFICATION):**
97
- Route to `/gsdd:verify` for that phase (only if `workflow.verifier` is enabled in config.json; if config.json cannot be read, assume verifier is disabled).
203
+ Route to `/gsdd-verify` for that phase (only if `workflow.verifier` is enabled in config.json; if config.json cannot be read, assume verifier is disabled).
98
204
 
99
205
  **All phases complete (all `[x]`):**
100
- Route to `/gsdd:audit-milestone`.
206
+ Route to `/gsdd-audit-milestone`.
101
207
  </determine_action>
102
208
 
103
209
  <present_options>
@@ -112,17 +218,21 @@ What would you like to do?
112
218
  4. Something else
113
219
  ```
114
220
 
115
- **Quick-resume shortcut:** If the user says "continue", "go", or "resume" without further input, skip the options and execute the primary action directly.
221
+ **Quick-resume shortcut:** If there is no stale-checkpoint banner and no material checkpoint/worktree mismatch, the user may say "continue", "go", or "resume" without further input to execute the primary action directly.
222
+
223
+ **Mismatch acknowledgement:** If material checkpoint/worktree mismatch was detected, require an explicit acknowledgement such as "continue despite mismatch" or a different selected path. Do not let a bare "continue" skip the warning.
116
224
 
117
225
  Wait for user selection.
118
226
  </present_options>
119
227
 
120
228
  <cleanup_checkpoint>
121
229
  Immediately after the user confirms their action selection (before routing to the target workflow):
122
- - If the user chose to resume from `.continue-here.md`, delete it now — before dispatching to the target workflow.
230
+ - If the user chose to resume from `.continue-here.md`:
231
+ 1. Run `gsdd file-op copy .planning/.continue-here.md .planning/.continue-here.bak`.
232
+ 2. After the copy succeeds, run `gsdd file-op delete .planning/.continue-here.md`.
123
233
  - If the user chose a different action (not based on the checkpoint), leave `.continue-here.md` in place for a future resume.
124
234
 
125
- Deleting before routing ensures a failed or interrupted workflow does not leave a stale checkpoint that would mislead the next resume invocation.
235
+ Copying before deleting ensures the checkpoint survives a session crash between deletion and dispatch. `.continue-here.bak` is cleaned up by the downstream workflow after absorbing the judgment, or by the next `pause.md` run.
126
236
  </cleanup_checkpoint>
127
237
 
128
238
  </process>
@@ -148,5 +258,5 @@ Present to the user before dispatching:
148
258
  Consider clearing context before starting the next workflow for best results.
149
259
  ---
150
260
 
151
- Then dispatch to the selected `/gsdd:*` workflow.
261
+ Then dispatch to the selected `/gsdd-*` workflow.
152
262
  </completion>
@@ -0,0 +1,260 @@
1
+ <purpose>
2
+ Validate built features through conversational testing with persistent state.
3
+ Creates UAT.md that tracks test progress, survives context resets, and feeds gaps into `/gsdd-plan`.
4
+
5
+ User tests, Claude records. One test at a time. Plain text responses.
6
+ </purpose>
7
+
8
+ <philosophy>
9
+ **Show expected, ask if reality matches.**
10
+
11
+ Present what SHOULD happen. User confirms or describes what's different.
12
+ - "yes" / "y" / "pass" / empty → pass
13
+ - Anything else → logged as issue, severity inferred from natural language
14
+
15
+ No Pass/Fail buttons. No severity questions. Just: "Here's what should happen. Does it?"
16
+ </philosophy>
17
+
18
+ <load_context>
19
+ Read these before any other action:
20
+ 1. `.planning/phases/{N}-*/` — all `*-SUMMARY.md` files for the target phase
21
+ 2. `.planning/SPEC.md` — requirements and acceptance criteria
22
+ 3. `.planning/ROADMAP.md` — phase goal and must-haves
23
+
24
+ **$ARGUMENTS:** optional phase number, e.g., `/gsdd-verify-work 4`
25
+ </load_context>
26
+
27
+ <session_detection>
28
+ Before starting a new session, check for existing UAT state:
29
+
30
+ ```bash
31
+ # Check for existing UAT files in this phase
32
+ ls .planning/phases/{N}-*/*-UAT.md 2>/dev/null || echo "none"
33
+ ```
34
+
35
+ **If a UAT.md exists** with `status: testing`, offer to resume:
36
+ ```
37
+ UAT in progress: Phase {N} — {passed}/{total} tests done, {issues} issues found so far.
38
+ Reply "resume" to continue from where you left off, or "restart" to begin fresh.
39
+ ```
40
+
41
+ **If no UAT.md exists** or user says "restart", proceed to `<extract_tests>`.
42
+ </session_detection>
43
+
44
+ <extract_tests>
45
+ From each `*-SUMMARY.md` in the phase directory, extract testable deliverables:
46
+
47
+ 1. Read **Accomplishments** and **Notes for Verification** sections.
48
+ 2. Focus on **user-observable outcomes** — UI behavior, API responses, workflow outputs. Skip refactors, type changes, internal restructures.
49
+ 3. For each deliverable, define:
50
+ - `name`: brief test name
51
+ - `expected`: what the user should see or experience (specific and observable)
52
+
53
+ Examples:
54
+ - Accomplishment: "Added comment threading" → Test: "Reply to a comment" → Expected: "Clicking Reply opens inline composer. Reply appears nested under parent with visual indent."
55
+ - Accomplishment: "JWT auth with refresh rotation" → Test: "Token refresh on expiry" → Expected: "After token expires, next request silently refreshes and succeeds. User is not logged out."
56
+
57
+ Present the test list to the user for a quick scan:
58
+ ```
59
+ Phase {N} — {count} tests extracted
60
+
61
+ 1. {Test Name}
62
+ 2. {Test Name}
63
+ ...
64
+
65
+ Reply "start" to begin, or add/remove tests before starting.
66
+ ```
67
+
68
+ Wait for confirmation.
69
+ </extract_tests>
70
+
71
+ <create_uat_file>
72
+ Create `.planning/phases/{N}-{name}/{phase_num}-UAT.md`:
73
+
74
+ ```markdown
75
+ ---
76
+ status: testing
77
+ phase: {N}-{name}
78
+ source: [{list of SUMMARY.md files read}]
79
+ started: {ISO timestamp}
80
+ updated: {ISO timestamp}
81
+ ---
82
+
83
+ ## Current Test
84
+
85
+ number: 1
86
+ name: {first test name}
87
+ expected: |
88
+ {what user should observe}
89
+ awaiting: user response
90
+
91
+ ## Tests
92
+
93
+ ### 1. {Test Name}
94
+ expected: {observable behavior}
95
+ result: pending
96
+
97
+ ### 2. {Test Name}
98
+ expected: {observable behavior}
99
+ result: pending
100
+
101
+ ...
102
+
103
+ ## Summary
104
+
105
+ total: {N}
106
+ passed: 0
107
+ issues: 0
108
+ pending: {N}
109
+ skipped: 0
110
+
111
+ ## Gaps
112
+
113
+ [none yet]
114
+ ```
115
+
116
+ **MANDATORY: Write UAT.md to disk before presenting the first test.** This ensures progress survives a context reset.
117
+ </create_uat_file>
118
+
119
+ <testing_loop>
120
+ **Present one test at a time:**
121
+
122
+ ```
123
+ Test {N}/{total}: {Test Name}
124
+ ──────────────────────────────────────────────────
125
+ Expected: {what should happen}
126
+
127
+ → Reply "pass" (or just press Enter) — or describe what went wrong
128
+ ──────────────────────────────────────────────────
129
+ ```
130
+
131
+ **Process the response:**
132
+
133
+ | Response | Action |
134
+ |----------|--------|
135
+ | empty, "yes", "y", "ok", "pass", "next" | Mark `result: pass` |
136
+ | "skip", "n/a", "can't test" | Mark `result: skipped`, capture reason |
137
+ | anything else | Treat as issue description — infer severity |
138
+
139
+ **Severity inference from natural language (never ask):**
140
+
141
+ | User says | Infer |
142
+ |-----------|-------|
143
+ | "crashes", "error", "exception", "fails completely" | `blocker` |
144
+ | "doesn't work", "nothing happens", "wrong behavior" | `major` |
145
+ | "works but...", "slow", "weird", "minor" | `minor` |
146
+ | "color", "spacing", "alignment", "looks off" | `cosmetic` |
147
+ | unclear | `major` (default) |
148
+
149
+ **On issue:** Write immediately to disk (append to Gaps section):
150
+ ```yaml
151
+ - truth: "{expected behavior from test}"
152
+ status: failed
153
+ reason: "User reported: {verbatim response}"
154
+ severity: {inferred}
155
+ test: {N}
156
+ root_cause: pending
157
+ ```
158
+
159
+ **After each response:** Update Summary counts and frontmatter `updated` timestamp in UAT.md.
160
+
161
+ Advance to the next pending test. Repeat until all tests have a result.
162
+ </testing_loop>
163
+
164
+ <diagnosis_protocol>
165
+ When all tests are done and **issues > 0**, run inline diagnosis before routing to planning.
166
+
167
+ For each gap in the Gaps section:
168
+
169
+ 1. Read the source files most likely responsible (infer from the expected behavior and `*-SUMMARY.md` "Notes for Verification").
170
+ 2. Form a root-cause hypothesis:
171
+ - Look for missing implementation, wrong logic, stale wiring, or missing state.
172
+ 3. Update the gap's `root_cause` field in UAT.md:
173
+ ```yaml
174
+ root_cause: "{one-sentence hypothesis: what is missing or wrong and where}"
175
+ ```
176
+ 4. Optionally add:
177
+ ```yaml
178
+ artifacts: ["{file path}"]
179
+ missing: ["{what is absent}"]
180
+ ```
181
+
182
+ Do not attempt fixes during diagnosis — only gather evidence.
183
+
184
+ After all gaps are diagnosed, write UAT.md to disk with the updated root causes.
185
+ </diagnosis_protocol>
186
+
187
+ <complete_session>
188
+ **Finalize the UAT file:**
189
+
190
+ Update frontmatter:
191
+ ```yaml
192
+ status: complete
193
+ updated: {now}
194
+ ```
195
+
196
+ Clear the Current Test block:
197
+ ```
198
+ ## Current Test
199
+
200
+ [testing complete]
201
+ ```
202
+
203
+ Write final UAT.md to disk.
204
+
205
+ **If no issues found:**
206
+ ```
207
+ UAT complete — all {N} tests passed.
208
+
209
+ Next step: /gsdd-progress — route to next phase or milestone audit
210
+ ```
211
+
212
+ **If issues found:**
213
+
214
+ Present summary:
215
+ ```
216
+ UAT complete — Phase {N}
217
+
218
+ | Result | Count |
219
+ |---------|-------|
220
+ | Passed | {N} |
221
+ | Issues | {N} |
222
+ | Skipped | {N} |
223
+
224
+ Diagnosed {N} root cause(s). Ready to plan fixes.
225
+ ```
226
+
227
+ Then route to gap closure (see `<completion>`).
228
+ </complete_session>
229
+
230
+ <success_criteria>
231
+ - [ ] Phase SUMMARY files read before extracting tests
232
+ - [ ] UAT.md written to disk before the first test is presented
233
+ - [ ] Tests presented one at a time with specific expected behavior
234
+ - [ ] Severity inferred from description — never asked
235
+ - [ ] UAT.md updated after each issue (not batched to end)
236
+ - [ ] Inline diagnosis completed for each issue before routing to planning
237
+ - [ ] UAT.md finalized on disk with `status: complete`
238
+ </success_criteria>
239
+
240
+ <completion>
241
+ Report to the user what was tested, then present the next step:
242
+
243
+ ---
244
+ **Completed:** UAT — created `.planning/phases/{phase_dir}/{phase_num}-UAT.md`.
245
+
246
+ If no issues:
247
+ **Next step:** `/gsdd-progress` — route to next phase or milestone audit
248
+
249
+ If issues found:
250
+ **Next step:** `/gsdd-plan` — plan gap closure using the diagnosed root causes in UAT.md
251
+ - Open `.planning/phases/{phase_dir}/{phase_num}-UAT.md` for the plan context
252
+ - Use `--gaps` mode if your runtime supports it
253
+
254
+ Also available:
255
+ - `/gsdd-verify` — re-run formal phase verification after fixes are implemented
256
+ - `/gsdd-pause` — save context for later if stopping work
257
+
258
+ Consider clearing context before starting the next workflow for best results.
259
+ ---
260
+ </completion>