@tekyzinc/gsd-t 2.50.12 → 2.53.10

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 (99) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +379 -372
  3. package/bin/component-registry.js +250 -0
  4. package/bin/graph-cgc.js +510 -510
  5. package/bin/graph-indexer.js +147 -147
  6. package/bin/graph-overlay.js +195 -195
  7. package/bin/graph-parsers.js +327 -327
  8. package/bin/graph-query.js +453 -452
  9. package/bin/graph-store.js +154 -154
  10. package/bin/qa-calibrator.js +194 -0
  11. package/bin/scan-data-collector.js +153 -153
  12. package/bin/scan-diagrams-generators.js +187 -187
  13. package/bin/scan-diagrams.js +79 -79
  14. package/bin/scan-renderer.js +92 -92
  15. package/bin/scan-report-sections.js +121 -121
  16. package/bin/scan-report.js +184 -184
  17. package/bin/scan-schema-parsers.js +199 -199
  18. package/bin/scan-schema.js +103 -103
  19. package/bin/token-budget.js +246 -0
  20. package/commands/Claude-md.md +10 -10
  21. package/commands/branch.md +15 -15
  22. package/commands/checkin.md +45 -45
  23. package/commands/global-change.md +209 -209
  24. package/commands/gsd-t-audit.md +199 -0
  25. package/commands/gsd-t-backlog-add.md +94 -94
  26. package/commands/gsd-t-backlog-edit.md +111 -111
  27. package/commands/gsd-t-backlog-list.md +63 -63
  28. package/commands/gsd-t-backlog-move.md +94 -94
  29. package/commands/gsd-t-backlog-promote.md +123 -123
  30. package/commands/gsd-t-backlog-remove.md +86 -86
  31. package/commands/gsd-t-backlog-settings.md +158 -158
  32. package/commands/gsd-t-complete-milestone.md +528 -515
  33. package/commands/gsd-t-debug.md +506 -399
  34. package/commands/gsd-t-discuss.md +174 -174
  35. package/commands/gsd-t-execute.md +758 -634
  36. package/commands/gsd-t-feature.md +276 -276
  37. package/commands/gsd-t-health.md +142 -142
  38. package/commands/gsd-t-help.md +465 -457
  39. package/commands/gsd-t-impact.md +302 -302
  40. package/commands/gsd-t-init.md +320 -280
  41. package/commands/gsd-t-integrate.md +365 -249
  42. package/commands/gsd-t-milestone.md +87 -87
  43. package/commands/gsd-t-partition.md +442 -361
  44. package/commands/gsd-t-pause.md +82 -82
  45. package/commands/gsd-t-plan.md +345 -344
  46. package/commands/gsd-t-populate.md +111 -111
  47. package/commands/gsd-t-prd.md +326 -326
  48. package/commands/gsd-t-project.md +211 -211
  49. package/commands/gsd-t-promote-debt.md +123 -123
  50. package/commands/gsd-t-prompt.md +137 -137
  51. package/commands/gsd-t-qa.md +266 -266
  52. package/commands/gsd-t-quick.md +357 -234
  53. package/commands/gsd-t-reflect.md +134 -134
  54. package/commands/gsd-t-resume.md +72 -72
  55. package/commands/gsd-t-scan.md +615 -615
  56. package/commands/gsd-t-setup.md +76 -0
  57. package/commands/gsd-t-status.md +192 -166
  58. package/commands/gsd-t-test-sync.md +381 -381
  59. package/commands/gsd-t-triage-and-merge.md +171 -171
  60. package/commands/gsd-t-verify.md +382 -382
  61. package/commands/gsd-t-visualize.md +118 -118
  62. package/commands/gsd-t-wave.md +401 -378
  63. package/docs/GSD-T-README.md +425 -422
  64. package/docs/architecture.md +385 -369
  65. package/docs/harness-design-analysis.md +371 -0
  66. package/docs/infrastructure.md +205 -205
  67. package/docs/prd-graph-engine.md +398 -398
  68. package/docs/prd-gsd2-hybrid.md +559 -559
  69. package/docs/prd-harness-evolution.md +583 -0
  70. package/docs/requirements.md +14 -0
  71. package/docs/workflows.md +226 -226
  72. package/examples/.gsd-t/domains/example-domain/scope.md +13 -13
  73. package/package.json +40 -40
  74. package/scripts/gsd-t-auto-route.js +39 -39
  75. package/scripts/gsd-t-dashboard-mockup.html +1143 -1143
  76. package/scripts/gsd-t-dashboard-server.js +171 -171
  77. package/scripts/gsd-t-dashboard.html +262 -262
  78. package/scripts/gsd-t-event-writer.js +128 -128
  79. package/scripts/gsd-t-statusline.js +94 -94
  80. package/scripts/gsd-t-tools.js +175 -175
  81. package/templates/CLAUDE-global.md +639 -614
  82. package/templates/CLAUDE-project.md +24 -0
  83. package/templates/backlog-settings.md +18 -18
  84. package/templates/backlog.md +1 -1
  85. package/templates/progress.md +40 -40
  86. package/templates/shared-services-contract.md +60 -60
  87. package/templates/stacks/desktop.ini +2 -2
  88. package/bin/desktop.ini +0 -2
  89. package/commands/desktop.ini +0 -2
  90. package/docs/ci-examples/desktop.ini +0 -2
  91. package/docs/desktop.ini +0 -2
  92. package/examples/.gsd-t/contracts/desktop.ini +0 -2
  93. package/examples/.gsd-t/desktop.ini +0 -2
  94. package/examples/.gsd-t/domains/desktop.ini +0 -2
  95. package/examples/.gsd-t/domains/example-domain/desktop.ini +0 -2
  96. package/examples/desktop.ini +0 -2
  97. package/examples/rules/desktop.ini +0 -2
  98. package/scripts/desktop.ini +0 -2
  99. package/templates/desktop.ini +0 -2
@@ -1,515 +1,528 @@
1
- # GSD-T: Complete Milestone — Archive and Tag Release
2
-
3
- You are finalizing a completed milestone. Your job is to archive the milestone documentation, create a git tag, and prepare for the next milestone.
4
-
5
- This command is:
6
- - **Auto-invoked** by `/user:gsd-t-verify` (Step 8) after all quality gates pass — at ALL autonomy levels
7
- - **Auto-invoked** by `/user:gsd-t-wave` as part of the VERIFY+COMPLETE phase
8
- - **Standalone** when user wants to manually close a milestone
9
-
10
- ## Step 1: Verify Completion
11
-
12
- Read:
13
- 1. `.gsd-t/progress.md` — confirm status is VERIFIED
14
- 2. `.gsd-t/verify-report.md` — confirm all checks passed
15
-
16
- If status is not VERIFIED:
17
- "⚠️ Milestone not yet verified. Run `/user:gsd-t-verify` first, or use `--force` to complete anyway."
18
-
19
- If `--force` flag provided, proceed with warning in archive.
20
-
21
- ## Step 1.25: Graph-Enhanced Completion Check
22
-
23
- If `.gsd-t/graph/meta.json` exists (graph index is available):
24
- 1. Query `getEntitiesByDomain` to validate all planned entities were implemented — compare against domain task lists
25
- 2. Query `findDeadCode` to flag unreachable implementations that may indicate incomplete wiring or orphaned code
26
- 3. If missing entities or significant dead code found, block completion and report gaps
27
-
28
- If graph is not available, skip this step.
29
-
30
- ## Step 1.5: Smoke Test Artifact Gate (MANDATORY — Categories 2 and 7)
31
-
32
- Before archiving, verify that high-risk features have testable artifacts. This gate catches what code review and unit tests cannot.
33
-
34
- **Scan this milestone's domains for any of the following:**
35
- - Audio capture/playback, speech recognition/synthesis
36
- - GPU/WebGPU/WebGL compute or rendering
37
- - ML inference, model loading, quantized model execution
38
- - Background workers, service workers, IPC channels
39
- - Native APIs (camera, bluetooth, filesystem, microphone)
40
- - WebAssembly modules
41
- - Any feature whose only prior "test" was manual user interaction
42
-
43
- **For each high-risk feature found:**
44
-
45
- 1. Check that a smoke test script exists (in `scripts/`, `tests/`, or `.gsd-t/smoke-tests/`)
46
- 2. Check that the script was run and passed (evidence in token-log.md, CI output, or a `.gsd-t/smoke-tests/{feature}.md` file with run results)
47
- 3. If manual steps remain unavoidable: `.gsd-t/smoke-tests/{feature}.md` must exist documenting exact steps and confirming they passed
48
-
49
- **If any high-risk feature lacks a smoke test artifact → BLOCK completion.**
50
- Do not proceed to archiving. Create the smoke test now, run it, confirm it passes, then continue.
51
-
52
- > This gate exists because complete-milestone is the last opportunity to catch "shipped blind" features before they become user-facing bugs requiring 15 debug sessions to resolve.
53
-
54
- ## Step 1.75: Goal-Backward Verification Gate (MANDATORY)
55
-
56
- Before archiving, verify that milestone goals are actually achieved end-to-end — not just structurally present. This catches placeholder implementations that passed all quality gates.
57
-
58
- Refer to `.gsd-t/contracts/goal-backward-contract.md` for the full verification flow, placeholder patterns, and findings report format.
59
-
60
- ### 1.75.1 Check for Existing Goal-Backward Results
61
-
62
- 1. Read `.gsd-t/verify-report.md` — check if it contains a `Goal-Backward:` line
63
- 2. If the verify-report already shows `Goal-Backward: PASS` or `Goal-Backward: WARN` (no CRITICAL/HIGH), skip to Step 2
64
- 3. If no goal-backward results exist, or verify was run without this step, execute the full goal-backward check now (follow the same logic as `gsd-t-verify.md` Step 5.5)
65
-
66
- ### 1.75.2 Evaluate Goal-Backward Status
67
-
68
- **If CRITICAL or HIGH findings exist:**
69
- - Display findings report to user in the contract format
70
- - **BLOCK milestone completion** — do not proceed to archiving
71
- - Prompt:
72
- ```
73
- ⛔ Goal-Backward Verification FAILED — milestone completion blocked.
74
-
75
- Findings:
76
- {findings table}
77
-
78
- Options:
79
- 1. Fix the findings and re-run /user:gsd-t-verify
80
- 2. Override with explicit acknowledgment: re-run this command with --force-goal-backward
81
-
82
- Proceed with option 1 (recommended) or acknowledge to force completion?
83
- ```
84
- - If user provides `--force-goal-backward` flag or explicit acknowledgment: log the override and proceed with warning
85
- - Log to `.gsd-t/progress.md` Decision Log:
86
- ```
87
- - {date}: [goal-backward-override] Milestone "{name}" completed with unresolved goal-backward findings — user acknowledged. Findings: {summary}
88
- ```
89
-
90
- **If only MEDIUM findings (warnings):**
91
- - Log findings to `.gsd-t/progress.md` Decision Log:
92
- ```
93
- - {date}: [goal-backward-warn] Goal-backward check found {N} medium findings before milestone archive — {summary}. Not blocking.
94
- ```
95
- - Proceed to Step 2
96
-
97
- **If PASS (no findings):**
98
- - Log to `.gsd-t/progress.md` Decision Log:
99
- ```
100
- - {date}: [goal-backward-pass] Goal-backward verification passed — {N} requirements checked, no placeholder patterns found
101
- ```
102
- - Proceed to Step 2
103
-
104
- ---
105
-
106
- ## Step 2: Gap Analysis Gate
107
-
108
- After verification passes, run a gap analysis against `docs/requirements.md` scoped to this milestone's deliverables:
109
-
110
- 1. Identify which requirements this milestone was supposed to satisfy (from domain scopes, tasks, and milestone definition)
111
- 2. Run `gsd-t-gap-analysis` against those requirements, comparing spec to actual code
112
- 3. If **all gaps resolved** (100% Implemented) → proceed to Step 2
113
- 4. If **gaps found** (Partial, Incorrect, or Not Implemented):
114
- a. Auto-fix: execute remediation for each gap (prioritize Critical → High → Medium)
115
- b. Run affected tests (unit + integration + Playwright E2E if configured)
116
- c. Re-run `gsd-t-verify` to confirm fixes don't break anything
117
- d. Re-run gap analysis to confirm gaps are resolved
118
- e. If gaps remain after **2 fix cycles** → STOP and report unresolved gaps to user
119
-
120
- This is a **mandatory gate** — the milestone cannot be archived with known gaps against its requirements.
121
-
122
- ## Step 2.5: Distillation — Extract Milestone Patterns
123
-
124
- Before archiving, extract learning from the event stream to improve future runs.
125
-
126
- 1. Check if `.gsd-t/events/` exists and has any `.jsonl` files for this milestone period
127
- - If no events files found: skip distillation (log "No events recorded — distillation skipped"), continue to Step 3
128
- - If event-writer not installed (`node ~/.claude/scripts/gsd-t-event-writer.js 2>/dev/null || true`): skip gracefully
129
-
130
- 2. Parse events: scan `.gsd-t/events/*.jsonl` for events with `"outcome":"failure"` or `"outcome":"learning"`
131
-
132
- 3. Group by `reasoning` field value — count occurrences of each distinct reasoning string
133
-
134
- 4. For each group with ≥ 3 occurrences:
135
- - Formulate a concrete rule (e.g., "Always read X before modifying Y — failed 4 times without this")
136
- - Present to user: "Pattern found {N} times: {reasoning}. Proposed rule: '{rule}'. Add to CLAUDE.md? [y/n]"
137
- - **Wait for user confirmation before writing** (Destructive Action Guard — CLAUDE.md changes require approval)
138
- - If approved: append the rule to CLAUDE.md under the relevant section
139
- - Write event: `node ~/.claude/scripts/gsd-t-event-writer.js --type distillation --command gsd-t-complete-milestone --reasoning "{rule}" --outcome success || true`
140
-
141
- 5. If no patterns found (fewer than 3 occurrences): log "Distillation complete — no repeating patterns found"
142
-
143
- ### Step 2.5b: Rule Engine Distillation
144
-
145
- After event-stream pattern detection, run rule-based distillation using the declarative rule engine and patch lifecycle:
146
-
147
- 1. **Rule Evaluation**: Run via Bash:
148
- `node -e "const re = require('./bin/rule-engine.js'); const domains = [/* list milestone domain names */]; domains.forEach(d => { const m = re.evaluateRules(d, { projectDir: '.', milestone: '{milestone-id}' }); m.forEach(x => { console.log('FIRED: ' + x.rule.id + ' — ' + x.rule.name + ' [' + x.severity + ']'); re.recordActivation(x.rule.id, '.'); }); });" 2>/dev/null || true`
149
-
150
- 2. **Patch Candidate Generation**: For each fired rule with `action: 'patch'`, run via Bash:
151
- `node -e "const re = require('./bin/rule-engine.js'); const pl = require('./bin/patch-lifecycle.js'); const fired = [/* rule IDs from step 1 */]; fired.forEach(ruleId => { const rule = re.getActiveRules('.').find(r => r.id === ruleId); if(rule && rule.action === 'patch' && rule.patch_template_id) { const p = pl.createCandidate(ruleId, rule.patch_template_id, 0, '.'); console.log('CANDIDATE: ' + p.id + ' from ' + ruleId); } });" 2>/dev/null || true`
152
-
153
- 3. **Promotion Gate Check**: For all applied/measured patches, run via Bash:
154
- `node -e "const pl = require('./bin/patch-lifecycle.js'); ['applied','measured'].forEach(s => { pl.getPatchesByStatus(s, '.').forEach(p => { const g = pl.checkPromotionGate(p.id, '.'); if(g.passes) { pl.promote(p.id, '.'); console.log('PROMOTED: ' + p.id); } else if(p.measured_milestones && p.measured_milestones.length >= 2) { pl.deprecate(p.id, g.reason, '.'); console.log('DEPRECATED: ' + p.id + ' — ' + g.reason); } }); });" 2>/dev/null || true`
155
-
156
- 4. **Graduation**: For promoted patches sustained 3+ milestones, run via Bash:
157
- `node -e "const pl = require('./bin/patch-lifecycle.js'); pl.getPatchesByStatus('promoted', '.').forEach(p => { const r = pl.graduate(p.id, '.'); if(r.target) console.log('GRADUATED: ' + p.id + ' → ' + r.target); });" 2>/dev/null || true`
158
-
159
- 5. **Consolidation & Deprecation**: Run via Bash:
160
- `node -e "const re = require('./bin/rule-engine.js'); const f = re.flagInactiveRules(5, '.'); if(f.length) f.forEach(r => console.log('INACTIVE: ' + r.id + ' — no activations in 5+ milestones'));" 2>/dev/null || true`
161
-
162
- 6. **Quality Budget Governance**: Compute rework percentage from task-metrics. Run via Bash:
163
- `node -e "const mc = require('./bin/metrics-collector.js'); const recs = mc.readTaskMetrics({ milestone: '{milestone-id}' }, '.'); if(recs.length) { const rework = recs.filter(r => r.fix_cycles > 0).length; const pct = (rework/recs.length*100).toFixed(1); console.log('Rework: ' + pct + '% (' + rework + '/' + recs.length + ')'); if(pct > 20) console.log('⚠️ REWORK CEILING EXCEEDED — triggering constraint tightening for next milestone'); }" 2>/dev/null || true`
164
-
165
- When rework ceiling (20%) exceeded: log warning and note that next milestone should: force discuss phase, require contract review, split large tasks.
166
-
167
- ### Step 2.5c: Global Rule Promotion
168
-
169
- After local rule promotion completes, propagate newly promoted rules to global metrics:
170
-
171
- 1. **Check for promoted rules**: Run via Bash:
172
- ```bash
173
- node -e "const pl = require('./bin/patch-lifecycle.js'); const promoted = pl.getPatchesByStatus('promoted', '.'); console.log(JSON.stringify(promoted.map(p => ({ id: p.id, rule_id: p.rule_id, template_id: p.template_id }))));" 2>/dev/null || true
174
- ```
175
-
176
- 2. **Copy promoted rules to global**: For each promoted rule, run via Bash:
177
- ```bash
178
- node -e "
179
- const gsm = require('./bin/global-sync-manager.js');
180
- const re = require('./bin/rule-engine.js');
181
- const pl = require('./bin/patch-lifecycle.js');
182
- const promoted = pl.getPatchesByStatus('promoted', '.');
183
- let count = 0;
184
- for (const p of promoted) {
185
- const rule = re.getActiveRules('.').find(r => r.id === p.rule_id);
186
- if (!rule) continue;
187
- const written = gsm.writeGlobalRule({
188
- id: rule.id,
189
- original_rule: rule,
190
- source_project: (() => { try { return require('./package.json').name; } catch { return require('path').basename(process.cwd()); } })(),
191
- source_project_dir: process.cwd(),
192
- });
193
- gsm.checkUniversalPromotion(written.global_id);
194
- count++;
195
- }
196
- if (count > 0) console.log('Promoted ' + count + ' rules to global metrics');
197
- " 2>/dev/null || true
198
- ```
199
-
200
- 3. **Write global rollup entry**: Run via Bash:
201
- ```bash
202
- node -e "
203
- const gsm = require('./bin/global-sync-manager.js');
204
- const mc = require('./bin/metrics-collector.js');
205
- const mr = require('./bin/metrics-rollup.js');
206
- const name = (() => { try { return require('./package.json').name; } catch { return require('path').basename(process.cwd()); } })();
207
- const rollups = mr.readRollups({}, '.');
208
- const latest = rollups.length > 0 ? rollups[rollups.length - 1] : null;
209
- if (latest) {
210
- gsm.writeGlobalRollup({
211
- source_project: name, source_project_dir: process.cwd(),
212
- milestone: latest.milestone, version: latest.version,
213
- total_tasks: latest.total_tasks, first_pass_rate: latest.first_pass_rate,
214
- avg_duration_s: latest.avg_duration_s, total_fix_cycles: latest.total_fix_cycles,
215
- total_tokens: latest.total_tokens, elo_after: latest.elo_after,
216
- signal_distribution: latest.signal_distribution,
217
- domain_breakdown: latest.domain_breakdown,
218
- });
219
- console.log('Updated global rollup for ' + name);
220
- }
221
- " 2>/dev/null || true
222
- ```
223
-
224
- 4. **Write global signal distribution**: Run via Bash:
225
- ```bash
226
- node -e "
227
- const gsm = require('./bin/global-sync-manager.js');
228
- const mc = require('./bin/metrics-collector.js');
229
- const name = (() => { try { return require('./package.json').name; } catch { return require('path').basename(process.cwd()); } })();
230
- const allRecs = mc.readTaskMetrics({}, '.');
231
- if (allRecs.length === 0) { process.exit(0); }
232
- const counts = {};
233
- allRecs.forEach(r => { counts[r.signal_type] = (counts[r.signal_type] || 0) + 1; });
234
- const total = allRecs.length;
235
- const rates = {};
236
- for (const [k, v] of Object.entries(counts)) { rates[k] = Math.round(v / total * 1000) / 1000; }
237
- gsm.writeGlobalSignalDistribution({
238
- source_project: name, source_project_dir: process.cwd(),
239
- total_tasks: total, signal_counts: counts, signal_rates: rates,
240
- domain_type_signals: [],
241
- });
242
- console.log('Updated global signal distribution for ' + name);
243
- " 2>/dev/null || true
244
- ```
245
-
246
- 5. If no rules were promoted this milestone: skip silently (steps 3-4 still run for rollup/signal tracking).
247
-
248
- ## Step 3: Gather Milestone Artifacts
249
-
250
- Collect all files related to this milestone:
251
- - `.gsd-t/progress.md` (current state)
252
- - `.gsd-t/verify-report.md`
253
- - `.gsd-t/impact-report.md` (if exists)
254
- - `.gsd-t/test-coverage.md` (if exists)
255
- - `.gsd-t/domains/*/` (all domain folders)
256
- - `.gsd-t/contracts/` (snapshot)
257
-
258
- ## Step 4: Create Archive
259
-
260
- Create milestone archive directory:
261
-
262
- ```
263
- .gsd-t/milestones/{milestone-name}-{date}/
264
- ├── progress.md # Final state
265
- ├── verify-report.md # Verification results
266
- ├── impact-report.md # Impact analysis (if any)
267
- ├── test-coverage.md # Test sync report (if any)
268
- ├── summary.md # Generated summary (see below)
269
- ├── contracts/ # Contract snapshot at completion
270
- │ └── ...
271
- └── domains/ # Domain artifacts
272
- └── ...
273
- ```
274
-
275
- ## Step 5: Generate Summary
276
-
277
- Create `summary.md`:
278
-
279
- ```markdown
280
- # Milestone Complete: {name}
281
-
282
- **Completed**: {date}
283
- **Duration**: {start date} → {end date}
284
- **Status**: {VERIFIED | FORCED}
285
-
286
- ## What Was Built
287
- {Extract from progress.md and domain scopes}
288
-
289
- ## Domains
290
- | Domain | Tasks Completed | Key Deliverables |
291
- |--------|-----------------|------------------|
292
- | {name} | {N} | {summary} |
293
-
294
- ## Contracts Defined/Updated
295
- - {contract}: {new | updated | unchanged}
296
-
297
- ## Key Decisions
298
- {Extract from Decision Log in progress.md}
299
-
300
- ## Issues Encountered
301
- {Extract any remediation tasks or blocked items}
302
-
303
- ## Test Coverage
304
- - Tests added: {N}
305
- - Tests updated: {N}
306
- - Coverage: {if known}
307
-
308
- ## Git Tag
309
- `{tag-name}`
310
-
311
- ## Files Changed
312
- {Summary of files created/modified/deleted}
313
- ```
314
-
315
- ## Step 6: Bump Version
316
-
317
- GSD-T tracks project version in `.gsd-t/progress.md` using semantic versioning: `Major.Minor.Patch`
318
-
319
- - **Major** (X.0.0): Breaking changes, major rework, v1 launch
320
- - **Minor** (0.X.0): New features, completed feature milestones
321
- - **Patch** (0.0.X): Bug fixes, minor improvements, cleanup milestones
322
-
323
- Determine the version bump based on the milestone:
324
- 1. Read current version from `.gsd-t/progress.md`
325
- 2. Assess milestone scope:
326
- - Was this a major/breaking milestone? → bump **major**, reset minor to 0, reset patch to **10**
327
- - Was this a feature milestone? → bump **minor**, reset patch to **10**
328
- - Was this a bugfix/cleanup/debt milestone? → bump **patch** (increment by 1)
329
- - **Patch numbers are always 2 digits (≥10).** After any minor/major reset, start at 10, never 0 or 1.
330
- 3. Update version in `.gsd-t/progress.md`
331
- 4. If a package manifest exists (`package.json`, `pyproject.toml`, `Cargo.toml`, etc.), update its version to match
332
- 5. Update `README.md` version badge or version reference if present
333
- 6. Include version in the milestone summary and git tag
334
-
335
- ## Step 7: Clean Working State
336
-
337
- Reset `.gsd-t/` for next milestone:
338
-
339
- 1. Archive current domains`.gsd-t/milestones/{name}/domains/`
340
- 2. Clear `.gsd-t/domains/` (empty, ready for next partition)
341
- 3. Archive current reports milestone folder
342
- 4. Clear `.gsd-t/impact-report.md`, `.gsd-t/test-coverage.md`
343
- 5. Update `.gsd-t/progress.md`:
344
-
345
- ```markdown
346
- # GSD-T Progress
347
-
348
- ## Version: {new version}
349
- ## Current Milestone
350
- None ready for next milestone
351
-
352
- ## Completed Milestones
353
- | Milestone | Version | Completed | Tag |
354
- |-----------|---------|-----------|-----|
355
- | {name} | {version} | {date} | v{version} |
356
- | {previous} | {version} | {date} | v{version} |
357
-
358
- ## Decision Log
359
- - {date}: [success] Milestone "{name}" completed — {summary of what was built}. v{version}
360
- {Keep all prior decision log entries — they are valuable context}
361
- ```
362
-
363
- ## Step 8: Update README.md
364
-
365
- If `README.md` exists, update it to reflect the completed milestone:
366
- - Add or update a **Features** / **What's Included** section with capabilities delivered
367
- - Update version number if displayed in README
368
- - Update setup instructions if infrastructure changed
369
- - Update tech stack if new dependencies were added
370
- - Keep existing user content — merge, don't overwrite
371
-
372
- If `README.md` doesn't exist, create one with project name, description, version, tech stack, setup instructions, and link to `docs/`.
373
-
374
- ## Step 8.5: Scan Doc Milestone Checkpoint
375
-
376
- Before tagging, ensure scan docs reflect the final state of the codebase after all milestone work. This is the full-refresh counterpart to the micro-updates done during execute/quick/debug.
377
-
378
- If `.gsd-t/scan/` exists (a prior scan has been run):
379
- 1. Check `.gsd-t/scan/.cache.json` for staleness count commits since last scan
380
- 2. If **any dimension is stale** (>0 commits since scan):
381
- - Log: "Running milestone scan checkpoint — refreshing all stale scan dimensions..."
382
- - Re-run all stale dimensions using scan teammates (same team structure as `gsd-t-scan` Step 2):
383
- - Stale `architecture.md` architecture teammate (model: haiku)
384
- - Stale `quality.md` → quality teammate (model: sonnet)
385
- - Stale `security.md` security teammate (model: sonnet)
386
- - Stale `business-rules.md` → business-rules teammate (model: haiku)
387
- - Stale `contract-drift.md` contracts teammate (model: haiku)
388
- - Update `.gsd-t/scan/.cache.json` after refresh
389
- - Update `.gsd-t/techdebt.md` mark any items resolved during this milestone as `[RESOLVED]`
390
- 3. If all dimensions are fresh → skip with log: "Scan docs are fresh — no checkpoint refresh needed"
391
-
392
- If `.gsd-t/scan/` doesn't exist skip (no scan data to maintain).
393
-
394
- ## Step 8.7: Generate Metrics Rollup
395
-
396
- Generate milestone-level metrics aggregation and ELO score:
397
-
398
- 1. Run via Bash:
399
- `node bin/metrics-rollup.js {milestone-id} {version} 2>/dev/null`
400
- 2. If rollup succeeds, display:
401
- ```
402
- ## Process Metrics{milestone}
403
- - ELO: {elo_before}{elo_after} ({elo_delta > 0 ? '+' : ''}{elo_delta})
404
- - First-pass rate: {first_pass_rate * 100}%
405
- - Tasks: {total_tasks} | Fix cycles: {total_fix_cycles}
406
- - Avg duration: {avg_duration_s}s | Avg context: {avg_context_pct}%
407
- ```
408
- 3. If `trend_delta` is present (previous milestone exists), display:
409
- ```
410
- Trend vs previous: first-pass rate {delta > 0 ? '↑' : '↓'} {delta}%, duration {delta}s
411
- ```
412
- 4. If `heuristic_flags` has entries, display as warnings:
413
- ```
414
- ⚠️ Heuristic: {heuristic} ({severity}) — {description}
415
- ```
416
- 5. If rollup fails (no task-metrics data): log "No task-metrics found rollup skipped" and continue.
417
-
418
- Include ELO score in the milestone summary (Step 5) and git tag message (Step 11).
419
-
420
- ## Step 9: Document Ripple
421
-
422
- Before creating the git tag, verify all documentation is up to date:
423
-
424
- ### Always update:
425
- 1. **`.gsd-t/progress.md`** Already updated in Step 6, verify it's complete with version and milestone state
426
- 2. **`README.md`** — Already updated in Step 7, verify it reflects all delivered capabilities
427
-
428
- ### Check if affected:
429
- 3. **`docs/requirements.md`** Verify all requirements delivered in this milestone are marked as complete
430
- 4. **`docs/architecture.md`** — Verify the architecture doc matches the current system state after all milestone work
431
- 5. **`docs/workflows.md`** Verify any workflows added or changed during the milestone are documented
432
- 6. **`docs/infrastructure.md`** — If infrastructure changed during the milestone (new services, new deployment steps), verify it's documented
433
- 7. **`CLAUDE.md`** Verify any conventions established during the milestone are captured
434
- 8. **`.gsd-t/techdebt.md`** — Verify any debt resolved during the milestone is marked done, and any new debt discovered is logged
435
-
436
- ### This is the LAST GATE before tagging — nothing should be undocumented.
437
-
438
- ## Step 10: Test Verification
439
-
440
- Verify the milestone is truly complete:
441
-
442
- 1. **Run ALL configured test suites** detect and run every one:
443
- a. Unit/integration tests (vitest/jest/mocha)
444
- b. If `playwright.config.*` exists run `npx playwright test` (full suite). Unit tests alone are NEVER sufficient when E2E exists.
445
- c. If specs are missing or stale, invoke `gsd-t-test-sync` first.
446
- d. Report: "Unit: X/Y pass | E2E: X/Y pass"
447
- 2. **Verify all pass**: Every test must pass. If any fail, fix before tagging (up to 2 attempts)
448
- 3. **Functional test quality gate**: Read every Playwright spec. Verify assertions check **functional behavior** (state changed after action, data loaded, content updated, widget responded to input) — NOT just element existence (`isVisible`, `toBeAttached`, `toBeEnabled`). Shallow tests that would pass on an empty HTML page with the right element IDs are a milestone completion FAIL. Flag and rewrite before proceeding.
449
- 4. **Compare to baseline**: If a test baseline was recorded at milestone start, verify coverage has improved or at minimum not regressed
450
- 5. **Log test results**: Include test pass/fail counts and shallow test audit results in the milestone summary (Step 4)
451
-
452
- ## Step 11: Create Git Tag
453
-
454
- ```bash
455
- # Stage any remaining .gsd-t changes
456
- git add .gsd-t/
457
-
458
- # Commit the archive
459
- git commit -m "milestone({milestone-name}): complete and archive v{version}"
460
-
461
- # Create annotated tag with version
462
- git tag -a "v{version}" -m "v{version} Milestone: {name}
463
-
464
- {Brief description from summary}
465
-
466
- Domains: {list}
467
- Verified: {date}"
468
- ```
469
-
470
- ## Step 12: Report Completion
471
-
472
- ```
473
- ✅ Milestone "{name}" completed — v{version}
474
-
475
- 📁 Archived to: .gsd-t/milestones/{name}-{date}/
476
- 🏷️ Tagged as: v{version}
477
-
478
- Summary:
479
- - Version: {previous version} → {new version}
480
- - Domains completed: {N}
481
- - Tasks completed: {N}
482
- - Contracts: {N} defined/updated
483
- - Tests: {N} added/updated
484
-
485
- Next steps:
486
- - Push tags: git push origin v{version}
487
- - Start next milestone: /user:gsd-t-milestone "{next name}"
488
- - Or view roadmap: /user:gsd-t-status
489
- ```
490
-
491
- ## Step 13: Update Roadmap (if exists)
492
-
493
- If `.gsd-t/roadmap.md` exists:
494
- - Mark this milestone as complete
495
- - Update any dependent milestones
496
- - Highlight next recommended milestone
497
-
498
- ## Error Handling
499
-
500
- ### If verify failed:
501
- "Cannot complete verification found issues. Address them first or use `--force`."
502
-
503
- ### If no milestone active:
504
- "No active milestone to complete. Run `/user:gsd-t-status` to see state."
505
-
506
- ### If git operations fail:
507
- - Still create archive
508
- - Report git error
509
- - Provide manual tag command
510
-
511
- $ARGUMENTS
512
-
513
- ## Auto-Clear
514
-
515
- All work is committed to project files. Execute `/clear` to free the context window for the next command.
1
+ # GSD-T: Complete Milestone — Archive and Tag Release
2
+
3
+ You are finalizing a completed milestone. Your job is to archive the milestone documentation, create a git tag, and prepare for the next milestone.
4
+
5
+ This command is:
6
+ - **Auto-invoked** by `/user:gsd-t-verify` (Step 8) after all quality gates pass — at ALL autonomy levels
7
+ - **Auto-invoked** by `/user:gsd-t-wave` as part of the VERIFY+COMPLETE phase
8
+ - **Standalone** when user wants to manually close a milestone
9
+
10
+ ## Step 1: Verify Completion
11
+
12
+ Read:
13
+ 1. `.gsd-t/progress.md` — confirm status is VERIFIED
14
+ 2. `.gsd-t/verify-report.md` — confirm all checks passed
15
+
16
+ If status is not VERIFIED:
17
+ "⚠️ Milestone not yet verified. Run `/user:gsd-t-verify` first, or use `--force` to complete anyway."
18
+
19
+ If `--force` flag provided, proceed with warning in archive.
20
+
21
+ ## Step 1.25: Graph-Enhanced Completion Check
22
+
23
+ If `.gsd-t/graph/meta.json` exists (graph index is available):
24
+ 1. Query `getEntitiesByDomain` to validate all planned entities were implemented — compare against domain task lists
25
+ 2. Query `findDeadCode` to flag unreachable implementations that may indicate incomplete wiring or orphaned code
26
+ 3. If missing entities or significant dead code found, block completion and report gaps
27
+
28
+ If graph is not available, skip this step.
29
+
30
+ ## Step 1.5: Smoke Test Artifact Gate (MANDATORY — Categories 2 and 7)
31
+
32
+ Before archiving, verify that high-risk features have testable artifacts. This gate catches what code review and unit tests cannot.
33
+
34
+ **Scan this milestone's domains for any of the following:**
35
+ - Audio capture/playback, speech recognition/synthesis
36
+ - GPU/WebGPU/WebGL compute or rendering
37
+ - ML inference, model loading, quantized model execution
38
+ - Background workers, service workers, IPC channels
39
+ - Native APIs (camera, bluetooth, filesystem, microphone)
40
+ - WebAssembly modules
41
+ - Any feature whose only prior "test" was manual user interaction
42
+
43
+ **For each high-risk feature found:**
44
+
45
+ 1. Check that a smoke test script exists (in `scripts/`, `tests/`, or `.gsd-t/smoke-tests/`)
46
+ 2. Check that the script was run and passed (evidence in token-log.md, CI output, or a `.gsd-t/smoke-tests/{feature}.md` file with run results)
47
+ 3. If manual steps remain unavoidable: `.gsd-t/smoke-tests/{feature}.md` must exist documenting exact steps and confirming they passed
48
+
49
+ **If any high-risk feature lacks a smoke test artifact → BLOCK completion.**
50
+ Do not proceed to archiving. Create the smoke test now, run it, confirm it passes, then continue.
51
+
52
+ > This gate exists because complete-milestone is the last opportunity to catch "shipped blind" features before they become user-facing bugs requiring 15 debug sessions to resolve.
53
+
54
+ ## Step 1.75: Goal-Backward Verification Gate (MANDATORY)
55
+
56
+ Before archiving, verify that milestone goals are actually achieved end-to-end — not just structurally present. This catches placeholder implementations that passed all quality gates.
57
+
58
+ Refer to `.gsd-t/contracts/goal-backward-contract.md` for the full verification flow, placeholder patterns, and findings report format.
59
+
60
+ ### 1.75.1 Check for Existing Goal-Backward Results
61
+
62
+ 1. Read `.gsd-t/verify-report.md` — check if it contains a `Goal-Backward:` line
63
+ 2. If the verify-report already shows `Goal-Backward: PASS` or `Goal-Backward: WARN` (no CRITICAL/HIGH), skip to Step 2
64
+ 3. If no goal-backward results exist, or verify was run without this step, execute the full goal-backward check now (follow the same logic as `gsd-t-verify.md` Step 5.5)
65
+
66
+ ### 1.75.2 Evaluate Goal-Backward Status
67
+
68
+ **If CRITICAL or HIGH findings exist:**
69
+ - Display findings report to user in the contract format
70
+ - **BLOCK milestone completion** — do not proceed to archiving
71
+ - Prompt:
72
+ ```
73
+ ⛔ Goal-Backward Verification FAILED — milestone completion blocked.
74
+
75
+ Findings:
76
+ {findings table}
77
+
78
+ Options:
79
+ 1. Fix the findings and re-run /user:gsd-t-verify
80
+ 2. Override with explicit acknowledgment: re-run this command with --force-goal-backward
81
+
82
+ Proceed with option 1 (recommended) or acknowledge to force completion?
83
+ ```
84
+ - If user provides `--force-goal-backward` flag or explicit acknowledgment: log the override and proceed with warning
85
+ - Log to `.gsd-t/progress.md` Decision Log:
86
+ ```
87
+ - {date}: [goal-backward-override] Milestone "{name}" completed with unresolved goal-backward findings — user acknowledged. Findings: {summary}
88
+ ```
89
+
90
+ **If only MEDIUM findings (warnings):**
91
+ - Log findings to `.gsd-t/progress.md` Decision Log:
92
+ ```
93
+ - {date}: [goal-backward-warn] Goal-backward check found {N} medium findings before milestone archive — {summary}. Not blocking.
94
+ ```
95
+ - Proceed to Step 2
96
+
97
+ **If PASS (no findings):**
98
+ - Log to `.gsd-t/progress.md` Decision Log:
99
+ ```
100
+ - {date}: [goal-backward-pass] Goal-backward verification passed — {N} requirements checked, no placeholder patterns found
101
+ ```
102
+ - Proceed to Step 2
103
+
104
+ ---
105
+
106
+ ## Step 2: Gap Analysis Gate
107
+
108
+ After verification passes, run a gap analysis against `docs/requirements.md` scoped to this milestone's deliverables:
109
+
110
+ 1. Identify which requirements this milestone was supposed to satisfy (from domain scopes, tasks, and milestone definition)
111
+ 2. Run `gsd-t-gap-analysis` against those requirements, comparing spec to actual code
112
+ 3. If **all gaps resolved** (100% Implemented) → proceed to Step 2
113
+ 4. If **gaps found** (Partial, Incorrect, or Not Implemented):
114
+ a. Auto-fix: execute remediation for each gap (prioritize Critical → High → Medium)
115
+ b. Run affected tests (unit + integration + Playwright E2E if configured)
116
+ c. Re-run `gsd-t-verify` to confirm fixes don't break anything
117
+ d. Re-run gap analysis to confirm gaps are resolved
118
+ e. If gaps remain after **2 fix cycles** → STOP and report unresolved gaps to user
119
+
120
+ This is a **mandatory gate** — the milestone cannot be archived with known gaps against its requirements.
121
+
122
+ ## Step 2.5: Distillation — Extract Milestone Patterns
123
+
124
+ Before archiving, extract learning from the event stream to improve future runs.
125
+
126
+ 1. Check if `.gsd-t/events/` exists and has any `.jsonl` files for this milestone period
127
+ - If no events files found: skip distillation (log "No events recorded — distillation skipped"), continue to Step 3
128
+ - If event-writer not installed (`node ~/.claude/scripts/gsd-t-event-writer.js 2>/dev/null || true`): skip gracefully
129
+
130
+ 2. Parse events: scan `.gsd-t/events/*.jsonl` for events with `"outcome":"failure"` or `"outcome":"learning"`
131
+
132
+ 3. Group by `reasoning` field value — count occurrences of each distinct reasoning string
133
+
134
+ 4. For each group with ≥ 3 occurrences:
135
+ - Formulate a concrete rule (e.g., "Always read X before modifying Y — failed 4 times without this")
136
+ - Present to user: "Pattern found {N} times: {reasoning}. Proposed rule: '{rule}'. Add to CLAUDE.md? [y/n]"
137
+ - **Wait for user confirmation before writing** (Destructive Action Guard — CLAUDE.md changes require approval)
138
+ - If approved: append the rule to CLAUDE.md under the relevant section
139
+ - Write event: `node ~/.claude/scripts/gsd-t-event-writer.js --type distillation --command gsd-t-complete-milestone --reasoning "{rule}" --outcome success || true`
140
+
141
+ 5. If no patterns found (fewer than 3 occurrences): log "Distillation complete — no repeating patterns found"
142
+
143
+ ### Step 2.5b: Rule Engine Distillation
144
+
145
+ After event-stream pattern detection, run rule-based distillation using the declarative rule engine and patch lifecycle:
146
+
147
+ 1. **Rule Evaluation**: Run via Bash:
148
+ `node -e "const re = require('./bin/rule-engine.js'); const domains = [/* list milestone domain names */]; domains.forEach(d => { const m = re.evaluateRules(d, { projectDir: '.', milestone: '{milestone-id}' }); m.forEach(x => { console.log('FIRED: ' + x.rule.id + ' — ' + x.rule.name + ' [' + x.severity + ']'); re.recordActivation(x.rule.id, '.'); }); });" 2>/dev/null || true`
149
+
150
+ 2. **Patch Candidate Generation**: For each fired rule with `action: 'patch'`, run via Bash:
151
+ `node -e "const re = require('./bin/rule-engine.js'); const pl = require('./bin/patch-lifecycle.js'); const fired = [/* rule IDs from step 1 */]; fired.forEach(ruleId => { const rule = re.getActiveRules('.').find(r => r.id === ruleId); if(rule && rule.action === 'patch' && rule.patch_template_id) { const p = pl.createCandidate(ruleId, rule.patch_template_id, 0, '.'); console.log('CANDIDATE: ' + p.id + ' from ' + ruleId); } });" 2>/dev/null || true`
152
+
153
+ 3. **Promotion Gate Check**: For all applied/measured patches, run via Bash:
154
+ `node -e "const pl = require('./bin/patch-lifecycle.js'); ['applied','measured'].forEach(s => { pl.getPatchesByStatus(s, '.').forEach(p => { const g = pl.checkPromotionGate(p.id, '.'); if(g.passes) { pl.promote(p.id, '.'); console.log('PROMOTED: ' + p.id); } else if(p.measured_milestones && p.measured_milestones.length >= 2) { pl.deprecate(p.id, g.reason, '.'); console.log('DEPRECATED: ' + p.id + ' — ' + g.reason); } }); });" 2>/dev/null || true`
155
+
156
+ 4. **Graduation**: For promoted patches sustained 3+ milestones, run via Bash:
157
+ `node -e "const pl = require('./bin/patch-lifecycle.js'); pl.getPatchesByStatus('promoted', '.').forEach(p => { const r = pl.graduate(p.id, '.'); if(r.target) console.log('GRADUATED: ' + p.id + ' → ' + r.target); });" 2>/dev/null || true`
158
+
159
+ 5. **Consolidation & Deprecation**: Run via Bash:
160
+ `node -e "const re = require('./bin/rule-engine.js'); const f = re.flagInactiveRules(5, '.'); if(f.length) f.forEach(r => console.log('INACTIVE: ' + r.id + ' — no activations in 5+ milestones'));" 2>/dev/null || true`
161
+
162
+ 6. **Quality Budget Governance**: Compute rework percentage from task-metrics. Run via Bash:
163
+ `node -e "const mc = require('./bin/metrics-collector.js'); const recs = mc.readTaskMetrics({ milestone: '{milestone-id}' }, '.'); if(recs.length) { const rework = recs.filter(r => r.fix_cycles > 0).length; const pct = (rework/recs.length*100).toFixed(1); console.log('Rework: ' + pct + '% (' + rework + '/' + recs.length + ')'); if(pct > 20) console.log('⚠️ REWORK CEILING EXCEEDED — triggering constraint tightening for next milestone'); }" 2>/dev/null || true`
164
+
165
+ When rework ceiling (20%) exceeded: log warning and note that next milestone should: force discuss phase, require contract review, split large tasks.
166
+
167
+ ### Step 2.5c: Global Rule Promotion
168
+
169
+ After local rule promotion completes, propagate newly promoted rules to global metrics:
170
+
171
+ 1. **Check for promoted rules**: Run via Bash:
172
+ ```bash
173
+ node -e "const pl = require('./bin/patch-lifecycle.js'); const promoted = pl.getPatchesByStatus('promoted', '.'); console.log(JSON.stringify(promoted.map(p => ({ id: p.id, rule_id: p.rule_id, template_id: p.template_id }))));" 2>/dev/null || true
174
+ ```
175
+
176
+ 2. **Copy promoted rules to global**: For each promoted rule, run via Bash:
177
+ ```bash
178
+ node -e "
179
+ const gsm = require('./bin/global-sync-manager.js');
180
+ const re = require('./bin/rule-engine.js');
181
+ const pl = require('./bin/patch-lifecycle.js');
182
+ const promoted = pl.getPatchesByStatus('promoted', '.');
183
+ let count = 0;
184
+ for (const p of promoted) {
185
+ const rule = re.getActiveRules('.').find(r => r.id === p.rule_id);
186
+ if (!rule) continue;
187
+ const written = gsm.writeGlobalRule({
188
+ id: rule.id,
189
+ original_rule: rule,
190
+ source_project: (() => { try { return require('./package.json').name; } catch { return require('path').basename(process.cwd()); } })(),
191
+ source_project_dir: process.cwd(),
192
+ });
193
+ gsm.checkUniversalPromotion(written.global_id);
194
+ count++;
195
+ }
196
+ if (count > 0) console.log('Promoted ' + count + ' rules to global metrics');
197
+ " 2>/dev/null || true
198
+ ```
199
+
200
+ 3. **Write global rollup entry**: Run via Bash:
201
+ ```bash
202
+ node -e "
203
+ const gsm = require('./bin/global-sync-manager.js');
204
+ const mc = require('./bin/metrics-collector.js');
205
+ const mr = require('./bin/metrics-rollup.js');
206
+ const name = (() => { try { return require('./package.json').name; } catch { return require('path').basename(process.cwd()); } })();
207
+ const rollups = mr.readRollups({}, '.');
208
+ const latest = rollups.length > 0 ? rollups[rollups.length - 1] : null;
209
+ if (latest) {
210
+ gsm.writeGlobalRollup({
211
+ source_project: name, source_project_dir: process.cwd(),
212
+ milestone: latest.milestone, version: latest.version,
213
+ total_tasks: latest.total_tasks, first_pass_rate: latest.first_pass_rate,
214
+ avg_duration_s: latest.avg_duration_s, total_fix_cycles: latest.total_fix_cycles,
215
+ total_tokens: latest.total_tokens, elo_after: latest.elo_after,
216
+ signal_distribution: latest.signal_distribution,
217
+ domain_breakdown: latest.domain_breakdown,
218
+ });
219
+ console.log('Updated global rollup for ' + name);
220
+ }
221
+ " 2>/dev/null || true
222
+ ```
223
+
224
+ 4. **Write global signal distribution**: Run via Bash:
225
+ ```bash
226
+ node -e "
227
+ const gsm = require('./bin/global-sync-manager.js');
228
+ const mc = require('./bin/metrics-collector.js');
229
+ const name = (() => { try { return require('./package.json').name; } catch { return require('path').basename(process.cwd()); } })();
230
+ const allRecs = mc.readTaskMetrics({}, '.');
231
+ if (allRecs.length === 0) { process.exit(0); }
232
+ const counts = {};
233
+ allRecs.forEach(r => { counts[r.signal_type] = (counts[r.signal_type] || 0) + 1; });
234
+ const total = allRecs.length;
235
+ const rates = {};
236
+ for (const [k, v] of Object.entries(counts)) { rates[k] = Math.round(v / total * 1000) / 1000; }
237
+ gsm.writeGlobalSignalDistribution({
238
+ source_project: name, source_project_dir: process.cwd(),
239
+ total_tasks: total, signal_counts: counts, signal_rates: rates,
240
+ domain_type_signals: [],
241
+ });
242
+ console.log('Updated global signal distribution for ' + name);
243
+ " 2>/dev/null || true
244
+ ```
245
+
246
+ 5. If no rules were promoted this milestone: skip silently (steps 3-4 still run for rollup/signal tracking).
247
+
248
+ ### Step 2.5d: Component Impact Evaluation (if available)
249
+
250
+ Record impact data for each active component and log QA miss-rate for this milestone:
251
+
252
+ 1. **Record component impact** — for each domain that completed tasks, run via Bash:
253
+ `node -e "const cr = require('./bin/component-registry.js'); const domains = [/* list completed domain names */]; domains.forEach(d => cr.recordImpact(d, '{milestone-id}', '.')); " 2>/dev/null || true`
254
+
255
+ 2. **Log QA misses** — compare Red Team findings against QA report to find misses:
256
+ Run via Bash:
257
+ `node -e "const qc = require('./bin/qa-calibrator.js'); const rt = require('fs').existsSync('.gsd-t/red-team-report.md') ? require('fs').readFileSync('.gsd-t/red-team-report.md','utf8') : ''; const qa = require('fs').existsSync('.gsd-t/qa-issues.md') ? require('fs').readFileSync('.gsd-t/qa-issues.md','utf8') : ''; if(rt && qa) { const missed = qc.detectMisses(rt, qa, '.'); if(missed.length) missed.forEach(m => qc.logMiss(m.domain, m.category, m.description, '.')); console.log('QA miss-rate: ' + missed.length + ' misses logged'); } else { console.log('QA miss-rate: no data'); }" 2>/dev/null || true`
258
+
259
+ 3. If neither `bin/component-registry.js` nor `bin/qa-calibrator.js` exists, skip silently.
260
+
261
+ ## Step 3: Gather Milestone Artifacts
262
+
263
+ Collect all files related to this milestone:
264
+ - `.gsd-t/progress.md` (current state)
265
+ - `.gsd-t/verify-report.md`
266
+ - `.gsd-t/impact-report.md` (if exists)
267
+ - `.gsd-t/test-coverage.md` (if exists)
268
+ - `.gsd-t/domains/*/` (all domain folders)
269
+ - `.gsd-t/contracts/` (snapshot)
270
+
271
+ ## Step 4: Create Archive
272
+
273
+ Create milestone archive directory:
274
+
275
+ ```
276
+ .gsd-t/milestones/{milestone-name}-{date}/
277
+ ├── progress.md # Final state
278
+ ├── verify-report.md # Verification results
279
+ ├── impact-report.md # Impact analysis (if any)
280
+ ├── test-coverage.md # Test sync report (if any)
281
+ ├── summary.md # Generated summary (see below)
282
+ ├── contracts/ # Contract snapshot at completion
283
+ │ └── ...
284
+ └── domains/ # Domain artifacts
285
+ └── ...
286
+ ```
287
+
288
+ ## Step 5: Generate Summary
289
+
290
+ Create `summary.md`:
291
+
292
+ ```markdown
293
+ # Milestone Complete: {name}
294
+
295
+ **Completed**: {date}
296
+ **Duration**: {start date} → {end date}
297
+ **Status**: {VERIFIED | FORCED}
298
+
299
+ ## What Was Built
300
+ {Extract from progress.md and domain scopes}
301
+
302
+ ## Domains
303
+ | Domain | Tasks Completed | Key Deliverables |
304
+ |--------|-----------------|------------------|
305
+ | {name} | {N} | {summary} |
306
+
307
+ ## Contracts Defined/Updated
308
+ - {contract}: {new | updated | unchanged}
309
+
310
+ ## Key Decisions
311
+ {Extract from Decision Log in progress.md}
312
+
313
+ ## Issues Encountered
314
+ {Extract any remediation tasks or blocked items}
315
+
316
+ ## Test Coverage
317
+ - Tests added: {N}
318
+ - Tests updated: {N}
319
+ - Coverage: {if known}
320
+
321
+ ## Git Tag
322
+ `{tag-name}`
323
+
324
+ ## Files Changed
325
+ {Summary of files created/modified/deleted}
326
+ ```
327
+
328
+ ## Step 6: Bump Version
329
+
330
+ GSD-T tracks project version in `.gsd-t/progress.md` using semantic versioning: `Major.Minor.Patch`
331
+
332
+ - **Major** (X.0.0): Breaking changes, major rework, v1 launch
333
+ - **Minor** (0.X.0): New features, completed feature milestones
334
+ - **Patch** (0.0.X): Bug fixes, minor improvements, cleanup milestones
335
+
336
+ Determine the version bump based on the milestone:
337
+ 1. Read current version from `.gsd-t/progress.md`
338
+ 2. Assess milestone scope:
339
+ - Was this a major/breaking milestone? bump **major**, reset minor to 0, reset patch to **10**
340
+ - Was this a feature milestone? bump **minor**, reset patch to **10**
341
+ - Was this a bugfix/cleanup/debt milestone? → bump **patch** (increment by 1)
342
+ - **Patch numbers are always 2 digits (≥10).** After any minor/major reset, start at 10, never 0 or 1.
343
+ 3. Update version in `.gsd-t/progress.md`
344
+ 4. If a package manifest exists (`package.json`, `pyproject.toml`, `Cargo.toml`, etc.), update its version to match
345
+ 5. Update `README.md` version badge or version reference if present
346
+ 6. Include version in the milestone summary and git tag
347
+
348
+ ## Step 7: Clean Working State
349
+
350
+ Reset `.gsd-t/` for next milestone:
351
+
352
+ 1. Archive current domains → `.gsd-t/milestones/{name}/domains/`
353
+ 2. Clear `.gsd-t/domains/` (empty, ready for next partition)
354
+ 3. Archive current reports → milestone folder
355
+ 4. Clear `.gsd-t/impact-report.md`, `.gsd-t/test-coverage.md`
356
+ 5. Update `.gsd-t/progress.md`:
357
+
358
+ ```markdown
359
+ # GSD-T Progress
360
+
361
+ ## Version: {new version}
362
+ ## Current Milestone
363
+ None ready for next milestone
364
+
365
+ ## Completed Milestones
366
+ | Milestone | Version | Completed | Tag |
367
+ |-----------|---------|-----------|-----|
368
+ | {name} | {version} | {date} | v{version} |
369
+ | {previous} | {version} | {date} | v{version} |
370
+
371
+ ## Decision Log
372
+ - {date}: [success] Milestone "{name}" completed {summary of what was built}. v{version}
373
+ {Keep all prior decision log entries — they are valuable context}
374
+ ```
375
+
376
+ ## Step 8: Update README.md
377
+
378
+ If `README.md` exists, update it to reflect the completed milestone:
379
+ - Add or update a **Features** / **What's Included** section with capabilities delivered
380
+ - Update version number if displayed in README
381
+ - Update setup instructions if infrastructure changed
382
+ - Update tech stack if new dependencies were added
383
+ - Keep existing user content merge, don't overwrite
384
+
385
+ If `README.md` doesn't exist, create one with project name, description, version, tech stack, setup instructions, and link to `docs/`.
386
+
387
+ ## Step 8.5: Scan Doc Milestone Checkpoint
388
+
389
+ Before tagging, ensure scan docs reflect the final state of the codebase after all milestone work. This is the full-refresh counterpart to the micro-updates done during execute/quick/debug.
390
+
391
+ If `.gsd-t/scan/` exists (a prior scan has been run):
392
+ 1. Check `.gsd-t/scan/.cache.json` for staleness count commits since last scan
393
+ 2. If **any dimension is stale** (>0 commits since scan):
394
+ - Log: "Running milestone scan checkpoint — refreshing all stale scan dimensions..."
395
+ - Re-run all stale dimensions using scan teammates (same team structure as `gsd-t-scan` Step 2):
396
+ - Stale `architecture.md` architecture teammate (model: haiku)
397
+ - Stale `quality.md` → quality teammate (model: sonnet)
398
+ - Stale `security.md` security teammate (model: sonnet)
399
+ - Stale `business-rules.md` → business-rules teammate (model: haiku)
400
+ - Stale `contract-drift.md` contracts teammate (model: haiku)
401
+ - Update `.gsd-t/scan/.cache.json` after refresh
402
+ - Update `.gsd-t/techdebt.md`mark any items resolved during this milestone as `[RESOLVED]`
403
+ 3. If all dimensions are fresh skip with log: "Scan docs are fresh — no checkpoint refresh needed"
404
+
405
+ If `.gsd-t/scan/` doesn't exist skip (no scan data to maintain).
406
+
407
+ ## Step 8.7: Generate Metrics Rollup
408
+
409
+ Generate milestone-level metrics aggregation and ELO score:
410
+
411
+ 1. Run via Bash:
412
+ `node bin/metrics-rollup.js {milestone-id} {version} 2>/dev/null`
413
+ 2. If rollup succeeds, display:
414
+ ```
415
+ ## Process Metrics — {milestone}
416
+ - ELO: {elo_before} {elo_after} ({elo_delta > 0 ? '+' : ''}{elo_delta})
417
+ - First-pass rate: {first_pass_rate * 100}%
418
+ - Tasks: {total_tasks} | Fix cycles: {total_fix_cycles}
419
+ - Avg duration: {avg_duration_s}s | Avg context: {avg_context_pct}%
420
+ ```
421
+ 3. If `trend_delta` is present (previous milestone exists), display:
422
+ ```
423
+ Trend vs previous: first-pass rate {delta > 0 ? '↑' : '↓'} {delta}%, duration {delta}s
424
+ ```
425
+ 4. If `heuristic_flags` has entries, display as warnings:
426
+ ```
427
+ ⚠️ Heuristic: {heuristic} ({severity}) — {description}
428
+ ```
429
+ 5. If rollup fails (no task-metrics data): log "No task-metrics found rollup skipped" and continue.
430
+
431
+ Include ELO score in the milestone summary (Step 5) and git tag message (Step 11).
432
+
433
+ ## Step 9: Document Ripple
434
+
435
+ Before creating the git tag, verify all documentation is up to date:
436
+
437
+ ### Always update:
438
+ 1. **`.gsd-t/progress.md`** — Already updated in Step 6, verify it's complete with version and milestone state
439
+ 2. **`README.md`** — Already updated in Step 7, verify it reflects all delivered capabilities
440
+
441
+ ### Check if affected:
442
+ 3. **`docs/requirements.md`** Verify all requirements delivered in this milestone are marked as complete
443
+ 4. **`docs/architecture.md`** Verify the architecture doc matches the current system state after all milestone work
444
+ 5. **`docs/workflows.md`** Verify any workflows added or changed during the milestone are documented
445
+ 6. **`docs/infrastructure.md`** — If infrastructure changed during the milestone (new services, new deployment steps), verify it's documented
446
+ 7. **`CLAUDE.md`** Verify any conventions established during the milestone are captured
447
+ 8. **`.gsd-t/techdebt.md`** — Verify any debt resolved during the milestone is marked done, and any new debt discovered is logged
448
+
449
+ ### This is the LAST GATE before tagging nothing should be undocumented.
450
+
451
+ ## Step 10: Test Verification
452
+
453
+ Verify the milestone is truly complete:
454
+
455
+ 1. **Run ALL configured test suites** — detect and run every one:
456
+ a. Unit/integration tests (vitest/jest/mocha)
457
+ b. If `playwright.config.*` exists → run `npx playwright test` (full suite). Unit tests alone are NEVER sufficient when E2E exists.
458
+ c. If specs are missing or stale, invoke `gsd-t-test-sync` first.
459
+ d. Report: "Unit: X/Y pass | E2E: X/Y pass"
460
+ 2. **Verify all pass**: Every test must pass. If any fail, fix before tagging (up to 2 attempts)
461
+ 3. **Functional test quality gate**: Read every Playwright spec. Verify assertions check **functional behavior** (state changed after action, data loaded, content updated, widget responded to input) — NOT just element existence (`isVisible`, `toBeAttached`, `toBeEnabled`). Shallow tests that would pass on an empty HTML page with the right element IDs are a milestone completion FAIL. Flag and rewrite before proceeding.
462
+ 4. **Compare to baseline**: If a test baseline was recorded at milestone start, verify coverage has improved or at minimum not regressed
463
+ 5. **Log test results**: Include test pass/fail counts and shallow test audit results in the milestone summary (Step 4)
464
+
465
+ ## Step 11: Create Git Tag
466
+
467
+ ```bash
468
+ # Stage any remaining .gsd-t changes
469
+ git add .gsd-t/
470
+
471
+ # Commit the archive
472
+ git commit -m "milestone({milestone-name}): complete and archive v{version}"
473
+
474
+ # Create annotated tag with version
475
+ git tag -a "v{version}" -m "v{version} — Milestone: {name}
476
+
477
+ {Brief description from summary}
478
+
479
+ Domains: {list}
480
+ Verified: {date}"
481
+ ```
482
+
483
+ ## Step 12: Report Completion
484
+
485
+ ```
486
+ Milestone "{name}" completed v{version}
487
+
488
+ 📁 Archived to: .gsd-t/milestones/{name}-{date}/
489
+ 🏷️ Tagged as: v{version}
490
+
491
+ Summary:
492
+ - Version: {previous version} → {new version}
493
+ - Domains completed: {N}
494
+ - Tasks completed: {N}
495
+ - Contracts: {N} defined/updated
496
+ - Tests: {N} added/updated
497
+
498
+ Next steps:
499
+ - Push tags: git push origin v{version}
500
+ - Start next milestone: /user:gsd-t-milestone "{next name}"
501
+ - Or view roadmap: /user:gsd-t-status
502
+ ```
503
+
504
+ ## Step 13: Update Roadmap (if exists)
505
+
506
+ If `.gsd-t/roadmap.md` exists:
507
+ - Mark this milestone as complete
508
+ - Update any dependent milestones
509
+ - Highlight next recommended milestone
510
+
511
+ ## Error Handling
512
+
513
+ ### If verify failed:
514
+ "Cannot complete — verification found issues. Address them first or use `--force`."
515
+
516
+ ### If no milestone active:
517
+ "No active milestone to complete. Run `/user:gsd-t-status` to see state."
518
+
519
+ ### If git operations fail:
520
+ - Still create archive
521
+ - Report git error
522
+ - Provide manual tag command
523
+
524
+ $ARGUMENTS
525
+
526
+ ## Auto-Clear
527
+
528
+ All work is committed to project files. Execute `/clear` to free the context window for the next command.