@tekyzinc/gsd-t 2.24.7 → 2.28.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.
@@ -0,0 +1,138 @@
1
+ # GSD-T: Health — Validate Project Structure
2
+
3
+ You are diagnosing the health of a GSD-T project. Check every required file and directory, report findings, and optionally repair missing pieces.
4
+
5
+ ## Step 0: Launch via Subagent (default)
6
+
7
+ When invoked directly by the user, spawn yourself as a Task subagent for a fresh context window:
8
+
9
+ ```
10
+ Task subagent (general-purpose, model: haiku):
11
+ "Run the GSD-T health check. Read commands/gsd-t-health.md for your full instructions.
12
+ Arguments: {$ARGUMENTS}
13
+ Skip Step 0 — you are already the subagent."
14
+ ```
15
+
16
+ Return the subagent's output and stop. Only skip Step 0 if you are already running as a subagent.
17
+
18
+ ## Step 1: Determine Mode
19
+
20
+ If `--repair` appears in $ARGUMENTS, set `REPAIR=true`. Otherwise `REPAIR=false`.
21
+
22
+ ## Step 2: Check Required Structure
23
+
24
+ Check each item below. Record status as `OK`, `MISSING`, or `INVALID`.
25
+
26
+ ### Root files
27
+ | File | Check |
28
+ |------|-------|
29
+ | `CLAUDE.md` | Exists and non-empty |
30
+ | `README.md` | Exists and non-empty |
31
+ | `.gsd-t/progress.md` | Exists, has `## Status:` and `## Version:` sections |
32
+ | `.gsd-t/backlog.md` | Exists |
33
+ | `.gsd-t/backlog-settings.md` | Exists |
34
+
35
+ ### Required directories
36
+ | Directory | Check |
37
+ |-----------|-------|
38
+ | `.gsd-t/contracts/` | Exists |
39
+ | `.gsd-t/domains/` | Exists |
40
+ | `docs/` | Exists |
41
+
42
+ ### Docs
43
+ | File | Check |
44
+ |------|-------|
45
+ | `docs/requirements.md` | Exists |
46
+ | `docs/architecture.md` | Exists |
47
+ | `docs/workflows.md` | Exists |
48
+ | `docs/infrastructure.md` | Exists |
49
+
50
+ ### Active milestone (if any)
51
+ Read `.gsd-t/progress.md` to find active milestone. For each domain listed as active:
52
+ - `.gsd-t/domains/{domain}/scope.md` — exists?
53
+ - `.gsd-t/domains/{domain}/tasks.md` — exists?
54
+ - `.gsd-t/contracts/` — at least one `.md` contract file present?
55
+
56
+ ## Step 3: Additional Checks
57
+
58
+ 1. **Version consistency**: Read `## Version:` from `.gsd-t/progress.md`. If `package.json` exists, compare — they should match.
59
+ 2. **Status validity**: Read `## Status:` value. Confirm it's one of: `DEFINED`, `PARTITIONED`, `DISCUSSED`, `PLANNED`, `EXECUTED`, `SYNCED`, `INTEGRATED`, `VERIFIED`, `VERIFIED-WITH-WARNINGS`, `VERIFY-FAILED`, `COMPLETED`.
60
+ 3. **Decision Log**: Confirm `## Decision Log` section exists and has at least one entry.
61
+ 4. **Contract integrity**: For each `.md` file in `.gsd-t/contracts/`, confirm it's non-empty.
62
+ 5. **Domain integrity**: For each directory in `.gsd-t/domains/`, confirm at least `scope.md` exists.
63
+
64
+ ## Step 4: Report Findings
65
+
66
+ Output a health report in this format:
67
+
68
+ ```
69
+ GSD-T Health Report
70
+ ═══════════════════════════════════════════════════════════
71
+
72
+ Core Files
73
+ ✓ CLAUDE.md
74
+ ✓ README.md
75
+ ✗ .gsd-t/progress.md — MISSING
76
+ ✓ .gsd-t/backlog.md
77
+
78
+ Directories
79
+ ✓ .gsd-t/contracts/
80
+ ✗ docs/ — MISSING
81
+
82
+ Docs
83
+ ✓ docs/requirements.md
84
+ ✗ docs/architecture.md — MISSING
85
+
86
+ Active Milestone: {name | none}
87
+ ✓ .gsd-t/domains/{domain}/scope.md
88
+ ✗ .gsd-t/domains/{domain}/tasks.md — MISSING
89
+
90
+ Additional Checks
91
+ ✓ Version: 2.27.10 (consistent with package.json)
92
+ ✓ Status: PLANNED (valid)
93
+ ✓ Decision Log: present
94
+ ✗ contracts/api-contract.md — EMPTY
95
+
96
+ ═══════════════════════════════════════════════════════════
97
+ Summary: {N} OK | {N} missing | {N} invalid
98
+ Overall: {HEALTHY | DEGRADED | BROKEN}
99
+ ```
100
+
101
+ Status thresholds:
102
+ - **HEALTHY**: 0 missing, 0 invalid
103
+ - **DEGRADED**: 1-3 missing/invalid (non-critical)
104
+ - **BROKEN**: 4+ missing/invalid OR progress.md missing OR contracts/ missing
105
+
106
+ ## Step 5: Repair (if --repair)
107
+
108
+ If `REPAIR=true` and any items are MISSING (not INVALID), create them now:
109
+
110
+ | Missing item | Repair action |
111
+ |--------------|---------------|
112
+ | `CLAUDE.md` | Create from `templates/CLAUDE-project.md` (with `{Project Name}` = directory name) |
113
+ | `README.md` | Create minimal `# {Project Name}\n\n_No description yet._\n` |
114
+ | `.gsd-t/progress.md` | Create from `templates/progress.md` |
115
+ | `.gsd-t/backlog.md` | Create from `templates/backlog.md` |
116
+ | `.gsd-t/backlog-settings.md` | Create from `templates/backlog-settings.md` |
117
+ | `.gsd-t/contracts/` | Create empty directory |
118
+ | `.gsd-t/domains/` | Create empty directory |
119
+ | `docs/` | Create directory |
120
+ | `docs/requirements.md` | Create from `templates/requirements.md` |
121
+ | `docs/architecture.md` | Create from `templates/architecture.md` |
122
+ | `docs/workflows.md` | Create from `templates/workflows.md` |
123
+ | `docs/infrastructure.md` | Create from `templates/infrastructure.md` |
124
+ | Domain `scope.md` | Create minimal scope with domain name as heading |
125
+ | Domain `tasks.md` | Create minimal task list with `## Tasks\n_No tasks defined yet._` |
126
+
127
+ After repair, re-run the checks and report the final state.
128
+
129
+ **Do NOT repair INVALID items** (e.g., empty contracts, bad status values) — flag them for user action.
130
+
131
+ ## Step 6: Next Steps
132
+
133
+ If HEALTHY → "✅ GSD-T structure is healthy — all required files present."
134
+ If DEGRADED with --repair done → "✅ Repaired {N} missing files. Run /user:gsd-t-health again to confirm."
135
+ If DEGRADED without --repair → "⚠ Run /user:gsd-t-health --repair to create {N} missing files."
136
+ If BROKEN → "🔴 Project structure is broken. Run /user:gsd-t-health --repair or /user:gsd-t-init to rebuild."
137
+
138
+ $ARGUMENTS
@@ -51,6 +51,8 @@ UTILITIES Manual
51
51
  resume Restore context after break
52
52
  quick Fast task with GSD-T guarantees
53
53
  debug Systematic debugging with state
54
+ health Validate .gsd-t/ structure, optionally repair missing files
55
+ pause Save exact position for reliable resume later
54
56
  promote-debt Convert techdebt items to milestones
55
57
  populate Auto-populate docs from existing codebase
56
58
  log Sync progress Decision Log with recent git activity
@@ -39,15 +39,38 @@ All subsequent steps run from inside the project directory.
39
39
 
40
40
  Execute the full init workflow (same as `/user:gsd-t-init`):
41
41
 
42
- 1. Create `.gsd-t/` directory structure (contracts/, domains/, progress.md, backlog.md, backlog-settings.md)
42
+ 1. Create `.gsd-t/` directory structure (contracts/, domains/, progress.md, backlog.md, backlog-settings.md, token-log.md, qa-issues.md)
43
43
  2. Ensure `CLAUDE.md` exists (create starter if missing, append GSD-T section if present without it)
44
44
  3. Create `docs/` with all 4 living document templates (skip existing files)
45
45
  4. Ensure `README.md` exists
46
- 5. Map existing codebase if code exists
47
- 6. Initialize backlog with auto-derived categories
48
- 7. Register project in `~/.claude/.gsd-t-projects`
49
-
50
- **If `.gsd-t/` already exists**: Skip init — it's already done. Log and continue to scan.
46
+ 5. **Copy project settings**:
47
+ - First, ensure `~/.claude/settings.local` exists. If it does NOT, create it with these defaults:
48
+ ```json
49
+ {
50
+ "permissions": {
51
+ "allow": [
52
+ "Edit",
53
+ "Write",
54
+ "Bash",
55
+ "Read",
56
+ "WebSearch",
57
+ "WebFetch",
58
+ "Skill"
59
+ ]
60
+ },
61
+ "outputStyle": "default"
62
+ }
63
+ ```
64
+ Log: "Created ~/.claude/settings.local with default permissions — update the allow list to match your security preferences."
65
+ - Then, if `.claude/settings.local.json` does NOT already exist in the project root:
66
+ - Create `.claude/` directory in the project root if needed
67
+ - Copy `~/.claude/settings.local` → `.claude/settings.local.json`
68
+ - Skip the copy silently if the target already exists
69
+ 6. Map existing codebase if code exists
70
+ 7. Initialize backlog with auto-derived categories
71
+ 8. Register project in `~/.claude/.gsd-t-projects`
72
+
73
+ **If `.gsd-t/` already exists**: Skip init — it's already done. Log and continue to scan. Still check and copy settings.local (step 5) even if init is skipped.
51
74
 
52
75
  ## Step 4: Deep Codebase Scan (gsd-t-scan)
53
76
 
@@ -20,11 +20,31 @@ If yes, read `.gsd/` state and create equivalent `.gsd-t/` structure.
20
20
 
21
21
  ## Step 2: Copy Local Settings
22
22
 
23
- If `~/.claude/settings.local` exists and `.claude/settings.local.json` does not exist in the project:
24
- 1. Create the `.claude/` directory in the project root if it doesn't exist
25
- 2. Copy `~/.claude/settings.local` → `.claude/settings.local.json`
26
-
27
- Skip silently if the source file doesn't exist or the target already exists.
23
+ 1. **Ensure `~/.claude/settings.local` exists**:
24
+ - If it does NOT exist, create it now with these default permissions:
25
+ ```json
26
+ {
27
+ "permissions": {
28
+ "allow": [
29
+ "Edit",
30
+ "Write",
31
+ "Bash",
32
+ "Read",
33
+ "WebSearch",
34
+ "WebFetch",
35
+ "Skill"
36
+ ]
37
+ },
38
+ "outputStyle": "default"
39
+ }
40
+ ```
41
+ After creating it, log: "Created ~/.claude/settings.local with default permissions — update the allow list to match your security preferences."
42
+
43
+ 2. **Copy to project**: If `.claude/settings.local.json` does NOT already exist in the project root:
44
+ - Create the `.claude/` directory in the project root if it doesn't exist
45
+ - Copy `~/.claude/settings.local` → `.claude/settings.local.json`
46
+
47
+ Skip the copy (step 2) silently if the target already exists.
28
48
 
29
49
  ## Step 3: Create Directory Structure
30
50
 
@@ -36,7 +56,21 @@ Skip silently if the source file doesn't exist or the target already exists.
36
56
  │ └── .gitkeep
37
57
  ├── backlog.md
38
58
  ├── backlog-settings.md
39
- └── progress.md
59
+ ├── progress.md
60
+ ├── token-log.md
61
+ └── qa-issues.md
62
+ ```
63
+
64
+ Create `token-log.md` with header row:
65
+ ```
66
+ | Date | Command | Step | Model | Duration(s) | Notes |
67
+ |------|---------|------|-------|-------------|-------|
68
+ ```
69
+
70
+ Create `qa-issues.md` with header row:
71
+ ```
72
+ | Date | Command | Step | Model | Duration(s) | Severity | Finding |
73
+ |------|---------|------|-------|-------------|----------|---------|
40
74
  ```
41
75
 
42
76
  ## Step 4: Initialize Backlog
@@ -88,17 +88,26 @@ Result: PASS
88
88
  Result: PARTIAL — needs pagination contract addition
89
89
  ```
90
90
 
91
- ## Step 5: Spawn QA Agent
91
+ ## Step 5: Contract Compliance Testing
92
92
 
93
- Spawn the QA teammate to verify contract compliance at domain boundaries:
93
+ Spawn a QA subagent via the Task tool to verify contract compliance at all domain boundaries:
94
94
 
95
95
  ```
96
- Teammate "qa": Read commands/gsd-t-qa.md for your full instructions.
97
- Phase context: integrate. Read .gsd-t/contracts/ for all contract definitions.
98
- Run contract compliance tests at every domain boundary.
99
- Report: boundary-by-boundary test results.
96
+ Task subagent (general-purpose, model: haiku):
97
+ "Run contract compliance tests for this integration. Read .gsd-t/contracts/ for all contract definitions.
98
+ Test every domain boundary: verify that producers and consumers match their contract shapes.
99
+ Run the full test suite.
100
+ Report: boundary-by-boundary test results with pass/fail counts."
100
101
  ```
101
102
 
103
+ **OBSERVABILITY LOGGING (MANDATORY):**
104
+ Before spawning: run `date +%s` via Bash → save as START
105
+ After subagent returns: run `date +%s` → compute `DURATION=$((END-START))`
106
+ Append to `.gsd-t/token-log.md` (create with header `| Date | Command | Step | Model | Duration(s) | Notes |` if missing):
107
+ `| {YYYY-MM-DD HH:MM} | gsd-t-integrate | Step 5 | haiku | {DURATION}s | {pass/fail}, {N} boundaries tested |`
108
+ If QA found issues, append each to `.gsd-t/qa-issues.md` (create with header `| Date | Command | Step | Model | Duration(s) | Severity | Finding |` if missing):
109
+ `| {YYYY-MM-DD HH:MM} | gsd-t-integrate | Step 5 | haiku | {DURATION}s | {severity} | {finding} |`
110
+
102
111
  QA failure blocks integration completion.
103
112
 
104
113
  ## Step 6: Document Ripple
@@ -175,20 +175,7 @@ Before finalizing the partition:
175
175
  2. **Verify passing**: If any tests fail, assign them to the appropriate domain as pre-existing issues
176
176
  3. **Map tests to domains**: Note which test files belong to which domain — this informs task planning
177
177
 
178
- ## Step 7: Spawn QA Agent
179
-
180
- After contracts are written, spawn the QA teammate to generate contract test skeletons:
181
-
182
- ```
183
- Teammate "qa": Read commands/gsd-t-qa.md for your full instructions.
184
- Phase context: partition. Read .gsd-t/contracts/ for contract definitions.
185
- Generate contract test skeleton files for every contract.
186
- Report: number of test files generated and total test cases.
187
- ```
188
-
189
- Wait for QA agent to complete before proceeding. QA failure blocks partition completion.
190
-
191
- ## Step 8: Validate
178
+ ## Step 7: Validate
192
179
 
193
180
  Before finishing, verify:
194
181
  - [ ] Every file in `src/` is owned by exactly one domain
@@ -0,0 +1,78 @@
1
+ # GSD-T: Pause — Save Exact Position for Later Resume
2
+
3
+ You are capturing the precise current position in an active GSD-T phase so the user can resume later with zero re-orientation overhead.
4
+
5
+ ## Step 1: Gather Current State
6
+
7
+ Read the following (use whatever is already in context first — only read files if needed):
8
+
9
+ 1. `.gsd-t/progress.md` — milestone name, current status/phase, version
10
+ 2. `.gsd-t/domains/*/tasks.md` — identify which tasks are done, in-progress, or pending
11
+ 3. Last entry in the Decision Log (from progress.md)
12
+ 4. `$ARGUMENTS` — if user provided a note, capture it verbatim
13
+
14
+ ## Step 2: Determine Exact Position
15
+
16
+ Identify:
17
+ - **Milestone**: current milestone name
18
+ - **Phase**: current phase (PARTITIONED, PLANNED, EXECUTED, etc.)
19
+ - **Domain** (if in execute/test-sync): which domain was being worked on
20
+ - **Task** (if in execute): which task number was in progress or next up
21
+ - **Last completed action**: what was the last thing that finished
22
+ - **Next action**: what should happen first when resuming
23
+ - **Blockers**: any known blockers or open questions
24
+
25
+ ## Step 3: Create Continue-Here File
26
+
27
+ Generate a timestamp: `{YYYY}-{MM}-{DD}T{HH}{MM}{SS}` (local time, no separators in time part).
28
+
29
+ Create `.gsd-t/continue-here-{timestamp}.md`:
30
+
31
+ ```markdown
32
+ # Continue Here — {YYYY-MM-DD HH:MM}
33
+
34
+ ## Snapshot
35
+ - **Milestone**: {milestone name}
36
+ - **Phase**: {phase}
37
+ - **Version**: {version from progress.md}
38
+ - **Paused at**: {domain} → Task {N} | Between phases | {other description}
39
+
40
+ ## Last Completed
41
+ {description of the last thing that finished — specific task, commit, or action}
42
+
43
+ ## Next Action
44
+ {exactly what to do first when resuming — specific, actionable}
45
+
46
+ ## Open Items
47
+ {any known blockers, pending decisions, or things to watch out for}
48
+ {None if clean}
49
+
50
+ ## User Note
51
+ {$ARGUMENTS if provided, otherwise: _No note provided._}
52
+
53
+ ## Resume Command
54
+ /user:gsd-t-resume
55
+ ```
56
+
57
+ ## Step 4: Confirm to User
58
+
59
+ Output:
60
+
61
+ ```
62
+ ⏸ Paused: {milestone name} — {phase}
63
+
64
+ Saved position: .gsd-t/continue-here-{timestamp}.md
65
+ Next action: {next action summary}
66
+
67
+ To resume: /user:gsd-t-resume
68
+ ```
69
+
70
+ ## Step 5: Do NOT Stop Work (unless user asked to pause all work)
71
+
72
+ This command only saves position. If the user invoked /pause mid-task intending to stop:
73
+ - They will close the session themselves
74
+ - Do not auto-continue executing tasks after creating the file
75
+
76
+ If invoked with $ARGUMENTS containing "and continue" or similar, create the file and then continue the current task normally.
77
+
78
+ $ARGUMENTS
@@ -12,6 +12,9 @@ Read ALL of these:
12
12
  5. `.gsd-t/domains/*/constraints.md` — every domain constraint
13
13
  6. `docs/` — requirements, architecture, schema, design
14
14
  7. Existing source code (if any) — understand current state
15
+ 8. `.gsd-t/CONTEXT.md` (if exists — from discuss phase) — **MANDATORY READ if present**
16
+
17
+ **If CONTEXT.md exists:** Every Locked Decision listed in it MUST be mapped to at least one task in Step 2. Do NOT proceed to execute if any Locked Decision is unmapped.
15
18
 
16
19
  ## Step 2: Create Task Lists Per Domain
17
20
 
@@ -49,9 +52,25 @@ For each domain, write `.gsd-t/domains/{domain-name}/tasks.md`:
49
52
  5. **Ordered**: Tasks within a domain are numbered in execution order
50
53
  6. **No implicit knowledge**: Don't assume the executing agent remembers previous tasks — reference contracts and files explicitly
51
54
 
55
+ ### REQ Traceability
56
+
57
+ After creating task lists, append a traceability table to `docs/requirements.md`:
58
+
59
+ ```markdown
60
+ ## Requirements Traceability (updated by plan phase)
61
+ | REQ-ID | Requirement Summary | Domain | Task(s) | Status |
62
+ |--------|---------------------|--------|---------|--------|
63
+ | REQ-001 | {summary} | {domain} | Task 1, Task 3 | pending |
64
+ | REQ-002 | {summary} | {domain} | Task 2 | pending |
65
+ ```
66
+
67
+ - Every REQ-ID must map to at least one domain/task — orphaned requirements are a planning gap
68
+ - Every task group should trace back to at least one REQ-ID — tasks with no REQ reference may be scope creep
69
+ - Report: orphaned requirements (no task) and unanchored tasks (no REQ)
70
+
52
71
  ## Step 3: Map Cross-Domain Dependencies
53
72
 
54
- Update `.gsd-t/contracts/integration-points.md` with the full dependency graph:
73
+ Update `.gsd-t/contracts/integration-points.md` with the full dependency graph **and wave groupings**:
55
74
 
56
75
  ```markdown
57
76
  # Integration Points
@@ -68,11 +87,37 @@ Update `.gsd-t/contracts/integration-points.md` with the full dependency graph:
68
87
  - UNLOCKS: auth Task 3 (user lookup), ui Task 3 (data fetching)
69
88
  - VERIFY: Lead confirms schema matches schema-contract.md
70
89
 
71
- ### Second Checkpoint
90
+ ### Second Checkpoint
72
91
  - GATE: auth Task 4 (auth middleware) must complete
73
92
  - UNLOCKS: ui Task 5 (protected routes)
74
93
  - VERIFY: Lead confirms auth endpoints match api-contract.md
75
94
 
95
+ ## Wave Execution Groups
96
+
97
+ Waves allow parallel execution within a wave and sequential execution between waves.
98
+ Each wave contains domains/tasks that can safely run in parallel (no shared files, no cross-domain dependencies within the wave).
99
+
100
+ ### Wave 1 — Independent (parallel)
101
+ - data-layer: Tasks 1-3
102
+ - auth: Tasks 1-2
103
+ - **Shared files**: NONE — safe to run in parallel
104
+ - **Completes when**: All listed tasks done
105
+
106
+ ### Wave 2 — After Wave 1 Checkpoint (parallel)
107
+ - CHECKPOINT: Lead verifies schema-contract.md before Wave 2 starts
108
+ - auth: Tasks 3-4
109
+ - ui: Tasks 1-2
110
+ - **Shared files**: NONE — safe to run in parallel
111
+ - **Completes when**: All listed tasks done
112
+
113
+ ### Wave 3 — After Wave 2 Checkpoint (sequential)
114
+ - CHECKPOINT: Lead verifies api-contract.md before Wave 3 starts
115
+ - ui: Tasks 3-5
116
+ - **Note**: Sequential — each task depends on the previous
117
+
118
+ ### Integration
119
+ - INTEGRATION: Wire all domains together
120
+
76
121
  ## Execution Order (for solo mode)
77
122
  1. data-layer Tasks 1-3
78
123
  2. auth Tasks 1-2 (parallel-safe with data-layer)
@@ -84,6 +129,12 @@ Update `.gsd-t/contracts/integration-points.md` with the full dependency graph:
84
129
  8. INTEGRATION: wire everything together
85
130
  ```
86
131
 
132
+ ### Wave Grouping Rules:
133
+ 1. **Same wave** = no shared files, no dependency between them
134
+ 2. **Different wave** = one depends on the other's output, OR they modify the same file
135
+ 3. **CHECKPOINT between waves** = lead verifies contract compliance before unlocking next wave
136
+ 4. Always check domain `scope.md` files for file ownership — overlapping files → different waves
137
+
87
138
  ## Step 4: Estimate Scope
88
139
 
89
140
  Add to each domain's `tasks.md`:
@@ -118,18 +169,37 @@ Before finalizing the plan:
118
169
  2. **Verify passing**: Document any pre-existing failures — assign them to appropriate domain tasks
119
170
  3. **Include test tasks**: Ensure each domain's task list includes test creation/update tasks where acceptance criteria require verification
120
171
 
121
- ## Step 7: Spawn QA Agent
172
+ ## Step 7: Plan Validation
122
173
 
123
- After task lists are created, spawn the QA teammate to generate acceptance test scenarios:
174
+ Spawn a Task subagent to validate the plan before proceeding:
124
175
 
125
176
  ```
126
- Teammate "qa": Read commands/gsd-t-qa.md for your full instructions.
127
- Phase context: plan. Read .gsd-t/domains/*/tasks.md for task lists.
128
- Generate acceptance test scenarios for tasks with user-facing deliverables.
129
- Report: number of acceptance test scenarios generated.
177
+ Task subagent (general-purpose, model: haiku):
178
+ "Validate this GSD-T plan. Read:
179
+ - .gsd-t/domains/*/tasks.md (all task lists)
180
+ - .gsd-t/contracts/ (all contracts)
181
+ - docs/requirements.md (including traceability table)
182
+ - .gsd-t/CONTEXT.md (if exists)
183
+
184
+ Check:
185
+ 1. REQ coverage: every REQ-ID in requirements.md maps to at least one task
186
+ 2. Locked Decisions (from CONTEXT.md if present): every Locked Decision maps to at least one task
187
+ 3. Task completeness: every task has files, contract refs, and acceptance criteria
188
+ 4. Cross-domain dependencies: all BLOCKED-BY references point to real tasks
189
+ 5. Contract existence: every task referencing a contract has that contract file present
190
+
191
+ Report: PASS (all checks pass) or FAIL with specific gaps listed."
130
192
  ```
131
193
 
132
- Wait for QA agent to complete before proceeding. QA failure blocks plan completion.
194
+ **OBSERVABILITY LOGGING (MANDATORY):**
195
+ Before spawning: run `date +%s` via Bash → save as START
196
+ After subagent returns: run `date +%s` → compute `DURATION=$((END-START))`
197
+ Append to `.gsd-t/token-log.md` (create with header `| Date | Command | Step | Model | Duration(s) | Notes |` if missing):
198
+ `| {YYYY-MM-DD HH:MM} | gsd-t-plan | Step 7 | haiku | {DURATION}s | {PASS/FAIL}, iteration {N} |`
199
+ If validation FAIL, append each gap to `.gsd-t/qa-issues.md` (create with header `| Date | Command | Step | Model | Duration(s) | Severity | Finding |` if missing):
200
+ `| {YYYY-MM-DD HH:MM} | gsd-t-plan | Step 7 | haiku | {DURATION}s | medium | {gap description} |`
201
+
202
+ **If FAIL**: Fix the identified gaps (up to 3 iterations). If still failing after 3 iterations, STOP and report to user with the specific gaps. Plan cannot proceed until validation PASSES.
133
203
 
134
204
  ## Step 8: Update Progress
135
205
 
@@ -2,6 +2,23 @@
2
2
 
3
3
  You are executing a small, focused task that doesn't need full phase planning. This is for bug fixes, config changes, small features, and ad-hoc work.
4
4
 
5
+ ## Step 0: Launch via Subagent
6
+
7
+ To give this task a fresh context window and prevent compaction during consecutive quick runs, always execute via a Task subagent.
8
+
9
+ **If you are the orchestrating agent** (you received the slash command directly):
10
+ Spawn a fresh subagent using the Task tool:
11
+ ```
12
+ subagent_type: general-purpose
13
+ prompt: "You are running gsd-t-quick for this request: {$ARGUMENTS}
14
+ Working directory: {current project root}
15
+ Read CLAUDE.md and .gsd-t/progress.md for project context, then execute gsd-t-quick starting at Step 1."
16
+ ```
17
+ Wait for the subagent to complete. Relay its summary to the user. **Do not execute Steps 1–5 yourself.**
18
+
19
+ **If you are the spawned subagent** (your prompt says "starting at Step 1"):
20
+ Continue to Step 1 below.
21
+
5
22
  ## Step 1: Load Context (Fast)
6
23
 
7
24
  Read:
@@ -24,20 +41,17 @@ Should I proceed with quick mode or use the full execute workflow?"
24
41
  ### If it's within a single domain or pre-partition:
25
42
  Proceed.
26
43
 
27
- ## Step 3: Spawn QA Agent
28
-
29
- Spawn the QA teammate to handle testing for this quick task:
44
+ ## Step 3: Execute
30
45
 
31
- ```
32
- Teammate "qa": Read commands/gsd-t-qa.md for your full instructions.
33
- Phase context: quick. Read .gsd-t/contracts/ for relevant contracts.
34
- Write tests for the change, run the full test suite.
35
- Report: test results and any coverage gaps found.
36
- ```
46
+ ### Deviation Rules
37
47
 
38
- QA failure blocks the commit.
48
+ When you encounter unexpected situations:
49
+ 1. **Bug blocking progress** → Fix it, up to 3 attempts. If still blocked, add to `.gsd-t/deferred-items.md` and skip.
50
+ 2. **Missing dependency clearly needed** → Add minimum required code to unblock. Note in commit.
51
+ 3. **Blocker (missing file, wrong API)** → Fix blocker and continue. Log if non-trivial.
52
+ 4. **Architectural change required** → STOP. Apply Destructive Action Guard. Never self-approve.
39
53
 
40
- ## Step 4: Execute
54
+ **3-attempt limit**: Stop looping after 3 failed fix attempts. Log and move on.
41
55
 
42
56
  1. Identify exactly which files need to change
43
57
  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 +60,7 @@ QA failure blocks the commit.
46
60
  5. Verify it works
47
61
  6. Commit: `[quick] {description}`
48
62
 
49
- ## Step 5: Document Ripple (if GSD-T is active)
63
+ ## Step 4: Document Ripple (if GSD-T is active)
50
64
 
51
65
  If `.gsd-t/progress.md` exists, assess what documentation was affected and update ALL relevant files:
52
66
 
@@ -65,7 +79,7 @@ If `.gsd-t/progress.md` exists, assess what documentation was affected and updat
65
79
 
66
80
  ### Skip what's not affected — most quick tasks will only touch 1-2 of these.
67
81
 
68
- ## Step 6: Test & Verify (MANDATORY)
82
+ ## Step 5: Test & Verify (MANDATORY)
69
83
 
70
84
  Quick does not mean skip testing. Before committing:
71
85
 
@@ -15,8 +15,9 @@ You are resuming work after an interruption. This handles both same-session paus
15
15
 
16
16
  Read in this exact order:
17
17
  1. `CLAUDE.md` — project context and conventions
18
- 2. `.gsd-t/progress.md` current status, decisions, blockers
19
- 3. `.gsd-t/contracts/`all contract files
18
+ 2. **Check for continue-here files first**: List `.gsd-t/continue-here-*.md` files. If any exist, read the most recent one (highest timestamp). It contains exact position, next action, and open items — use this as the primary resume point.
19
+ 3. `.gsd-t/progress.md`current status, decisions, blockers (always read this too)
20
+ 4. `.gsd-t/contracts/` — all contract files
20
21
  4. `.gsd-t/domains/*/scope.md` — domain boundaries
21
22
  5. `.gsd-t/domains/*/tasks.md` — task lists with completion status
22
23
  6. `.gsd-t/domains/*/constraints.md` — domain rules
@@ -25,13 +26,15 @@ Read in this exact order:
25
26
 
26
27
  ## Step 2: Determine Current Position
27
28
 
28
- From progress.md (or conversation context if same-session), identify:
29
+ From the continue-here file (if present) OR progress.md (or conversation context if same-session), identify:
29
30
  - Current milestone and status
30
31
  - Which phase we're in
31
32
  - Which tasks are done, in progress, or blocked
32
33
  - Any pending decisions or user-input-needed items
33
34
  - Last entry in the Decision Log
34
35
 
36
+ **If a continue-here file was found**: Use its "Next Action" field as the primary resume point. The continue-here file is more precise than progress.md alone. After resuming, delete the continue-here file (it has been consumed).
37
+
35
38
  ## Step 3: Report and Continue
36
39
 
37
40
  **Level 3 (Full Auto)**: Log a brief status line and auto-resume from the current task/phase. Do NOT wait for user input.
@@ -2,6 +2,24 @@
2
2
 
3
3
  You are the lead agent performing a comprehensive analysis of an existing codebase. Your job is to understand the architecture, identify business rules, surface vulnerabilities, find inefficiencies, and produce an actionable tech debt register.
4
4
 
5
+ ## Step 0: Launch via Subagent
6
+
7
+ Scans are long-running and context-heavy. Always execute via a Task subagent for a fresh context window.
8
+
9
+ **If you are the orchestrating agent** (you received the slash command directly):
10
+ Spawn a fresh subagent using the Task tool:
11
+ ```
12
+ subagent_type: general-purpose
13
+ prompt: "You are running gsd-t-scan. Working directory: {current project root}
14
+ Read CLAUDE.md and .gsd-t/progress.md for project context, then execute gsd-t-scan starting at Step 1.
15
+ IMPORTANT: Step 2 requires team mode — spawn 5 teammates (architecture, business-rules, security, quality, contracts)
16
+ running in parallel. Do not skip team mode or run dimensions sequentially."
17
+ ```
18
+ Wait for the subagent to complete. Relay its summary to the user. **Do not execute Steps 1+ yourself.**
19
+
20
+ **If you are the spawned subagent** (your prompt says "starting at Step 1"):
21
+ Continue to Step 1 below. At Step 2, use team mode — spawn the 5 teammates in parallel.
22
+
5
23
  ## Step 1: Load Existing Context
6
24
 
7
25
  Read:
@@ -22,15 +40,15 @@ ALL TEAMMATES read first:
22
40
  - CLAUDE.md (if exists)
23
41
  - .gsd-t/contracts/ (if exists)
24
42
 
25
- - Teammate "architecture": Analyze project structure, tech stack,
43
+ - Teammate "architecture" (model: haiku): Analyze project structure, tech stack,
26
44
  data flow, patterns. Write findings to .gsd-t/scan/architecture.md
27
- - Teammate "business-rules": Extract all embedded business logic,
45
+ - Teammate "business-rules" (model: haiku): Extract all embedded business logic,
28
46
  validation, auth rules, workflows. Write to .gsd-t/scan/business-rules.md
29
- - Teammate "security": Full security audit — auth, injection, exposure,
47
+ - Teammate "security" (model: sonnet): Full security audit — auth, injection, exposure,
30
48
  dependencies. Write to .gsd-t/scan/security.md
31
- - Teammate "quality": Dead code, duplication, complexity, test gaps,
49
+ - Teammate "quality" (model: sonnet): Dead code, duplication, complexity, test gaps,
32
50
  performance, stale deps. Write to .gsd-t/scan/quality.md
33
- - Teammate "contracts": Compare .gsd-t/contracts/ to actual implementation,
51
+ - Teammate "contracts" (model: haiku): Compare .gsd-t/contracts/ to actual implementation,
34
52
  find drift and undocumented interfaces. Write to .gsd-t/scan/contract-drift.md
35
53
  (skip if no contracts exist)
36
54