@tekyzinc/gsd-t 2.50.12 → 2.53.10

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.
Files changed (99) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +379 -372
  3. package/bin/component-registry.js +250 -0
  4. package/bin/graph-cgc.js +510 -510
  5. package/bin/graph-indexer.js +147 -147
  6. package/bin/graph-overlay.js +195 -195
  7. package/bin/graph-parsers.js +327 -327
  8. package/bin/graph-query.js +453 -452
  9. package/bin/graph-store.js +154 -154
  10. package/bin/qa-calibrator.js +194 -0
  11. package/bin/scan-data-collector.js +153 -153
  12. package/bin/scan-diagrams-generators.js +187 -187
  13. package/bin/scan-diagrams.js +79 -79
  14. package/bin/scan-renderer.js +92 -92
  15. package/bin/scan-report-sections.js +121 -121
  16. package/bin/scan-report.js +184 -184
  17. package/bin/scan-schema-parsers.js +199 -199
  18. package/bin/scan-schema.js +103 -103
  19. package/bin/token-budget.js +246 -0
  20. package/commands/Claude-md.md +10 -10
  21. package/commands/branch.md +15 -15
  22. package/commands/checkin.md +45 -45
  23. package/commands/global-change.md +209 -209
  24. package/commands/gsd-t-audit.md +199 -0
  25. package/commands/gsd-t-backlog-add.md +94 -94
  26. package/commands/gsd-t-backlog-edit.md +111 -111
  27. package/commands/gsd-t-backlog-list.md +63 -63
  28. package/commands/gsd-t-backlog-move.md +94 -94
  29. package/commands/gsd-t-backlog-promote.md +123 -123
  30. package/commands/gsd-t-backlog-remove.md +86 -86
  31. package/commands/gsd-t-backlog-settings.md +158 -158
  32. package/commands/gsd-t-complete-milestone.md +528 -515
  33. package/commands/gsd-t-debug.md +506 -399
  34. package/commands/gsd-t-discuss.md +174 -174
  35. package/commands/gsd-t-execute.md +758 -634
  36. package/commands/gsd-t-feature.md +276 -276
  37. package/commands/gsd-t-health.md +142 -142
  38. package/commands/gsd-t-help.md +465 -457
  39. package/commands/gsd-t-impact.md +302 -302
  40. package/commands/gsd-t-init.md +320 -280
  41. package/commands/gsd-t-integrate.md +365 -249
  42. package/commands/gsd-t-milestone.md +87 -87
  43. package/commands/gsd-t-partition.md +442 -361
  44. package/commands/gsd-t-pause.md +82 -82
  45. package/commands/gsd-t-plan.md +345 -344
  46. package/commands/gsd-t-populate.md +111 -111
  47. package/commands/gsd-t-prd.md +326 -326
  48. package/commands/gsd-t-project.md +211 -211
  49. package/commands/gsd-t-promote-debt.md +123 -123
  50. package/commands/gsd-t-prompt.md +137 -137
  51. package/commands/gsd-t-qa.md +266 -266
  52. package/commands/gsd-t-quick.md +357 -234
  53. package/commands/gsd-t-reflect.md +134 -134
  54. package/commands/gsd-t-resume.md +72 -72
  55. package/commands/gsd-t-scan.md +615 -615
  56. package/commands/gsd-t-setup.md +76 -0
  57. package/commands/gsd-t-status.md +192 -166
  58. package/commands/gsd-t-test-sync.md +381 -381
  59. package/commands/gsd-t-triage-and-merge.md +171 -171
  60. package/commands/gsd-t-verify.md +382 -382
  61. package/commands/gsd-t-visualize.md +118 -118
  62. package/commands/gsd-t-wave.md +401 -378
  63. package/docs/GSD-T-README.md +425 -422
  64. package/docs/architecture.md +385 -369
  65. package/docs/harness-design-analysis.md +371 -0
  66. package/docs/infrastructure.md +205 -205
  67. package/docs/prd-graph-engine.md +398 -398
  68. package/docs/prd-gsd2-hybrid.md +559 -559
  69. package/docs/prd-harness-evolution.md +583 -0
  70. package/docs/requirements.md +14 -0
  71. package/docs/workflows.md +226 -226
  72. package/examples/.gsd-t/domains/example-domain/scope.md +13 -13
  73. package/package.json +40 -40
  74. package/scripts/gsd-t-auto-route.js +39 -39
  75. package/scripts/gsd-t-dashboard-mockup.html +1143 -1143
  76. package/scripts/gsd-t-dashboard-server.js +171 -171
  77. package/scripts/gsd-t-dashboard.html +262 -262
  78. package/scripts/gsd-t-event-writer.js +128 -128
  79. package/scripts/gsd-t-statusline.js +94 -94
  80. package/scripts/gsd-t-tools.js +175 -175
  81. package/templates/CLAUDE-global.md +639 -614
  82. package/templates/CLAUDE-project.md +24 -0
  83. package/templates/backlog-settings.md +18 -18
  84. package/templates/backlog.md +1 -1
  85. package/templates/progress.md +40 -40
  86. package/templates/shared-services-contract.md +60 -60
  87. package/templates/stacks/desktop.ini +2 -2
  88. package/bin/desktop.ini +0 -2
  89. package/commands/desktop.ini +0 -2
  90. package/docs/ci-examples/desktop.ini +0 -2
  91. package/docs/desktop.ini +0 -2
  92. package/examples/.gsd-t/contracts/desktop.ini +0 -2
  93. package/examples/.gsd-t/desktop.ini +0 -2
  94. package/examples/.gsd-t/domains/desktop.ini +0 -2
  95. package/examples/.gsd-t/domains/example-domain/desktop.ini +0 -2
  96. package/examples/desktop.ini +0 -2
  97. package/examples/rules/desktop.ini +0 -2
  98. package/scripts/desktop.ini +0 -2
  99. package/templates/desktop.ini +0 -2
@@ -1,614 +1,639 @@
1
- <!-- GSD-T:START — Do not remove this marker. Content between START/END is managed by gsd-t update. -->
2
- # Prime Directives
3
-
4
- 1. SIMPLICITY ABOVE ALL. Every change should be minimal and impact as little code as possible. No massive refactors.
5
- 2. ALWAYS check for unwanted downstream effects before writing any new code or changing existing code.
6
- 3. ALWAYS check for completeness that any code creation/change/deletion is implemented thoroughly in every relevant file.
7
- 4. ALWAYS work autonomously. ONLY ask for user input when truly blocked.
8
-
9
-
10
- # GSD-T: Contract-Driven Development
11
-
12
- ## Work Hierarchy
13
-
14
- ```
15
- PROJECT or FEATURE or SCAN
16
- └── MILESTONE (major deliverable)
17
- └── PARTITION → DISCUSS → PLAN → IMPACT → EXECUTE → TEST-SYNC → INTEGRATE → VERIFY → COMPLETE
18
- ```
19
-
20
- - **Project**: Full greenfield project → decomposed into milestones
21
- - **Feature**: Major new feature for existing codebase → impact analysis → milestones
22
- - **Scan**: Deep codebase analysis → techdebt.md → promotable to milestones
23
- - **Milestone**: A significant deliverable (e.g., "User Authentication Complete")
24
- - **Domain**: An independent area of responsibility within a milestone, with its own scope, tasks, and file boundaries
25
- - **Contract**: The documented interface between domains — API shapes, schemas, component props
26
-
27
- ## Commands Reference
28
-
29
- | Command | Purpose |
30
- |---------|---------|
31
- | `/user:gsd` | Smart router — describe what you need, auto-routes to the right command |
32
- | `/user:gsd-t-help` | List all commands or get detailed help |
33
- | `/user:gsd-t-prompt` | Help formulate your idea before committing |
34
- | `/user:gsd-t-brainstorm` | Creative exploration and idea generation |
35
- | `/user:gsd-t-prd` | Generate a GSD-T-optimized Product Requirements Document |
36
- | `/user:gsd-t-project` | Full project → milestone roadmap |
37
- | `/user:gsd-t-feature` | Major feature → impact analysis + milestones |
38
- | `/user:gsd-t-scan` | Deep codebase analysis → techdebt.md |
39
- | `/user:gsd-t-gap-analysis` | Requirements gap analysis — spec vs. existing code |
40
- | `/user:gsd-t-promote-debt` | Convert debt items to milestones |
41
- | `/user:gsd-t-setup` | Generate or restructure project CLAUDE.md |
42
- | `/user:gsd-t-init` | Initialize project structure |
43
- | `/user:gsd-t-init-scan-setup` | Full onboarding: git + init + scan + setup in one |
44
- | `/user:gsd-t-milestone` | Define new milestone |
45
- | `/user:gsd-t-partition` | Decompose into domains + contracts |
46
- | `/user:gsd-t-discuss` | Multi-perspective design exploration |
47
- | `/user:gsd-t-plan` | Create atomic task lists per domain (tasks auto-split to fit one context window) |
48
- | `/user:gsd-t-impact` | Analyze downstream effects before execution |
49
- | `/user:gsd-t-execute` | Run tasks — task-level fresh dispatch, worktree isolation, adaptive replanning, active rule injection |
50
- | `/user:gsd-t-test-sync` | Keep tests aligned with code changes |
51
- | `/user:gsd-t-qa` | QA agent — test generation, execution, gap reporting |
52
- | `/user:gsd-t-doc-ripple` | Automated document ripple — update downstream docs after code changes |
53
- | `/user:gsd-t-integrate` | Wire domains together |
54
- | `/user:gsd-t-verify` | Run quality gates + goal-backward behavior verification |
55
- | `/user:gsd-t-complete-milestone` | Archive milestone + git tag (goal-backward gate, rule engine distillation) |
56
- | `/user:gsd-t-wave` | Full cycle (auto-advances all phases) |
57
- | `/user:gsd-t-status` | Cross-domain progress view with token breakdown, global ELO and cross-project rankings |
58
- | `/user:gsd-t-debug` | Systematic debugging |
59
- | `/user:gsd-t-quick` | Fast task, respects contracts |
60
- | `/user:gsd-t-reflect` | Generate retrospective from event stream, propose memory updates |
61
- | `/user:gsd-t-visualize` | Launch browser dashboard |
62
- | `/user:gsd-t-metrics` | View task telemetry, process ELO, domain health, and cross-project comparison (`--cross-project`) |
63
- | `/user:gsd-t-health` | Validate .gsd-t/ structure, optionally repair |
64
- | `/user:gsd-t-pause` | Save exact position for reliable resume |
65
- | `/user:gsd-t-populate` | Auto-populate docs from existing codebase |
66
- | `/user:gsd-t-log` | Sync progress Decision Log with recent git activity |
67
- | `/user:gsd-t-resume` | Restore context, continue |
68
- | `/user:gsd-t-version-update` | Update GSD-T to latest version |
69
- | `/user:gsd-t-version-update-all` | Update GSD-T + all registered projects |
70
- | `/user:gsd-t-triage-and-merge` | Auto-review, merge, and publish GitHub branches |
71
- | `/user:gsd-t-backlog-add` | Capture item, auto-categorize, append to backlog |
72
- | `/user:gsd-t-backlog-list` | Filtered, ordered view of backlog items |
73
- | `/user:gsd-t-backlog-move` | Reorder items by position (priority) |
74
- | `/user:gsd-t-backlog-edit` | Modify backlog entry fields |
75
- | `/user:gsd-t-backlog-remove` | Drop item with optional reason |
76
- | `/user:gsd-t-backlog-promote` | Refine, classify, launch GSD-T workflow |
77
- | `/user:gsd-t-backlog-settings` | Manage types, apps, categories, defaults |
78
- | `/user:branch` | Create and switch to a new git branch |
79
- | `/user:checkin` | Auto-bump version, stage, commit, and push |
80
- | `/user:Claude-md` | Reload and apply CLAUDE.md directives |
81
- | `/global-change` | Apply file changes across all registered GSD-T projects |
82
-
83
-
84
- # Living Documents
85
-
86
- These documents MUST be maintained and referenced throughout development:
87
-
88
- | Document | Location | Purpose |
89
- |----------|----------|---------|
90
- | **Requirements** | `docs/requirements.md` | Functional and technical requirements |
91
- | **Architecture** | `docs/architecture.md` | System design, components, data flow, decisions |
92
- | **Workflows** | `docs/workflows.md` | User journeys and technical process flows |
93
- | **Infrastructure** | `docs/infrastructure.md` | Commands, DB setup, server access, creds |
94
- | **README** | `README.md` | Project overview, setup, features |
95
- | **Progress** | `.gsd-t/progress.md` | Current milestone/phase state + version |
96
- | **Contracts** | `.gsd-t/contracts/` | Interfaces between domains |
97
- | **Tech Debt** | `.gsd-t/techdebt.md` | Debt register from scans |
98
-
99
- ## The "No Re-Research" Rule
100
-
101
- **BEFORE researching how something works, CHECK THE DOCS FIRST.**
102
-
103
- ```
104
- NEED TO UNDERSTAND SOMETHING?
105
- ├── Is it about system structure/components? → Read docs/architecture.md
106
- ├── Is it about how a process flows? → Read docs/workflows.md
107
- ├── Is it about what to build? → Read docs/requirements.md
108
- ├── Is it about how to deploy/operate? → Read docs/infrastructure.md
109
- ├── Is it about domain interfaces? → Read .gsd-t/contracts/
110
- └── Not documented? → Research, then DOCUMENT IT
111
- ```
112
-
113
-
114
- # Versioning
115
-
116
- GSD-T tracks project version in `.gsd-t/progress.md` using semantic versioning: `Major.Minor.Patch`
117
-
118
- | Segment | Bumped When | Example |
119
- |---------|-------------|---------|
120
- | **Major** | Breaking changes, major rework, v1 launch | 1.0.10 → 2.0.10 |
121
- | **Minor** | New features, completed feature milestones | 1.10.10 → 1.11.10 |
122
- | **Patch** | Bug fixes, minor improvements, cleanup | 1.1.10 → 1.1.11 |
123
-
124
- **Patch convention**: Patch numbers are always 2 digits (≥10). When resetting after a minor or major bump, start at **10** (not 0). This keeps patches always 2 characters without leading zeros, so semver stays valid.
125
-
126
- - Version is set during `gsd-t-init`:
127
- - **New project** (no existing manifest version): starts at `0.1.00` — first `complete-milestone` resets patch to `0.1.10`
128
- - **Existing repo** (has `package.json`, `pyproject.toml`, `Cargo.toml`, etc. with a version): use that version as the starting point
129
- - Version is bumped during `gsd-t-complete-milestone` based on milestone scope
130
- - Version is reflected in: `progress.md`, `README.md`, package manifest (if any), and git tags (`v{version}`)
131
-
132
-
133
- # Destructive Action Guard (MANDATORY)
134
-
135
- **NEVER perform destructive or structural changes without explicit user approval.** This applies at ALL autonomy levels, including Level 3.
136
-
137
- ```
138
- BEFORE any of these actions, STOP and ask the user:
139
- ├── DROP TABLE, DROP COLUMN, DROP INDEX, TRUNCATE, DELETE without WHERE
140
- ├── Renaming or removing database tables or columns
141
- ├── Schema migrations that lose data or break existing queries
142
- ├── Replacing an existing architecture pattern (e.g., normalized denormalized)
143
- ├── Removing or replacing existing files/modules that contain working functionality
144
- ├── Changing ORM models in ways that conflict with the existing database schema
145
- ├── Removing API endpoints or changing response shapes that existing clients depend on
146
- ├── Replacing a dependency or framework with a different one
147
- └── Any change that would require other parts of the system to be rewritten
148
- ```
149
-
150
- ### How to handle schema/architecture mismatches:
151
- 1. **READ the existing schema/code first** — understand what exists before proposing changes
152
- 2. **Adapt new code to match existing structures** — not the other way around
153
- 3. **If restructuring is truly needed**, present the case to the user with:
154
- - What exists today and why it might have been designed that way
155
- - What you want to change and why
156
- - What will break if you make the change
157
- - What data or functionality will be lost
158
- - A migration path that preserves existing data
159
- 4. **Wait for explicit approval** before proceeding
160
-
161
- ### Why this matters:
162
- Even in development, the user may have:
163
- - Working functionality they've tested and rely on
164
- - Data they've carefully set up (seed data, test accounts, configuration)
165
- - Other code that depends on the current structure
166
- - Design decisions made for reasons not documented
167
-
168
- **"Adapt to what exists" is always safer than "replace what exists."**
169
-
170
-
171
- # Autonomous Execution Rules
172
-
173
- ## Update Notices
174
-
175
- On session start, a version check hook auto-updates GSD-T and outputs a status message. Show the result to the user at the **beginning** of your first response:
176
-
177
- - If `[GSD-T AUTO-UPDATE]` appears → GSD-T was just auto-updated. Show:
178
- ```
179
- ✅ GSD-T auto-updated: v{old} → v{new}
180
- Changelog: https://github.com/Tekyz-Inc/get-stuff-done-teams/blob/main/CHANGELOG.md
181
- ```
182
-
183
- - If `[GSD-T UPDATE]` appears → update available but auto-update failed. Show:
184
- ```
185
- ⬆️ GSD-T update available: v{installed} → v{latest} (auto-update failed)
186
- Run: /user:gsd-t-version-update-all
187
- Changelog: https://github.com/Tekyz-Inc/get-stuff-done-teams/blob/main/CHANGELOG.md
188
- ```
189
- Also repeat at the **end** of your first response.
190
-
191
- - If `[GSD-T]` appears → up to date. Show:
192
- ```
193
- GSD-T v{version} — up to date
194
- Changelog: https://github.com/Tekyz-Inc/get-stuff-done-teams/blob/main/CHANGELOG.md
195
- ```
196
-
197
- ## Conversation vs. Work
198
-
199
- Only execute GSD-T workflow behavior when a `/gsd-t-*` command is invoked or when actively mid-phase (resumed via `/gsd-t-resume`). **Plain text messages — especially questions — should be answered conversationally.** Do not launch into workflow execution, file reading, or phase advancement from a question or comment. If the user wants work done, they will invoke a command.
200
-
201
- **Exception — Auto-Route signal**: When `[GSD-T AUTO-ROUTE]` appears in your context (injected by the UserPromptSubmit hook), the user's plain text message should be treated as a `/user:gsd {message}` invocation. Execute the `/gsd` smart router with the user's full message as the argument instead of replying conversationally. The hook only fires in GSD-T projects (directories containing `.gsd-t/progress.md`) — it silently passes through in all other directories.
202
-
203
- ## Auto-Init Guard
204
-
205
- Before executing any GSD-T workflow command, check if **any** of these files are missing in the current project:
206
- - `.gsd-t/progress.md`, `.gsd-t/backlog.md`, `.gsd-t/backlog-settings.md`
207
- - `.gsd-t/contracts/`, `.gsd-t/domains/`
208
- - `.claude/settings.local.json` (if `~/.claude/settings.local` exists)
209
- - `CLAUDE.md`, `README.md`
210
- - `docs/requirements.md`, `docs/architecture.md`, `docs/workflows.md`, `docs/infrastructure.md`
211
-
212
- If any are missing:
213
- 1. Run `gsd-t-init` automatically (it skips files that already exist)
214
- 2. Then continue with the originally requested command
215
-
216
- **Exempt commands** (do not trigger auto-init): `gsd-t-init`, `gsd-t-init-scan-setup`, `gsd-t-help`, `gsd-t-version-update`, `gsd-t-version-update-all`.
217
-
218
- ## Playwright Readiness Guard
219
-
220
- Before any command that involves testing (`gsd-t-execute`, `gsd-t-test-sync`, `gsd-t-verify`, `gsd-t-quick`, `gsd-t-wave`, `gsd-t-milestone`, `gsd-t-complete-milestone`, `gsd-t-debug`), check if `playwright.config.*` exists in the project. If it does not:
221
- 1. Detect the package manager and install Playwright (`@playwright/test` + chromium)
222
- 2. Create a basic `playwright.config.ts` with sensible defaults
223
- 3. Create the E2E test directory with a placeholder spec
224
- 4. Then continue with the original command
225
-
226
- Playwright must always be ready before any testing occurs. Do not skip this check. Do not defer setup to "later."
227
-
228
- ### Playwright Cleanup
229
-
230
- After Playwright tests finish (pass or fail), **kill any app/server processes that were started for the tests**. Playwright often launches a dev server (via `webServer` config or manually). These processes must not be left running:
231
- 1. Check for any dev server processes spawned during the test run
232
- 2. Kill them (e.g., `npx kill-port`, or terminate the process directly)
233
- 3. Verify the port is free before proceeding
234
-
235
- This applies everywhere Playwright tests are executed: execute, test-sync, verify, quick, wave, debug, complete-milestone, and integrate.
236
-
237
- ### E2E Enforcement Rule (MANDATORY)
238
-
239
- **Running only unit tests when E2E tests exist is a test failure.** This is non-negotiable.
240
-
241
- ```
242
- BEFORE reporting "tests pass" for ANY task:
243
- ├── Does playwright.config.* or cypress.config.* exist?
244
- │ YES You MUST run the full E2E suite. Unit-only results are INCOMPLETE.
245
- NO → Unit/integration tests are sufficient.
246
- ├── Did you run every detected test runner?
247
- │ NO Run it now. Do not commit until ALL suites pass.
248
- └── Report format MUST include all suites:
249
- "Unit: X/Y pass | E2E: X/Y pass" (or "E2E: N/A — no config")
250
- ```
251
-
252
- The conditional "if UI/routes/flows changed" in command files applies to **writing new E2E specs**, not to **running existing ones**. You always run existing E2E specs. Always.
253
-
254
- ### E2E Test Quality Standard (MANDATORY)
255
-
256
- **E2E tests must be FUNCTIONAL tests, not LAYOUT tests.** This is non-negotiable.
257
-
258
- A layout test checks that elements exist (`isVisible`, `toBeAttached`, `toBeEnabled`, `toHaveCount`). A functional test checks that features work — actions produce correct outcomes.
259
-
260
- ```
261
- LAYOUT TEST (WRONG — passes even if every feature is broken):
262
- await expect(page.locator('#tab-sessions')).toBeVisible();
263
- await page.click('#tab-sessions');
264
- // ← No assertion that the tab's content actually loaded
265
-
266
- FUNCTIONAL TEST (RIGHT — fails if the feature is broken):
267
- await page.click('#tab-sessions');
268
- await expect(page.locator('.session-list')).toContainText('Session 1');
269
- // ← Proves clicking the tab loaded the session data
270
- ```
271
-
272
- Every Playwright assertion must verify one of:
273
- - **State changed**: After click/type/submit, the app state is different (new content, updated data, changed status)
274
- - **Data flowed**: User input API call response rendered (use `page.waitForResponse` or assert on rendered data)
275
- - **Content loaded**: Navigation/tab switchdestination content appeared (assert on text/data unique to destination)
276
- - **Widget responded**: Terminal accepted keystrokes and produced output, editor saved changes, form submitted and data persisted
277
-
278
- **If a test would pass on an empty HTML page with the correct element IDs and no JavaScript, it is not a functional test.** Rewrite it.
279
-
280
- ## QA Agent (Mandatory)
281
-
282
- Any GSD-T phase that produces or validates code **MUST run QA**. The QA agent's sole job is test generation, execution, and gap reporting. It never writes feature code.
283
-
284
- **QA method by command:**
285
- - `execute`, `integrate` → spawn QA via **Task subagent** (lightweight, no TeamCreate)
286
- - `test-sync`, `verify`, `complete-milestone`perform contract testing and gap analysis **inline**
287
- - `quick`, `debug` → run the full test suite **inline** as part of the command's Test & Verify step
288
- - `wave` → each phase agent handles QA per the rules above
289
- - `partition`, `plan`no QA spawn needed (no code produced yet)
290
-
291
- **Task subagent spawn instruction (execute/integrate):**
292
- ```
293
- Task subagent (general-purpose):
294
- "Run ALL configured test suites — detect and run every one:
295
- a. Unit tests (vitest/jest/mocha): run the full suite
296
- b. E2E tests: check for playwright.config.* or cypress.config.* — if found, run the FULL E2E suite
297
- c. NEVER skip E2E when a config file exists. Running only unit tests is a QA FAILURE.
298
- d. Read .gsd-t/contracts/ for contract definitions. Check contract compliance.
299
- e. AUDIT E2E test quality: Review each Playwright spec — if any test only checks element
300
- existence (isVisible, toBeAttached, toBeEnabled) without verifying functional behavior
301
- (state changes, data loaded, content updated after user actions), flag it as
302
- 'SHALLOW TEST needs functional assertions'. A passing test suite that doesn't catch
303
- broken features is a QA FAILURE.
304
- Report format: 'Unit: X/Y pass | E2E: X/Y pass (or N/A if no config) | Contract: compliant/violations | Shallow tests: N'"
305
- ```
306
-
307
- **QA failure OR shallow tests found blocks phase completion.** Lead cannot proceed until QA reports PASS with zero shallow tests, or user explicitly overrides.
308
-
309
- ## Model Display (MANDATORY)
310
-
311
- **Before every subagent spawn, display the model being used to the user:**
312
- `⚙ [{model}] {command} {brief description}` (e.g., `⚙ [sonnet] gsd-t-execute → domain: auth-service`, `⚙ [haiku] gsd-t-execute → QA validation`)
313
-
314
- This gives the user real-time visibility into which model is handling each operation.
315
-
316
- **Model assignments:**
317
- - `model: haiku` mechanical tasks: run tests, count pass/fail, validate structure, check file existence, report status
318
- - `model: sonnet` mid-tier reasoning: routine code changes, standard refactors, test writing, straightforward synthesis
319
- - `model: opus` high-stakes reasoning: architecture decisions, security analysis, complex debugging, cross-module refactors, quality judgment on critical paths
320
-
321
- ## API Documentation Guard (Swagger/OpenAPI)
322
-
323
- **Every API endpoint MUST be documented in a Swagger/OpenAPI spec. No exceptions.**
324
-
325
- When any GSD-T command creates or modifies an API endpoint:
326
- 1. **If no Swagger/OpenAPI spec exists**: Set one up immediately
327
- - Detect the framework (Express, Fastify, Hono, Django, FastAPI, etc.)
328
- - Install the appropriate Swagger integration (e.g., `swagger-jsdoc` + `swagger-ui-express`, `@fastify/swagger`, FastAPI's built-in OpenAPI)
329
- - Create the OpenAPI spec file or configure auto-generation from code
330
- - Add a `/docs` or `/api-docs` route serving the Swagger UI
331
- 2. **Update the spec**: Every new or changed endpoint must be reflected in the Swagger/OpenAPI spec — routes, request/response schemas, auth requirements, error responses
332
- 3. **Publish the Swagger URL**: The Swagger/API docs URL MUST appear in:
333
- - `CLAUDE.md` — under Documentation or Infrastructure section
334
- - `README.md` under API section or Getting Started
335
- - `docs/infrastructure.md` under API documentation
336
- 4. **Verify**: After any API change, confirm the Swagger UI loads and reflects the current endpoints
337
-
338
- This applies during: `gsd-t-execute`, `gsd-t-quick`, `gsd-t-integrate`, `gsd-t-wave`, and any command that touches API code.
339
-
340
- ## Prime Rule
341
- KEEP GOING. Only stop for:
342
- 1. Unrecoverable errors after 2 fix attempts (delegate to `gsd-t headless --debug-loop` first only stop if exit code 4)
343
- 2. Ambiguity that fundamentally changes project direction
344
- 3. Milestone completion (checkpoint for user review)
345
- 4. Destructive actions (see Destructive Action Guard above — ALWAYS stop)
346
-
347
- ## Pre-Commit Gate (MANDATORY)
348
-
349
- NEVER commit code without running this checklist. This is not optional.
350
-
351
- ```
352
- BEFORE EVERY COMMIT:
353
- ├── Am I on the correct branch?
354
- │ CHECK Run `git branch --show-current`
355
- │ Compare against "Expected branch" in project CLAUDE.md
356
- │ WRONG BRANCH STOP. Do NOT commit. Switch to the correct branch first.
357
- │ No guard set Proceed (but warn user to set one)
358
- ├── Did I create or change an API endpoint or response shape?
359
- │ YES Update .gsd-t/contracts/api-contract.md
360
- │ YES → Update Swagger/OpenAPI spec (see API Documentation Guard below)
361
- │ YES Verify Swagger URL is in CLAUDE.md and README.md
362
- ├── Did I change the database schema?
363
- │ YES Update .gsd-t/contracts/schema-contract.md AND docs/schema.md
364
- ├── Did I add/change a UI component interface?
365
- │ YES Update .gsd-t/contracts/component-contract.md
366
- ├── Did I add new files or directories?
367
- │ YES Update the owning domain's scope.md
368
- ├── Did I implement or change a requirement?
369
- │ YES Update docs/requirements.md (mark complete or revise)
370
- ├── Did I add/change/remove a component or change data flow?
371
- │ YES → Update docs/architecture.md
372
- ├── Did I modify any document, script, or code file?
373
- │ YES → Add timestamped entry to .gsd-t/progress.md Decision Log
374
- │ Format: `- YYYY-MM-DD HH:MM: {what was done} {brief context or result}`
375
- │ This includes ALL file-modifying activities:
376
- │ project, feature, scan, gap-analysis, milestone, partition, discuss,
377
- │ plan, impact, execute, test-sync, integrate, verify, complete-milestone,
378
- │ wave, quick, debug, promote-debt, populate, setup, init, init-scan-setup,
379
- backlog-add/edit/move/remove/promote/settings, and any manual code changes
380
- ├── Did I make an architectural or design decision?
381
- YESAlso include decision rationale in the progress.md entry
382
- ├── Did I discover or fix tech debt?
383
- │ YES Update .gsd-t/techdebt.md
384
- ├── Did I establish a pattern future work should follow?
385
- │ YES → Update CLAUDE.md or domain constraints.md
386
- ├── Did I add/change tests?
387
- │ YES Verify test names and paths are referenced in requirements
388
- ├── Did I change UI, routes, or user flows?
389
- │ YES Update affected E2E test specs (Playwright/Cypress)
390
- └── Did I run the affected tests?
391
- YES Verify they pass. NO Run them now.
392
- ```
393
-
394
- If ANY answer is YES and the doc is NOT updated, update it BEFORE committing. No exceptions.
395
-
396
- ## Document Ripple Completion Gate (MANDATORY)
397
-
398
- **NEVER report a task as "done" or present a summary until ALL downstream documents are updated.** This is not optional.
399
-
400
- When a change affects multiple files (e.g., a new standard that applies across command files, a renamed API, a new convention), you MUST:
401
-
402
- 1. **Identify the full blast radius BEFORE starting**: List every file that needs the change
403
- 2. **Complete ALL updates in one pass**: Do not update 3 of 8 files and then present a summary
404
- 3. **Run the Pre-Commit Gate on the COMPLETE changeset**: Not on a partial subset
405
- 4. **Only THEN report completion**
406
-
407
- ```
408
- BEFORE reporting "done" or presenting a summary:
409
- ├── Did this change establish a new standard, rule, or convention?
410
- │ YES → Grep for every file that should enforce it. Update ALL of them.
411
- ├── Did this change modify a pattern used in multiple command files?
412
- │ YES → Find and update EVERY command file that uses that pattern.
413
- ├── Did this change affect a template (CLAUDE-global, CLAUDE-project, etc.)?
414
- │ YES → The template AND the live equivalent (~/.claude/CLAUDE.md) must match.
415
- ├── Did this change add a new requirement?
416
- YES → Add to docs/requirements.md in the same pass.
417
- ├── Have I checked EVERY file in the blast radius?
418
- │ NO → Keep going. Do not present partial work.
419
- └── Am I about to say "want me to also update X?" or "should I check Y?"
420
- YES → STOP. Just update X and check Y. Then report done.
421
- ```
422
-
423
- **The test for this gate**: If the user asks "did you update all the documents?" and the answer would be "no, I missed some" you failed this gate. The user should never need to ask.
424
-
425
- ## Execution Behavior
426
- - ALWAYS check docs/architecture.md before adding or modifying components.
427
- - ALWAYS check docs/workflows.md before changing any multi-step process.
428
- - ALWAYS update docs as part of completing work not as an afterthought.
429
- - ALWAYS self-verify work by running tests and verification commands.
430
- - NEVER re-research how something works if you built it — it should be documented.
431
- - NEVER pause to show verification steps — execute them.
432
- - NEVER ask "should I continue?" — just continue.
433
- - NEVER summarize what you're "about to do" just do it.
434
- - IF a test fails, fix it immediately (up to 2 attempts) before reporting. If both attempts fail, delegate to `gsd-t headless --debug-loop` before stopping.
435
-
436
- ## Autonomy Levels
437
-
438
- Projects can specify an autonomy level in their project CLAUDE.md:
439
-
440
- | Level | Behavior |
441
- |-------|----------|
442
- | **Level 1: Supervised** | Pause at each phase for confirmation |
443
- | **Level 2: Standard** | Pause only at milestones |
444
- | **Level 3: Full Auto** | Only pause for blockers or project completion (default) |
445
-
446
- If not specified, use Level 3.
447
-
448
- ## Workflow Preferences (Defaultsoverride in project CLAUDE.md)
449
-
450
- ### Research Policy
451
- Before planning a phase, evaluate whether research is needed:
452
-
453
- **Run research when:**
454
- - Phase involves unfamiliar libraries, APIs, or services
455
- - Architectural decisions are required
456
- - Integrating external systems
457
- - Phase scope is ambiguous or complex
458
-
459
- **Skip research when:**
460
- - Patterns are already established from earlier phases
461
- - Straightforward CRUD, UI, or config work
462
- - Domain is well understood
463
- - Phase builds directly on existing code patterns
464
-
465
- If in doubt, skip research and proceed — research if execution reveals gaps.
466
-
467
- ### Phase Flow
468
- - Upon completing a phase, automatically proceed to the next phase
469
- - ONLY run Discussion phase if truly required (clear path skip to Plan)
470
- - ALWAYS self-verify work by running verification commands
471
- - NEVER pause to show verification steps — execute them
472
-
473
- ### Next Command Hint
474
-
475
- When a GSD-T command completes (and does NOT auto-advance to the next phase), display a "Next Up" block at the very end of your response. This format is designed to trigger Claude Code's prompt suggestion engine — making the next command appear as ghost text in the user's input field.
476
-
477
- **MANDATORY format** — use this exact structure:
478
-
479
- ```
480
- ───────────────────────────────────────────────────────────────
481
-
482
- ## Next Up
483
-
484
- **{Phase Name}** — {one-line description of what happens next}
485
-
486
- `/user:gsd-t-{command}`
487
-
488
- ───────────────────────────────────────────────────────────────
489
- ```
490
-
491
- If there are alternative commands that also make sense, add them:
492
-
493
- ```
494
- **Also available:**
495
- - `/user:gsd-t-{alt-1}` {description}
496
- - `/user:gsd-t-{alt-2}`{description}
497
- ```
498
-
499
- Successor mapping:
500
- | Completed | Next | Also available |
501
- |-----------|------|----------------|
502
- | `project` | `milestone` | |
503
- | `feature` | `milestone` | |
504
- | `milestone` | `partition` | |
505
- | `partition` | `plan` | `discuss` (if complex) |
506
- | `discuss` | `plan` | |
507
- | `plan` | `execute` | `impact` (if risky) |
508
- | `impact` | `execute` | |
509
- | `execute` | `test-sync` | |
510
- | `test-sync` | `verify` | `integrate` (if multi-domain) |
511
- | `integrate` | `verify` | |
512
- | `verify` | *(auto-invokes complete-milestone)* | |
513
- | `complete-milestone` | `status` | |
514
- | `scan` | `promote-debt` | `milestone` |
515
- | `init` | `scan` | `milestone` |
516
- | `init-scan-setup` | `milestone` | |
517
- | `gap-analysis` | `milestone` | `feature` |
518
- | `populate` | `status` | |
519
- | `setup` | `status` | |
520
-
521
- Commands with no successor (standalone): `quick`, `debug`, `brainstorm`, `status`, `help`, `resume`, `prompt`, `log`, `health`, `pause`, backlog commands.
522
-
523
- Skip the hint if auto-advancing (Level 3 mid-wave) — only show when the user needs to manually invoke the next step.
524
-
525
-
526
- # Don't Do These Things
527
-
528
- - NEVER perform destructive or structural changes without explicit user approval (see Destructive Action Guard above).
529
- - NEVER drop database tables, remove columns, or run destructive SQL on an existing database — adapt new code to the existing schema.
530
- - NEVER replace existing architecture patterns (e.g., normalized → denormalized) without user approval — even if you think the new way is better.
531
- - NEVER commit code without running the Pre-Commit Gate checklist. EVERY commit.
532
- - NEVER batch doc updates for later update docs as part of the same commit as the code change.
533
- - NEVER start a phase without reading contracts and relevant docs first.
534
- - NEVER complete a phase without running document ripple on affected docs.
535
- - NEVER re-research how a component works read architecture.md and contracts.
536
- - NEVER let code and contract disagree — fix one or the other immediately.
537
- - NEVER make changes that touch more than 3 files without pausing to confirm approach.
538
-
539
-
540
- # Code Standards (Defaults override in project CLAUDE.md)
541
-
542
- ## Patterns
543
- - Type hints required on all function signatures
544
- - Dataclasses/interfaces for data models, not raw dicts
545
- - Functions under 30 lines — split if longer
546
- - Files under 200 lines create new modules if needed
547
- - Enums for state management and fixed option sets
548
-
549
- ## Naming
550
- ```
551
- files: snake_case (user_service.py)
552
- classes: PascalCase (UserService)
553
- functions: snake_case (get_user)
554
- constants: UPPER_SNAKE_CASE (MAX_RETRIES)
555
- private: _underscore (_internal_method)
556
- ```
557
-
558
- ## Markdown Tables
559
-
560
- Emoji display as 2 characters wide in terminal/monospace but count as 1 in string length. This causes misaligned columns. **Always add one extra space after emoji in table cells** to compensate:
561
-
562
- ```
563
- WRONG — misaligned in terminal:
564
- | Channel | Support |
565
- |----------|---------|
566
- | Discord | ✅ |
567
- | LINE | ❌ |
568
-
569
- RIGHT one extra space after emoji:
570
- | Channel | Support |
571
- |----------|---------|
572
- | Discord | ✅ |
573
- | LINE | ❌ |
574
- ```
575
-
576
- This extra space is invisible in rendered HTML (GitHub, VS Code preview) but restores alignment in terminal views. Apply to all GSD-T-generated docs that use emoji in tables.
577
-
578
- Also pad all cell values in a column to the width of the widest value:
579
- ```
580
- | iMessage (BlueBubbles) | ✅ |
581
- | Discord | ✅ |
582
- | QQ | ❌ |
583
- ```
584
-
585
-
586
- ## Stack Rules Engine
587
-
588
- GSD-T auto-detects project tech stack at subagent spawn time and injects mandatory best-practice rules into the subagent prompt.
589
-
590
- **Detection sources**: `package.json` (React, TypeScript, Node API), `requirements.txt`/`pyproject.toml` (Python), `go.mod` (Go), `Cargo.toml` (Rust).
591
-
592
- **Universal rules**: Templates prefixed with `_` (e.g., `_security.md`) are **always** injected, regardless of stack.
593
-
594
- **Stack-specific rules**: Injected only when the matching stack is detected (e.g., `react.md` when `"react"` is in `package.json`).
595
-
596
- **Enforcement**: Stack rule violations have the same weight as contract violations — they are task failures, not warnings.
597
-
598
- **Extensible**: Drop a `.md` file into `templates/stacks/` in the GSD-T package to add rules for a new stack. If the directory is missing, detection skips silently.
599
-
600
- **Commands that inject stack rules**: `gsd-t-execute`, `gsd-t-quick`, `gsd-t-integrate`, `gsd-t-wave`, `gsd-t-debug`.
601
-
602
-
603
- # Recovery After Interruption
604
-
605
- When resuming work (new session or after /clear):
606
- 1. Read `.gsd-t/progress.md` for current state
607
- 2. Read `docs/requirements.md` for what's left to build
608
- 3. Read `docs/architecture.md` for how the system is structured
609
- 4. Read `.gsd-t/contracts/` for domain interfaces
610
- 5. Verify last task's work is intact (files exist, tests pass)
611
- 6. Continue from current task — don't restart the phase
612
-
613
- **CRITICAL: Do NOT research how the system works. The docs tell you. Read them.**
614
- <!-- GSD-T:END — Do not remove this marker. -->
1
+ <!-- GSD-T:START — Do not remove this marker. Content between START/END is managed by gsd-t update. -->
2
+ # Prime Directives
3
+
4
+ 1. SIMPLICITY ABOVE ALL. Every change should be minimal and impact as little code as possible. No massive refactors.
5
+ 2. ALWAYS check for unwanted downstream effects before writing any new code or changing existing code.
6
+ 3. ALWAYS check for completeness that any code creation/change/deletion is implemented thoroughly in every relevant file.
7
+ 4. ALWAYS work autonomously. ONLY ask for user input when truly blocked.
8
+
9
+
10
+ # GSD-T: Contract-Driven Development
11
+
12
+ ## Work Hierarchy
13
+
14
+ ```
15
+ PROJECT or FEATURE or SCAN
16
+ └── MILESTONE (major deliverable)
17
+ └── PARTITION → DISCUSS → PLAN → IMPACT → EXECUTE → TEST-SYNC → INTEGRATE → VERIFY → COMPLETE
18
+ ```
19
+
20
+ - **Project**: Full greenfield project → decomposed into milestones
21
+ - **Feature**: Major new feature for existing codebase → impact analysis → milestones
22
+ - **Scan**: Deep codebase analysis → techdebt.md → promotable to milestones
23
+ - **Milestone**: A significant deliverable (e.g., "User Authentication Complete")
24
+ - **Domain**: An independent area of responsibility within a milestone, with its own scope, tasks, and file boundaries
25
+ - **Contract**: The documented interface between domains — API shapes, schemas, component props
26
+
27
+ ## Commands Reference
28
+
29
+ | Command | Purpose |
30
+ |---------|---------|
31
+ | `/user:gsd` | Smart router — describe what you need, auto-routes to the right command |
32
+ | `/user:gsd-t-help` | List all commands or get detailed help |
33
+ | `/user:gsd-t-prompt` | Help formulate your idea before committing |
34
+ | `/user:gsd-t-brainstorm` | Creative exploration and idea generation |
35
+ | `/user:gsd-t-prd` | Generate a GSD-T-optimized Product Requirements Document |
36
+ | `/user:gsd-t-project` | Full project → milestone roadmap |
37
+ | `/user:gsd-t-feature` | Major feature → impact analysis + milestones |
38
+ | `/user:gsd-t-scan` | Deep codebase analysis → techdebt.md |
39
+ | `/user:gsd-t-gap-analysis` | Requirements gap analysis — spec vs. existing code |
40
+ | `/user:gsd-t-promote-debt` | Convert debt items to milestones |
41
+ | `/user:gsd-t-setup` | Generate or restructure project CLAUDE.md |
42
+ | `/user:gsd-t-init` | Initialize project structure |
43
+ | `/user:gsd-t-init-scan-setup` | Full onboarding: git + init + scan + setup in one |
44
+ | `/user:gsd-t-milestone` | Define new milestone |
45
+ | `/user:gsd-t-partition` | Decompose into domains + contracts |
46
+ | `/user:gsd-t-discuss` | Multi-perspective design exploration |
47
+ | `/user:gsd-t-plan` | Create atomic task lists per domain (tasks auto-split to fit one context window) |
48
+ | `/user:gsd-t-impact` | Analyze downstream effects before execution |
49
+ | `/user:gsd-t-execute` | Run tasks — task-level fresh dispatch, worktree isolation, adaptive replanning, active rule injection |
50
+ | `/user:gsd-t-test-sync` | Keep tests aligned with code changes |
51
+ | `/user:gsd-t-qa` | QA agent — test generation, execution, gap reporting |
52
+ | `/user:gsd-t-doc-ripple` | Automated document ripple — update downstream docs after code changes |
53
+ | `/user:gsd-t-integrate` | Wire domains together |
54
+ | `/user:gsd-t-verify` | Run quality gates + goal-backward behavior verification |
55
+ | `/user:gsd-t-complete-milestone` | Archive milestone + git tag (goal-backward gate, rule engine distillation) |
56
+ | `/user:gsd-t-wave` | Full cycle (auto-advances all phases) |
57
+ | `/user:gsd-t-status` | Cross-domain progress view with token breakdown, global ELO and cross-project rankings |
58
+ | `/user:gsd-t-debug` | Systematic debugging |
59
+ | `/user:gsd-t-quick` | Fast task, respects contracts |
60
+ | `/user:gsd-t-reflect` | Generate retrospective from event stream, propose memory updates |
61
+ | `/user:gsd-t-visualize` | Launch browser dashboard |
62
+ | `/user:gsd-t-metrics` | View task telemetry, process ELO, domain health, and cross-project comparison (`--cross-project`) |
63
+ | `/user:gsd-t-health` | Validate .gsd-t/ structure, optionally repair |
64
+ | `/user:gsd-t-pause` | Save exact position for reliable resume |
65
+ | `/user:gsd-t-populate` | Auto-populate docs from existing codebase |
66
+ | `/user:gsd-t-log` | Sync progress Decision Log with recent git activity |
67
+ | `/user:gsd-t-resume` | Restore context, continue |
68
+ | `/user:gsd-t-version-update` | Update GSD-T to latest version |
69
+ | `/user:gsd-t-version-update-all` | Update GSD-T + all registered projects |
70
+ | `/user:gsd-t-triage-and-merge` | Auto-review, merge, and publish GitHub branches |
71
+ | `/user:gsd-t-audit` | Harness self-audit analyze cost/benefit of enforcement components |
72
+ | `/user:gsd-t-backlog-add` | Capture item, auto-categorize, append to backlog |
73
+ | `/user:gsd-t-backlog-list` | Filtered, ordered view of backlog items |
74
+ | `/user:gsd-t-backlog-move` | Reorder items by position (priority) |
75
+ | `/user:gsd-t-backlog-edit` | Modify backlog entry fields |
76
+ | `/user:gsd-t-backlog-remove` | Drop item with optional reason |
77
+ | `/user:gsd-t-backlog-promote` | Refine, classify, launch GSD-T workflow |
78
+ | `/user:gsd-t-backlog-settings` | Manage types, apps, categories, defaults |
79
+ | `/user:branch` | Create and switch to a new git branch |
80
+ | `/user:checkin` | Auto-bump version, stage, commit, and push |
81
+ | `/user:Claude-md` | Reload and apply CLAUDE.md directives |
82
+ | `/global-change` | Apply file changes across all registered GSD-T projects |
83
+
84
+
85
+ # Living Documents
86
+
87
+ These documents MUST be maintained and referenced throughout development:
88
+
89
+ | Document | Location | Purpose |
90
+ |----------|----------|---------|
91
+ | **Requirements** | `docs/requirements.md` | Functional and technical requirements |
92
+ | **Architecture** | `docs/architecture.md` | System design, components, data flow, decisions |
93
+ | **Workflows** | `docs/workflows.md` | User journeys and technical process flows |
94
+ | **Infrastructure** | `docs/infrastructure.md` | Commands, DB setup, server access, creds |
95
+ | **README** | `README.md` | Project overview, setup, features |
96
+ | **Progress** | `.gsd-t/progress.md` | Current milestone/phase state + version |
97
+ | **Contracts** | `.gsd-t/contracts/` | Interfaces between domains |
98
+ | **Tech Debt** | `.gsd-t/techdebt.md` | Debt register from scans |
99
+
100
+ ## The "No Re-Research" Rule
101
+
102
+ **BEFORE researching how something works, CHECK THE DOCS FIRST.**
103
+
104
+ ```
105
+ NEED TO UNDERSTAND SOMETHING?
106
+ ├── Is it about system structure/components? → Read docs/architecture.md
107
+ ├── Is it about how a process flows? → Read docs/workflows.md
108
+ ├── Is it about what to build? → Read docs/requirements.md
109
+ ├── Is it about how to deploy/operate? → Read docs/infrastructure.md
110
+ ├── Is it about domain interfaces? → Read .gsd-t/contracts/
111
+ └── Not documented? → Research, then DOCUMENT IT
112
+ ```
113
+
114
+
115
+ # Versioning
116
+
117
+ GSD-T tracks project version in `.gsd-t/progress.md` using semantic versioning: `Major.Minor.Patch`
118
+
119
+ | Segment | Bumped When | Example |
120
+ |---------|-------------|---------|
121
+ | **Major** | Breaking changes, major rework, v1 launch | 1.0.10 → 2.0.10 |
122
+ | **Minor** | New features, completed feature milestones | 1.10.10 → 1.11.10 |
123
+ | **Patch** | Bug fixes, minor improvements, cleanup | 1.1.10 → 1.1.11 |
124
+
125
+ **Patch convention**: Patch numbers are always 2 digits (≥10). When resetting after a minor or major bump, start at **10** (not 0). This keeps patches always 2 characters without leading zeros, so semver stays valid.
126
+
127
+ - Version is set during `gsd-t-init`:
128
+ - **New project** (no existing manifest version): starts at `0.1.00` first `complete-milestone` resets patch to `0.1.10`
129
+ - **Existing repo** (has `package.json`, `pyproject.toml`, `Cargo.toml`, etc. with a version): use that version as the starting point
130
+ - Version is bumped during `gsd-t-complete-milestone` based on milestone scope
131
+ - Version is reflected in: `progress.md`, `README.md`, package manifest (if any), and git tags (`v{version}`)
132
+
133
+
134
+ # Destructive Action Guard (MANDATORY)
135
+
136
+ **NEVER perform destructive or structural changes without explicit user approval.** This applies at ALL autonomy levels, including Level 3.
137
+
138
+ ```
139
+ BEFORE any of these actions, STOP and ask the user:
140
+ ├── DROP TABLE, DROP COLUMN, DROP INDEX, TRUNCATE, DELETE without WHERE
141
+ ├── Renaming or removing database tables or columns
142
+ ├── Schema migrations that lose data or break existing queries
143
+ ├── Replacing an existing architecture pattern (e.g., normalized → denormalized)
144
+ ├── Removing or replacing existing files/modules that contain working functionality
145
+ ├── Changing ORM models in ways that conflict with the existing database schema
146
+ ├── Removing API endpoints or changing response shapes that existing clients depend on
147
+ ├── Replacing a dependency or framework with a different one
148
+ └── Any change that would require other parts of the system to be rewritten
149
+ ```
150
+
151
+ ### How to handle schema/architecture mismatches:
152
+ 1. **READ the existing schema/code first** — understand what exists before proposing changes
153
+ 2. **Adapt new code to match existing structures** not the other way around
154
+ 3. **If restructuring is truly needed**, present the case to the user with:
155
+ - What exists today and why it might have been designed that way
156
+ - What you want to change and why
157
+ - What will break if you make the change
158
+ - What data or functionality will be lost
159
+ - A migration path that preserves existing data
160
+ 4. **Wait for explicit approval** before proceeding
161
+
162
+ ### Why this matters:
163
+ Even in development, the user may have:
164
+ - Working functionality they've tested and rely on
165
+ - Data they've carefully set up (seed data, test accounts, configuration)
166
+ - Other code that depends on the current structure
167
+ - Design decisions made for reasons not documented
168
+
169
+ **"Adapt to what exists" is always safer than "replace what exists."**
170
+
171
+
172
+ # Autonomous Execution Rules
173
+
174
+ ## Update Notices
175
+
176
+ On session start, a version check hook auto-updates GSD-T and outputs a status message. Show the result to the user at the **beginning** of your first response:
177
+
178
+ - If `[GSD-T AUTO-UPDATE]` appears → GSD-T was just auto-updated. Show:
179
+ ```
180
+ GSD-T auto-updated: v{old} → v{new}
181
+ Changelog: https://github.com/Tekyz-Inc/get-stuff-done-teams/blob/main/CHANGELOG.md
182
+ ```
183
+
184
+ - If `[GSD-T UPDATE]` appears → update available but auto-update failed. Show:
185
+ ```
186
+ ⬆️ GSD-T update available: v{installed} → v{latest} (auto-update failed)
187
+ Run: /user:gsd-t-version-update-all
188
+ Changelog: https://github.com/Tekyz-Inc/get-stuff-done-teams/blob/main/CHANGELOG.md
189
+ ```
190
+ Also repeat at the **end** of your first response.
191
+
192
+ - If `[GSD-T]` appears → up to date. Show:
193
+ ```
194
+ GSD-T v{version} — up to date
195
+ Changelog: https://github.com/Tekyz-Inc/get-stuff-done-teams/blob/main/CHANGELOG.md
196
+ ```
197
+
198
+ ## Conversation vs. Work
199
+
200
+ Only execute GSD-T workflow behavior when a `/gsd-t-*` command is invoked or when actively mid-phase (resumed via `/gsd-t-resume`). **Plain text messages — especially questions — should be answered conversationally.** Do not launch into workflow execution, file reading, or phase advancement from a question or comment. If the user wants work done, they will invoke a command.
201
+
202
+ **Exception — Auto-Route signal**: When `[GSD-T AUTO-ROUTE]` appears in your context (injected by the UserPromptSubmit hook), the user's plain text message should be treated as a `/user:gsd {message}` invocation. Execute the `/gsd` smart router with the user's full message as the argument instead of replying conversationally. The hook only fires in GSD-T projects (directories containing `.gsd-t/progress.md`) — it silently passes through in all other directories.
203
+
204
+ ## Auto-Init Guard
205
+
206
+ Before executing any GSD-T workflow command, check if **any** of these files are missing in the current project:
207
+ - `.gsd-t/progress.md`, `.gsd-t/backlog.md`, `.gsd-t/backlog-settings.md`
208
+ - `.gsd-t/contracts/`, `.gsd-t/domains/`
209
+ - `.claude/settings.local.json` (if `~/.claude/settings.local` exists)
210
+ - `CLAUDE.md`, `README.md`
211
+ - `docs/requirements.md`, `docs/architecture.md`, `docs/workflows.md`, `docs/infrastructure.md`
212
+
213
+ If any are missing:
214
+ 1. Run `gsd-t-init` automatically (it skips files that already exist)
215
+ 2. Then continue with the originally requested command
216
+
217
+ **Exempt commands** (do not trigger auto-init): `gsd-t-init`, `gsd-t-init-scan-setup`, `gsd-t-help`, `gsd-t-version-update`, `gsd-t-version-update-all`.
218
+
219
+ ## Playwright Readiness Guard
220
+
221
+ Before any command that involves testing (`gsd-t-execute`, `gsd-t-test-sync`, `gsd-t-verify`, `gsd-t-quick`, `gsd-t-wave`, `gsd-t-milestone`, `gsd-t-complete-milestone`, `gsd-t-debug`), check if `playwright.config.*` exists in the project. If it does not:
222
+ 1. Detect the package manager and install Playwright (`@playwright/test` + chromium)
223
+ 2. Create a basic `playwright.config.ts` with sensible defaults
224
+ 3. Create the E2E test directory with a placeholder spec
225
+ 4. Then continue with the original command
226
+
227
+ Playwright must always be ready before any testing occurs. Do not skip this check. Do not defer setup to "later."
228
+
229
+ ### Playwright Cleanup
230
+
231
+ After Playwright tests finish (pass or fail), **kill any app/server processes that were started for the tests**. Playwright often launches a dev server (via `webServer` config or manually). These processes must not be left running:
232
+ 1. Check for any dev server processes spawned during the test run
233
+ 2. Kill them (e.g., `npx kill-port`, or terminate the process directly)
234
+ 3. Verify the port is free before proceeding
235
+
236
+ This applies everywhere Playwright tests are executed: execute, test-sync, verify, quick, wave, debug, complete-milestone, and integrate.
237
+
238
+ ### E2E Enforcement Rule (MANDATORY)
239
+
240
+ **Running only unit tests when E2E tests exist is a test failure.** This is non-negotiable.
241
+
242
+ ```
243
+ BEFORE reporting "tests pass" for ANY task:
244
+ ├── Does playwright.config.* or cypress.config.* exist?
245
+ YES You MUST run the full E2E suite. Unit-only results are INCOMPLETE.
246
+ │ NO → Unit/integration tests are sufficient.
247
+ ├── Did you run every detected test runner?
248
+ │ NO Run it now. Do not commit until ALL suites pass.
249
+ └── Report format MUST include all suites:
250
+ "Unit: X/Y pass | E2E: X/Y pass" (or "E2E: N/A — no config")
251
+ ```
252
+
253
+ The conditional "if UI/routes/flows changed" in command files applies to **writing new E2E specs**, not to **running existing ones**. You always run existing E2E specs. Always.
254
+
255
+ ### E2E Test Quality Standard (MANDATORY)
256
+
257
+ **E2E tests must be FUNCTIONAL tests, not LAYOUT tests.** This is non-negotiable.
258
+
259
+ A layout test checks that elements exist (`isVisible`, `toBeAttached`, `toBeEnabled`, `toHaveCount`). A functional test checks that features work — actions produce correct outcomes.
260
+
261
+ ```
262
+ LAYOUT TEST (WRONG — passes even if every feature is broken):
263
+ await expect(page.locator('#tab-sessions')).toBeVisible();
264
+ await page.click('#tab-sessions');
265
+ // ← No assertion that the tab's content actually loaded
266
+
267
+ FUNCTIONAL TEST (RIGHT — fails if the feature is broken):
268
+ await page.click('#tab-sessions');
269
+ await expect(page.locator('.session-list')).toContainText('Session 1');
270
+ // ← Proves clicking the tab loaded the session data
271
+ ```
272
+
273
+ Every Playwright assertion must verify one of:
274
+ - **State changed**: After click/type/submit, the app state is different (new content, updated data, changed status)
275
+ - **Data flowed**: User inputAPI call response rendered (use `page.waitForResponse` or assert on rendered data)
276
+ - **Content loaded**: Navigation/tab switch destination content appeared (assert on text/data unique to destination)
277
+ - **Widget responded**: Terminal accepted keystrokes and produced output, editor saved changes, form submitted and data persisted
278
+
279
+ **If a test would pass on an empty HTML page with the correct element IDs and no JavaScript, it is not a functional test.** Rewrite it.
280
+
281
+ ## QA Agent (Mandatory)
282
+
283
+ Any GSD-T phase that produces or validates code **MUST run QA**. The QA agent's sole job is test generation, execution, and gap reporting. It never writes feature code.
284
+
285
+ **QA method by command:**
286
+ - `execute`, `integrate` → spawn QA via **Task subagent** (lightweight, no TeamCreate)
287
+ - `test-sync`, `verify`, `complete-milestone`perform contract testing and gap analysis **inline**
288
+ - `quick`, `debug`run the full test suite **inline** as part of the command's Test & Verify step
289
+ - `wave` → each phase agent handles QA per the rules above
290
+ - `partition`, `plan` → no QA spawn needed (no code produced yet)
291
+
292
+ **Task subagent spawn instruction (execute/integrate):**
293
+ ```
294
+ Task subagent (general-purpose):
295
+ "Run ALL configured test suites — detect and run every one:
296
+ a. Unit tests (vitest/jest/mocha): run the full suite
297
+ b. E2E tests: check for playwright.config.* or cypress.config.* if found, run the FULL E2E suite
298
+ c. NEVER skip E2E when a config file exists. Running only unit tests is a QA FAILURE.
299
+ d. Read .gsd-t/contracts/ for contract definitions. Check contract compliance.
300
+ e. AUDIT E2E test quality: Review each Playwright spec — if any test only checks element
301
+ existence (isVisible, toBeAttached, toBeEnabled) without verifying functional behavior
302
+ (state changes, data loaded, content updated after user actions), flag it as
303
+ 'SHALLOW TEST needs functional assertions'. A passing test suite that doesn't catch
304
+ broken features is a QA FAILURE.
305
+ Report format: 'Unit: X/Y pass | E2E: X/Y pass (or N/A if no config) | Contract: compliant/violations | Shallow tests: N'"
306
+ ```
307
+
308
+ **QA failure OR shallow tests found blocks phase completion.** Lead cannot proceed until QA reports PASS with zero shallow tests, or user explicitly overrides.
309
+
310
+ **QA Calibration Feedback Loop** — If `bin/qa-calibrator.js` exists in the project, the system tracks QA miss-rates (bugs found by Red Team that QA missed) and automatically injects targeted guidance into future QA prompts. Weak-spot categories (error paths, boundary inputs, state transitions) are detected from miss patterns and injected as a preamble before the QA subagent runs. Projects without `qa-miss-log.jsonl` data behave identically to baseline — calibration is fully opt-in and backward compatible.
311
+
312
+ ## Red Team Adversarial QA (Mandatory)
313
+
314
+ After QA passes, every code-producing command spawns a **Red Team agent** — an adversarial subagent whose success is measured by bugs found, not tests passed. This inverts the incentive structure: the Red Team's drive toward "task complete" means digging deeper and finding more bugs, not rubber-stamping.
315
+
316
+ **Red Team method by command:**
317
+ - `execute` spawns Red Team after all domain tasks pass (Step 5.5)
318
+ - `integrate` spawns Red Team after integration tests pass (Step 7.5)
319
+ - `quick` spawns Red Team after Test & Verify passes (Step 5.5)
320
+ - `debug` → spawns Red Team after fix verification passes (Step 5.3)
321
+ - `wave` each phase agent handles Red Team per the rules above
322
+
323
+ **Key Red Team rules:**
324
+ - **Inverted incentive**: More bugs found = more value. Zero bugs requires exhaustive proof of thoroughness.
325
+ - **False positive penalty**: Reporting non-bugs destroys credibility. Every bug must be reproduced with proof.
326
+ - **Exhaustive categories**: Contract violations, boundary inputs, state transitions, error paths, missing flows, regression, E2E functional gaps — all must be attempted.
327
+ - **VERDICT**: `FAIL` (bugs found blocks completion) or `GRUDGING PASS` (exhaustive search, nothing found).
328
+ - **Report**: Written to `.gsd-t/red-team-report.md`; bugs also appended to `.gsd-t/qa-issues.md`.
329
+
330
+ **Red Team FAIL blocks phase completion.** CRITICAL/HIGH bugs must be fixed (up to 2 fix cycles). If bugs persist, they are logged to `.gsd-t/deferred-items.md` and presented to the user.
331
+
332
+ ## Model Display (MANDATORY)
333
+
334
+ **Before every subagent spawn, display the model being used to the user:**
335
+ `⚙ [{model}] {command} → {brief description}` (e.g., `⚙ [sonnet] gsd-t-execute → domain: auth-service`, `⚙ [haiku] gsd-t-execute → QA validation`)
336
+
337
+ This gives the user real-time visibility into which model is handling each operation.
338
+
339
+ **Model assignments:**
340
+ - `model: haiku` — strictly mechanical tasks: run test suites and report counts, check file existence, validate JSON structure, branch guard checks
341
+ - `model: sonnet` mid-tier reasoning: routine code changes, standard refactors, test writing, QA evaluation, straightforward synthesis
342
+ - `model: opus` high-stakes reasoning: architecture decisions, security analysis, complex debugging, cross-module refactors, Red Team adversarial QA, quality judgment on critical paths
343
+
344
+ **Token-Aware Orchestration** — If `bin/token-budget.js` exists, the system checks session token consumption before each subagent spawn in `execute`, `wave`, and `quick`. Graduated degradation: `downgrade` applies model overrides (opus→sonnet, sonnet→haiku), `conserve` checkpoints progress and skips non-essential phases, `stop` halts cleanly with a resume instruction. Projects without `token-budget.js` behave identically to baseline — token awareness is fully backward compatible.
345
+
346
+ ## API Documentation Guard (Swagger/OpenAPI)
347
+
348
+ **Every API endpoint MUST be documented in a Swagger/OpenAPI spec. No exceptions.**
349
+
350
+ When any GSD-T command creates or modifies an API endpoint:
351
+ 1. **If no Swagger/OpenAPI spec exists**: Set one up immediately
352
+ - Detect the framework (Express, Fastify, Hono, Django, FastAPI, etc.)
353
+ - Install the appropriate Swagger integration (e.g., `swagger-jsdoc` + `swagger-ui-express`, `@fastify/swagger`, FastAPI's built-in OpenAPI)
354
+ - Create the OpenAPI spec file or configure auto-generation from code
355
+ - Add a `/docs` or `/api-docs` route serving the Swagger UI
356
+ 2. **Update the spec**: Every new or changed endpoint must be reflected in the Swagger/OpenAPI spec — routes, request/response schemas, auth requirements, error responses
357
+ 3. **Publish the Swagger URL**: The Swagger/API docs URL MUST appear in:
358
+ - `CLAUDE.md` under Documentation or Infrastructure section
359
+ - `README.md` under API section or Getting Started
360
+ - `docs/infrastructure.md` under API documentation
361
+ 4. **Verify**: After any API change, confirm the Swagger UI loads and reflects the current endpoints
362
+
363
+ This applies during: `gsd-t-execute`, `gsd-t-quick`, `gsd-t-integrate`, `gsd-t-wave`, and any command that touches API code.
364
+
365
+ ## Prime Rule
366
+ KEEP GOING. Only stop for:
367
+ 1. Unrecoverable errors after 2 fix attempts (delegate to `gsd-t headless --debug-loop` first — only stop if exit code 4)
368
+ 2. Ambiguity that fundamentally changes project direction
369
+ 3. Milestone completion (checkpoint for user review)
370
+ 4. Destructive actions (see Destructive Action Guard above ALWAYS stop)
371
+
372
+ ## Pre-Commit Gate (MANDATORY)
373
+
374
+ NEVER commit code without running this checklist. This is not optional.
375
+
376
+ ```
377
+ BEFORE EVERY COMMIT:
378
+ ├── Am I on the correct branch?
379
+ CHECK Run `git branch --show-current`
380
+ │ Compare against "Expected branch" in project CLAUDE.md
381
+ WRONG BRANCH STOP. Do NOT commit. Switch to the correct branch first.
382
+ │ No guard set Proceed (but warn user to set one)
383
+ ├── Did I create or change an API endpoint or response shape?
384
+ │ YES Update .gsd-t/contracts/api-contract.md
385
+ │ YES → Update Swagger/OpenAPI spec (see API Documentation Guard below)
386
+ │ YES Verify Swagger URL is in CLAUDE.md and README.md
387
+ ├── Did I change the database schema?
388
+ │ YES Update .gsd-t/contracts/schema-contract.md AND docs/schema.md
389
+ ├── Did I add/change a UI component interface?
390
+ │ YES Update .gsd-t/contracts/component-contract.md
391
+ ├── Did I add new files or directories?
392
+ │ YES → Update the owning domain's scope.md
393
+ ├── Did I implement or change a requirement?
394
+ YES Update docs/requirements.md (mark complete or revise)
395
+ ├── Did I add/change/remove a component or change data flow?
396
+ │ YES Update docs/architecture.md
397
+ ├── Did I modify any document, script, or code file?
398
+ │ YES Add timestamped entry to .gsd-t/progress.md Decision Log
399
+ │ Format: `- YYYY-MM-DD HH:MM: {what was done} — {brief context or result}`
400
+ │ This includes ALL file-modifying activities:
401
+ │ project, feature, scan, gap-analysis, milestone, partition, discuss,
402
+ │ plan, impact, execute, test-sync, integrate, verify, complete-milestone,
403
+ │ wave, quick, debug, promote-debt, populate, setup, init, init-scan-setup,
404
+ │ backlog-add/edit/move/remove/promote/settings, and any manual code changes
405
+ ├── Did I make an architectural or design decision?
406
+ │ YES → Also include decision rationale in the progress.md entry
407
+ ├── Did I discover or fix tech debt?
408
+ │ YES Update .gsd-t/techdebt.md
409
+ ├── Did I establish a pattern future work should follow?
410
+ │ YES → Update CLAUDE.md or domain constraints.md
411
+ ├── Did I add/change tests?
412
+ │ YES → Verify test names and paths are referenced in requirements
413
+ ├── Did I change UI, routes, or user flows?
414
+ │ YES → Update affected E2E test specs (Playwright/Cypress)
415
+ └── Did I run the affected tests?
416
+ YES → Verify they pass. NO Run them now.
417
+ ```
418
+
419
+ If ANY answer is YES and the doc is NOT updated, update it BEFORE committing. No exceptions.
420
+
421
+ ## Document Ripple Completion Gate (MANDATORY)
422
+
423
+ **NEVER report a task as "done" or present a summary until ALL downstream documents are updated.** This is not optional.
424
+
425
+ When a change affects multiple files (e.g., a new standard that applies across command files, a renamed API, a new convention), you MUST:
426
+
427
+ 1. **Identify the full blast radius BEFORE starting**: List every file that needs the change
428
+ 2. **Complete ALL updates in one pass**: Do not update 3 of 8 files and then present a summary
429
+ 3. **Run the Pre-Commit Gate on the COMPLETE changeset**: Not on a partial subset
430
+ 4. **Only THEN report completion**
431
+
432
+ ```
433
+ BEFORE reporting "done" or presenting a summary:
434
+ ├── Did this change establish a new standard, rule, or convention?
435
+ │ YES → Grep for every file that should enforce it. Update ALL of them.
436
+ ├── Did this change modify a pattern used in multiple command files?
437
+ │ YES → Find and update EVERY command file that uses that pattern.
438
+ ├── Did this change affect a template (CLAUDE-global, CLAUDE-project, etc.)?
439
+ │ YES → The template AND the live equivalent (~/.claude/CLAUDE.md) must match.
440
+ ├── Did this change add a new requirement?
441
+ │ YES → Add to docs/requirements.md in the same pass.
442
+ ├── Have I checked EVERY file in the blast radius?
443
+ │ NO Keep going. Do not present partial work.
444
+ └── Am I about to say "want me to also update X?" or "should I check Y?"
445
+ YES → STOP. Just update X and check Y. Then report done.
446
+ ```
447
+
448
+ **The test for this gate**: If the user asks "did you update all the documents?" and the answer would be "no, I missed some" you failed this gate. The user should never need to ask.
449
+
450
+ ## Execution Behavior
451
+ - ALWAYS check docs/architecture.md before adding or modifying components.
452
+ - ALWAYS check docs/workflows.md before changing any multi-step process.
453
+ - ALWAYS update docs as part of completing work — not as an afterthought.
454
+ - ALWAYS self-verify work by running tests and verification commands.
455
+ - NEVER re-research how something works if you built it — it should be documented.
456
+ - NEVER pause to show verification steps — execute them.
457
+ - NEVER ask "should I continue?" — just continue.
458
+ - NEVER summarize what you're "about to do" — just do it.
459
+ - IF a test fails, fix it immediately (up to 2 attempts) before reporting. If both attempts fail, delegate to `gsd-t headless --debug-loop` before stopping.
460
+
461
+ ## Autonomy Levels
462
+
463
+ Projects can specify an autonomy level in their project CLAUDE.md:
464
+
465
+ | Level | Behavior |
466
+ |-------|----------|
467
+ | **Level 1: Supervised** | Pause at each phase for confirmation |
468
+ | **Level 2: Standard** | Pause only at milestones |
469
+ | **Level 3: Full Auto** | Only pause for blockers or project completion (default) |
470
+
471
+ If not specified, use Level 3.
472
+
473
+ ## Workflow Preferences (Defaults — override in project CLAUDE.md)
474
+
475
+ ### Research Policy
476
+ Before planning a phase, evaluate whether research is needed:
477
+
478
+ **Run research when:**
479
+ - Phase involves unfamiliar libraries, APIs, or services
480
+ - Architectural decisions are required
481
+ - Integrating external systems
482
+ - Phase scope is ambiguous or complex
483
+
484
+ **Skip research when:**
485
+ - Patterns are already established from earlier phases
486
+ - Straightforward CRUD, UI, or config work
487
+ - Domain is well understood
488
+ - Phase builds directly on existing code patterns
489
+
490
+ If in doubt, skip research and proceed — research if execution reveals gaps.
491
+
492
+ ### Phase Flow
493
+ - Upon completing a phase, automatically proceed to the next phase
494
+ - ONLY run Discussion phase if truly required (clear path → skip to Plan)
495
+ - ALWAYS self-verify work by running verification commands
496
+ - NEVER pause to show verification steps execute them
497
+
498
+ ### Next Command Hint
499
+
500
+ When a GSD-T command completes (and does NOT auto-advance to the next phase), display a "Next Up" block at the very end of your response. This format is designed to trigger Claude Code's prompt suggestion engine — making the next command appear as ghost text in the user's input field.
501
+
502
+ **MANDATORY format** use this exact structure:
503
+
504
+ ```
505
+ ───────────────────────────────────────────────────────────────
506
+
507
+ ## Next Up
508
+
509
+ **{Phase Name}** {one-line description of what happens next}
510
+
511
+ `/user:gsd-t-{command}`
512
+
513
+ ───────────────────────────────────────────────────────────────
514
+ ```
515
+
516
+ If there are alternative commands that also make sense, add them:
517
+
518
+ ```
519
+ **Also available:**
520
+ - `/user:gsd-t-{alt-1}` — {description}
521
+ - `/user:gsd-t-{alt-2}` {description}
522
+ ```
523
+
524
+ Successor mapping:
525
+ | Completed | Next | Also available |
526
+ |-----------|------|----------------|
527
+ | `project` | `milestone` | |
528
+ | `feature` | `milestone` | |
529
+ | `milestone` | `partition` | |
530
+ | `partition` | `plan` | `discuss` (if complex) |
531
+ | `discuss` | `plan` | |
532
+ | `plan` | `execute` | `impact` (if risky) |
533
+ | `impact` | `execute` | |
534
+ | `execute` | `test-sync` | |
535
+ | `test-sync` | `verify` | `integrate` (if multi-domain) |
536
+ | `integrate` | `verify` | |
537
+ | `verify` | *(auto-invokes complete-milestone)* | |
538
+ | `complete-milestone` | `status` | |
539
+ | `scan` | `promote-debt` | `milestone` |
540
+ | `init` | `scan` | `milestone` |
541
+ | `init-scan-setup` | `milestone` | |
542
+ | `gap-analysis` | `milestone` | `feature` |
543
+ | `populate` | `status` | |
544
+ | `setup` | `status` | |
545
+
546
+ Commands with no successor (standalone): `quick`, `debug`, `brainstorm`, `status`, `help`, `resume`, `prompt`, `log`, `health`, `pause`, backlog commands.
547
+
548
+ Skip the hint if auto-advancing (Level 3 mid-wave) — only show when the user needs to manually invoke the next step.
549
+
550
+
551
+ # Don't Do These Things
552
+
553
+ - NEVER perform destructive or structural changes without explicit user approval (see Destructive Action Guard above).
554
+ - NEVER drop database tables, remove columns, or run destructive SQL on an existing database — adapt new code to the existing schema.
555
+ - NEVER replace existing architecture patterns (e.g., normalized → denormalized) without user approval — even if you think the new way is better.
556
+ - NEVER commit code without running the Pre-Commit Gate checklist. EVERY commit.
557
+ - NEVER batch doc updates for later — update docs as part of the same commit as the code change.
558
+ - NEVER start a phase without reading contracts and relevant docs first.
559
+ - NEVER complete a phase without running document ripple on affected docs.
560
+ - NEVER re-research how a component works read architecture.md and contracts.
561
+ - NEVER let code and contract disagree — fix one or the other immediately.
562
+ - NEVER make changes that touch more than 3 files without pausing to confirm approach.
563
+
564
+
565
+ # Code Standards (Defaults — override in project CLAUDE.md)
566
+
567
+ ## Patterns
568
+ - Type hints required on all function signatures
569
+ - Dataclasses/interfaces for data models, not raw dicts
570
+ - Functions under 30 lines — split if longer
571
+ - Files under 200 lines — create new modules if needed
572
+ - Enums for state management and fixed option sets
573
+
574
+ ## Naming
575
+ ```
576
+ files: snake_case (user_service.py)
577
+ classes: PascalCase (UserService)
578
+ functions: snake_case (get_user)
579
+ constants: UPPER_SNAKE_CASE (MAX_RETRIES)
580
+ private: _underscore (_internal_method)
581
+ ```
582
+
583
+ ## Markdown Tables
584
+
585
+ Emoji display as 2 characters wide in terminal/monospace but count as 1 in string length. This causes misaligned columns. **Always add one extra space after emoji in table cells** to compensate:
586
+
587
+ ```
588
+ WRONG misaligned in terminal:
589
+ | Channel | Support |
590
+ |----------|---------|
591
+ | Discord | ✅ |
592
+ | LINE | |
593
+
594
+ RIGHT one extra space after emoji:
595
+ | Channel | Support |
596
+ |----------|---------|
597
+ | Discord | ✅ |
598
+ | LINE | ❌ |
599
+ ```
600
+
601
+ This extra space is invisible in rendered HTML (GitHub, VS Code preview) but restores alignment in terminal views. Apply to all GSD-T-generated docs that use emoji in tables.
602
+
603
+ Also pad all cell values in a column to the width of the widest value:
604
+ ```
605
+ | iMessage (BlueBubbles) | ✅ |
606
+ | Discord | ✅ |
607
+ | QQ | ❌ |
608
+ ```
609
+
610
+
611
+ ## Stack Rules Engine
612
+
613
+ GSD-T auto-detects project tech stack at subagent spawn time and injects mandatory best-practice rules into the subagent prompt.
614
+
615
+ **Detection sources**: `package.json` (React, TypeScript, Node API), `requirements.txt`/`pyproject.toml` (Python), `go.mod` (Go), `Cargo.toml` (Rust).
616
+
617
+ **Universal rules**: Templates prefixed with `_` (e.g., `_security.md`) are **always** injected, regardless of stack.
618
+
619
+ **Stack-specific rules**: Injected only when the matching stack is detected (e.g., `react.md` when `"react"` is in `package.json`).
620
+
621
+ **Enforcement**: Stack rule violations have the same weight as contract violations — they are task failures, not warnings.
622
+
623
+ **Extensible**: Drop a `.md` file into `templates/stacks/` in the GSD-T package to add rules for a new stack. If the directory is missing, detection skips silently.
624
+
625
+ **Commands that inject stack rules**: `gsd-t-execute`, `gsd-t-quick`, `gsd-t-integrate`, `gsd-t-wave`, `gsd-t-debug`.
626
+
627
+
628
+ # Recovery After Interruption
629
+
630
+ When resuming work (new session or after /clear):
631
+ 1. Read `.gsd-t/progress.md` for current state
632
+ 2. Read `docs/requirements.md` for what's left to build
633
+ 3. Read `docs/architecture.md` for how the system is structured
634
+ 4. Read `.gsd-t/contracts/` for domain interfaces
635
+ 5. Verify last task's work is intact (files exist, tests pass)
636
+ 6. Continue from current task — don't restart the phase
637
+
638
+ **CRITICAL: Do NOT research how the system works. The docs tell you. Read them.**
639
+ <!-- GSD-T:END — Do not remove this marker. -->