gsdd-cli 0.3.1 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +131 -67
  2. package/agents/DISTILLATION.md +15 -13
  3. package/agents/README.md +1 -1
  4. package/agents/planner.md +2 -0
  5. package/bin/adapters/agents.mjs +1 -0
  6. package/bin/adapters/claude.mjs +20 -4
  7. package/bin/adapters/codex.mjs +9 -1
  8. package/bin/adapters/opencode.mjs +20 -5
  9. package/bin/gsdd.mjs +24 -7
  10. package/bin/lib/cli-utils.mjs +1 -1
  11. package/bin/lib/evidence-contract.mjs +112 -0
  12. package/bin/lib/file-ops.mjs +161 -0
  13. package/bin/lib/health-truth.mjs +186 -0
  14. package/bin/lib/health.mjs +72 -67
  15. package/bin/lib/init-flow.mjs +50 -3
  16. package/bin/lib/init-prompts.mjs +22 -83
  17. package/bin/lib/init-runtime.mjs +47 -25
  18. package/bin/lib/init.mjs +3 -3
  19. package/bin/lib/lifecycle-preflight.mjs +333 -0
  20. package/bin/lib/lifecycle-state.mjs +293 -0
  21. package/bin/lib/models.mjs +19 -4
  22. package/bin/lib/phase.mjs +159 -18
  23. package/bin/lib/plan-constants.mjs +30 -0
  24. package/bin/lib/provenance.mjs +165 -0
  25. package/bin/lib/rendering.mjs +8 -0
  26. package/bin/lib/runtime-freshness.mjs +239 -0
  27. package/bin/lib/session-fingerprint.mjs +106 -0
  28. package/bin/lib/templates.mjs +17 -0
  29. package/distilled/DESIGN.md +733 -49
  30. package/distilled/EVIDENCE-INDEX.md +402 -0
  31. package/distilled/README.md +73 -33
  32. package/distilled/SKILL.md +89 -85
  33. package/distilled/templates/agents.block.md +13 -84
  34. package/distilled/templates/agents.md +0 -7
  35. package/distilled/templates/delegates/plan-checker.md +6 -3
  36. package/distilled/workflows/audit-milestone.md +56 -6
  37. package/distilled/workflows/complete-milestone.md +333 -0
  38. package/distilled/workflows/execute.md +201 -19
  39. package/distilled/workflows/map-codebase.md +17 -4
  40. package/distilled/workflows/new-milestone.md +262 -0
  41. package/distilled/workflows/new-project.md +7 -6
  42. package/distilled/workflows/pause.md +40 -6
  43. package/distilled/workflows/plan-milestone-gaps.md +183 -0
  44. package/distilled/workflows/plan.md +77 -11
  45. package/distilled/workflows/progress.md +107 -29
  46. package/distilled/workflows/quick.md +23 -12
  47. package/distilled/workflows/resume.md +135 -12
  48. package/distilled/workflows/verify-work.md +260 -0
  49. package/distilled/workflows/verify.md +159 -33
  50. package/docs/BROWNFIELD-PROOF.md +95 -0
  51. package/docs/RUNTIME-SUPPORT.md +77 -0
  52. package/docs/USER-GUIDE.md +439 -0
  53. package/docs/VERIFICATION-DISCIPLINE.md +59 -0
  54. package/docs/claude/context-monitor.md +98 -0
  55. package/docs/proof/consumer-node-cli/README.md +37 -0
  56. package/docs/proof/consumer-node-cli/ROADMAP.md +14 -0
  57. package/docs/proof/consumer-node-cli/SPEC.md +17 -0
  58. package/docs/proof/consumer-node-cli/brief.md +9 -0
  59. package/docs/proof/consumer-node-cli/phases/01-foundation/01-01-PLAN.md +34 -0
  60. package/docs/proof/consumer-node-cli/phases/01-foundation/01-01-SUMMARY.md +10 -0
  61. package/docs/proof/consumer-node-cli/phases/01-foundation/01-VERIFICATION.md +30 -0
  62. package/package.json +38 -29
@@ -10,13 +10,32 @@ 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
+
19
+ <lifecycle_preflight>
20
+ Before loading checkpoint state or cleaning up any checkpoint file, run:
21
+
22
+ - `gsdd lifecycle-preflight resume`
23
+
24
+ If the preflight result is `blocked`, STOP and report the blocker instead of inferring resume eligibility from workflow-local prose.
25
+
26
+ Treat the preflight as an authorization seam over shared repo truth only:
27
+ - it may authorize or reject resume
28
+ - it does not mutate phase or milestone state
29
+ - the owned write for this workflow remains checkpoint cleanup when the user actually resumes from `.continue-here.md`
30
+ </lifecycle_preflight>
31
+
13
32
  <process>
14
33
 
15
34
  <detect_state>
16
35
  Check for project artifacts in order:
17
36
 
18
37
  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.
38
+ 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
39
  3. **Both exist** — proceed to load state.
21
40
  </detect_state>
22
41
 
@@ -44,7 +63,9 @@ Read `.planning/SPEC.md`. Extract:
44
63
  Check if `.planning/.continue-here.md` exists. If yes, read it and extract:
45
64
  - `workflow` frontmatter (phase/quick/generic)
46
65
  - `phase` frontmatter
66
+ - `runtime` frontmatter (the runtime that wrote the checkpoint; use `unknown` if field absent)
47
67
  - All 6 sections: current_state, completed_work, remaining_work, decisions, blockers, next_action
68
+ - `<judgment>` if present, including `<active_constraints>`, `<unresolved_uncertainty>`, `<decision_posture>`, and `<anti_regression>`
48
69
 
49
70
  **Phase directories:**
50
71
  Scan `.planning/phases/` for:
@@ -53,8 +74,67 @@ Scan `.planning/phases/` for:
53
74
 
54
75
  **Quick task log:**
55
76
  If `.planning/quick/LOG.md` exists, read the last entry. Check if it has a non-terminal status (not `done`/`passed`).
77
+
78
+ **Git/worktree truth:**
79
+ Collect the live integration-surface facts separately from checkpoint narrative truth:
80
+ - current branch name
81
+ - branch divergence from `main` (and tracked remote when available)
82
+ - staged pending truth
83
+ - unstaged local edits
84
+ - untracked local files
85
+ - PR presence/state when available
86
+ - whether the current branch appears stale/spent or the dirty tree appears mixed-scope
56
87
  </load_artifacts>
57
88
 
89
+ <provenance_reconciliation>
90
+ Before routing, reconstruct and compare these truth buckets explicitly:
91
+
92
+ 1. **Checkpoint narrative truth** — what `.planning/.continue-here.md` claims was happening
93
+ 2. **Planning/artifact truth** — what ROADMAP, SPEC, phase files, and quick-task logs say
94
+ 3. **Git/worktree truth** — what the live branch and working tree say now
95
+
96
+ Treat them as separate inputs. Do not flatten them into one continuity story.
97
+
98
+ Material mismatch signals include:
99
+ - checkpoint narrative describes only a narrow slice of a broader dirty tree
100
+ - current branch is stale/spent relative to the next intended integration surface
101
+ - dirty files suggest overlapping write sets or mixed phase scope
102
+
103
+ If git/worktree truth materially disagrees with checkpoint narrative truth:
104
+ - record a mismatch flag
105
+ - keep ordinary git risk warning-level by default
106
+ - require explicit user acknowledgement before routing onward
107
+ - do not allow a quick "continue" shortcut to skip that acknowledgement
108
+ </provenance_reconciliation>
109
+
110
+ <validate_checkpoint>
111
+ Only run this step when `.planning/.continue-here.md` was found in `<load_artifacts>`. If no checkpoint exists, skip this step entirely.
112
+
113
+ Cross-validate checkpoint fields against current roadmap state in this order:
114
+
115
+ 1. Extract the checkpoint `workflow` and `phase` frontmatter fields.
116
+ 2. If `phase` is non-null, look up that exact phase name in `.planning/ROADMAP.md`.
117
+ - If the matching roadmap entry is `[x]`, mark the checkpoint as stale.
118
+ - Record the specific reason in this form: `checkpoint references phase "[phase]" which is already complete [x] in ROADMAP.md`.
119
+ - Stop further staleness checks after recording this reason.
120
+ 3. If `workflow` is `phase` and `phase` is null, mark the checkpoint as potentially stale.
121
+ - Record the reason in this form: `checkpoint workflow is "phase" but checkpoint phase is missing`.
122
+ 4. If `workflow` is `phase` and `phase` is non-null but no matching roadmap entry exists, mark the checkpoint as potentially stale.
123
+ - Record the reason in this form: `checkpoint workflow is "phase" but phase "[phase]" was not found in ROADMAP.md`.
124
+ 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.
125
+ 6. If no structural staleness rule applied, skip validation cleanly. This includes `generic` or `quick` checkpoints with null `phase`.
126
+
127
+ When staleness is detected:
128
+ - Record a staleness flag and keep the full reason text.
129
+ - Record only one staleness reason string. Do not append additional reasons after the first matching rule.
130
+ - Do NOT delete the checkpoint.
131
+ - Do NOT suppress the checkpoint contents.
132
+
133
+ The output of this step is either:
134
+ - no staleness flag, or
135
+ - a staleness flag with a specific reason string that flows into `<present_status>` and `<determine_action>`.
136
+ </validate_checkpoint>
137
+
58
138
  <present_status>
59
139
  Present a compact status to the user:
60
140
 
@@ -64,10 +144,43 @@ Phase: [current] of [total] — [phase name]
64
144
  Completed: [N] phases done
65
145
 
66
146
  [If .continue-here.md exists:]
147
+ [If stale checkpoint flag set:]
148
+ ⚠ Stale checkpoint detected
149
+ Reason: [specific staleness reason]
150
+ Review the checkpoint contents below and decide whether to resume from it or continue without it.
151
+
67
152
  Checkpoint found: [workflow type] — [phase name or task description]
68
153
  Last paused: [timestamp from frontmatter]
154
+ Paused by: [runtime from checkpoint, or unknown if field absent]
155
+ Resuming in: [inferred current runtime]
69
156
  Next action: [next_action section content]
70
157
 
158
+ [If <judgment> was present in checkpoint:]
159
+ Judgment context:
160
+ Constraints:
161
+ [Full content of <active_constraints>]
162
+ Uncertainty:
163
+ [Full content of <unresolved_uncertainty>]
164
+ Posture:
165
+ [Full content of <decision_posture>]
166
+ Anti-regression:
167
+ [Full content of <anti_regression>]
168
+
169
+ [If git/worktree truth was collected:]
170
+ Git/worktree truth:
171
+ Branch: [current branch]
172
+ Divergence: [ahead/behind or unknown]
173
+ Staged: [count]
174
+ Unstaged: [count]
175
+ Untracked: [count]
176
+ PR: [open|closed|merged|none|unknown]
177
+ Integration surface: [clean | warning | stale/spent | mixed-scope]
178
+
179
+ [If material checkpoint/worktree mismatch flag set:]
180
+ ⚠ Checkpoint/worktree mismatch
181
+ The checkpoint narrative no longer matches the live branch/worktree scope.
182
+ Review both truth surfaces before choosing the next action.
183
+
71
184
  [If incomplete phase execution found:]
72
185
  Incomplete execution: Phase [N] has a PLAN but no SUMMARY
73
186
 
@@ -76,6 +189,8 @@ Incomplete quick task: [description from LOG.md]
76
189
  ```
77
190
 
78
191
  No ASCII art, no progress bars. Keep it scannable.
192
+
193
+ 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
194
  </present_status>
80
195
 
81
196
  <determine_action>
@@ -83,21 +198,25 @@ Evaluate in priority order and present the primary recommendation:
83
198
 
84
199
  **Checkpoint exists (`.continue-here.md`):**
85
200
  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
88
- - `generic` — present the next_action and let the user decide
201
+ - `phase` — route to `/gsdd-execute` (or `/gsdd-plan`/`/gsdd-verify` based on checkpoint context)
202
+ - `quick` — route to `/gsdd-quick` to complete the task
203
+ - `generic` — present the checkpoint `next_action` and let the user decide. This workflow still owns checkpoint cleanup only if the user explicitly resumes from that checkpoint, but downstream read-only `progress` routing must treat the surviving generic checkpoint as informational context rather than an automatic blocker.
204
+
205
+ 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.
206
+
207
+ 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.
89
208
 
90
209
  **Incomplete plan execution (PLAN without SUMMARY):**
91
- Route to `/gsdd:execute` for that phase.
210
+ Route to `/gsdd-execute` for that phase.
92
211
 
93
212
  **Phase needs planning (next `[ ]` phase, no PLAN file exists):**
94
- Route to `/gsdd:plan` for that phase.
213
+ Route to `/gsdd-plan` for that phase.
95
214
 
96
215
  **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).
216
+ 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
217
 
99
218
  **All phases complete (all `[x]`):**
100
- Route to `/gsdd:audit-milestone`.
219
+ Route to `/gsdd-audit-milestone`.
101
220
  </determine_action>
102
221
 
103
222
  <present_options>
@@ -112,17 +231,21 @@ What would you like to do?
112
231
  4. Something else
113
232
  ```
114
233
 
115
- **Quick-resume shortcut:** If the user says "continue", "go", or "resume" without further input, skip the options and execute the primary action directly.
234
+ **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.
235
+
236
+ **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
237
 
117
238
  Wait for user selection.
118
239
  </present_options>
119
240
 
120
241
  <cleanup_checkpoint>
121
242
  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.
243
+ - If the user chose to resume from `.continue-here.md`:
244
+ 1. Run `gsdd file-op copy .planning/.continue-here.md .planning/.continue-here.bak`.
245
+ 2. After the copy succeeds, run `gsdd file-op delete .planning/.continue-here.md`.
123
246
  - If the user chose a different action (not based on the checkpoint), leave `.continue-here.md` in place for a future resume.
124
247
 
125
- Deleting before routing ensures a failed or interrupted workflow does not leave a stale checkpoint that would mislead the next resume invocation.
248
+ 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
249
  </cleanup_checkpoint>
127
250
 
128
251
  </process>
@@ -148,5 +271,5 @@ Present to the user before dispatching:
148
271
  Consider clearing context before starting the next workflow for best results.
149
272
  ---
150
273
 
151
- Then dispatch to the selected `/gsdd:*` workflow.
274
+ Then dispatch to the selected `/gsdd-*` workflow.
152
275
  </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>