@tekyzinc/gsd-t 2.23.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`
@@ -10,6 +10,17 @@ Read ONLY:
10
10
 
11
11
  Do NOT read contracts, domains, docs, or source code. You are the orchestrator — phase agents handle their own context loading.
12
12
 
13
+ ### Integrity Check
14
+
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
19
+
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.
23
+
13
24
  ## Step 2: Determine Resume Point
14
25
 
15
26
  From progress.md status, determine which phase to start from:
@@ -64,10 +75,13 @@ Spawn agent → `commands/gsd-t-partition.md`
64
75
  - If failed: Report error, stop
65
76
 
66
77
  #### 2. DISCUSS (conditional)
67
- - Check: Are there open architectural questions or multiple viable approaches?
68
- - If YES: Spawn agent `commands/gsd-t-discuss.md`
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`
69
83
  - **Note**: Discuss always pauses for user input, even at Level 3. The discuss agent will interact with the user directly.
70
- - If NO (path is clear): Skip to Plan
84
+ - If all checks pass: Skip to Plan
71
85
 
72
86
  #### 3. PLAN
73
87
  Spawn agent → `commands/gsd-t-plan.md`
@@ -188,6 +202,34 @@ Each phase agent gets a **fresh context window** (~200K tokens). This means:
188
202
 
189
203
  State handoff happens through `.gsd-t/` files — exactly what they were designed for.
190
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
225
+
226
+ ### Recommendations
227
+
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
232
+
191
233
  ## Workflow Visualization
192
234
 
193
235
  ```
@@ -117,6 +117,18 @@ GSD-T reads all state files and tells you exactly where you left off.
117
117
  | `/user:gsd-t-version-update-all` | Update GSD-T + all registered projects | Manual |
118
118
  | `/user:gsd-t-triage-and-merge` | Auto-review, merge, and publish GitHub branches | Manual |
119
119
 
120
+ ### Backlog Management
121
+
122
+ | Command | Purpose | Auto |
123
+ |---------|---------|------|
124
+ | `/user:gsd-t-backlog-add` | Capture item, auto-categorize, append to backlog | Manual |
125
+ | `/user:gsd-t-backlog-list` | Filtered, ordered view of backlog items | Manual |
126
+ | `/user:gsd-t-backlog-move` | Reorder items by position (priority) | Manual |
127
+ | `/user:gsd-t-backlog-edit` | Modify backlog entry fields | Manual |
128
+ | `/user:gsd-t-backlog-remove` | Drop item with optional reason | Manual |
129
+ | `/user:gsd-t-backlog-promote` | Refine, classify, launch GSD-T workflow | Manual |
130
+ | `/user:gsd-t-backlog-settings` | Manage types, apps, categories, defaults | Manual |
131
+
120
132
  ---
121
133
 
122
134
  ## Workflow Phases
@@ -1,6 +1,6 @@
1
1
  # Architecture — GSD-T Framework (@tekyzinc/gsd-t)
2
2
 
3
- ## Last Updated: 2026-02-18
3
+ ## Last Updated: 2026-02-18 (Post-M9)
4
4
 
5
5
  ## System Overview
6
6
 
@@ -8,36 +8,100 @@ GSD-T is an npm-distributed methodology framework for Claude Code. It provides s
8
8
 
9
9
  The framework has no runtime — it is consumed entirely by Claude Code's slash command system and the user's shell. The CLI handles installation, updates, and diagnostics. The command files define the workflow methodology that Claude Code follows.
10
10
 
11
+ **Architecture Pattern**: Distributed Markdown Instruction System with CLI Lifecycle Manager. Command files are the "source code" interpreted by Claude Code. The CLI is a lifecycle manager (install/update/init/status/doctor/uninstall). State files persist across sessions as git-tracked Markdown.
12
+
11
13
  ## Components
12
14
 
13
15
  ### CLI Installer (bin/gsd-t.js)
14
16
  - **Purpose**: Install, update, diagnose, and manage GSD-T across projects
15
- - **Location**: `bin/gsd-t.js`
17
+ - **Location**: `bin/gsd-t.js` (1,298 lines, 81 functions, 49 exports)
16
18
  - **Dependencies**: Node.js built-ins only (fs, path, os, child_process, https)
17
19
  - **Subcommands**: install, update, status, doctor, init, uninstall, update-all, register, changelog
20
+ - **Organization**: Configuration → Guard section → Helpers → Heartbeat → Commands → Install/Update → Init → Status → Uninstall → Update-All → Doctor → Register → Update Check → Help → Main dispatch
21
+ - **All functions ≤ 30 lines** (M6 refactoring). Largest: `doRegister()` at 30 lines, `summarize()` at 30 lines.
18
22
 
19
23
  ### Slash Commands (commands/*.md)
20
24
  - **Purpose**: Define the GSD-T methodology as executable workflows for Claude Code
21
25
  - **Location**: `commands/`
22
- - **Count**: 41 (37 GSD-T workflow + 4 utility)
23
- - **Format**: Pure markdown with step-numbered instructions, team mode blocks, and document ripple sections
26
+ - **Count**: 43 (39 GSD-T workflow + 4 utility: gsd, branch, checkin, Claude-md)
27
+ - **Format**: Pure markdown with step-numbered instructions, team mode blocks, document ripple sections, and $ARGUMENTS terminator
24
28
 
25
29
  ### Templates (templates/*.md)
26
30
  - **Purpose**: Starter files for project initialization
27
31
  - **Location**: `templates/`
28
32
  - **Count**: 9 (CLAUDE-global, CLAUDE-project, requirements, architecture, workflows, infrastructure, progress, backlog, backlog-settings)
29
- - **Tokens**: `{Project Name}`, `{Date}`, `{app}` replaced during init
33
+ - **Tokens**: `{Project Name}` and `{Date}` replaced during init via `applyTokens()`
30
34
 
31
- ### Heartbeat System (scripts/gsd-t-heartbeat.js)
32
- - **Purpose**: Real-time event logging via Claude Code hooks
33
- - **Location**: `scripts/gsd-t-heartbeat.js`
34
- - **Output**: `.gsd-t/heartbeat-{session}.jsonl` files
35
+ ### Hook Scripts (scripts/)
36
+ - **gsd-t-heartbeat.js** (181 lines, 6 functions, 5 exports): Real-time event logging via Claude Code hooks. Captures 9 event types as structured JSONL. Input capped at 1MB. Session ID validated. Path traversal protection. Secret scrubbing via `scrubSecrets()`/`scrubUrl()` (M5). Notification message + title scrubbing (M8/M9). EVENT_HANDLERS map pattern (M6). Auto-cleanup after 7 days (SessionStart only, M6).
37
+ - **npm-update-check.js** (43 lines): Background npm registry version checker. Spawned detached by CLI when update cache is stale. Path validation within `~/.claude/` (M5). Symlink check before write (M5). 1MB response limit (M5).
38
+ - **gsd-t-fetch-version.js** (26 lines, NEW in M6): Synchronous npm registry fetch. Called by `fetchVersionSync()` via `execFileSync`. HTTPS-only, 5s timeout, 1MB limit. Silent failure on errors (caller validates).
35
39
 
36
40
  ### Examples (examples/)
37
41
  - **Purpose**: Reference project structure and settings
38
42
  - **Location**: `examples/`
39
43
  - **Contents**: settings.json, .gsd-t/ with sample contracts and domain structure
40
44
 
45
+ ## Data Flow
46
+
47
+ ### Installation Flow
48
+ ```
49
+ npm install @tekyzinc/gsd-t → bin/gsd-t.js install
50
+ ├── Copy commands/*.md → ~/.claude/commands/
51
+ ├── Copy/append templates/CLAUDE-global.md → ~/.claude/CLAUDE.md
52
+ ├── Copy scripts/gsd-t-heartbeat.js → ~/.claude/scripts/
53
+ ├── Configure 9 hooks in ~/.claude/settings.json
54
+ └── Write version to ~/.claude/.gsd-t-version
55
+ ```
56
+
57
+ ### Project Initialization Flow
58
+ ```
59
+ gsd-t init [name] → templates/ → applyTokens()
60
+ ├── → {project}/CLAUDE.md
61
+ ├── → {project}/docs/{requirements,architecture,workflows,infrastructure}.md
62
+ ├── → {project}/.gsd-t/{progress,backlog,backlog-settings}.md
63
+ └── → {project}/.gsd-t/{contracts,domains}/.gitkeep
64
+ ```
65
+
66
+ ### Runtime Command Execution (within Claude Code)
67
+ ```
68
+ User types /user:gsd-t-{command} [args]
69
+ → Claude Code loads ~/.claude/commands/gsd-t-{command}.md
70
+ → Claude interprets step-by-step instructions
71
+ → Reads state files → Executes workflow → Pre-Commit Gate → Updates progress.md
72
+ ```
73
+
74
+ ### Update Check Flow
75
+ ```
76
+ CLI command → Read cache (~/.claude/.gsd-t-update-check)
77
+ ├── Fresh (<1h): Show notice if latest > installed
78
+ ├── No cache: Synchronous fetch → cache → show notice
79
+ └── Stale (>1h): Spawn background scripts/npm-update-check.js
80
+ ```
81
+
82
+ ## Configuration Model
83
+
84
+ Three-tier configuration:
85
+
86
+ | Layer | Location | Purpose |
87
+ |-------|----------|---------|
88
+ | **Global** | `~/.claude/CLAUDE.md` | Framework defaults: autonomy rules, code standards, pre-commit gate |
89
+ | **Project** | `{cwd}/CLAUDE.md` | Project-specific: tech stack, branch guard, conventions, overrides |
90
+ | **State** | `{cwd}/.gsd-t/` | Live state: progress, contracts, domains, backlog, scan results |
91
+
92
+ ## State Files
93
+
94
+ | File | Purpose | Read By | Written By |
95
+ |------|---------|---------|------------|
96
+ | `progress.md` | Master state, version, decision log | All commands | Most commands |
97
+ | `contracts/*.md` | Domain interfaces | execute, integrate, verify | partition |
98
+ | `domains/{name}/scope.md` | File ownership | execute, quick | partition |
99
+ | `domains/{name}/tasks.md` | Task list | execute, status, resume | plan, execute |
100
+ | `backlog.md` | Priority-ordered backlog | backlog-list, status | backlog-add/edit/move/remove |
101
+ | `backlog-settings.md` | Types, apps, categories | backlog-add/edit/settings | backlog-settings, init |
102
+ | `techdebt.md` | Prioritized tech debt | promote-debt, scan | scan |
103
+ | `scan/*.md` | Codebase analysis | scan (synthesis), setup | scan (teammates) |
104
+
41
105
  ## Data Models
42
106
 
43
107
  ### Progress State (.gsd-t/progress.md)
@@ -45,14 +109,14 @@ The framework has no runtime — it is consumed entirely by Claude Code's slash
45
109
  |-------|------|-------|
46
110
  | Project | string | Name from CLAUDE.md |
47
111
  | Version | semver | Major.Minor.Patch |
48
- | Status | enum | INITIALIZED, IN_PROGRESS, READY |
112
+ | Status | enum | READY, INITIALIZED, PARTITIONED, DISCUSSED, PLANNED, IMPACT_ANALYZED, EXECUTING, EXECUTED, TESTS_SYNCED, INTEGRATED, VERIFIED, VERIFY_FAILED, COMPLETED |
49
113
  | Current Milestone | string | Active milestone name or "None" |
50
114
  | Decision Log | entries | Timestamped log of all changes |
51
115
 
52
116
  ### Backlog (.gsd-t/backlog.md)
53
117
  | Field | Type | Notes |
54
118
  |-------|------|-------|
55
- | ID | Bn | Sequential backlog item ID |
119
+ | Position | integer | Sequential, 1 = highest priority |
56
120
  | Type | enum | bug, feature, improvement, ux, architecture |
57
121
  | App | string | Target application |
58
122
  | Category | string | Domain/module category |
@@ -61,14 +125,60 @@ The framework has no runtime — it is consumed entirely by Claude Code's slash
61
125
  ### Contracts (.gsd-t/contracts/)
62
126
  | Contract | Purpose |
63
127
  |----------|---------|
64
- | command-interface-contract.md | Slash command file format and structure |
65
- | file-format-contract.md | File naming and organization rules |
128
+ | backlog-command-interface.md | Backlog command interface and promote flow |
66
129
  | integration-points.md | How components connect |
67
- | backlog-file-formats.md | Backlog markdown structure |
130
+ | backlog-file-formats.md | Backlog markdown structure (authoritative — duplicate file-format-contract.md deleted in M9) |
68
131
  | domain-structure.md | Domain directory layout |
69
132
  | pre-commit-gate.md | Commit checklist contract |
70
133
  | progress-file-format.md | Progress.md structure |
71
134
  | wave-phase-sequence.md | Phase ordering rules |
135
+ | qa-agent-contract.md | QA agent spawn interface, output per phase, communication protocol |
136
+
137
+ ## Workflow Phase Architecture
138
+
139
+ ```
140
+ PARTITION → DISCUSS → PLAN → IMPACT → EXECUTE → TEST-SYNC → INTEGRATE → VERIFY → COMPLETE
141
+ ```
142
+
143
+ | Phase | Mode | QA Agent | Why |
144
+ |-------|------|----------|-----|
145
+ | Partition | Solo only | YES — test skeletons | Needs full cross-domain context |
146
+ | Discuss | Solo only | No | Always pauses for user input (even Level 3) |
147
+ | Plan | Solo only | YES — acceptance scenarios | Needs full cross-domain context |
148
+ | Impact | Solo only | No | Cross-cutting analysis |
149
+ | Execute | Solo or Team | YES — continuous testing | Tasks within domains are independent |
150
+ | Test-Sync | Solo only | YES — coverage audit | Sequential verification |
151
+ | Integrate | Solo only | YES — boundary tests | Needs to see all seams |
152
+ | Verify | Solo or Team | YES — full audit | Dimensions are independent |
153
+ | Complete | Solo only | YES — final gate | Archival and tagging |
154
+
155
+ ### Wave Orchestrator (Agent-Per-Phase Model)
156
+
157
+ The wave command spawns an independent agent for each phase via the Task tool with `bypassPermissions`. Each phase agent gets a fresh ~200K token context window, eliminating context accumulation and mid-wave compaction. The orchestrator itself stays lightweight (~30KB), reading only `progress.md` and `CLAUDE.md`. State handoff between phases occurs through `.gsd-t/` files.
158
+
159
+ ### QA Agent Integration
160
+
161
+ 10 commands spawn a QA teammate (`commands/gsd-t-qa.md`) for test-driven contract enforcement. QA behavior is phase-dependent: test skeletons during partition, continuous testing during execute, full audit during verify. QA failure blocks phase completion (user override available). Communication protocol: `QA: {PASS|FAIL} — {summary}`.
162
+
163
+ ### Test Suite (test/)
164
+ - **helpers.test.js** (27 tests): Pure helper functions — validateProjectName, applyTokens, isNewerVersion, normalizeEol, etc.
165
+ - **filesystem.test.js** (37 tests): Filesystem helpers + CLI subcommand integration — ensureDir, isSymlink, writeTemplateFile, status/doctor/help outputs
166
+ - **security.test.js** (30 tests): Security functions — scrubSecrets (18), scrubUrl (5), summarize integration (4), hasSymlinkInPath (3)
167
+ - **cli-quality.test.js** (22 tests): M6 refactored functions — buildEvent (10), readProjectDeps (3), readPyContent (2), insertGuardSection (3), readUpdateCache (1), addHeartbeatHook (3)
168
+ - **Runner**: Node.js built-in (`node --test`), zero test dependencies
169
+ - **Total**: 116 tests, all passing
170
+
171
+ ## Security Model
172
+
173
+ - **Zero dependencies**: No supply chain attack surface
174
+ - **Symlink protection**: `isSymlink()` at 15+ write sites + `hasSymlinkInPath()` for parent directory validation (M5)
175
+ - **Secret scrubbing**: `scrubSecrets()` masks passwords/tokens/API keys in heartbeat logs; `scrubUrl()` masks URL query params (M5)
176
+ - **Input validation**: Project names, version strings, session IDs, project paths all validated
177
+ - **Path traversal prevention**: Heartbeat validates session_id regex, resolves paths, verifies containment; npm-update-check validates cache path within `~/.claude/` (M5)
178
+ - **Command injection mitigation**: `execFileSync` with array args (not `execSync`)
179
+ - **Exclusive file creation**: Init uses `{ flag: "wx" }` for atomic create-or-fail
180
+ - **Resource limits**: Heartbeat stdin capped at 1MB, HTTP responses capped at 1MB (M5), 5s/8s timeouts, 7-day file cleanup
181
+ - **Wave security**: `bypassPermissions` mode documented with attack surface analysis and mitigations (M5)
72
182
 
73
183
  ## Design Decisions
74
184
 
@@ -80,3 +190,13 @@ The framework has no runtime — it is consumed entirely by Claude Code's slash
80
190
  | 2026-02-12 | Heartbeat via Claude Code hooks | Non-invasive monitoring, no command file changes needed | Polling, WebSocket |
81
191
  | 2026-02-13 | Semantic router over keyword matching | Better intent detection, fewer misroutes | Regex patterns, ML classifier |
82
192
  | 2026-02-16 | Mandatory Playwright for all projects | Consistent E2E testing, no "we'll add tests later" | Optional testing, Jest-only |
193
+ | 2026-02-16 | Team mode default for scan | Parallel scanning faster, better results | Solo sequential scan |
194
+ | 2026-02-17 | QA Agent as cross-cutting concern | Mandatory test-driven contracts for all code phases | Optional testing, deferred testing |
195
+ | 2026-02-17 | Agent-per-phase wave orchestration | Fresh context window per phase, eliminates compaction | Inline execution (original approach) |
196
+
197
+ ## Known Architecture Concerns
198
+
199
+ 1. **CLI single-file size**: bin/gsd-t.js at 1,298 lines exceeds the 200-line convention, but splitting adds complexity for questionable benefit given zero-dependency constraint. Accepted deviation.
200
+ 2. **Four-file synchronization**: Any command change requires updating README, GSD-T-README, CLAUDE-global template, and gsd-t-help. Manual process — no automated validation.
201
+ 3. **Pre-Commit Gate unenforced**: Mental checklist in CLAUDE.md, not a git hook or CI check.
202
+ 4. **Progress.md Decision Log growth**: Unbounded append-only log. May need periodic archival strategy for long-lived projects.