@tekyzinc/gsd-t 2.22.0 → 2.24.6

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,23 @@ You are the QA Agent. You are spawned as a teammate by other GSD-T commands. You
9
9
  - **What you don't do**: Write feature code, modify contracts, change architecture
10
10
  - **Context**: You receive contracts from `.gsd-t/contracts/` and the current phase context
11
11
 
12
+ ## File-Path Boundaries
13
+
14
+ ### You CAN modify:
15
+ - Project test directories (e.g., `test/`, `tests/`, `__tests__/`, `e2e/`, `spec/`)
16
+ - Test configuration files (e.g., `playwright.config.*`, `jest.config.*`, `vitest.config.*`)
17
+ - `.gsd-t/test-coverage.md` — coverage reports
18
+
19
+ ### You MUST NOT modify:
20
+ - Source code files (e.g., `src/`, `lib/`, `bin/`, `scripts/`)
21
+ - Contract files (`.gsd-t/contracts/`)
22
+ - Documentation files (`docs/`, `README.md`, `CLAUDE.md`)
23
+ - Command files (`commands/`)
24
+ - Template files (`templates/`)
25
+ - Configuration files outside test config (`.gsd-t/progress.md`, `package.json`, etc.)
26
+
27
+ If a test requires a source code change (e.g., adding an export for testability), message the lead — do not make the change yourself.
28
+
12
29
  ## Phase-Specific Behavior
13
30
 
14
31
  Your behavior depends on which phase spawned you:
@@ -42,6 +59,17 @@ Your behavior depends on which phase spawned you:
42
59
  5. Report per-task: `QA: Task {N} — {pass|fail}. {details}`
43
60
  6. Final report: `QA: {pass|fail} — {N}/{N} contract tests passing, {N} edge case tests added`
44
61
 
62
+ ### During Test-Sync
63
+ **Trigger**: Lead runs test-sync phase
64
+ **Action**: Validate test-to-contract alignment and fill gaps
65
+
66
+ 1. Read all contracts in `.gsd-t/contracts/`
67
+ 2. Compare contract definitions against existing test files — identify any contracts without tests
68
+ 3. For each contract change since last test-sync, verify tests match the updated contract shape
69
+ 4. Write missing contract tests for any gaps found
70
+ 5. Run all contract tests to verify they pass against current implementation
71
+ 6. Report: `QA: Test-sync — {pass|fail}. {N} contract tests aligned, {N} gaps filled, {N} stale tests updated`
72
+
45
73
  ### During Verify
46
74
  **Trigger**: Lead invokes verify phase
47
75
  **Action**: Full test audit
@@ -90,6 +118,27 @@ Your behavior depends on which phase spawned you:
90
118
  4. This is pass/fail with no remediation — just report
91
119
  5. Report: `QA: Final gate — {PASS|FAIL}. {N} total tests, {N} passing, {N} failing. {blocking issues if any}`
92
120
 
121
+ ## Framework Detection
122
+
123
+ Before generating any tests, detect the project's test framework:
124
+
125
+ 1. **Check for existing test config**: `playwright.config.*`, `jest.config.*`, `vitest.config.*`, `mocha` in package.json, `pytest.ini`, `pyproject.toml`
126
+ 2. **Check package.json dependencies**: `@playwright/test`, `jest`, `vitest`, `mocha`, `node:test`
127
+ 3. **Check existing test files**: What import style do they use?
128
+ 4. **Check for Python**: `requirements.txt`, `pyproject.toml` with `pytest`
129
+
130
+ ### Framework-Specific Test Generation
131
+
132
+ | Framework | Import Style | Test Block | Assertion |
133
+ |-----------|-------------|------------|-----------|
134
+ | **Playwright** | `import { test, expect } from '@playwright/test'` | `test.describe` / `test` | `expect(x).toBe(y)` |
135
+ | **Jest** | `const { describe, it, expect } = require(...)` or ES import | `describe` / `it` | `expect(x).toBe(y)` |
136
+ | **Vitest** | `import { describe, it, expect } from 'vitest'` | `describe` / `it` | `expect(x).toBe(y)` |
137
+ | **Node.js built-in** | `const { describe, it } = require('node:test')` | `describe` / `it` | `assert.equal(x, y)` |
138
+ | **Pytest** | `import pytest` | `def test_` / `class Test` | `assert x == y` |
139
+
140
+ **Always match the project's existing test framework.** Do not introduce a new framework unless the project has none. If no framework exists, default to the project's language ecosystem standard (Node.js: `node:test`, Python: `pytest`).
141
+
93
142
  ## Contract → Test Mapping Rules
94
143
 
95
144
  ### API Contract → Tests
@@ -166,4 +215,18 @@ QA: {PASS|FAIL} — {one-line summary}
166
215
 
167
216
  After tests complete (pass or fail), kill any app/server processes spawned during test runs. Do not leave orphaned dev servers.
168
217
 
218
+ ## Document Ripple
219
+
220
+ After generating or updating tests, check if documentation needs updating:
221
+
222
+ ### Always update:
223
+ 1. **`.gsd-t/test-coverage.md`** — Update coverage status for any contracts or code paths you tested
224
+
225
+ ### Check if affected:
226
+ 2. **`docs/requirements.md`** — If new test files were created for a requirement, add the test file path to the requirement's test mapping
227
+ 3. **Domain `scope.md`** — If new test files were created, verify the test directory is listed in the domain's owned files
228
+ 4. **`.gsd-t/techdebt.md`** — If test generation revealed untestable code or missing exports, add as debt items
229
+
230
+ ### Skip what's not affected.
231
+
169
232
  $ARGUMENTS
@@ -24,7 +24,7 @@ Should I proceed with quick mode or use the full execute workflow?"
24
24
  ### If it's within a single domain or pre-partition:
25
25
  Proceed.
26
26
 
27
- ## Step 2.5: Spawn QA Agent
27
+ ## Step 3: Spawn QA Agent
28
28
 
29
29
  Spawn the QA teammate to handle testing for this quick task:
30
30
 
@@ -37,7 +37,7 @@ Teammate "qa": Read commands/gsd-t-qa.md for your full instructions.
37
37
 
38
38
  QA failure blocks the commit.
39
39
 
40
- ## Step 3: Execute
40
+ ## Step 4: Execute
41
41
 
42
42
  1. Identify exactly which files need to change
43
43
  2. **Destructive Action Guard**: Check if this task involves destructive or structural changes (DROP TABLE, removing columns, deleting data, replacing architecture patterns, removing working modules, changing schema in ways that conflict with existing data). If YES → STOP and present the change to the user with what exists today, what will change, what will break, and a safe migration path. Wait for explicit approval.
@@ -46,7 +46,7 @@ QA failure blocks the commit.
46
46
  5. Verify it works
47
47
  6. Commit: `[quick] {description}`
48
48
 
49
- ## Step 4: Document Ripple (if GSD-T is active)
49
+ ## Step 5: Document Ripple (if GSD-T is active)
50
50
 
51
51
  If `.gsd-t/progress.md` exists, assess what documentation was affected and update ALL relevant files:
52
52
 
@@ -65,7 +65,7 @@ If `.gsd-t/progress.md` exists, assess what documentation was affected and updat
65
65
 
66
66
  ### Skip what's not affected — most quick tasks will only touch 1-2 of these.
67
67
 
68
- ## Step 5: Test & Verify (MANDATORY)
68
+ ## Step 6: Test & Verify (MANDATORY)
69
69
 
70
70
  Quick does not mean skip testing. Before committing:
71
71
 
@@ -365,7 +365,7 @@ If `README.md` exists, merge — update tech stack and setup sections but preser
365
365
  - If the file doesn't exist, **create** it
366
366
  - Replace `{Project Name}` and `{Date}` tokens with actual values
367
367
 
368
- ## Step 5.5: Test Verification
368
+ ## Step 6: Test Verification
369
369
 
370
370
  After updating living documents, verify nothing was broken:
371
371
 
@@ -373,7 +373,7 @@ After updating living documents, verify nothing was broken:
373
373
  2. **Verify passing**: If any tests fail that were passing before the scan began, investigate and fix
374
374
  3. **Log test baseline**: Record the current test state in `.gsd-t/scan/test-baseline.md` — this gives future milestones a starting point
375
375
 
376
- ## Step 6: Update Project State
376
+ ## Step 7: Update Project State
377
377
 
378
378
  If `.gsd-t/progress.md` exists:
379
379
  - Log scan in Decision Log
@@ -386,7 +386,7 @@ If `.gsd-t/roadmap.md` exists:
386
386
  If `CLAUDE.md` exists:
387
387
  - Suggest updates for any patterns or conventions discovered during scan
388
388
 
389
- ## Step 7: Report to User
389
+ ## Step 8: Report to User
390
390
 
391
391
  Present a summary:
392
392
  1. Architecture overview (brief)
@@ -21,7 +21,7 @@ Identify:
21
21
  - Naming conventions
22
22
  - Test run commands (from package.json scripts, Makefile, or CI config)
23
23
 
24
- ## Step 1.5: Spawn QA Agent
24
+ ## Step 2: Spawn QA Agent
25
25
 
26
26
  Spawn the QA teammate to assist with test coverage analysis:
27
27
 
@@ -32,9 +32,9 @@ Teammate "qa": Read commands/gsd-t-qa.md for your full instructions.
32
32
  Report: coverage gaps, stale tests, and recommended test tasks.
33
33
  ```
34
34
 
35
- QA agent works alongside the test sync process. QA failure flags are included in the coverage report.
35
+ QA agent works alongside the test sync process. QA failure blocks test-sync completion.
36
36
 
37
- ## Step 2: Map Code to Tests
37
+ ## Step 3: Map Code to Tests
38
38
 
39
39
  For each file changed in recent tasks:
40
40
 
@@ -56,7 +56,7 @@ find . -name "*.spec.*" | xargs grep -l "{class_name}"
56
56
  | src/api/users.py | tests/test_users.py | PARTIAL |
57
57
  ```
58
58
 
59
- ## Step 3: Detect Test Issues
59
+ ## Step 4: Detect Test Issues
60
60
 
61
61
  ### A) Stale Tests
62
62
  Tests that reference old behavior:
@@ -90,7 +90,7 @@ Tests that sometimes fail:
90
90
  - Check recent CI runs
91
91
  - Note any intermittent failures
92
92
 
93
- ## Step 4: Run Affected Tests
93
+ ## Step 5: Run Affected Tests
94
94
 
95
95
  ### A) Unit/Integration Tests
96
96
  Execute tests that cover changed code:
@@ -149,7 +149,7 @@ For all test types:
149
149
  - FAIL: Test needs update or code has bug
150
150
  - ERROR: Test broken (import error, etc.)
151
151
 
152
- ## Step 5: Produce Test Coverage Report
152
+ ## Step 6: Produce Test Coverage Report
153
153
 
154
154
  Create/update `.gsd-t/test-coverage.md`:
155
155
 
@@ -236,7 +236,7 @@ Create/update `.gsd-t/test-coverage.md`:
236
236
  {Based on findings, what should be prioritized}
237
237
  ```
238
238
 
239
- ## Step 6: Generate Test Tasks
239
+ ## Step 7: Generate Test Tasks
240
240
 
241
241
  If issues found, add to current domain's tasks:
242
242
 
@@ -259,7 +259,7 @@ If issues found, add to current domain's tasks:
259
259
  - Action: Update all user fixtures
260
260
  ```
261
261
 
262
- ## Step 7: Integration with Workflow
262
+ ## Step 8: Integration with Workflow
263
263
 
264
264
  ### During Execute Phase (auto-invoked):
265
265
  After each task completes:
@@ -289,7 +289,7 @@ Full sync:
289
289
  3. Generate all test tasks
290
290
  4. Do not auto-add to domains — present for review
291
291
 
292
- ## Step 8: Report to User
292
+ ## Step 9: Report to User
293
293
 
294
294
  ### Quick Mode (during execute):
295
295
  ```
@@ -12,7 +12,7 @@ Read:
12
12
  5. `docs/requirements.md` — original requirements
13
13
  6. All source code
14
14
 
15
- ## Step 1.5: Spawn QA Agent
15
+ ## Step 2: Spawn QA Agent
16
16
 
17
17
  Spawn the QA teammate to run the full test audit:
18
18
 
@@ -25,7 +25,7 @@ Teammate "qa": Read commands/gsd-t-qa.md for your full instructions.
25
25
 
26
26
  QA failure blocks verification completion.
27
27
 
28
- ## Step 2: Define Verification Dimensions
28
+ ## Step 3: Define Verification Dimensions
29
29
 
30
30
  Standard dimensions (adjust based on project):
31
31
 
@@ -41,7 +41,7 @@ Standard dimensions (adjust based on project):
41
41
  6. **Security**: Auth flows, input validation, data exposure, dependencies
42
42
  7. **Integration Integrity**: Do the seams between domains hold under stress?
43
43
 
44
- ## Step 3: Execute Verification
44
+ ## Step 4: Execute Verification
45
45
 
46
46
  ### Solo Mode (default)
47
47
  Work through each dimension sequentially. For each:
@@ -109,7 +109,7 @@ Teammate assignments:
109
109
  Lead: Collect all reports (including QA), synthesize, create remediation plan.
110
110
  ```
111
111
 
112
- ## Step 4: Compile Verification Report
112
+ ## Step 5: Compile Verification Report
113
113
 
114
114
  Create or update `.gsd-t/verify-report.md`:
115
115
 
@@ -147,7 +147,7 @@ Create or update `.gsd-t/verify-report.md`:
147
147
  | 2 | ui | Add loading states for async calls | WARN |
148
148
  ```
149
149
 
150
- ## Step 5: Handle Remediation
150
+ ## Step 6: Handle Remediation
151
151
 
152
152
  If there are CRITICAL findings:
153
153
  1. Create remediation tasks in the affected domain's `tasks.md`
@@ -155,7 +155,7 @@ If there are CRITICAL findings:
155
155
  3. Re-verify the specific findings
156
156
  4. Update the verification report
157
157
 
158
- ## Step 6: Update State
158
+ ## Step 7: Update State
159
159
 
160
160
  Update `.gsd-t/progress.md`:
161
161
  - If all PASS: Set status to `VERIFIED`
@@ -1,125 +1,145 @@
1
- # GSD-T: Wave — Full Cycle Orchestration
1
+ # GSD-T: Wave — Full Cycle Orchestration (Agent-Per-Phase)
2
2
 
3
- You are running a complete GSD-T cycle through all phases for the current milestone. This is the "just go" command it runs partition discuss plan impact execute test-sync integrate verify → complete-milestone in sequence, using teams where beneficial.
3
+ You are the wave orchestrator. You do NOT execute phases yourself. Instead, you spawn an **independent agent for each phase**, giving each a fresh context window. This eliminates context accumulation across phases and prevents mid-wave compaction.
4
4
 
5
- ## Step 1: Load State
5
+ ## Step 1: Load State (Lightweight)
6
6
 
7
- Read:
8
- 1. `CLAUDE.md`
9
- 2. `.gsd-t/progress.md`
10
- 3. All `.gsd-t/` files
7
+ Read ONLY:
8
+ 1. `.gsd-t/progress.md` — current status, milestone name, phase state
9
+ 2. `CLAUDE.md` — autonomy level only (scan for Level 1/2/3)
11
10
 
12
- Determine current status and resume from wherever the milestone left off.
11
+ Do NOT read contracts, domains, docs, or source code. You are the orchestrator phase agents handle their own context loading.
13
12
 
14
- ## Step 1.5: QA Agent Spawning
13
+ ### Integrity Check
15
14
 
16
- Every phase that produces or validates code will automatically spawn a QA teammate. The QA agent is spawned per-phase (not once for the entire wave) because each phase has different QA responsibilities. Each phase's command file contains its own QA spawn instructions — follow them when executing that phase.
15
+ After reading progress.md, verify it contains the required fields before proceeding:
16
+ - **Status field**: A `Status:` line with a recognized value (DEFINED, PARTITIONED, PLANNED, etc.)
17
+ - **Milestone name**: A `Milestone` heading or table entry identifying the current milestone
18
+ - **Domains table**: A `| Domain |` table with at least one row
17
19
 
18
- ## Step 2: Execute Remaining Phases
20
+ If ANY of these are missing or malformed, STOP and report:
21
+ "Wave cannot proceed — progress.md is missing required fields: {list}. Run `/user:gsd-t-status` to inspect, or `/user:gsd-t-init` to repair."
22
+ Do NOT attempt to fix progress.md yourself — that risks data loss.
19
23
 
20
- Work through each phase that hasn't been completed:
24
+ ## Step 2: Determine Resume Point
21
25
 
22
- ### INITIALIZED or DEFINED Run Partition
23
- - Decompose into domains with contracts
24
- - Set status to PARTITIONED
26
+ From progress.md status, determine which phase to start from:
25
27
 
26
- ### PARTITIONED Run Discuss (if needed)
27
- - If there are open architectural questions or multiple viable approaches: discuss
28
- - If the path is clear (simple milestone, clear requirements): skip to plan
29
- - Set status to DISCUSSED
28
+ | Status | Next Phase |
29
+ |--------|------------|
30
+ | READY | Need milestone first prompt user or run milestone |
31
+ | INITIALIZED / DEFINED | Partition |
32
+ | PARTITIONED | Discuss (or skip to Plan if path is clear) |
33
+ | DISCUSSED | Plan |
34
+ | PLANNED | Impact |
35
+ | IMPACT_ANALYZED | Execute |
36
+ | EXECUTED | Test-Sync |
37
+ | TESTS_SYNCED | Integrate |
38
+ | INTEGRATED | Verify |
39
+ | VERIFIED | Complete |
40
+ | VERIFY_FAILED | Remediate → re-Verify |
30
41
 
31
- ### DISCUSSED Run Plan
32
- - Create atomic task lists per domain
33
- - Map dependencies and checkpoints
34
- - Set status to PLANNED
42
+ ## Step 3: Phase Orchestration Loop
35
43
 
36
- ### PLANNED Run Impact Analysis
37
- - Analyze downstream effects of all planned changes
38
- - Check for contract violations
39
- - Trace dependencies and consumers
40
- - Produce `.gsd-t/impact-report.md`
44
+ 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.
41
45
 
42
- **Decision Gate:**
43
- - If PROCEED: continue to execute
44
- - If PROCEED WITH CAUTION: report items, continue if no user intervention
45
- - If BLOCK: stop, add remediation tasks, require user decision
46
+ ### Phase Agent Spawn Pattern
46
47
 
47
- - Set status to IMPACT_ANALYZED
48
+ For each phase, spawn the agent like this:
48
49
 
49
- ### IMPACT_ANALYZED → Run Execute
50
- - **Auto-select mode**:
51
- - Count total independent starting tasks across domains
52
- - If 3+ domains with independent work AND teams are enabled: use team mode
53
- - Otherwise: solo mode
54
-
55
- - **Destructive Action Guard**: Before each task, check if it involves destructive or structural changes (DROP TABLE, schema changes that lose data, removing existing modules, replacing architecture patterns). If YES → STOP and present the change to the user. Wait for explicit approval. This applies at ALL autonomy levels.
56
-
57
- - **After each task:**
58
- - Run quick test-sync (affected tests only)
59
- - If test failures: pause and report
60
- - If all pass: continue
61
-
62
- - Run through all tasks, respecting checkpoints
63
- - Set status to EXECUTED
64
-
65
- ### EXECUTED → Run Full Test Sync
66
- - Complete test coverage analysis
67
- - Run all tests
68
- - Generate/update test tasks if gaps found
69
- - If critical test failures: add fix tasks, re-execute
70
- - Set status to TESTS_SYNCED
71
-
72
- ### TESTS_SYNCED → Run Integrate
73
- - Wire domains together
74
- - Verify contract compliance at boundaries
75
- - Run integration tests
76
- - Set status to INTEGRATED
77
-
78
- ### INTEGRATED → Run Verify
79
- - **Auto-select mode**:
80
- - If teams enabled and milestone is complex (3+ domains): team verify
81
- - Otherwise: solo verify
82
- - Run quality gates across all dimensions
83
- - Handle remediation if needed
84
- - Set status to VERIFIED
85
-
86
- ### VERIFIED → Run Complete Milestone
87
- - Archive milestone documentation to `.gsd-t/milestones/{name}/`
88
- - Generate summary.md
89
- - Clean working state for next milestone
90
- - Create git tag
91
- - Set status to COMPLETED
50
+ ```
51
+ Task agent (subagent_type: "general-purpose", mode: "bypassPermissions"):
52
+ "Execute the {PHASE} phase of the current GSD-T milestone.
92
53
 
93
- ## Step 3: Phase Transitions
54
+ Read and follow the full instructions in commands/gsd-t-{phase}.md
55
+ Read .gsd-t/progress.md for current milestone and state.
56
+ Read CLAUDE.md for project conventions.
57
+ Read .gsd-t/contracts/ for domain interfaces.
94
58
 
95
- Between each phase:
96
- 1. Update `.gsd-t/progress.md`
97
- 2. Report brief status to user
59
+ Complete the phase fully:
60
+ - Follow every step in the command file
61
+ - Update .gsd-t/progress.md status when done
62
+ - Run document ripple as specified
63
+ - Commit your work
98
64
 
99
- ### Autonomy Behavior
65
+ Report back: one-line status summary."
66
+ ```
100
67
 
101
- **Level 3 (Full Auto)**: Auto-advance to the next phase after logging status. Only STOP for:
102
- - Destructive Action Guard violations (always)
103
- - Impact analysis BLOCK verdict (always)
68
+ ### Phase Sequence
69
+
70
+ Execute phases in this order, spawning one agent per phase:
71
+
72
+ #### 1. PARTITION
73
+ Spawn agent → `commands/gsd-t-partition.md`
74
+ - After: Read `progress.md`, verify status = PARTITIONED
75
+ - If failed: Report error, stop
76
+
77
+ #### 2. DISCUSS (conditional)
78
+ - **Structured skip check** — skip discuss and go directly to Plan if ALL of these are true:
79
+ - (a) Single domain milestone (only one entry in Domains table)
80
+ - (b) No items containing "OPEN QUESTION" in the Decision Log
81
+ - (c) For multi-domain milestones: all cross-domain contracts exist in `.gsd-t/contracts/`
82
+ - If ANY check fails: Spawn agent → `commands/gsd-t-discuss.md`
83
+ - **Note**: Discuss always pauses for user input, even at Level 3. The discuss agent will interact with the user directly.
84
+ - If all checks pass: Skip to Plan
85
+
86
+ #### 3. PLAN
87
+ Spawn agent → `commands/gsd-t-plan.md`
88
+ - After: Read `progress.md`, verify status = PLANNED
89
+
90
+ #### 4. IMPACT
91
+ Spawn agent → `commands/gsd-t-impact.md`
92
+ - After: Read `progress.md` and `.gsd-t/impact-report.md`
93
+ - **Decision Gate**:
94
+ - PROCEED → continue to Execute
95
+ - PROCEED WITH CAUTION → log items, continue
96
+ - BLOCK → stop, report to user, wait for decision
97
+
98
+ #### 5. EXECUTE
99
+ Spawn agent → `commands/gsd-t-execute.md`
100
+ - This is the heaviest phase. The execute agent will handle its own domain agent spawning and QA agent internally.
101
+ - After: Read `progress.md`, verify status = EXECUTED
102
+
103
+ #### 6. TEST-SYNC
104
+ Spawn agent → `commands/gsd-t-test-sync.md`
105
+ - After: Read `progress.md`, verify status = TESTS_SYNCED
106
+
107
+ #### 7. INTEGRATE
108
+ Spawn agent → `commands/gsd-t-integrate.md`
109
+ - After: Read `progress.md`, verify status = INTEGRATED
110
+
111
+ #### 8. VERIFY
112
+ Spawn agent → `commands/gsd-t-verify.md`
113
+ - After: Read `progress.md`, check status:
114
+ - VERIFIED → proceed to Complete
115
+ - VERIFY_FAILED → handle remediation (see Error Recovery)
116
+
117
+ #### 9. COMPLETE
118
+ Spawn agent → `commands/gsd-t-complete-milestone.md`
119
+ - After: Read `progress.md`, verify status = COMPLETED
120
+
121
+ ### Between Each Phase
122
+
123
+ After each agent completes:
124
+ 1. Read `.gsd-t/progress.md` to verify the phase updated status correctly
125
+ 2. Report brief status to user:
126
+ ```
127
+ ✅ {Phase} complete — {agent's one-line summary}
128
+ ```
129
+ 3. If status was NOT updated correctly: report error and stop
130
+ 4. Proceed to next phase
131
+
132
+ ## Step 4: Autonomy Behavior
133
+
134
+ **Level 3 (Full Auto)**: Auto-advance to next phase after each agent completes. Only STOP for:
135
+ - Destructive Action Guard violations (reported by phase agent)
136
+ - Impact analysis BLOCK verdict
104
137
  - Unrecoverable errors after 2 fix attempts
105
- - The Discuss phase (always pauses for user input, even at Level 3)
138
+ - Discuss phase (always pauses for user input)
106
139
 
107
- **Level 1–2**: If any phase produces findings that need user input, STOP and ask. If all clear, continue to next phase.
108
-
109
- Status messages:
110
- ```
111
- ✅ Partition complete — 3 domains defined, 4 contracts written
112
- ✅ Discuss complete — 2 design decisions logged
113
- ✅ Plan complete — 12 tasks across 3 domains
114
- ⚠️ Impact analysis found 2 items requiring attention — proceeding
115
- ✅ Execute complete — 12/12 tasks done
116
- ✅ Test sync — 8 tests affected, all passing, 1 gap noted
117
- ✅ Integrate complete — all domain boundaries wired
118
- ✅ Verify complete — all quality gates passed
119
- ✅ Milestone archived and tagged
120
- ```
140
+ **Level 1–2**: Pause between phases, show status, ask to continue.
121
141
 
122
- ## Step 4: Completion
142
+ ## Step 5: Completion
123
143
 
124
144
  When all phases are done:
125
145
  ```
@@ -147,59 +167,95 @@ Next steps:
147
167
 
148
168
  ## Interruption Handling
149
169
 
150
- If the user interrupts or the session needs to end:
151
- 1. Finish the current atomic task
152
- 2. Save all state to `.gsd-t/progress.md`
153
- 3. Note exactly where to resume: "{phase} {domain} — Task {N}"
154
- 4. Report: "Paused at {location}. Run `/user:gsd-t-resume` to continue."
170
+ If the user interrupts or a phase agent fails:
171
+ 1. The current phase agent saves its own state to `.gsd-t/progress.md`
172
+ 2. Report: "Paused at {phase}. Run `/user:gsd-t-resume` to continue."
173
+ 3. Resume will pick up from the last completed phase
155
174
 
156
175
  ## Error Recovery
157
176
 
158
177
  ### If impact analysis blocks:
159
- - Report blocking issues
160
- - Generate remediation tasks
161
- - Add to appropriate domain
178
+ - Read the impact report from the agent's output
179
+ - Report blocking issues to user
162
180
 
163
- **Level 3 (Full Auto)**: Auto-execute remediation tasks, then re-run impact analysis. Only STOP if remediation fails after 2 attempts.
164
-
165
- **Level 1–2**: Ask: "Address blockers now, or pause?" If address: execute remediation tasks, re-run impact. If pause: save state, exit.
181
+ **Level 3**: Spawn a remediation agent to fix blocking issues, then re-spawn impact agent. Max 2 attempts.
182
+ **Level 1–2**: Ask user for direction.
166
183
 
167
184
  ### If tests fail during execute:
168
- - Pause execution
169
- - Report failing tests
170
- - Generate fix tasks
185
+ - The execute agent handles test failures internally (up to 2 fix attempts)
186
+ - If still failing after 2 attempts, the execute agent reports failure
187
+ - Orchestrator stops and reports to user
171
188
 
172
- **Level 3 (Full Auto)**: Auto-execute fix tasks and re-run tests (up to 2 fix attempts). If still failing, STOP and report to user.
189
+ ### If verify fails:
190
+ - Read verify report for failure details
173
191
 
174
- **Level 1–2**: Ask: "Fix now or continue?" If fix: execute fix tasks, re-run tests. If continue: note failures, proceed (will catch in verify).
192
+ **Level 3**: Spawn remediation agent, then re-spawn verify agent. Max 2 attempts.
193
+ **Level 1–2**: Ask user for direction.
175
194
 
176
- ### If verify fails:
177
- - Report failures
178
- - Generate remediation tasks
179
- - Do NOT run complete-milestone
195
+ ## Why Agent-Per-Phase
196
+
197
+ Each phase agent gets a **fresh context window** (~200K tokens). This means:
198
+ - Phase 7 doesn't carry the context baggage from phases 1-6
199
+ - Mid-phase compaction is eliminated for standard-sized phases
200
+ - Each agent loads only what it needs from state files
201
+ - The orchestrator stays lightweight (~30KB total)
202
+
203
+ State handoff happens through `.gsd-t/` files — exactly what they were designed for.
204
+
205
+ ## Security Considerations
206
+
207
+ ### bypassPermissions Mode
208
+
209
+ 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.
210
+
211
+ ### Attack Surface
212
+
213
+ If command files in `~/.claude/commands/` are tampered with, wave agents will execute the modified instructions with full permissions. The attack requires:
214
+ 1. Write access to the user's `~/.claude/commands/` directory
215
+ 2. Knowledge of the GSD-T command file format
216
+ 3. The user to run `/gsd-t-wave` after tampering
217
+
218
+ ### Current Mitigations
219
+
220
+ - **npm-installed files**: Command files are installed from the npm registry, providing a known-good source
221
+ - **Content comparison on update**: `gsd-t update` compares file contents and reports changes
222
+ - **User-owned directory**: `~/.claude/commands/` inherits the user's filesystem permissions
223
+ - **Destructive Action Guard**: CLAUDE.md instructions provide soft protection against destructive operations (DROP TABLE, schema changes, etc.), though agents could theoretically ignore these
224
+ - **Autonomy levels**: Level 1 and Level 2 pause between phases, giving users visibility into agent activity
180
225
 
181
- **Level 3 (Full Auto)**: Auto-execute remediation tasks and re-run verify (up to 2 attempts). If still failing, STOP and report to user.
226
+ ### Recommendations
182
227
 
183
- **Level 1–2**: Ask: "Address issues now?" If yes: execute remediation, re-run verify. If no: save state with VERIFY_FAILED status.
228
+ - For sensitive projects, use **Level 1 or Level 2 autonomy** instead of Level 3 to review each phase's output
229
+ - Periodically verify command file integrity: `gsd-t doctor` checks installation health
230
+ - If security is a concern, audit `~/.claude/commands/gsd-t-*.md` files for unexpected modifications
231
+ - Keep GSD-T updated (`gsd-t update`) to receive the latest command files from npm
184
232
 
185
233
  ## Workflow Visualization
186
234
 
187
235
  ```
188
- ┌─────────┐ ┌─────────┐ ┌──────┐ ┌────────┐ ┌─────────┐
189
- PARTITION│ DISCUSS │ → │ PLAN │ → │ IMPACT │ → │ EXECUTE │
190
- └─────────┘ └─────────┘ └──────┘ └────────┘ └────┬────┘
191
-
192
- BLOCK? test-sync
193
- ↓ after each
194
- remediate task
195
- │ │
196
- ┌──────────┐ ┌────────┐ ┌───────────┐ ┌────────┴────────┐
197
- COMPLETE ← │ VERIFY │ ← │ INTEGRATE │ ← └── │ FULL TEST-SYNC │
198
- └──────────┘ └────────┘ └───────────┘ └─────────────────┘
199
-
200
-
201
- archive
202
- git tag
236
+ ┌──────────────────────────────────────────────────────────────────────────────┐
237
+ Wave Orchestrator (lightweight)
238
+ │ │
239
+ ┌─────────┐ ┌─────────┐ ┌──────┐ ┌────────┐ ┌─────────┐
240
+ │ │PARTITION│ → │ DISCUSS │ → │ PLAN │ → │ IMPACT │ → │ EXECUTE │ │
241
+ │ │ agent 1 │ │ agent 2 │ │agent 3│ │agent 4 │ │ agent 5 │ │
242
+ │ └────┬────┘ └────┬────┘ └───┬──┘ └───┬────┘ └────┬────┘ │
243
+ ↓ ↓ ↓ ↓ ↓
244
+ status status status status status │
245
+ check check check check + check
246
+ │ gate │
247
+
248
+ │ ┌──────────┐ ┌────────┐ ┌───────────┐ ┌─────────────────┐ │
249
+ │ COMPLETE │ ← │ VERIFY │ ← │ INTEGRATE │ ←──── │ FULL TEST-SYNC │ │
250
+ agent 9 │ │agent 8 │ │ agent 7 │ │ agent 6 │ │
251
+ │ └────┬────┘ └────┬────┘ └─────┬─────┘ └────────┬────────┘ │
252
+ │ ↓ ↓ ↓ ↓ │
253
+ │ archive status + status status │
254
+ │ git tag gate check check check │
255
+ │ │
256
+ │ Each agent: fresh context window, reads state from files, dies when done │
257
+ │ Orchestrator: ~30KB total, never compacts │
258
+ └──────────────────────────────────────────────────────────────────────────────┘
203
259
  ```
204
260
 
205
261
  $ARGUMENTS