@tekyzinc/gsd-t 3.12.15 → 3.13.11

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.
@@ -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-quick --step 0 --step-label ".1: Launch via Subagent" 2>/dev/null || true
31
+ ```
32
+
29
33
  To give this task a fresh context window and prevent compaction during consecutive quick runs, always execute via a Task subagent.
30
34
 
31
35
  **If you are the orchestrating agent** (you received the slash command directly):
@@ -127,6 +131,10 @@ Continue to Step 1 below.
127
131
 
128
132
  ## Step 1: Load Context (Fast)
129
133
 
134
+ ```bash
135
+ 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-quick --step 1 --step-label "Load Context (Fast)" 2>/dev/null || true
136
+ ```
137
+
130
138
  Read:
131
139
  1. `CLAUDE.md`
132
140
  2. `.gsd-t/progress.md` (if exists)
@@ -134,6 +142,10 @@ Read:
134
142
 
135
143
  ## Step 1.5: Graph-Enhanced Scope Check
136
144
 
145
+ ```bash
146
+ 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-quick --step 1 --step-label ".5: Graph-Enhanced Scope Check" 2>/dev/null || true
147
+ ```
148
+
137
149
  If `.gsd-t/graph/meta.json` exists (graph index is available):
138
150
  1. Query `getDomainOwner` for the target function/file to verify it belongs to the expected domain
139
151
  2. Query `getDomainBoundaryViolations` to check if the quick change would cross domain boundaries
@@ -143,6 +155,10 @@ If graph is not available, skip this step.
143
155
 
144
156
  ## Step 2: Scope Check
145
157
 
158
+ ```bash
159
+ 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-quick --step 2 --step-label "Scope Check" 2>/dev/null || true
160
+ ```
161
+
146
162
  Based on $ARGUMENTS, determine:
147
163
  - Which domain does this touch? (check `.gsd-t/domains/*/scope.md` if available)
148
164
  - Does it cross a domain boundary?
@@ -158,6 +174,10 @@ Proceed.
158
174
 
159
175
  ## Step 3: Execute
160
176
 
177
+ ```bash
178
+ 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-quick --step 3 --step-label "Execute" 2>/dev/null || true
179
+ ```
180
+
161
181
  ### Deviation Rules
162
182
 
163
183
  When you encounter unexpected situations:
@@ -190,6 +210,10 @@ When you encounter unexpected situations:
190
210
 
191
211
  ## Step 3.5: Emit Task Metrics
192
212
 
213
+ ```bash
214
+ 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-quick --step 3 --step-label ".5: Emit Task Metrics" 2>/dev/null || true
215
+ ```
216
+
193
217
  After committing, emit a task-metrics record for this quick task — run via Bash:
194
218
  `node bin/metrics-collector.js --milestone {current-milestone-or-none} --domain {domain-or-quick} --task quick-{timestamp} --command quick --duration_s {elapsed} --tokens_used {estimated} --context_pct ${CTX_PCT:-0} --pass {true|false} --fix_cycles {0|N} --signal_type {pass-through|fix-cycle} --notes "[quick] {description}" 2>/dev/null || true`
195
219
 
@@ -200,6 +224,10 @@ Emit task_complete event — run via Bash:
200
224
 
201
225
  ## Step 4: Document Ripple (if GSD-T is active)
202
226
 
227
+ ```bash
228
+ 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-quick --step 4 --step-label "Document Ripple (if GSD-T is active)" 2>/dev/null || true
229
+ ```
230
+
203
231
  If `.gsd-t/progress.md` exists, assess what documentation was affected and update ALL relevant files:
204
232
 
205
233
  ### Always update:
@@ -231,6 +259,10 @@ Skip scan docs not affected by this task. Skip analytical sections — those req
231
259
 
232
260
  ## Step 5: Test & Verify (MANDATORY)
233
261
 
262
+ ```bash
263
+ 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-quick --step 5 --step-label "Test & Verify (MANDATORY)" 2>/dev/null || true
264
+ ```
265
+
234
266
  Quick does not mean skip testing. Before committing:
235
267
 
236
268
  1. **Write/update tests for every new or changed code path**:
@@ -265,6 +297,10 @@ Note: Exploratory findings do NOT count against the scripted test pass/fail rati
265
297
 
266
298
  ## Step 5.25: Design Verification Agent (MANDATORY when design contract exists)
267
299
 
300
+ ```bash
301
+ 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-quick --step 5 --step-label ".25: Design Verification Agent (MANDATORY when design contract exists)" 2>/dev/null || true
302
+ ```
303
+
268
304
  After tests pass, check if `.gsd-t/contracts/design-contract.md` exists. If it does NOT, skip to Step 5.5.
269
305
 
270
306
  If it DOES exist and this task involved UI changes — spawn the Design Verification Agent. This agent's ONLY job is to open a browser, compare the built frontend against the original design, and produce a structured comparison table. It writes NO feature code.
@@ -338,6 +374,10 @@ After subagent returns — run observability Bash and append to token-log.md.
338
374
 
339
375
  ## Step 5.5: Red Team — Adversarial QA (MANDATORY)
340
376
 
377
+ ```bash
378
+ 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-quick --step 5 --step-label ".5: Red Team — Adversarial QA (MANDATORY)" 2>/dev/null || true
379
+ ```
380
+
341
381
  After tests pass, spawn an adversarial Red Team agent. Its success is measured by bugs found, not tests passed.
342
382
 
343
383
  ⚙ [opus] Red Team → adversarial validation of quick task
@@ -369,6 +409,10 @@ Append to `.gsd-t/token-log.md`:
369
409
 
370
410
  ## Step 6: Doc-Ripple (Automated)
371
411
 
412
+ ```bash
413
+ 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-quick --step 6 --step-label "Doc-Ripple (Automated)" 2>/dev/null || true
414
+ ```
415
+
372
416
  After all work is committed but before reporting completion:
373
417
 
374
418
  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 resuming work after an interruption. This handles both same-session paus
4
4
 
5
5
  ## Step 0: Unattended Supervisor Auto-Reattach
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-resume --step 0 --step-label "Unattended Supervisor Auto-Reattach" 2>/dev/null || true
9
+ ```
10
+
7
11
  **This step runs FIRST, before reading any docs, contracts, or continue-here files.**
8
12
 
9
13
  **Worker bypass**: If the environment variable `GSD_T_UNATTENDED_WORKER=1` is set, this resume is being invoked by the unattended supervisor as a worker iteration. **SKIP this entire Step 0** — do NOT check for supervisor.pid, do NOT auto-reattach, do NOT schedule a watch tick. Fall through directly to Step 0.1. The worker's job is to do actual work, not watch itself.
@@ -33,6 +37,10 @@ Contract reference: `unattended-supervisor-contract.md` §9 (Resume Auto-Reattac
33
37
 
34
38
  ## Step 0.1: Detect Resume Mode
35
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-resume --step 0 --step-label ".1: Detect Resume Mode" 2>/dev/null || true
42
+ ```
43
+
36
44
  **Same-session** (conversation context still available — you can see prior messages about the active phase/task):
37
45
  - Skip to Step 2 — you already have the context loaded
38
46
  - Do NOT re-read all state files
@@ -42,6 +50,10 @@ Contract reference: `unattended-supervisor-contract.md` §9 (Resume Auto-Reattac
42
50
 
43
51
  ## Step 0.2: Handoff Lock Wait (headless resume only)
44
52
 
53
+ ```bash
54
+ 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-resume --step 0 --step-label ".2: Handoff Lock Wait (headless resume only)" 2>/dev/null || true
55
+ ```
56
+
45
57
  Before reading any continue-here file or state file, check if a parent process wrote a handoff lock for this session:
46
58
 
47
59
  ```bash
@@ -64,6 +76,10 @@ This prevents the child side of a headless spawn from reading a partial continue
64
76
 
65
77
  ## Step 0.5: Headless Read-Back Banner (MANDATORY)
66
78
 
79
+ ```bash
80
+ 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-resume --step 0 --step-label ".5: Headless Read-Back Banner (MANDATORY)" 2>/dev/null || true
81
+ ```
82
+
67
83
  Before loading full state, surface any completed headless sessions the user hasn't seen yet. Run this once at the start of every resume invocation:
68
84
 
69
85
  ```bash
@@ -76,6 +92,10 @@ Contract: `.gsd-t/contracts/headless-default-contract.md` v1.0.0
76
92
 
77
93
  ## Step 0.6: Context Meter Health Check (MANDATORY, v3.10.12+)
78
94
 
95
+ ```bash
96
+ 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-resume --step 0 --step-label ".6: Context Meter Health Check (MANDATORY, v3.10.12+)" 2>/dev/null || true
97
+ ```
98
+
79
99
  Before loading any other state, verify the Context Meter (M34) is actually alive. A dead meter was the root cause of the M36 `/compact` regression (2026-04-15) — `checkCount=2102` but every hook call failed fail-open because `ANTHROPIC_API_KEY` was unset, and the gate silently reported `pct=0` forever.
80
100
 
81
101
  Run via Bash:
@@ -105,6 +125,10 @@ Contract: `context-meter-contract.md` v1.1.0 (v3.10.12) — §"Stale Band and Re
105
125
 
106
126
  ## Step 1: Load Full State (cross-session only)
107
127
 
128
+ ```bash
129
+ 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-resume --step 1 --step-label "Load Full State (cross-session only)" 2>/dev/null || true
130
+ ```
131
+
108
132
  Read in this exact order:
109
133
  1. `CLAUDE.md` — project context and conventions
110
134
  2. **Check for continue-here files first**: List `.gsd-t/continue-here-*.md` files. If any exist, read the most recent one (highest timestamp). It contains exact position, next action, and open items — use this as the primary resume point.
@@ -118,6 +142,10 @@ Read in this exact order:
118
142
 
119
143
  ## Step 2: Determine Current Position
120
144
 
145
+ ```bash
146
+ 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-resume --step 2 --step-label "Determine Current Position" 2>/dev/null || true
147
+ ```
148
+
121
149
  From the continue-here file (if present) OR progress.md (or conversation context if same-session), identify:
122
150
  - Current milestone and status
123
151
  - Which phase we're in
@@ -129,6 +157,10 @@ From the continue-here file (if present) OR progress.md (or conversation context
129
157
 
130
158
  ## Step 3: Report and Continue
131
159
 
160
+ ```bash
161
+ 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-resume --step 3 --step-label "Report and Continue" 2>/dev/null || true
162
+ ```
163
+
132
164
  **Level 3 (Full Auto)**: Log a brief status line and auto-resume from the current task/phase. Do NOT wait for user input.
133
165
 
134
166
  ```
@@ -154,6 +186,10 @@ Ready to continue? Or run /gsd-t-status for full details.
154
186
 
155
187
  ## Step 4: Continue
156
188
 
189
+ ```bash
190
+ 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-resume --step 4 --step-label "Continue" 2>/dev/null || true
191
+ ```
192
+
157
193
  If $ARGUMENTS specifies what to do next, proceed with that.
158
194
  Otherwise, pick up from the logical next action based on current state:
159
195
  - Mid-execution → Continue with next unblocked task
@@ -163,6 +199,10 @@ Otherwise, pick up from the logical next action based on current state:
163
199
 
164
200
  ## Step 5: Auto-Advance Through End of Milestone (MANDATORY)
165
201
 
202
+ ```bash
203
+ 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-resume --step 5 --step-label "Auto-Advance Through End of Milestone (MANDATORY)" 2>/dev/null || true
204
+ ```
205
+
166
206
  **Resume does NOT stop at the end of a wave or phase. It must chain all the way to `COMPLETED` status.**
167
207
 
168
208
  When the resumed work reaches a natural handoff point, do NOT print a "Next Up" hint and wait for the user. At Level 3 Full Auto, keep going. The successor mapping in CLAUDE-global.md is the contract — resume honors it exactly like any other command:
@@ -17,6 +17,10 @@ Default path is `autoSpawnHeadless({command, spawnType, watch: WATCH_FLAG, proje
17
17
 
18
18
  ## Step 0: Launch via Subagent
19
19
 
20
+ ```bash
21
+ 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-scan --step 0 --step-label "Launch via Subagent" 2>/dev/null || true
22
+ ```
23
+
20
24
  Scans are long-running and context-heavy. Always execute via a Task subagent for a fresh context window.
21
25
 
22
26
  **If you are the orchestrating agent** (you received the slash command directly):
@@ -36,6 +40,10 @@ Continue to Step 1 below. At Step 2, use team mode — spawn the 5 teammates in
36
40
 
37
41
  ## Step 1: Load Existing Context
38
42
 
43
+ ```bash
44
+ 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-scan --step 1 --step-label "Load Existing Context" 2>/dev/null || true
45
+ ```
46
+
39
47
  Read:
40
48
  1. `CLAUDE.md` (if exists)
41
49
  2. `.gsd-t/progress.md` (if exists)
@@ -45,6 +53,10 @@ Read:
45
53
 
46
54
  ## Step 1.5: Graph Index (if available)
47
55
 
56
+ ```bash
57
+ 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-scan --step 1 --step-label ".5: Graph Index (if available)" 2>/dev/null || true
58
+ ```
59
+
48
60
  Before scanning, check if `bin/graph-indexer.js` exists in the GSD-T installation or if `.gsd-t/graph/meta.json` exists in the project. If so:
49
61
 
50
62
  ```bash
@@ -63,6 +75,10 @@ Pass the graph query results to each teammate in their prompt context so they ca
63
75
 
64
76
  ## Step 2: Full Codebase Scan
65
77
 
78
+ ```bash
79
+ 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-scan --step 2 --step-label "Full Codebase Scan" 2>/dev/null || true
80
+ ```
81
+
66
82
  **Always use Team Mode** unless the codebase is trivially small (< 5 files) or agent teams are explicitly disabled. Each dimension is fully independent — parallel scanning is faster and produces better results.
67
83
 
68
84
  ```
@@ -283,6 +299,10 @@ Produce: `.gsd-t/scan/contract-drift.md`
283
299
 
284
300
  ## Step 2.5: Schema Extraction
285
301
 
302
+ ```bash
303
+ 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-scan --step 2 --step-label ".5: Schema Extraction" 2>/dev/null || true
304
+ ```
305
+
286
306
  Run schema extraction on the scanned project to detect ORM/database schema files and parse entity definitions. This data feeds the database schema diagram in Step 3.5.
287
307
 
288
308
  Using Bash tool:
@@ -298,6 +318,10 @@ If `schemaData.detected === false`, note: "No ORM/schema files detected — data
298
318
 
299
319
  ## Step 2.9: Archive Previous Tech Debt Register
300
320
 
321
+ ```bash
322
+ 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-scan --step 2 --step-label ".9: Archive Previous Tech Debt Register" 2>/dev/null || true
323
+ ```
324
+
301
325
  Before building the new register, archive the existing one so the file stays small. Each scan is a complete snapshot — the archive preserves history.
302
326
 
303
327
  If `.gsd-t/techdebt.md` exists:
@@ -309,6 +333,10 @@ The new `techdebt.md` created in Step 3 will contain only the current scan's fin
309
333
 
310
334
  ## Step 3: Build Tech Debt Register
311
335
 
336
+ ```bash
337
+ 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-scan --step 3 --step-label "Build Tech Debt Register" 2>/dev/null || true
338
+ ```
339
+
312
340
  Synthesize ALL findings into a **fresh** `.gsd-t/techdebt.md` (the previous version was archived in Step 2.9). This file contains only the current scan's findings — no resolved items table, no scan history. Previous scans are preserved in `techdebt_YYYY-MM-DD.md` archives.
313
341
 
314
342
  **Between scans:** when an item is fixed, change its `**Status**:` field to `[RESOLVED] — {brief reason/milestone}`. Do not delete the item — it stays visible until the next scan replaces the file.
@@ -399,6 +427,10 @@ Nice-to-haves and cleanup.
399
427
 
400
428
  ## Step 3.5: Diagram Generation
401
429
 
430
+ ```bash
431
+ 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-scan --step 3 --step-label ".5: Diagram Generation" 2>/dev/null || true
432
+ ```
433
+
402
434
  Generate all 6 architectural diagrams using analysis data from Step 2 and schema data from Step 2.5.
403
435
 
404
436
  Using Bash tool:
@@ -418,6 +450,10 @@ Capture the full array as `diagrams`. Log:
418
450
 
419
451
  ## Step 4: Suggest Milestone Promotions
420
452
 
453
+ ```bash
454
+ 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-scan --step 4 --step-label "Suggest Milestone Promotions" 2>/dev/null || true
455
+ ```
456
+
421
457
  Review all items marked `Milestone candidate: YES` and group them into logical milestones:
422
458
 
423
459
  ```markdown
@@ -447,6 +483,10 @@ Note: Use `/gsd-t-partition` Step 1.6 to design the SharedCore domain
447
483
 
448
484
  ## Step 5: Update Living Documents
449
485
 
486
+ ```bash
487
+ 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-scan --step 5 --step-label "Update Living Documents" 2>/dev/null || true
488
+ ```
489
+
450
490
  The scan produces deep analysis in `.gsd-t/scan/`. Now cross-populate findings into the living docs so knowledge persists across milestones.
451
491
 
452
492
  ### docs/architecture.md
@@ -505,6 +545,10 @@ If `README.md` exists, merge — update tech stack and setup sections but preser
505
545
 
506
546
  ## Step 6: Test Verification
507
547
 
548
+ ```bash
549
+ 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-scan --step 6 --step-label "Test Verification" 2>/dev/null || true
550
+ ```
551
+
508
552
  After updating living documents, verify nothing was broken:
509
553
 
510
554
  1. **Run existing tests**: Execute the full test suite to establish a baseline — document what passes and what was already failing
@@ -513,6 +557,10 @@ After updating living documents, verify nothing was broken:
513
557
 
514
558
  ## Step 6.5: Generate Scan Freshness Cache
515
559
 
560
+ ```bash
561
+ 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-scan --step 6 --step-label ".5: Generate Scan Freshness Cache" 2>/dev/null || true
562
+ ```
563
+
516
564
  After the scan completes and living docs are updated, generate a hash cache so downstream commands can detect staleness without re-scanning.
517
565
 
518
566
  Create `.gsd-t/scan/.cache.json` with this structure:
@@ -557,6 +605,10 @@ This cache enables downstream commands (`partition`, `feature`, `gap-analysis`)
557
605
 
558
606
  ## Step 7: Update Project State
559
607
 
608
+ ```bash
609
+ 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-scan --step 7 --step-label "Update Project State" 2>/dev/null || true
610
+ ```
611
+
560
612
  If `.gsd-t/progress.md` exists:
561
613
  - Log scan in Decision Log
562
614
  - Note critical findings
@@ -570,6 +622,10 @@ If `CLAUDE.md` exists:
570
622
 
571
623
  ## Step 8: Report to User
572
624
 
625
+ ```bash
626
+ 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-scan --step 8 --step-label "Report to User" 2>/dev/null || true
627
+ ```
628
+
573
629
  Present a summary:
574
630
  1. Architecture overview (brief)
575
631
  2. Business rules found (count + any undocumented ones)
@@ -15,6 +15,10 @@ This command is:
15
15
 
16
16
  ## Step 1: Load Context
17
17
 
18
+ ```bash
19
+ 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-test-sync --step 1 --step-label "Load Context" 2>/dev/null || true
20
+ ```
21
+
18
22
  Read:
19
23
  1. `CLAUDE.md` — testing conventions, test locations
20
24
  2. `.gsd-t/progress.md` — what just changed
@@ -30,6 +34,10 @@ Identify:
30
34
 
31
35
  ## Step 1.5: Graph-Enhanced Test Discovery
32
36
 
37
+ ```bash
38
+ 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-test-sync --step 1 --step-label ".5: Graph-Enhanced Test Discovery" 2>/dev/null || true
39
+ ```
40
+
33
41
  If `.gsd-t/graph/meta.json` exists (graph index is available):
34
42
  1. Query `getTestsFor` each changed entity to find stale or missing tests more precisely than filesystem search
35
43
  2. Query `getTransitiveCallers` for changed functions to find indirectly affected tests that may need updating
@@ -39,6 +47,10 @@ If graph is not available, skip this step.
39
47
 
40
48
  ## Step 2: Contract Coverage Audit
41
49
 
50
+ ```bash
51
+ 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-test-sync --step 2 --step-label "Contract Coverage Audit" 2>/dev/null || true
52
+ ```
53
+
42
54
  Perform inline contract testing and gap analysis:
43
55
 
44
56
  1. Read all contracts in `.gsd-t/contracts/` — identify the interface each one defines
@@ -51,6 +63,10 @@ Test-sync cannot complete if critical contract gaps remain unaddressed.
51
63
 
52
64
  ## Step 3: Map Code to Tests
53
65
 
66
+ ```bash
67
+ 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-test-sync --step 3 --step-label "Map Code to Tests" 2>/dev/null || true
68
+ ```
69
+
54
70
  For each file changed in recent tasks:
55
71
 
56
72
  ### A) Find Existing Tests
@@ -73,6 +89,10 @@ find . -name "*.spec.*" | xargs grep -l "{class_name}"
73
89
 
74
90
  ## Step 4: Detect Test Issues
75
91
 
92
+ ```bash
93
+ 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-test-sync --step 4 --step-label "Detect Test Issues" 2>/dev/null || true
94
+ ```
95
+
76
96
  ### A) Stale Tests
77
97
  Tests that reference old behavior:
78
98
  - Function signatures that changed
@@ -107,6 +127,10 @@ Tests that sometimes fail:
107
127
 
108
128
  ## Step 5: Run Affected Tests
109
129
 
130
+ ```bash
131
+ 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-test-sync --step 5 --step-label "Run Affected Tests" 2>/dev/null || true
132
+ ```
133
+
110
134
  ### A) Unit/Integration Tests
111
135
  Execute tests that cover changed code:
112
136
 
@@ -187,6 +211,10 @@ For all test types:
187
211
 
188
212
  ## Step 6: Produce Test Coverage Report
189
213
 
214
+ ```bash
215
+ 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-test-sync --step 6 --step-label "Produce Test Coverage Report" 2>/dev/null || true
216
+ ```
217
+
190
218
  Create/update `.gsd-t/test-coverage.md`:
191
219
 
192
220
  ```markdown
@@ -274,6 +302,10 @@ Create/update `.gsd-t/test-coverage.md`:
274
302
 
275
303
  ## Step 7: Generate Test Tasks
276
304
 
305
+ ```bash
306
+ 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-test-sync --step 7 --step-label "Generate Test Tasks" 2>/dev/null || true
307
+ ```
308
+
277
309
  If issues found, add to current domain's tasks:
278
310
 
279
311
  ```markdown
@@ -297,6 +329,10 @@ If issues found, add to current domain's tasks:
297
329
 
298
330
  ## Step 8: Integration with Workflow
299
331
 
332
+ ```bash
333
+ 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-test-sync --step 8 --step-label "Integration with Workflow" 2>/dev/null || true
334
+ ```
335
+
300
336
  ### During Execute Phase (auto-invoked):
301
337
  After each task completes:
302
338
  1. Scan changed files and map to existing tests
@@ -331,6 +367,10 @@ Full sync:
331
367
 
332
368
  ## Step 9: Report to User
333
369
 
370
+ ```bash
371
+ 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-test-sync --step 9 --step-label "Report to User" 2>/dev/null || true
372
+ ```
373
+
334
374
  ### Quick Mode (during execute):
335
375
  ```
336
376
  🧪 Test sync: 3 tests affected, 3 passing
@@ -103,8 +103,15 @@ if (state) {
103
103
  const lt = state.lastTick ? Date.parse(state.lastTick) : null;
104
104
  const tickAgeMs = lt ? (Date.now() - lt) : null;
105
105
  out('TICK_AGE_MS', tickAgeMs);
106
+ // v3.13.11 Bug 3: IS_STALE computed deterministically here (not in Haiku's
107
+ // rendering step) — stale iff tickAgeMs > 540000 (2× 270s tick cadence per
108
+ // unattended-supervisor-contract §3). Below threshold → false. At/above
109
+ // threshold → true. Renderer just reads this flag; no prose interpretation.
110
+ const IS_STALE = tickAgeMs !== null && tickAgeMs > 540000;
111
+ out('IS_STALE', IS_STALE);
106
112
  } else {
107
113
  out('STATUS', null);
114
+ out('IS_STALE', false);
108
115
  }
109
116
 
110
117
  // --- run.log tail (last ~2KB via fd seek, not full read) ---
@@ -312,7 +319,7 @@ Render two blocks: the workflow-progress header (existing) plus the M38 **event-
312
319
  Format rules:
313
320
  - One extra space after each emoji (per CLAUDE.md markdown table rules — preserves alignment in terminal views).
314
321
  - Elapsed formatted as `{H}h{M}m` from `ELAPSED_MS`.
315
- - Last-tick age formatted as `{S}s` or `{M}m{S}s`. If age > 540s (2× tick cadence), append ` ⚠️ stale` as a soft warning.
322
+ - Last-tick age formatted as `{S}s` or `{M}m{S}s`. If `IS_STALE=true` (computed deterministically in Step 2 as `tickAgeMs > 540000`), append ` ⚠️ stale`. The renderer must NOT interpret the threshold itself — Step 2 is the source of truth; rendering just reads the IS_STALE flag verbatim.
316
323
  - Tasks progress bar: `[████████░░░░] 8/12` — filled blocks proportional to done/total.
317
324
  - Domain breakdown only shown if ≤6 domains (otherwise too noisy).
318
325
 
@@ -347,7 +354,7 @@ const fs = require('fs');
347
354
  let state = {};
348
355
  try { state = JSON.parse(fs.readFileSync('.gsd-t/.unattended/state.json','utf8')); } catch(_){}
349
356
  const { events, newCursor } = es.readSinceCursor('.');
350
- console.log(wf.formatWatchTick({ events, state }));
357
+ console.log(wf.formatWatchTick({ events, state, withWatchProgress: true }));
351
358
  es.advanceCursor('.', newCursor);
352
359
  "
353
360
  ```
@@ -395,6 +402,6 @@ After the tool call, end the turn. Do NOT output a "Next Up" hint, do NOT contin
395
402
  - **Terminal = STOP**: any terminal branch (3, 4, 5) ends the loop. The user relaunches via `/gsd-t-unattended` if needed.
396
403
  - **Never spawn subagents**: this is a pure polling command — no Task, no TeamCreate, no observability logging block.
397
404
  - **No branch guard, no pre-commit gate, no doc ripple**: this command does not modify any files.
398
- - **Stale-tick tolerance**: if `lastTick` is >540s old but PID is still alive, warn soft (`⚠️ stale`) but still reschedule — the supervisor may be mid-worker.
405
+ - **Stale-tick tolerance**: `IS_STALE=true` iff `tickAgeMs > 540000` (computed deterministically in Step 2). When stale, warn soft (`⚠️ stale`) but still reschedule — the supervisor may be mid-worker. The threshold math lives in Step 2's node block; rendering reads the flag verbatim.
399
406
 
400
407
  $ARGUMENTS
@@ -10,6 +10,10 @@ See `unattended-supervisor-contract.md` §7 (Launch Handshake), §4 (Status Enum
10
10
 
11
11
  ## Step 1: Pre-Flight Checks
12
12
 
13
+ ```bash
14
+ 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-unattended --step 1 --step-label "Pre-Flight Checks" 2>/dev/null || true
15
+ ```
16
+
13
17
  ### 1a: Verify GSD-T Project
14
18
 
15
19
  Run via Bash:
@@ -247,6 +251,10 @@ If `WARNINGS` were emitted, print them as a non-blocking advisory before proceed
247
251
 
248
252
  ## Step 2: Spawn the Detached Supervisor
249
253
 
254
+ ```bash
255
+ 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-unattended --step 2 --step-label "Spawn the Detached Supervisor" 2>/dev/null || true
256
+ ```
257
+
250
258
  ⚙ [sonnet] gsd-t-unattended → spawning detached supervisor
251
259
 
252
260
  **Before spawn — read starting context tokens (observability bracket):**
@@ -323,6 +331,10 @@ fs.appendFileSync(LOG, row);
323
331
 
324
332
  ## Step 3: Verify Supervisor Liveness
325
333
 
334
+ ```bash
335
+ 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-unattended --step 3 --step-label "Verify Supervisor Liveness" 2>/dev/null || true
336
+ ```
337
+
326
338
  Wait up to 2 seconds for the supervisor to write its PID file and transition out of `initializing`:
327
339
 
328
340
  ```bash
@@ -400,6 +412,10 @@ End the turn without scheduling a watch tick.
400
412
 
401
413
  ## Step 4: Display Initial Status Block
402
414
 
415
+ ```bash
416
+ 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-unattended --step 4 --step-label "Display Initial Status Block" 2>/dev/null || true
417
+ ```
418
+
403
419
  Print the launch confirmation block:
404
420
 
405
421
  ```
@@ -421,6 +437,10 @@ Print the launch confirmation block:
421
437
 
422
438
  ## Step 5: Schedule the First Watch Tick
423
439
 
440
+ ```bash
441
+ 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-unattended --step 5 --step-label "Schedule the First Watch Tick" 2>/dev/null || true
442
+ ```
443
+
424
444
  Call the harness `ScheduleWakeup` tool with these exact parameters:
425
445
 
426
446
  - `delaySeconds`: `270` (fixed — inside the 5-minute prompt-cache TTL)