@tekyzinc/gsd-t 3.12.14 → 3.13.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.
@@ -9,6 +9,10 @@ This command is:
9
9
 
10
10
  ## Step 1: Verify Completion
11
11
 
12
+ ```bash
13
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-complete-milestone --step 1 --step-label "Verify Completion" 2>/dev/null || true
14
+ ```
15
+
12
16
  Read:
13
17
  1. `.gsd-t/progress.md` — confirm status is VERIFIED
14
18
  2. `.gsd-t/verify-report.md` — confirm all checks passed
@@ -20,6 +24,10 @@ If `--force` flag provided, proceed with warning in archive.
20
24
 
21
25
  ## Step 1.25: Graph-Enhanced Completion Check
22
26
 
27
+ ```bash
28
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-complete-milestone --step 1 --step-label ".25: Graph-Enhanced Completion Check" 2>/dev/null || true
29
+ ```
30
+
23
31
  If `.gsd-t/graph/meta.json` exists (graph index is available):
24
32
  1. Query `getEntitiesByDomain` to validate all planned entities were implemented — compare against domain task lists
25
33
  2. Query `findDeadCode` to flag unreachable implementations that may indicate incomplete wiring or orphaned code
@@ -29,6 +37,10 @@ If graph is not available, skip this step.
29
37
 
30
38
  ## Step 1.5: Smoke Test Artifact Gate (MANDATORY — Categories 2 and 7)
31
39
 
40
+ ```bash
41
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-complete-milestone --step 1 --step-label ".5: Smoke Test Artifact Gate (MANDATORY — Categories 2 and 7)" 2>/dev/null || true
42
+ ```
43
+
32
44
  Before archiving, verify that high-risk features have testable artifacts. This gate catches what code review and unit tests cannot.
33
45
 
34
46
  **Scan this milestone's domains for any of the following:**
@@ -53,6 +65,10 @@ Do not proceed to archiving. Create the smoke test now, run it, confirm it passe
53
65
 
54
66
  ## Step 1.75: Goal-Backward Verification Gate (MANDATORY)
55
67
 
68
+ ```bash
69
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-complete-milestone --step 1 --step-label ".75: Goal-Backward Verification Gate (MANDATORY)" 2>/dev/null || true
70
+ ```
71
+
56
72
  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
73
 
58
74
  Refer to `.gsd-t/contracts/goal-backward-contract.md` for the full verification flow, placeholder patterns, and findings report format.
@@ -105,6 +121,10 @@ Refer to `.gsd-t/contracts/goal-backward-contract.md` for the full verification
105
121
 
106
122
  ## Step 2: Gap Analysis Gate
107
123
 
124
+ ```bash
125
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-complete-milestone --step 2 --step-label "Gap Analysis Gate" 2>/dev/null || true
126
+ ```
127
+
108
128
  After verification passes, run a gap analysis against `docs/requirements.md` scoped to this milestone's deliverables:
109
129
 
110
130
  1. Identify which requirements this milestone was supposed to satisfy (from domain scopes, tasks, and milestone definition)
@@ -121,6 +141,10 @@ This is a **mandatory gate** — the milestone cannot be archived with known gap
121
141
 
122
142
  ## Step 2.5: Distillation — Extract Milestone Patterns
123
143
 
144
+ ```bash
145
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-complete-milestone --step 2 --step-label ".5: Distillation — Extract Milestone Patterns" 2>/dev/null || true
146
+ ```
147
+
124
148
  Before archiving, extract learning from the event stream to improve future runs.
125
149
 
126
150
  1. Check if `.gsd-t/events/` exists and has any `.jsonl` files for this milestone period
@@ -142,6 +166,10 @@ Before archiving, extract learning from the event stream to improve future runs.
142
166
 
143
167
  ### Step 2.5b: Rule Engine Distillation
144
168
 
169
+ ```bash
170
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-complete-milestone --step 2 --step-label ".5b: Rule Engine Distillation" 2>/dev/null || true
171
+ ```
172
+
145
173
  After event-stream pattern detection, run rule-based distillation using the declarative rule engine and patch lifecycle:
146
174
 
147
175
  1. **Rule Evaluation**: Run via Bash:
@@ -166,6 +194,10 @@ After event-stream pattern detection, run rule-based distillation using the decl
166
194
 
167
195
  ### Step 2.5c: Global Rule Promotion
168
196
 
197
+ ```bash
198
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-complete-milestone --step 2 --step-label ".5c: Global Rule Promotion" 2>/dev/null || true
199
+ ```
200
+
169
201
  After local rule promotion completes, propagate newly promoted rules to global metrics:
170
202
 
171
203
  1. **Check for promoted rules**: Run via Bash:
@@ -247,6 +279,10 @@ After local rule promotion completes, propagate newly promoted rules to global m
247
279
 
248
280
  ### Step 2.5d: Component Impact Evaluation (if available)
249
281
 
282
+ ```bash
283
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-complete-milestone --step 2 --step-label ".5d: Component Impact Evaluation (if available)" 2>/dev/null || true
284
+ ```
285
+
250
286
  Record impact data for each active component:
251
287
 
252
288
  1. **Record component impact** — for each domain that completed tasks, run via Bash:
@@ -256,6 +292,10 @@ Record impact data for each active component:
256
292
 
257
293
  ## Step 3: Gather Milestone Artifacts
258
294
 
295
+ ```bash
296
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-complete-milestone --step 3 --step-label "Gather Milestone Artifacts" 2>/dev/null || true
297
+ ```
298
+
259
299
  Collect all files related to this milestone:
260
300
  - `.gsd-t/progress.md` (current state)
261
301
  - `.gsd-t/verify-report.md`
@@ -266,6 +306,10 @@ Collect all files related to this milestone:
266
306
 
267
307
  ## Step 4: Create Archive
268
308
 
309
+ ```bash
310
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-complete-milestone --step 4 --step-label "Create Archive" 2>/dev/null || true
311
+ ```
312
+
269
313
  Create milestone archive directory:
270
314
 
271
315
  ```
@@ -283,6 +327,10 @@ Create milestone archive directory:
283
327
 
284
328
  ## Step 5: Generate Summary
285
329
 
330
+ ```bash
331
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-complete-milestone --step 5 --step-label "Generate Summary" 2>/dev/null || true
332
+ ```
333
+
286
334
  Create `summary.md`:
287
335
 
288
336
  ```markdown
@@ -323,6 +371,10 @@ Create `summary.md`:
323
371
 
324
372
  ## Step 6: Bump Version
325
373
 
374
+ ```bash
375
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-complete-milestone --step 6 --step-label "Bump Version" 2>/dev/null || true
376
+ ```
377
+
326
378
  GSD-T tracks project version in `.gsd-t/progress.md` using semantic versioning: `Major.Minor.Patch`
327
379
 
328
380
  - **Major** (X.0.0): Breaking changes, major rework, v1 launch
@@ -343,6 +395,10 @@ Determine the version bump based on the milestone:
343
395
 
344
396
  ## Step 7: Clean Working State
345
397
 
398
+ ```bash
399
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-complete-milestone --step 7 --step-label "Clean Working State" 2>/dev/null || true
400
+ ```
401
+
346
402
  Reset `.gsd-t/` for next milestone:
347
403
 
348
404
  1. Archive current domains → `.gsd-t/milestones/{name}/domains/`
@@ -351,6 +407,14 @@ Reset `.gsd-t/` for next milestone:
351
407
  4. Clear `.gsd-t/impact-report.md`, `.gsd-t/test-coverage.md`
352
408
  5. Update `.gsd-t/progress.md`:
353
409
 
410
+ **CRITICAL — Decision Log Trim**: This trim happens AFTER Step 4's archive copy of `.gsd-t/progress.md` is written. The archive snapshot at `.gsd-t/milestones/{name}-{date}/progress.md` is the source-of-truth for full history. The live Decision Log is reset to the just-completed milestone's entries only — everything dated before the milestone's start date is deleted from the live file (it remains in the archive). This prevents the live progress.md from growing without bound.
411
+
412
+ Steps to apply the trim:
413
+ - Identify the just-completed milestone's start date (typically the `[milestone-defined]` entry for this milestone)
414
+ - Delete all Decision Log entries dated BEFORE that start date from the live `.gsd-t/progress.md`
415
+ - Keep entries from the start date onward (they cover the milestone arc + the completion entry you're about to add)
416
+ - Prepend the pointer line shown below
417
+
354
418
  ```markdown
355
419
  # GSD-T Progress
356
420
 
@@ -365,12 +429,19 @@ None — ready for next milestone
365
429
  | {previous} | {version} | {date} | v{version} |
366
430
 
367
431
  ## Decision Log
432
+
433
+ > Prior decision log entries preserved in `.gsd-t/milestones/*/progress.md` — see archive snapshots for pre-{next-milestone-name} history.
434
+
368
435
  - {date}: [success] Milestone "{name}" completed — {summary of what was built}. v{version}
369
- {Keep all prior decision log entries they are valuable context}
436
+ {Trim: delete all decision-log entries older than the just-completed milestone's start date. Those entries are preserved in the milestone archive created in Step 4. Keep only the completion entry above plus any entries logged on or after the cutoff — typically the live log is near-empty when the next milestone begins.}
370
437
  ```
371
438
 
372
439
  ## Step 8: Update README.md
373
440
 
441
+ ```bash
442
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-complete-milestone --step 8 --step-label "Update README.md" 2>/dev/null || true
443
+ ```
444
+
374
445
  If `README.md` exists, update it to reflect the completed milestone:
375
446
  - Add or update a **Features** / **What's Included** section with capabilities delivered
376
447
  - Update version number if displayed in README
@@ -382,6 +453,10 @@ If `README.md` doesn't exist, create one with project name, description, version
382
453
 
383
454
  ## Step 8.5: Scan Doc Milestone Checkpoint
384
455
 
456
+ ```bash
457
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-complete-milestone --step 8 --step-label ".5: Scan Doc Milestone Checkpoint" 2>/dev/null || true
458
+ ```
459
+
385
460
  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.
386
461
 
387
462
  If `.gsd-t/scan/` exists (a prior scan has been run):
@@ -402,6 +477,10 @@ If `.gsd-t/scan/` doesn't exist → skip (no scan data to maintain).
402
477
 
403
478
  ## Step 8.7: Generate Metrics Rollup
404
479
 
480
+ ```bash
481
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-complete-milestone --step 8 --step-label ".7: Generate Metrics Rollup" 2>/dev/null || true
482
+ ```
483
+
405
484
  Generate milestone-level metrics aggregation and ELO score:
406
485
 
407
486
  1. Run via Bash:
@@ -428,6 +507,10 @@ Include ELO score in the milestone summary (Step 5) and git tag message (Step 11
428
507
 
429
508
  ## Step 9: Document Ripple
430
509
 
510
+ ```bash
511
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-complete-milestone --step 9 --step-label "Document Ripple" 2>/dev/null || true
512
+ ```
513
+
431
514
  Before creating the git tag, verify all documentation is up to date:
432
515
 
433
516
  ### Always update:
@@ -446,6 +529,10 @@ Before creating the git tag, verify all documentation is up to date:
446
529
 
447
530
  ## Step 10: Test Verification
448
531
 
532
+ ```bash
533
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-complete-milestone --step 10 --step-label "Test Verification" 2>/dev/null || true
534
+ ```
535
+
449
536
  Verify the milestone is truly complete:
450
537
 
451
538
  1. **Run ALL configured test suites** — detect and run every one:
@@ -460,6 +547,10 @@ Verify the milestone is truly complete:
460
547
 
461
548
  ## Step 11: Create Git Tag
462
549
 
550
+ ```bash
551
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-complete-milestone --step 11 --step-label "Create Git Tag" 2>/dev/null || true
552
+ ```
553
+
463
554
  ```bash
464
555
  # Stage any remaining .gsd-t changes
465
556
  git add .gsd-t/
@@ -478,6 +569,10 @@ Verified: {date}"
478
569
 
479
570
  ## Step 12: Report Completion
480
571
 
572
+ ```bash
573
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-complete-milestone --step 12 --step-label "Report Completion" 2>/dev/null || true
574
+ ```
575
+
481
576
  ```
482
577
  ✅ Milestone "{name}" completed — v{version}
483
578
 
@@ -499,6 +594,10 @@ Next steps:
499
594
 
500
595
  ## Step 13: Update Roadmap (if exists)
501
596
 
597
+ ```bash
598
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-complete-milestone --step 13 --step-label "Update Roadmap (if exists)" 2>/dev/null || true
599
+ ```
600
+
502
601
  If `.gsd-t/roadmap.md` exists:
503
602
  - Mark this milestone as complete
504
603
  - Update any dependent milestones
@@ -26,6 +26,10 @@ Per `.gsd-t/contracts/model-selection-contract.md` v1.0.0.
26
26
 
27
27
  ## Step 0.1: Launch via Subagent
28
28
 
29
+ ```bash
30
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-debug --step 0 --step-label ".1: Launch via Subagent" 2>/dev/null || true
31
+ ```
32
+
29
33
  To give this debug session a fresh context window and prevent compaction, always execute via a Task subagent.
30
34
 
31
35
  **If you are the orchestrating agent** (you received the slash command directly):
@@ -117,6 +121,10 @@ Continue to Step 1 below.
117
121
 
118
122
  ## Step 1: Load Context
119
123
 
124
+ ```bash
125
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-debug --step 1 --step-label "Load Context" 2>/dev/null || true
126
+ ```
127
+
120
128
  Read:
121
129
  1. `CLAUDE.md`
122
130
  2. `.gsd-t/progress.md`
@@ -125,6 +133,10 @@ Read:
125
133
 
126
134
  ## Step 1.5: Debug Loop Detection (MANDATORY)
127
135
 
136
+ ```bash
137
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-debug --step 1 --step-label ".5: Debug Loop Detection (MANDATORY)" 2>/dev/null || true
138
+ ```
139
+
128
140
  Before attempting any fix, check whether this issue has been through multiple failed debug sessions. This prevents the 10–20 attempt death spiral that happens when the same approach is retried repeatedly.
129
141
 
130
142
  **Detection:**
@@ -207,6 +219,10 @@ Please select an option (or provide your own direction) before I proceed.
207
219
 
208
220
  ## Step 1.7: Experience Retrieval
209
221
 
222
+ ```bash
223
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-debug --step 1 --step-label ".7: Experience Retrieval" 2>/dev/null || true
224
+ ```
225
+
210
226
  Before proceeding to classification and fix, retrieve relevant past failures from the Decision Log.
211
227
 
212
228
  Run via Bash:
@@ -223,6 +239,10 @@ If no results found: proceed normally to Step 2.
223
239
 
224
240
  ## Step 1.7: Graph-Enhanced Root Cause Tracing (if available)
225
241
 
242
+ ```bash
243
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-debug --step 1 --step-label ".7: Graph-Enhanced Root Cause Tracing (if available)" 2>/dev/null || true
244
+ ```
245
+
226
246
  If `.gsd-t/graph/meta.json` exists, use the graph to accelerate root cause identification:
227
247
 
228
248
  1. **Call chain from error**: `query('getCallers', { entity: '{error_function}' })` → trace backward from the error location
@@ -235,6 +255,10 @@ Graph results replace the manual "classify the bug" analysis in Step 2 — the c
235
255
 
236
256
  ## Step 2: Classify the Bug
237
257
 
258
+ ```bash
259
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-debug --step 2 --step-label "Classify the Bug" 2>/dev/null || true
260
+ ```
261
+
238
262
  Based on the user's description ($ARGUMENTS) and graph analysis (if available), determine:
239
263
 
240
264
  ### A) Within-Domain Bug
@@ -265,6 +289,10 @@ The contract didn't specify something it should have. Symptoms:
265
289
 
266
290
  ## Step 2.5: Reproduce First (MANDATORY — Category 5)
267
291
 
292
+ ```bash
293
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-debug --step 2 --step-label ".5: Reproduce First (MANDATORY — Category 5)" 2>/dev/null || true
294
+ ```
295
+
268
296
  **A fix attempt without a reproduction script is a guess, not a fix.**
269
297
 
270
298
  Before touching any code:
@@ -286,6 +314,10 @@ Before touching any code:
286
314
 
287
315
  ## Step 3: Debug (Solo or Team)
288
316
 
317
+ ```bash
318
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-debug --step 3 --step-label "Debug (Solo or Team)" 2>/dev/null || true
319
+ ```
320
+
289
321
  ### Deviation Rules
290
322
 
291
323
  When you encounter unexpected situations during the fix:
@@ -330,6 +362,10 @@ First to find root cause: message the lead with findings.
330
362
 
331
363
  ## Step 4: Document Ripple
332
364
 
365
+ ```bash
366
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-debug --step 4 --step-label "Document Ripple" 2>/dev/null || true
367
+ ```
368
+
333
369
  After fixing, assess what documentation was affected by the change and update ALL relevant files:
334
370
 
335
371
  ### Always check:
@@ -366,6 +402,10 @@ Skip scan docs not affected by this fix. Skip analytical sections — those requ
366
402
 
367
403
  ## Step 5: Test Verification (run tests confirming fix)
368
404
 
405
+ ```bash
406
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-debug --step 5 --step-label "Test Verification (run tests confirming fix)" 2>/dev/null || true
407
+ ```
408
+
369
409
  Before committing, ensure the fix is solid:
370
410
 
371
411
  1. **Update tests**: If the bug reveals a missing test case, add one that would have caught it
@@ -395,6 +435,10 @@ Commit: `[debug] Fix {description} — root cause: {explanation}`
395
435
 
396
436
  ## Step 5.3: Red Team — Adversarial QA (MANDATORY)
397
437
 
438
+ ```bash
439
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-debug --step 5 --step-label ".3: Red Team — Adversarial QA (MANDATORY)" 2>/dev/null || true
440
+ ```
441
+
398
442
  After the fix passes all tests, spawn an adversarial Red Team agent to BREAK the fix and find regressions.
399
443
 
400
444
  ⚙ [opus] Red Team → adversarial validation of debug fix
@@ -422,6 +466,10 @@ Append to `.gsd-t/token-log.md`:
422
466
 
423
467
  ## Step 5.5: Emit Task Metrics
424
468
 
469
+ ```bash
470
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-debug --step 5 --step-label ".5: Emit Task Metrics" 2>/dev/null || true
471
+ ```
472
+
425
473
  After committing, emit a task-metrics record for this debug session — run via Bash:
426
474
  `node bin/metrics-collector.js --milestone {current-milestone-or-none} --domain {domain-or-debug} --task debug-{timestamp} --command debug --duration_s {elapsed} --tokens_used {estimated} --context_pct ${CTX_PCT:-0} --pass {true|false} --fix_cycles {attempts} --signal_type debug-invoked --notes "[debug] {description}" 2>/dev/null || true`
427
475
 
@@ -432,6 +480,10 @@ Emit task_complete event — run via Bash:
432
480
 
433
481
  ## Step 6: Doc-Ripple (Automated)
434
482
 
483
+ ```bash
484
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-debug --step 6 --step-label "Doc-Ripple (Automated)" 2>/dev/null || true
485
+ ```
486
+
435
487
  After all work is committed but before reporting completion:
436
488
 
437
489
  1. Run threshold check — read `git diff --name-only HEAD~1` and evaluate against doc-ripple-contract.md trigger conditions
@@ -56,6 +56,10 @@ Per `.gsd-t/contracts/model-selection-contract.md` v1.0.0. Selection is determin
56
56
 
57
57
  ## Step 0.1: Verify Context Gate Readiness (MANDATORY — first thing in a fresh session)
58
58
 
59
+ ```bash
60
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-execute --step 0 --step-label ".1: Verify Context Gate Readiness (MANDATORY — first thing in a fresh session)" 2>/dev/null || true
61
+ ```
62
+
59
63
  Run via Bash:
60
64
 
61
65
  ```bash
@@ -70,6 +74,10 @@ Why: every `/gsd-t-execute` invocation is a fresh orchestrator session and needs
70
74
 
71
75
  ## Step 1: Load State
72
76
 
77
+ ```bash
78
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-execute --step 1 --step-label "Load State" 2>/dev/null || true
79
+ ```
80
+
73
81
  Read:
74
82
  1. `CLAUDE.md` — check for **Branch Guard** (`Expected branch` field)
75
83
  2. `.gsd-t/progress.md`
@@ -87,6 +95,10 @@ Identify:
87
95
 
88
96
  ## Step 1.5: Graph-Enhanced Domain Isolation Check (if available)
89
97
 
98
+ ```bash
99
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-execute --step 1 --step-label ".5: Graph-Enhanced Domain Isolation Check (if available)" 2>/dev/null || true
100
+ ```
101
+
90
102
  If `.gsd-t/graph/meta.json` exists, run graph queries before execution begins:
91
103
 
92
104
  1. **Reindex** (if stale): `query('reindex', { force: false })` — ensure graph reflects current code
@@ -98,6 +110,10 @@ After each domain completes, re-run `getDomainBoundaryViolations` and diff again
98
110
 
99
111
  ## Step 2: QA Subagent
100
112
 
113
+ ```bash
114
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-execute --step 2 --step-label "QA Subagent" 2>/dev/null || true
115
+ ```
116
+
101
117
  In solo mode, QA runs inside each domain subagent (see Step 3). In team mode, the lead spawns QA subagents at each domain checkpoint using the pattern below.
102
118
 
103
119
  **QA subagent prompt** — `spawnType: 'validation'` (always headless, `--watch` ignored per headless-default-contract §2):
@@ -114,6 +130,10 @@ If QA found issues, append each to `.gsd-t/qa-issues.md` (create with header `|
114
130
 
115
131
  ## Step 3: Choose Execution Mode
116
132
 
133
+ ```bash
134
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-execute --step 3 --step-label "Choose Execution Mode" 2>/dev/null || true
135
+ ```
136
+
117
137
  ### Wave Scheduling (read first)
118
138
 
119
139
  Before choosing solo or team mode, read the `## Wave Execution Groups` section in `.gsd-t/contracts/integration-points.md` (added by the plan phase).
@@ -651,6 +671,10 @@ Cleanup is not optional — orphaned worktrees waste disk space and can confuse
651
671
 
652
672
  ## Step 3.5: Orchestrator Context Gate (MANDATORY)
653
673
 
674
+ ```bash
675
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-execute --step 3 --step-label ".5: Orchestrator Context Gate (MANDATORY)" 2>/dev/null || true
676
+ ```
677
+
654
678
  Single-band context gate per `.gsd-t/contracts/context-meter-contract.md` v1.3.0. The orchestrator checks `getSessionStatus()` BEFORE every task subagent spawn. `bin/token-budget.cjs` reads `.gsd-t/.context-meter-state.json` — the token estimate produced by the Context Meter PostToolUse hook.
655
679
 
656
680
  **Before each task spawn — gate check:**
@@ -670,6 +694,10 @@ The threshold percentage (default `75`) lives in `.gsd-t/context-meter-config.js
670
694
 
671
695
  ## Step 4: Checkpoint Handling
672
696
 
697
+ ```bash
698
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-execute --step 4 --step-label "Checkpoint Handling" 2>/dev/null || true
699
+ ```
700
+
673
701
  When a checkpoint is reached (solo or team):
674
702
 
675
703
  1. **Stop** execution of blocked tasks
@@ -685,6 +713,10 @@ When a checkpoint is reached (solo or team):
685
713
 
686
714
  ## Step 5: Error Handling
687
715
 
716
+ ```bash
717
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-execute --step 5 --step-label "Error Handling" 2>/dev/null || true
718
+ ```
719
+
688
720
  ### Contract Violation
689
721
  A teammate implements something that doesn't match a contract:
690
722
  1. Stop the teammate
@@ -709,6 +741,10 @@ A teammate finishes independent tasks and is waiting on a checkpoint:
709
741
 
710
742
  ## Step 5.25: Design Verification Agent (per-domain, MANDATORY when design contract exists)
711
743
 
744
+ ```bash
745
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-execute --step 5 --step-label ".25: Design Verification Agent (per-domain, MANDATORY when design contract exists)" 2>/dev/null || true
746
+ ```
747
+
712
748
  **IMPORTANT — frequency change in v2.74.12**: Design Verification was previously run once at the end of every execute run, regardless of how many domains existed. It is now run ONCE PER COMPLETED DOMAIN — call this step from the "After all tasks in a domain complete" block (Step 3.5 area), not from a global post-execute hook. This keeps verification co-located with the changes that introduced visual deviation, but stops the agent from re-materializing on every task spawn (which is what commit `b68353e` accidentally caused).
713
749
 
714
750
  After all tasks in the CURRENT DOMAIN complete and per-task QA has passed, check if `.gsd-t/contracts/design-contract.md` exists. If it does NOT exist, skip this step entirely.
@@ -763,6 +799,10 @@ After the Design Verification Agent returns, check `.gsd-t/contracts/design-cont
763
799
 
764
800
  ## Step 5.5: Red Team — Adversarial QA (per-domain, MANDATORY)
765
801
 
802
+ ```bash
803
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-execute --step 5 --step-label ".5: Red Team — Adversarial QA (per-domain, MANDATORY)" 2>/dev/null || true
804
+ ```
805
+
766
806
  **IMPORTANT — frequency change in v2.74.12**: Red Team was promoted to per-task by commit `da6d3ae` on the assumption that the orchestrator would catch context drain via an environment-variable-based self-check. That env-var path was never populated by Claude Code, so the check was inert and the per-task spawning of ~10k-token Red Team subagents was the largest single contributor to the v2.74.x context-burn regression. Red Team is now run ONCE PER COMPLETED DOMAIN — call this step from the "After all tasks in a domain complete" block, not from a per-task hook.
767
807
 
768
808
  After all tasks in the CURRENT DOMAIN pass their tests, spawn an adversarial Red Team agent. Its sole purpose is to BREAK the domain that was just built.
@@ -808,6 +848,10 @@ Append to `.gsd-t/token-log.md`:
808
848
 
809
849
  ## Step 6: Completion
810
850
 
851
+ ```bash
852
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-execute --step 6 --step-label "Completion" 2>/dev/null || true
853
+ ```
854
+
811
855
  When all tasks in all domains are complete:
812
856
  1. Update `.gsd-t/progress.md` — all tasks marked complete
813
857
  2. Set status to `EXECUTED`
@@ -821,6 +865,10 @@ When all tasks in all domains are complete:
821
865
 
822
866
  ## Step 7: Doc-Ripple (Automated)
823
867
 
868
+ ```bash
869
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-execute --step 7 --step-label "Doc-Ripple (Automated)" 2>/dev/null || true
870
+ ```
871
+
824
872
  After all work is committed but before reporting completion:
825
873
 
826
874
  1. Run threshold check — read `git diff --name-only HEAD~1` and evaluate against doc-ripple-contract.md trigger conditions
@@ -4,6 +4,10 @@ You are the lead agent planning a significant new feature for an existing codeba
4
4
 
5
5
  ## Step 0.5: Scan Freshness Auto-Refresh
6
6
 
7
+ ```bash
8
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-feature --step 0 --step-label ".5: Scan Freshness Auto-Refresh" 2>/dev/null || true
9
+ ```
10
+
7
11
  Before reading scan data for impact analysis, check if scan docs are stale and auto-refresh if needed. This ensures feature planning is based on current code — no warnings, no user involvement.
8
12
 
9
13
  If `.gsd-t/scan/.cache.json` exists:
@@ -22,6 +26,10 @@ If `.gsd-t/scan/` doesn't exist at all → skip (no scan data to refresh).
22
26
 
23
27
  ## Step 1: Understand What Exists
24
28
 
29
+ ```bash
30
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-feature --step 1 --step-label "Understand What Exists" 2>/dev/null || true
31
+ ```
32
+
25
33
  Read everything:
26
34
  1. `CLAUDE.md` — project conventions, stack, patterns
27
35
  2. `.gsd-t/progress.md` — completed milestones, decision history
@@ -50,6 +58,10 @@ Note what you find — this informs Step 3's Multi-Consumer Check and Step 4's m
50
58
 
51
59
  ## Step 1.5: Graph-Enhanced Blast Radius Analysis
52
60
 
61
+ ```bash
62
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-feature --step 1 --step-label ".5: Graph-Enhanced Blast Radius Analysis" 2>/dev/null || true
63
+ ```
64
+
53
65
  If `.gsd-t/graph/meta.json` exists (graph index is available):
54
66
  1. Query `getSurfaceConsumers` and `getCallers` on functions likely affected by the feature to calculate blast radius across all consumer surfaces
55
67
  2. Query `getTransitiveCallers` for deep impact chains that may not be obvious from architecture docs alone
@@ -59,6 +71,10 @@ If graph is not available, skip this step.
59
71
 
60
72
  ## Step 2: Understand the Feature
61
73
 
74
+ ```bash
75
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-feature --step 2 --step-label "Understand the Feature" 2>/dev/null || true
76
+ ```
77
+
62
78
  From $ARGUMENTS and conversation:
63
79
  - What does this feature do?
64
80
  - Who uses it?
@@ -74,6 +90,10 @@ If context is thin, ask targeted questions:
74
90
 
75
91
  ## Step 3: Impact Analysis
76
92
 
93
+ ```bash
94
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-feature --step 3 --step-label "Impact Analysis" 2>/dev/null || true
95
+ ```
96
+
77
97
  Before planning milestones, analyze how this feature touches the existing system.
78
98
 
79
99
  ### Team Mode (recommended for large codebases)
@@ -149,6 +169,10 @@ Produce a combined analysis:
149
169
 
150
170
  ## Step 4: Decompose into Milestones
151
171
 
172
+ ```bash
173
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-feature --step 4 --step-label "Decompose into Milestones" 2>/dev/null || true
174
+ ```
175
+
152
176
  The feature may be a single milestone or multiple, depending on scope:
153
177
 
154
178
  ### Single Milestone (if feature is focused):
@@ -216,6 +240,10 @@ Append to `.gsd-t/roadmap.md` (or create if doesn't exist):
216
240
 
217
241
  ## Step 5: Reconcile with Existing State
218
242
 
243
+ ```bash
244
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-feature --step 5 --step-label "Reconcile with Existing State" 2>/dev/null || true
245
+ ```
246
+
219
247
  Critical step — make sure the new milestones fit with what's already built:
220
248
 
221
249
  1. **Check for conflicts**: Do new milestones conflict with in-progress work?
@@ -228,6 +256,10 @@ If conflicts exist, present them to the user with options:
228
256
 
229
257
  ## Step 6: Update Project State
230
258
 
259
+ ```bash
260
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-feature --step 6 --step-label "Update Project State" 2>/dev/null || true
261
+ ```
262
+
231
263
  Update `.gsd-t/progress.md`:
232
264
  - Add new milestones to the table
233
265
  - Log the feature addition in Decision Log
@@ -235,6 +267,10 @@ Update `.gsd-t/progress.md`:
235
267
 
236
268
  ## Step 7: Document Ripple
237
269
 
270
+ ```bash
271
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-feature --step 7 --step-label "Document Ripple" 2>/dev/null || true
272
+ ```
273
+
238
274
  After creating the feature roadmap and milestones, update all affected documentation:
239
275
 
240
276
  ### Always update:
@@ -252,6 +288,10 @@ After creating the feature roadmap and milestones, update all affected documenta
252
288
 
253
289
  ## Step 8: Test Verification
254
290
 
291
+ ```bash
292
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-feature --step 8 --step-label "Test Verification" 2>/dev/null || true
293
+ ```
294
+
255
295
  Before finalizing the feature plan:
256
296
 
257
297
  1. **Run existing tests**: Execute the full test suite to confirm the codebase is in a clean state before feature work begins
@@ -260,6 +300,10 @@ Before finalizing the feature plan:
260
300
 
261
301
  ## Step 9: Report to User
262
302
 
303
+ ```bash
304
+ node scripts/gsd-t-watch-state.js advance --agent-id "$GSD_T_AGENT_ID" --parent-id "${GSD_T_PARENT_AGENT_ID:-null}" --command gsd-t-feature --step 9 --step-label "Report to User" 2>/dev/null || true
305
+ ```
306
+
263
307
  Present:
264
308
  1. Impact analysis summary (what's new vs. what's modified)
265
309
  2. Milestone breakdown for the feature