@tekyzinc/gsd-t 3.29.11 → 4.0.12
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.
- package/CHANGELOG.md +146 -0
- package/bin/gsd-t-parallel.cjs +64 -13
- package/bin/gsd-t.js +48 -376
- package/bin/journey-coverage.cjs +6 -3
- package/bin/parallel-cli.cjs +13 -1
- package/commands/gsd-t-debug.md +47 -533
- package/commands/gsd-t-design-decompose.md +24 -497
- package/commands/gsd-t-doc-ripple.md +23 -139
- package/commands/gsd-t-execute.md +41 -958
- package/commands/gsd-t-help.md +0 -2
- package/commands/gsd-t-impact.md +26 -295
- package/commands/gsd-t-integrate.md +44 -369
- package/commands/gsd-t-milestone.md +25 -124
- package/commands/gsd-t-partition.md +28 -539
- package/commands/gsd-t-plan.md +26 -472
- package/commands/gsd-t-prd.md +25 -311
- package/commands/gsd-t-quick.md +1 -1
- package/commands/gsd-t-resume.md +0 -33
- package/commands/gsd-t-verify.md +52 -569
- package/commands/gsd-t-wave.md +41 -430
- package/package.json +1 -1
- package/scripts/gsd-t-calibration-hook.js +3 -1
- package/scripts/hooks/pre-commit-journey-coverage +0 -2
- package/scripts/hooks/pre-commit-playwright-gate +0 -2
- package/templates/CLAUDE-global.md +43 -173
- package/templates/CLAUDE-project.md +118 -104
- package/templates/prompts/design-verify-subagent.md +3 -0
- package/templates/prompts/qa-subagent.md +3 -0
- package/templates/prompts/red-team-subagent.md +5 -2
- package/templates/workflows/_lib.js +176 -0
- package/templates/workflows/gsd-t-debug.workflow.js +86 -0
- package/templates/workflows/gsd-t-execute.workflow.js +206 -0
- package/templates/workflows/gsd-t-integrate.workflow.js +71 -0
- package/templates/workflows/gsd-t-phase.workflow.js +94 -0
- package/templates/workflows/gsd-t-quick.workflow.js +72 -0
- package/templates/workflows/gsd-t-verify.workflow.js +348 -0
- package/templates/workflows/gsd-t-wave.workflow.js +43 -0
- package/bin/check-headless-sessions.js +0 -140
- package/bin/context-budget-audit.cjs +0 -447
- package/bin/context-meter-config.cjs +0 -101
- package/bin/context-meter-config.test.cjs +0 -101
- package/bin/event-stream.cjs +0 -205
- package/bin/gsd-t-benchmark-orchestrator.js +0 -437
- package/bin/gsd-t-capture-lint.cjs +0 -440
- package/bin/gsd-t-economics.cjs +0 -315
- package/bin/gsd-t-in-session-usage.cjs +0 -213
- package/bin/gsd-t-orchestrator-config.cjs +0 -161
- package/bin/gsd-t-orchestrator-queue.cjs +0 -180
- package/bin/gsd-t-orchestrator-recover.cjs +0 -231
- package/bin/gsd-t-orchestrator-worker.cjs +0 -219
- package/bin/gsd-t-orchestrator.js +0 -535
- package/bin/gsd-t-parallel-probe.cjs +0 -132
- package/bin/gsd-t-ratelimit-probe-worker.cjs +0 -237
- package/bin/gsd-t-ratelimit-probe.cjs +0 -648
- package/bin/gsd-t-report-tokens.cjs +0 -549
- package/bin/gsd-t-stream-feed-client.cjs +0 -151
- package/bin/gsd-t-token-backfill.cjs +0 -366
- package/bin/gsd-t-token-capture.cjs +0 -321
- package/bin/gsd-t-token-dashboard.cjs +0 -353
- package/bin/gsd-t-token-regenerate-log.cjs +0 -129
- package/bin/gsd-t-tool-attribution.cjs +0 -377
- package/bin/gsd-t-tool-cost.cjs +0 -195
- package/bin/gsd-t-transcript-tee.cjs +0 -246
- package/bin/gsd-t-unattended-heartbeat.cjs +0 -188
- package/bin/gsd-t-unattended-platform.cjs +0 -551
- package/bin/gsd-t-unattended-platform.js +0 -381
- package/bin/gsd-t-unattended-safety.cjs +0 -773
- package/bin/gsd-t-unattended-safety.js +0 -788
- package/bin/gsd-t-unattended.cjs +0 -2109
- package/bin/gsd-t-unattended.js +0 -1367
- package/bin/gsd-t-worker-dispatch.cjs +0 -211
- package/bin/handoff-lock.cjs +0 -249
- package/bin/handoff-lock.js +0 -249
- package/bin/headless-auto-spawn.cjs +0 -711
- package/bin/headless-auto-spawn.js +0 -373
- package/bin/headless-exit-codes.cjs +0 -67
- package/bin/live-activity-report.cjs +0 -615
- package/bin/log-tail.cjs +0 -81
- package/bin/m44-proof-measure.cjs +0 -285
- package/bin/m46-iter-proof.cjs +0 -149
- package/bin/m46-worker-proof.cjs +0 -201
- package/bin/m55-substrate-proof.cjs +0 -134
- package/bin/metrics-rollup.js +0 -200
- package/bin/model-windows.cjs +0 -99
- package/bin/model-windows.test.cjs +0 -75
- package/bin/parallelism-report.cjs +0 -535
- package/bin/runway-estimator.cjs +0 -242
- package/bin/spawn-plan-derive.cjs +0 -163
- package/bin/spawn-plan-status-updater.cjs +0 -292
- package/bin/spawn-plan-writer.cjs +0 -204
- package/bin/supervisor-pid-fingerprint.cjs +0 -126
- package/bin/token-budget.cjs +0 -265
- package/bin/unattended-watch-format.cjs +0 -178
- package/bin/watch-progress.js +0 -155
- package/commands/gsd-t-unattended-stop.md +0 -85
- package/commands/gsd-t-unattended-watch.md +0 -465
- package/commands/gsd-t-unattended.md +0 -476
- package/commands/gsd-t-visualize.md +0 -116
- package/scripts/gsd-t-context-meter.e2e.test.js +0 -364
- package/scripts/gsd-t-context-meter.js +0 -341
- package/scripts/gsd-t-context-meter.test.js +0 -471
- package/scripts/gsd-t-dashboard-server.js +0 -1203
- package/scripts/gsd-t-post-commit-spawn-plan.sh +0 -86
- package/scripts/gsd-t-transcript.html +0 -1821
- package/scripts/hooks/gsd-t-conversation-capture.js +0 -439
- package/scripts/hooks/gsd-t-in-session-usage-hook.js +0 -84
- package/scripts/spawn-plan-fmt-tokens.cjs +0 -80
- package/templates/hooks/post-commit-spawn-plan.sh +0 -85
package/commands/gsd-t-wave.md
CHANGED
|
@@ -1,454 +1,65 @@
|
|
|
1
|
-
# GSD-T: Wave — Full Cycle Orchestration
|
|
1
|
+
# GSD-T: Wave — Full Cycle Orchestration
|
|
2
2
|
|
|
3
|
-
You are the
|
|
3
|
+
You are the lead agent. Run a milestone wave end-to-end by invoking the canonical Workflow script at `templates/workflows/gsd-t-wave.workflow.js`.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## What this command does
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Replaces the M40-era wave-orchestrator-agent-per-phase scaffolding with a single Workflow that composes execute and verify as sub-workflows:
|
|
8
8
|
|
|
9
|
-
## Spawn Primitive — Always Headless (M43 D4, v2.0.0)
|
|
10
|
-
|
|
11
|
-
Per `.gsd-t/contracts/headless-default-contract.md` v2.0.0. Spawn classifications (kept for logging only — both always headless):
|
|
12
|
-
|
|
13
|
-
- `spawnType: 'primary'` — per-phase agents (partition, discuss, plan, impact, execute, test-sync, integrate, verify+complete)
|
|
14
|
-
- `spawnType: 'validation'` — post-phase spot-checks, doc-ripple agent
|
|
15
|
-
|
|
16
|
-
Spawn path is `autoSpawnHeadless({command, spawnType, projectDir, sessionContext})` with the read-back banner surfacing completion.
|
|
17
|
-
|
|
18
|
-
## Model Assignment
|
|
19
|
-
|
|
20
|
-
Per `.gsd-t/contracts/model-selection-contract.md` v1.0.0. Each phase spawn picks its tier from `bin/model-selector.js` — the wave orchestrator itself is routine coordination work.
|
|
21
|
-
|
|
22
|
-
- **Wave orchestrator (this agent)**: `sonnet` (`selectModel({phase: "wave"})`).
|
|
23
|
-
- **Per-phase spawns**: each phase agent selects its own tier — `partition` → opus, `discuss` → opus, `plan` → sonnet, `execute` → sonnet (with mechanical haiku subroutines and opus Red Team), `test-sync` → sonnet, `integrate` → sonnet, `verify` → opus, `doc-ripple` → sonnet. The phase command files carry their own Model Assignment blocks.
|
|
24
|
-
- **Escalation**: `/advisor` convention-based fallback from `bin/advisor-integration.js` at declared high-stakes sub-decisions (see `.gsd-t/M35-advisor-findings.md`). Never silently downgrade the model or skip phases under context pressure — M35 removed that behavior.
|
|
25
|
-
|
|
26
|
-
## Step 0.1: Verify Context Gate Readiness (MANDATORY — first thing in a fresh session)
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
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-wave --step 0 --step-label ".1: Verify Context Gate Readiness (MANDATORY — first thing in a fresh session)" 2>/dev/null || true
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Run via Bash:
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
node -e "const tb = require('./bin/token-budget.cjs'); const s = tb.getSessionStatus('.'); console.log(JSON.stringify(s));"
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
This calls `getSessionStatus()` which reads `.gsd-t/.context-meter-state.json` produced by the Context Meter PostToolUse hook. The returned `{pct, threshold}` is captured for the NEXT spawn's token-log Ctx% column — under headless-default-contract v2.0.0 the `threshold` band does NOT drive the spawn decision; every phase agent goes through `autoSpawnHeadless()` unconditionally. When the state file is absent, `getSessionStatus()` returns `{pct: 0, threshold: 'normal'}`. `thresholdPct` (default `75`) and `modelWindowSize` are configured in `.gsd-t/context-meter-config.json`.
|
|
39
|
-
|
|
40
|
-
## Step 1: Load State (Lightweight)
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
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-wave --step 1 --step-label "Load State (Lightweight)" 2>/dev/null || true
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Read ONLY:
|
|
47
|
-
1. `.gsd-t/progress.md` — current status, milestone name, phase state
|
|
48
|
-
2. `CLAUDE.md` — autonomy level only (scan for Level 1/2/3)
|
|
49
|
-
|
|
50
|
-
Do NOT read contracts, domains, docs, or source code. You are the orchestrator — phase agents handle their own context loading.
|
|
51
|
-
|
|
52
|
-
### Integrity Check
|
|
53
|
-
|
|
54
|
-
After reading progress.md, verify it contains the required fields before proceeding:
|
|
55
|
-
- **Status field**: A `Status:` line with a recognized value (DEFINED, PARTITIONED, PLANNED, etc.)
|
|
56
|
-
- **Milestone name**: A `Milestone` heading or table entry identifying the current milestone
|
|
57
|
-
- **Domains table**: A `| Domain |` table with at least one row
|
|
58
|
-
|
|
59
|
-
If ANY of these are missing or malformed, STOP and report:
|
|
60
|
-
"Wave cannot proceed — progress.md is missing required fields: {list}. Run `/gsd-t-status` to inspect, or `/gsd-t-init` to repair."
|
|
61
|
-
Do NOT attempt to fix progress.md yourself — that risks data loss.
|
|
62
|
-
|
|
63
|
-
## Step 2: Determine Resume Point
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
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-wave --step 2 --step-label "Determine Resume Point" 2>/dev/null || true
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
From progress.md status, determine which phase to start from:
|
|
70
|
-
|
|
71
|
-
| Status | Next Phase |
|
|
72
|
-
|--------|------------|
|
|
73
|
-
| READY | Need milestone first — prompt user or run milestone |
|
|
74
|
-
| INITIALIZED / DEFINED | Partition |
|
|
75
|
-
| PARTITIONED | Discuss (or skip to Plan if path is clear) |
|
|
76
|
-
| DISCUSSED | Plan |
|
|
77
|
-
| PLANNED | Impact |
|
|
78
|
-
| IMPACT_ANALYZED | Execute |
|
|
79
|
-
| EXECUTED | Test-Sync |
|
|
80
|
-
| TESTS_SYNCED | Integrate |
|
|
81
|
-
| INTEGRATED | Verify |
|
|
82
|
-
| VERIFIED | Complete |
|
|
83
|
-
| VERIFY_FAILED | Remediate → re-Verify |
|
|
84
|
-
|
|
85
|
-
## Step 2.5: Token Budget Pre-Flight (if available)
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
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-wave --step 2 --step-label ".5: Token Budget Pre-Flight (if available)" 2>/dev/null || true
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
Before starting the phase loop, check the projected token cost for this milestone:
|
|
92
|
-
|
|
93
|
-
Run via Bash:
|
|
94
|
-
`node -e "const tb = require('./bin/token-budget.cjs'); const est = tb.estimateMilestoneCost('.'); if(est) process.stdout.write(JSON.stringify(est));" 2>/dev/null`
|
|
95
|
-
|
|
96
|
-
If the command returns data, display to user:
|
|
97
|
-
- `estimated_tokens`: projected total tokens for this milestone
|
|
98
|
-
- `warning`: if `estimated_tokens > budget_ceiling * 0.8`, warn: "Token budget pre-flight: {estimated_tokens} tokens estimated — approaching session ceiling. Consider splitting milestone."
|
|
99
|
-
|
|
100
|
-
If the file doesn't exist or returns nothing, skip silently and proceed.
|
|
101
|
-
|
|
102
|
-
## Step 3: Phase Orchestration Loop
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
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-wave --step 3 --step-label "Phase Orchestration Loop" 2>/dev/null || true
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
For each remaining phase, spawn an **independent agent** using the Task tool. Each agent gets a fresh context window, loads its own state from files, and reports back.
|
|
109
|
-
|
|
110
|
-
### Graph Availability
|
|
111
|
-
|
|
112
|
-
If `.gsd-t/graph/meta.json` exists, the code graph is available for all phases. Each phase agent's spawn prompt should include:
|
|
113
|
-
"If .gsd-t/graph/meta.json exists, use graph queries (getCallers, getDomainBoundaryViolations, getTestsFor, etc.) to enhance analysis per the phase command instructions."
|
|
114
|
-
|
|
115
|
-
### Phase Agent Spawn Pattern
|
|
116
|
-
|
|
117
|
-
For each phase, spawn the agent like this:
|
|
118
|
-
|
|
119
|
-
**Stack Rules Detection (before spawning subagent):**
|
|
120
|
-
Run via Bash to detect project stack and collect matching rules:
|
|
121
|
-
`GSD_T_DIR=$(npm root -g 2>/dev/null)/@tekyzinc/gsd-t; STACKS_DIR="$GSD_T_DIR/templates/stacks"; STACK_RULES=""; if [ -d "$STACKS_DIR" ]; then for f in "$STACKS_DIR"/_*.md; do [ -f "$f" ] && STACK_RULES="${STACK_RULES}$(cat "$f")"$'\n\n'; done; if [ -f "package.json" ]; then grep -q '"react"' package.json 2>/dev/null && [ -f "$STACKS_DIR/react.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/react.md")"$'\n\n'; (grep -q '"typescript"' package.json 2>/dev/null || [ -f "tsconfig.json" ]) && [ -f "$STACKS_DIR/typescript.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/typescript.md")"$'\n\n'; grep -qE '"(express|fastify|hono|koa)"' package.json 2>/dev/null && [ -f "$STACKS_DIR/node-api.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/node-api.md")"$'\n\n'; fi; [ -f "requirements.txt" ] || [ -f "pyproject.toml" ] && [ -f "$STACKS_DIR/python.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/python.md")"$'\n\n'; [ -f "go.mod" ] && [ -f "$STACKS_DIR/go.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/go.md")"$'\n\n'; [ -f "Cargo.toml" ] && [ -f "$STACKS_DIR/rust.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/rust.md")"$'\n\n'; ([ -f ".gsd-t/contracts/design-contract.md" ] || [ -f "design-tokens.json" ] || [ -d "design-tokens" ] || [ -f ".figmarc" ] || [ -f "figma.config.json" ] || grep -q '"figma"' ~/.claude/settings.json 2>/dev/null) && [ -f "$STACKS_DIR/design-to-code.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/design-to-code.md")"$'\n\n'; fi`
|
|
122
|
-
|
|
123
|
-
If STACK_RULES is non-empty, append to the subagent prompt:
|
|
124
|
-
```
|
|
125
|
-
## Stack Rules (MANDATORY — violations fail this task)
|
|
126
|
-
|
|
127
|
-
{STACK_RULES}
|
|
128
|
-
|
|
129
|
-
These standards have the same enforcement weight as contract compliance.
|
|
130
|
-
Violations are task failures, not warnings.
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
If STACK_RULES is empty (no templates/stacks/ dir or no matches), skip silently.
|
|
134
|
-
|
|
135
|
-
**OBSERVABILITY LOGGING (MANDATORY) — wrap every phase spawn with `captureSpawn`:**
|
|
136
|
-
|
|
137
|
-
```
|
|
138
|
-
node -e "
|
|
139
|
-
const { captureSpawn } = require('./bin/gsd-t-token-capture.cjs');
|
|
140
|
-
(async () => {
|
|
141
|
-
await captureSpawn({
|
|
142
|
-
command: 'gsd-t-wave',
|
|
143
|
-
step: '{PHASE}',
|
|
144
|
-
model: 'sonnet',
|
|
145
|
-
description: 'phase: {PHASE}',
|
|
146
|
-
projectDir: '.',
|
|
147
|
-
notes: 'phase: {PHASE}',
|
|
148
|
-
spawnFn: async () => { /* Task agent (spawnType: primary, subagent_type: 'general-purpose', mode: 'bypassPermissions'):
|
|
149
|
-
'Execute the {PHASE} phase of the current GSD-T milestone.
|
|
150
|
-
Read and follow the full instructions in commands/gsd-t-{phase}.md
|
|
151
|
-
Read .gsd-t/progress.md for current milestone and state.
|
|
152
|
-
Read CLAUDE.md for project conventions.
|
|
153
|
-
Read .gsd-t/contracts/ for domain interfaces.
|
|
154
|
-
Complete the phase fully:
|
|
155
|
-
- Follow every step in the command file
|
|
156
|
-
- Update .gsd-t/progress.md status when done
|
|
157
|
-
- Run document ripple as specified
|
|
158
|
-
- Commit your work
|
|
159
|
-
Report back: one-line status summary.' */ },
|
|
160
|
-
});
|
|
161
|
-
})();
|
|
162
|
-
"
|
|
163
9
|
```
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
After each phase agent returns, run via Bash:
|
|
170
|
-
|
|
171
|
-
```bash
|
|
172
|
-
node -e "const tb=require('./bin/token-budget.cjs'); const s=tb.getSessionStatus('.'); process.stdout.write(JSON.stringify(s));"
|
|
10
|
+
gsd-t-wave.workflow.js
|
|
11
|
+
├── workflow("gsd-t-execute", {milestone, domains, projectDir})
|
|
12
|
+
│ └── preflight → brief → disjointness → parallel(workers) → integrate → verify-gate
|
|
13
|
+
└── workflow("gsd-t-verify", {milestone, projectDir})
|
|
14
|
+
└── preflight → verify-gate → M57 gates → M58 gate → orthogonal triad → synthesis
|
|
173
15
|
```
|
|
174
16
|
|
|
175
|
-
The
|
|
176
|
-
|
|
177
|
-
Handling:
|
|
178
|
-
Capture `pct` for the next spawn's Ctx% log field. The `threshold` field is observational under headless-default-contract v2.0.0 — every spawn routes through `autoSpawnHeadless()` unconditionally, so the band does not gate phase progression.
|
|
179
|
-
|
|
180
|
-
### Phase Sequence
|
|
181
|
-
|
|
182
|
-
Execute phases in this order, spawning one agent per phase:
|
|
183
|
-
|
|
184
|
-
#### 1. PARTITION
|
|
185
|
-
Spawn agent → `commands/gsd-t-partition.md`
|
|
186
|
-
- After: Read `progress.md`, verify status = PARTITIONED
|
|
187
|
-
- If failed: Report error, stop
|
|
188
|
-
|
|
189
|
-
#### 2. DISCUSS (conditional)
|
|
190
|
-
- **Structured skip check** — skip discuss and go directly to Plan if ALL of these are true:
|
|
191
|
-
- (a) Single domain milestone (only one entry in Domains table)
|
|
192
|
-
- (b) No items containing "OPEN QUESTION" in the Decision Log
|
|
193
|
-
- (c) For multi-domain milestones: all cross-domain contracts exist in `.gsd-t/contracts/`
|
|
194
|
-
- If ANY check fails: Spawn agent → `commands/gsd-t-discuss.md`
|
|
195
|
-
- **Note**: Discuss always pauses for user input, even at Level 3. The discuss agent will interact with the user directly.
|
|
196
|
-
- If all checks pass: Skip to Plan
|
|
197
|
-
|
|
198
|
-
#### 3. PLAN
|
|
199
|
-
Spawn agent → `commands/gsd-t-plan.md`
|
|
200
|
-
- After: Read `progress.md`, verify status = PLANNED
|
|
201
|
-
|
|
202
|
-
#### 4. IMPACT
|
|
203
|
-
Spawn agent → `commands/gsd-t-impact.md`
|
|
204
|
-
- After: Read `progress.md` and `.gsd-t/impact-report.md`
|
|
205
|
-
- **Decision Gate**:
|
|
206
|
-
- PROCEED → continue to Execute
|
|
207
|
-
- PROCEED WITH CAUTION → log items, continue
|
|
208
|
-
- BLOCK → stop, report to user, wait for decision
|
|
209
|
-
|
|
210
|
-
#### 5. EXECUTE
|
|
211
|
-
Spawn agent → `commands/gsd-t-execute.md`
|
|
212
|
-
- This is the heaviest phase. The execute agent uses **task-level dispatch** (fresh-dispatch-contract.md): one Task subagent per task within each domain, each receiving only scope.md + relevant contracts + single task + graph context + up to 5 prior summaries. The execute agent handles domain task-dispatching and QA internally.
|
|
213
|
-
|
|
214
|
-
##### Parallel Dispatch (M44 D9, single instrument)
|
|
17
|
+
The native Workflow `workflow()` global runs each sub-workflow inline and returns its envelope. Sub-workflow tokens count against the parent's budget; sub-workflow agents appear under a "▸ name" group in `/workflows`. Nesting is one level deep — a sub-workflow cannot call another sub-workflow.
|
|
215
18
|
|
|
216
|
-
|
|
19
|
+
## Step 1: Read the current milestone state
|
|
217
20
|
|
|
218
|
-
|
|
219
|
-
- **Team/parallel mode**: If the plan defines parallel domains (same wave), the execute agent dispatches each domain teammate with `isolation: "worktree"` (per worktree-isolation-contract.md). Each domain works in an isolated git worktree. After all domains complete, the execute agent runs the Sequential Merge Protocol: merge domain A → test → merge domain B → test. Per-domain rollback if tests fail. Worktrees are cleaned up after all merges complete.
|
|
220
|
-
- After: Read `progress.md`, verify status = EXECUTED. Phase summary must include replan actions if any occurred:
|
|
221
|
-
```
|
|
222
|
-
📋 Phase 5 (EXECUTE): {N}/{N} tasks done | Replan cycles: {N} | Domains revised: {list or "none"}
|
|
223
|
-
```
|
|
21
|
+
Read `.gsd-t/progress.md` to determine the active milestone and the wave domain list from `.gsd-t/contracts/m{NN}-integration-points.md`.
|
|
224
22
|
|
|
225
|
-
|
|
226
|
-
Spawn agent → `commands/gsd-t-test-sync.md`
|
|
227
|
-
- After: Read `progress.md`, verify status = TESTS_SYNCED
|
|
23
|
+
## Step 2: Invoke the wave Workflow
|
|
228
24
|
|
|
229
|
-
|
|
230
|
-
Spawn agent → `commands/gsd-t-integrate.md`
|
|
231
|
-
- After: Read `progress.md`, verify status = INTEGRATED
|
|
25
|
+
Call the `Workflow` tool with:
|
|
232
26
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
- Phase summary must include the `Goal-Backward:` line from verify-report.md:
|
|
243
|
-
```
|
|
244
|
-
📋 Phase 8 (VERIFY+COMPLETE): {N} gates passed | Goal-Backward: {PASS/WARN/FAIL} — {N} requirements checked, {N} findings
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
#### 9. DOC-RIPPLE (Automated — after verify+complete)
|
|
248
|
-
|
|
249
|
-
After the final phase completes but before wave reports done:
|
|
250
|
-
|
|
251
|
-
1. Run threshold check — read `git diff --name-only HEAD~1` and evaluate against doc-ripple-contract.md trigger conditions
|
|
252
|
-
2. If SKIP: log "Doc-ripple: SKIP — {reason}" and proceed
|
|
253
|
-
3. If FIRE: spawn doc-ripple agent — `spawnType: 'validation'` (always headless per headless-default-contract v2.0.0):
|
|
254
|
-
|
|
255
|
-
⚙ [{model}] gsd-t-doc-ripple → blast radius analysis + parallel updates
|
|
256
|
-
|
|
257
|
-
Task subagent (spawnType: validation, general-purpose, model: sonnet):
|
|
258
|
-
"Execute the doc-ripple workflow per commands/gsd-t-doc-ripple.md.
|
|
259
|
-
Git diff context: {files changed list}
|
|
260
|
-
Command that triggered: wave
|
|
261
|
-
Produce manifest at .gsd-t/doc-ripple-manifest.md.
|
|
262
|
-
Update all affected documents.
|
|
263
|
-
Report: 'Doc-ripple: {N} checked, {N} updated, {N} skipped'"
|
|
264
|
-
|
|
265
|
-
4. After doc-ripple returns, verify manifest exists and report summary inline
|
|
266
|
-
|
|
267
|
-
### Between Each Phase
|
|
268
|
-
|
|
269
|
-
After each agent completes, run this spot-check before proceeding:
|
|
270
|
-
|
|
271
|
-
1. **Status check**: Read `.gsd-t/progress.md` — verify the phase updated status correctly (no FAILED markers, status matches expected phase completion state)
|
|
272
|
-
2. **Git check**: Run `git log --oneline -5` — verify commits were made during this phase (if execute/integrate: at least one commit per task completed)
|
|
273
|
-
3. **Filesystem check**: Verify key output files exist on disk — e.g., for partition: `.gsd-t/domains/*/scope.md` and `.gsd-t/contracts/` files; for execute: newly created source files; for verify: `.gsd-t/verify-report.md`. Do not trust agent-reported completions alone.
|
|
274
|
-
4. Report to user:
|
|
275
|
-
```
|
|
276
|
-
✅ {Phase} complete — {agent's one-line summary}
|
|
277
|
-
📋 Spot-check: {N} commits | {N} output files verified | no FAILED markers
|
|
278
|
-
```
|
|
279
|
-
5. If spot-check fails: write failure event via Bash, then report the discrepancy, re-spawn the phase agent once to correct it, then re-verify. If still failing: stop and report to user.
|
|
280
|
-
```bash
|
|
281
|
-
node ~/.claude/scripts/gsd-t-event-writer.js \
|
|
282
|
-
--type phase_transition \
|
|
283
|
-
--command gsd-t-wave \
|
|
284
|
-
--phase {COMPLETED_PHASE} \
|
|
285
|
-
--reasoning "Spot-check failed: {one-line discrepancy summary}" \
|
|
286
|
-
--outcome failure \
|
|
287
|
-
--agent-id "${CLAUDE_SESSION_ID:-unknown}" || true
|
|
288
|
-
```
|
|
289
|
-
5a. After spot-check passes, write success event via Bash:
|
|
290
|
-
```bash
|
|
291
|
-
node ~/.claude/scripts/gsd-t-event-writer.js \
|
|
292
|
-
--type phase_transition \
|
|
293
|
-
--command gsd-t-wave \
|
|
294
|
-
--phase {COMPLETED_PHASE} \
|
|
295
|
-
--reasoning "Phase complete: {one-line spot-check summary}" \
|
|
296
|
-
--outcome success \
|
|
297
|
-
--agent-id "${CLAUDE_SESSION_ID:-unknown}" || true
|
|
298
|
-
```
|
|
299
|
-
The `|| true` ensures event write failure never blocks wave execution.
|
|
300
|
-
6. Proceed to next phase
|
|
301
|
-
|
|
302
|
-
## Step 4: Autonomy Behavior
|
|
303
|
-
|
|
304
|
-
```bash
|
|
305
|
-
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-wave --step 4 --step-label "Autonomy Behavior" 2>/dev/null || true
|
|
27
|
+
```js
|
|
28
|
+
{
|
|
29
|
+
scriptPath: "templates/workflows/gsd-t-wave.workflow.js",
|
|
30
|
+
args: {
|
|
31
|
+
milestone: "M{NN}",
|
|
32
|
+
domains: ["m{NN}-d1-...", "m{NN}-d2-...", ...], // domains for this wave only, per integration-points
|
|
33
|
+
projectDir: "."
|
|
34
|
+
}
|
|
35
|
+
}
|
|
306
36
|
```
|
|
307
37
|
|
|
308
|
-
|
|
309
|
-
- Destructive Action Guard violations (reported by phase agent)
|
|
310
|
-
- Impact analysis BLOCK verdict
|
|
311
|
-
- Unrecoverable errors after 2 fix attempts
|
|
312
|
-
- Discuss phase (always pauses for user input)
|
|
313
|
-
|
|
314
|
-
**Level 1–2**: Pause between phases, show status, ask to continue.
|
|
315
|
-
|
|
316
|
-
## Step 5: Completion
|
|
38
|
+
## Step 3: Interpret the result
|
|
317
39
|
|
|
318
|
-
```
|
|
319
|
-
|
|
40
|
+
```js
|
|
41
|
+
{
|
|
42
|
+
status: "complete" | "verify-failed" | "failed",
|
|
43
|
+
milestone: "M{NN}",
|
|
44
|
+
execResult: { status, domainResults, integrate, verifyGate },
|
|
45
|
+
verifyResult: { status, overallVerdict, verifyGate, buildCoverage, ciParity, testDataPurge, triad, verdict }
|
|
46
|
+
}
|
|
320
47
|
```
|
|
321
48
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
✅ Milestone "{name}" complete!
|
|
326
|
-
═══════════════════════════════════════════════════════════════════════════════
|
|
327
|
-
|
|
328
|
-
📁 Archived to: .gsd-t/milestones/{name}-{date}/
|
|
329
|
-
🏷️ Tagged as: milestone/{name}
|
|
330
|
-
|
|
331
|
-
Summary:
|
|
332
|
-
- Domains: {list}
|
|
333
|
-
- Tasks completed: {N}
|
|
334
|
-
- Contracts: {N} defined/verified
|
|
335
|
-
- Tests: {N} added/updated
|
|
336
|
-
- Impact items addressed: {N}
|
|
337
|
-
- Decision log entries: {N}
|
|
338
|
-
|
|
339
|
-
Next steps:
|
|
340
|
-
- Push tag: git push origin milestone/{name}
|
|
341
|
-
- Start next: /gsd-t-milestone "{next}"
|
|
342
|
-
- View roadmap: /gsd-t-status
|
|
343
|
-
═══════════════════════════════════════════════════════════════════════════════
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
## Interruption Handling
|
|
347
|
-
|
|
348
|
-
If the user interrupts or a phase agent fails:
|
|
349
|
-
1. The current phase agent saves its own state to `.gsd-t/progress.md`
|
|
350
|
-
2. Report: "Paused at {phase}. Run `/gsd-t-resume` to continue."
|
|
351
|
-
3. Resume will pick up from the last completed phase
|
|
352
|
-
|
|
353
|
-
## Error Recovery
|
|
354
|
-
|
|
355
|
-
### If impact analysis blocks:
|
|
356
|
-
- Read the impact report from the agent's output
|
|
357
|
-
- Report blocking issues to user
|
|
358
|
-
|
|
359
|
-
**Level 3**: Spawn a remediation agent to fix blocking issues, then re-spawn impact agent. Max 2 attempts.
|
|
360
|
-
If both attempts fail:
|
|
361
|
-
1. Write failure context to `.gsd-t/debug-state.jsonl` via `node -e "require('./bin/debug-ledger.js').appendEntry('.', {iteration:1,timestamp:new Date().toISOString(),test:'impact-remediation',error:'2 in-context fix attempts exhausted',hypothesis:'see impact-report.md',fix:'n/a',fixFiles:[],result:'STILL_FAILS',learning:'delegating to headless debug-loop',model:'sonnet',duration:0})"`
|
|
362
|
-
2. Log: "Delegating to headless debug-loop (2 in-context attempts exhausted)"
|
|
363
|
-
3. Run: `gsd-t headless --debug-loop --max-iterations 10`
|
|
364
|
-
4. Exit code 0 → continue; 1/4 → log to `.gsd-t/deferred-items.md`, report to user; 3 → report error
|
|
365
|
-
**Level 1–2**: Ask user for direction.
|
|
366
|
-
|
|
367
|
-
### If tests fail during execute:
|
|
368
|
-
- The execute agent handles test failures internally (up to 2 fix attempts)
|
|
369
|
-
- If still failing after 2 attempts, the execute agent reports failure
|
|
370
|
-
- Orchestrator stops and reports to user
|
|
371
|
-
|
|
372
|
-
### If verify fails:
|
|
373
|
-
- Read verify report for failure details
|
|
374
|
-
|
|
375
|
-
**Level 3**: Spawn remediation agent, then re-spawn verify agent. Max 2 attempts.
|
|
376
|
-
If both attempts fail:
|
|
377
|
-
1. Write failure context to `.gsd-t/debug-state.jsonl` via `node -e "require('./bin/debug-ledger.js').appendEntry('.', {iteration:1,timestamp:new Date().toISOString(),test:'verify-remediation',error:'2 in-context fix attempts exhausted',hypothesis:'see verify-report.md',fix:'n/a',fixFiles:[],result:'STILL_FAILS',learning:'delegating to headless debug-loop',model:'sonnet',duration:0})"`
|
|
378
|
-
2. Log: "Delegating to headless debug-loop (2 in-context attempts exhausted)"
|
|
379
|
-
3. Run: `gsd-t headless --debug-loop --max-iterations 10`
|
|
380
|
-
4. Exit code 0 → re-spawn verify agent; 1/4 → log to `.gsd-t/deferred-items.md`, report to user; 3 → report error
|
|
381
|
-
**Level 1–2**: Ask user for direction.
|
|
49
|
+
- `complete` → auto-advance to `/gsd-t-complete-milestone`.
|
|
50
|
+
- `verify-failed` → execute completed but verify-gate found regressions; invoke `gsd-t-debug` against `verifyResult.verdict.blockingFindings`.
|
|
51
|
+
- `failed` → domain worker, integrate, or preflight blocked; read `execResult.domainResults` for the blocking entry.
|
|
382
52
|
|
|
383
|
-
##
|
|
53
|
+
## Multi-Wave Milestones
|
|
384
54
|
|
|
385
|
-
Each
|
|
386
|
-
- Phase 7 doesn't carry the context baggage from phases 1-6
|
|
387
|
-
- Mid-phase compaction is eliminated for standard-sized phases
|
|
388
|
-
- Each agent loads only what it needs from state files
|
|
389
|
-
- The orchestrator stays lightweight (~30KB total)
|
|
55
|
+
For milestones with multiple waves (see `.gsd-t/contracts/m{NN}-integration-points.md` "Wave Sequencing"), invoke `gsd-t-wave` once per wave. Each call uses the domain list for that wave. Checkpoints (C1, C2, C3, …) gate between waves — verify the prior wave's verdict before starting the next.
|
|
390
56
|
|
|
391
|
-
|
|
57
|
+
## Document Ripple
|
|
392
58
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
### bypassPermissions Mode
|
|
396
|
-
|
|
397
|
-
Wave spawns each phase agent with `mode: "bypassPermissions"`. This means agents execute bash commands, write files, and perform git operations **without per-action user approval**. This is by design — wave phases would be impractical with manual approval at every step.
|
|
398
|
-
|
|
399
|
-
### Attack Surface
|
|
400
|
-
|
|
401
|
-
If command files in `~/.claude/commands/` are tampered with, wave agents will execute the modified instructions with full permissions. The attack requires:
|
|
402
|
-
1. Write access to the user's `~/.claude/commands/` directory
|
|
403
|
-
2. Knowledge of the GSD-T command file format
|
|
404
|
-
3. The user to run `/gsd-t-wave` after tampering
|
|
405
|
-
|
|
406
|
-
### Current Mitigations
|
|
407
|
-
|
|
408
|
-
- **npm-installed files**: Command files are installed from the npm registry, providing a known-good source
|
|
409
|
-
- **Content comparison on update**: `gsd-t update` compares file contents and reports changes
|
|
410
|
-
- **User-owned directory**: `~/.claude/commands/` inherits the user's filesystem permissions
|
|
411
|
-
- **Destructive Action Guard**: CLAUDE.md instructions provide soft protection against destructive operations (DROP TABLE, schema changes, etc.), though agents could theoretically ignore these
|
|
412
|
-
- **Autonomy levels**: Level 1 and Level 2 pause between phases, giving users visibility into agent activity
|
|
413
|
-
|
|
414
|
-
### Recommendations
|
|
415
|
-
|
|
416
|
-
- For sensitive projects, use **Level 1 or Level 2 autonomy** instead of Level 3 to review each phase's output
|
|
417
|
-
- Periodically verify command file integrity: `gsd-t doctor` checks installation health
|
|
418
|
-
- If security is a concern, audit `~/.claude/commands/gsd-t-*.md` files for unexpected modifications
|
|
419
|
-
- Keep GSD-T updated (`gsd-t update`) to receive the latest command files from npm
|
|
420
|
-
|
|
421
|
-
## Workflow Visualization
|
|
422
|
-
|
|
423
|
-
```
|
|
424
|
-
┌──────────────────────────────────────────────────────────────────────────────┐
|
|
425
|
-
│ Wave Orchestrator (lightweight) │
|
|
426
|
-
│ │
|
|
427
|
-
│ ┌─────────┐ ┌─────────┐ ┌──────┐ ┌────────┐ ┌─────────┐ │
|
|
428
|
-
│ │PARTITION│ → │ DISCUSS │ → │ PLAN │ → │ IMPACT │ → │ EXECUTE │ │
|
|
429
|
-
│ │ agent 1 │ │ agent 2 │ │agent 3│ │agent 4 │ │ agent 5 │ │
|
|
430
|
-
│ └────┬────┘ └────┬────┘ └───┬──┘ └───┬────┘ └────┬────┘ │
|
|
431
|
-
│ ↓ ↓ ↓ ↓ ↓ │
|
|
432
|
-
│ status status status status status │
|
|
433
|
-
│ check check check check + check │
|
|
434
|
-
│ gate │
|
|
435
|
-
│ │
|
|
436
|
-
│ ┌──────────────────┐ ┌───────────┐ ┌─────────────────┐ │
|
|
437
|
-
│ │ VERIFY+COMPLETE │ ← │ INTEGRATE │ ←──── │ FULL TEST-SYNC │ │
|
|
438
|
-
│ │ agent 8 │ │ agent 7 │ │ agent 6 │ │
|
|
439
|
-
│ └────────┬─────────┘ └─────┬─────┘ └────────┬────────┘ │
|
|
440
|
-
│ ↓ ↓ ↓ │
|
|
441
|
-
│ gate check → status status │
|
|
442
|
-
│ auto-complete check check │
|
|
443
|
-
│ archive + tag │
|
|
444
|
-
│ │
|
|
445
|
-
│ Each agent: fresh context window, reads state from files, dies when done │
|
|
446
|
-
│ Orchestrator: 8 agents (was 9), ~30KB total, never compacts │
|
|
447
|
-
└──────────────────────────────────────────────────────────────────────────────┘
|
|
448
|
-
```
|
|
59
|
+
Wave delegates to execute and verify; their doc-ripple guarantees apply. Wave itself adds:
|
|
449
60
|
|
|
450
|
-
|
|
61
|
+
- `.gsd-t/progress.md` — wave-level status line + per-wave verdict
|
|
451
62
|
|
|
452
|
-
##
|
|
63
|
+
## Next Up
|
|
453
64
|
|
|
454
|
-
|
|
65
|
+
`/gsd-t-complete-milestone` (after final wave). For mid-milestone waves, no next-up — operator runs the next wave when ready.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tekyzinc/gsd-t",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.12",
|
|
4
4
|
"description": "GSD-T: Contract-Driven Development for Claude Code — 54 slash commands with headless-by-default workflow spawning, unattended supervisor relay with event stream, graph-powered code analysis, real-time agent dashboard, task telemetry, doc-ripple enforcement, backlog management, impact analysis, test sync, milestone archival, and PRD generation",
|
|
5
5
|
"author": "Tekyz, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,7 +39,9 @@
|
|
|
39
39
|
const fs = require("fs");
|
|
40
40
|
const path = require("path");
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
// M61 D1: model-windows retired. SAFE_DEFAULT_WINDOW was 1M (the Opus 4.7/4.8
|
|
43
|
+
// native window). Native /context replaces the meter that consumed this.
|
|
44
|
+
const SAFE_DEFAULT_WINDOW = 1_000_000;
|
|
43
45
|
|
|
44
46
|
const MAX_STDIN = 1024 * 1024; // 1 MiB
|
|
45
47
|
const SCHEMA_VERSION = 1;
|
|
@@ -25,8 +25,6 @@ PASS_FILE="$ROOT/.gsd-t/.last-playwright-pass"
|
|
|
25
25
|
# Patterns that count as "viewer/UI source" for gating purposes. Globs are
|
|
26
26
|
# checked against the staged file list returned by git.
|
|
27
27
|
VIEWER_SOURCE_PATTERNS=(
|
|
28
|
-
"scripts/gsd-t-transcript.html"
|
|
29
|
-
"scripts/gsd-t-dashboard-server.js"
|
|
30
28
|
"e2e/viewer/"
|
|
31
29
|
)
|
|
32
30
|
|