@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,422 +1,425 @@
1
- # GSD-T: Contract-Driven Development for Claude Code
2
-
3
- A methodology for reliable, parallelizable development using Claude Code with optional Agent Teams support.
4
-
5
- ## What It Does
6
-
7
- **Solves context rot** — the quality degradation that happens as Claude fills its context window.
8
-
9
- **Enables parallel execution** — contract-driven domains can be worked on simultaneously.
10
-
11
- **Maintains test coverage** — automatically keeps tests aligned with code changes.
12
-
13
- **Catches downstream effects** — analyzes impact before changes break things.
14
-
15
- **Self-learning rule engine** — declarative rules detect failure patterns from task metrics. Patches progress through 5 lifecycle stages with measurable improvement gates before graduating into permanent methodology.
16
-
17
- ---
18
-
19
- ## Quick Start
20
-
21
- ```bash
22
- # 1. Start Claude Code in your project
23
- cd my-project
24
- claude
25
-
26
- # 2. Full onboarding (git + init + scan + setup in one)
27
- /user:gsd-t-init-scan-setup
28
-
29
- # Or step by step:
30
- /user:gsd-t-init my-project
31
-
32
- # 3. Define what you're building
33
- /user:gsd-t-milestone "User Authentication System"
34
-
35
- # 5. Let it rip (auto-advances through all phases)
36
- /user:gsd-t-wave
37
-
38
- # Or go phase by phase for more control:
39
- /user:gsd-t-partition
40
- /user:gsd-t-discuss
41
- /user:gsd-t-plan
42
- /user:gsd-t-impact
43
- /user:gsd-t-execute
44
- /user:gsd-t-test-sync
45
- /user:gsd-t-integrate
46
- /user:gsd-t-verify
47
- /user:gsd-t-complete-milestone
48
- ```
49
-
50
- ## Resuming After a Break
51
-
52
- ```bash
53
- claude
54
- /user:gsd-t-resume
55
- ```
56
-
57
- GSD-T reads all state files and tells you exactly where you left off.
58
-
59
- ---
60
-
61
- ## Commands Reference
62
-
63
- ### Smart Router
64
-
65
- | Command | Purpose | Auto |
66
- |---------|---------|------|
67
- | `/user:gsd {request}` | Describe what you need → auto-routes to the right command | Manual |
68
- | _(any plain text)_ | Auto-routed via UserPromptSubmit hook — no leading `/` needed | Auto |
69
-
70
- ### Help & Onboarding
71
-
72
- | Command | Purpose | Auto |
73
- |---------|---------|------|
74
- | `/user:gsd-t-help` | List all commands with descriptions | Manual |
75
- | `/user:gsd-t-help {cmd}` | Detailed help for specific command | Manual |
76
- | `/user:gsd-t-prompt` | Help formulate your idea before committing | Manual |
77
- | `/user:gsd-t-brainstorm` | Creative exploration and idea generation | Manual |
78
- | `/user:gsd-t-prd` | Generate a GSD-T-optimized Product Requirements Document | Manual |
79
-
80
- ### Project Initialization
81
-
82
- | Command | Purpose | Auto |
83
- |---------|---------|------|
84
- | `/user:gsd-t-setup` | Generate or restructure project CLAUDE.md | Manual |
85
- | `/user:gsd-t-init` | Initialize GSD-T structure in project | Manual |
86
- | `/user:gsd-t-init-scan-setup` | Full onboarding: git + init + scan + setup in one | Manual |
87
- | `/user:gsd-t-project` | Full project → milestone roadmap | Manual |
88
- | `/user:gsd-t-feature` | Major feature → impact analysis + milestones | Manual |
89
- | `/user:gsd-t-scan` | Deep codebase analysis → techdebt.md | Manual |
90
- | `/user:gsd-t-gap-analysis` | Requirements gap analysis — spec vs. existing code | Manual |
91
- | `/user:gsd-t-promote-debt` | Convert techdebt items to milestones | Manual |
92
- | `/user:gsd-t-populate` | Auto-populate docs from existing codebase | Manual |
93
-
94
- ### Milestone Workflow
95
-
96
- | Command | Purpose | Auto |
97
- |---------|---------|------|
98
- | `/user:gsd-t-milestone` | Define new milestone | Manual |
99
- | `/user:gsd-t-partition` | Decompose into domains + contracts | In wave |
100
- | `/user:gsd-t-discuss` | Multi-perspective design exploration | In wave |
101
- | `/user:gsd-t-plan` | Create atomic task lists per domain (tasks auto-split to fit one context window) | In wave |
102
- | `/user:gsd-t-impact` | Analyze downstream effects | In wave |
103
- | `/user:gsd-t-execute` | Run tasks — task-level fresh dispatch, worktree isolation, adaptive replanning, stack rules injection | In wave |
104
- | `/user:gsd-t-test-sync` | Sync tests with code changes | In wave |
105
- | `/user:gsd-t-qa` | QA agent — test generation, execution, gap reporting | Auto-spawned |
106
- | `/user:gsd-t-doc-ripple` | Automated document ripple update downstream docs after code changes | Auto-spawned |
107
- | `/user:gsd-t-integrate` | Wire domains together | In wave |
108
- | `/user:gsd-t-verify` | Run quality gates + goal-backward verification → auto-invokes complete-milestone | In wave |
109
- | `/user:gsd-t-complete-milestone` | Archive + git tag (auto-invoked by verify, also standalone) | In wave |
110
-
111
- ### Automation & Utilities
112
-
113
- | Command | Purpose | Auto |
114
- |---------|---------|------|
115
- | `/user:gsd-t-wave` | Full cycle, auto-advances all phases | Manual |
116
- | `/user:gsd-t-status` | Cross-domain progress view with token breakdown, global ELO and cross-project rankings | Manual |
117
- | `/user:gsd-t-resume` | Restore context, continue | Manual |
118
- | `/user:gsd-t-quick` | Fast task with GSD-T guarantees | Manual |
119
- | `/user:gsd-t-reflect` | Generate retrospective from event stream, propose memory updates | Manual |
120
- | `/user:gsd-t-visualize` | Launch browser dashboard SSE server + React Flow agent visualization | Manual |
121
- | `/user:gsd-t-debug` | Systematic debugging with state | Manual |
122
- | `/user:gsd-t-metrics` | View task telemetry, process ELO, signal distribution, domain health, and cross-project comparison (`--cross-project`) | Manual |
123
- | `/user:gsd-t-health` | Validate .gsd-t/ structure, optionally repair | Manual |
124
- | `/user:gsd-t-pause` | Save exact position for reliable resume | Manual |
125
- | `/user:gsd-t-log` | Sync progress Decision Log with recent git activity | Manual |
126
- | `/user:gsd-t-version-update` | Update GSD-T to latest version | Manual |
127
- | `/user:gsd-t-version-update-all` | Update GSD-T + all registered projects | Manual |
128
- | `/user:gsd-t-triage-and-merge` | Auto-review, merge, and publish GitHub branches | Manual |
129
- | `/global-change` | Apply file changes (copy/insert/update/delete) across all GSD-T projects | Manual |
130
-
131
- ### Backlog Management
132
-
133
- | Command | Purpose | Auto |
134
- |---------|---------|------|
135
- | `/user:gsd-t-backlog-add` | Capture item, auto-categorize, append to backlog | Manual |
136
- | `/user:gsd-t-backlog-list` | Filtered, ordered view of backlog items | Manual |
137
- | `/user:gsd-t-backlog-move` | Reorder items by position (priority) | Manual |
138
- | `/user:gsd-t-backlog-edit` | Modify backlog entry fields | Manual |
139
- | `/user:gsd-t-backlog-remove` | Drop item with optional reason | Manual |
140
- | `/user:gsd-t-backlog-promote` | Refine, classify, launch GSD-T workflow | Manual |
141
- | `/user:gsd-t-backlog-settings` | Manage types, apps, categories, defaults | Manual |
142
-
143
- ---
144
-
145
- ## Workflow Phases
146
-
147
- ```
148
- ┌─────────────────────────────────────────────────────────────────────────────┐
149
- │ GSD-T Wave Flow │
150
- ├─────────────────────────────────────────────────────────────────────────────┤
151
-
152
- │ milestone → partition → discuss → plan → impact → execute → test-sync │
153
- │ │
154
- └──────┐ │
155
- │ │
156
- │ │ ┌───────────────────┐
157
- │ │ (runs after each │ │
158
- │ │ │ task + at verify)│
159
- │ │ └───────────────────┘
160
-
161
- verify+complete ◄──────────── integrate ◄──────────────────────┘
162
-
163
- └─────────────────────────────────────────────────────────────────────────────┘
164
- ```
165
-
166
- | Phase | Purpose | Solo/Team |
167
- |-------|---------|-----------|
168
- | **Prompt** | Formulate idea (pre-workflow) | Solo |
169
- | **Project/Feature/Scan** | Initialize work | Solo (team for large scans) |
170
- | **Milestone** | Define deliverable | Solo |
171
- | **Partition** | Decompose into domains + contracts | Solo |
172
- | **Discuss** | Explore design decisions | Both |
173
- | **Plan** | Create atomic task lists | Solo (always) |
174
- | **Impact** | Downstream effect analysis | Solo |
175
- | **Execute** | Build it | Both |
176
- | **Test-Sync** | Maintain test coverage | Solo |
177
- | **Integrate** | Wire domains together | Solo (always) |
178
- | **Verify** | Quality gates | Both |
179
- | **Complete** | Archive + tag | Solo |
180
-
181
- ---
182
-
183
- ## Project Structure
184
-
185
- ```
186
- your-project/
187
- ├── CLAUDE.md # Project conventions + GSD-T reference
188
- ├── docs/
189
- │ ├── requirements.md # Functional + technical requirements
190
- ├── architecture.md # System design, components, data flow
191
- ├── workflows.md # User journeys, technical processes
192
- └── infrastructure.md # Dev setup, DB, cloud, deployment
193
- ├── .gsd-t/
194
- │ ├── progress.md # Master state file
195
- ├── roadmap.md # Milestone roadmap
196
- ├── techdebt.md # Technical debt register
197
- │ ├── verify-report.md # Latest verification results
198
- │ ├── impact-report.md # Downstream effect analysis
199
- │ ├── test-coverage.md # Test sync report
200
- │ ├── contracts/
201
- ├── api-contract.md # API endpoint specifications
202
- ├── schema-contract.md # Database/data model specs
203
- ├── component-contract.md # UI component interfaces
204
- │ │ └── integration-points.md # Dependency graph + checkpoints
205
- │ ├── domains/
206
- │ │ └── {domain-name}/
207
- │ │ ├── scope.md # What this domain owns
208
- ├── tasks.md # Atomic task list
209
- │ │ └── constraints.md # Rules and boundaries
210
- │ ├── milestones/ # Archived completed milestones
211
- │ │ └── {milestone-name}-{date}/
212
- │ │ ├── summary.md
213
- ├── progress.md
214
- │ │ ├── verify-report.md
215
- │ │ ├── contracts/
216
- │ │ └── domains/
217
- └── scan/ # Codebase analysis outputs
218
- │ ├── architecture.md
219
- ├── business-rules.md
220
- ├── security.md
221
- └── quality.md
222
- └── src/
223
- ```
224
-
225
- ---
226
-
227
- ## Stack Rules Engine
228
-
229
- GSD-T auto-detects your project's tech stack and injects mandatory best-practice rules into subagent prompts at execute-time. This ensures stack conventions are enforced at the same weight as contract compliance — violations are task failures, not warnings.
230
-
231
- ### How It Works
232
-
233
- 1. At subagent spawn time, GSD-T reads project manifest files to detect the active stack(s).
234
- 2. Universal rules (`templates/stacks/_security.md`, `_auth.md`) are **always** injected.
235
- 3. Stack-specific rules are injected when the corresponding stack is detected.
236
- 4. Project-level overrides in `.gsd-t/stacks/` replace global files of the same name.
237
- 5. Rules are appended to the subagent prompt as a `## Stack Rules (MANDATORY)` section.
238
-
239
- ### Stack Detection (27 files)
240
-
241
- | Project File | Detected Stack(s) |
242
- |---|---|
243
- | *(always)* | `_security.md`, `_auth.md` |
244
- | `package.json` with `"react"` | `react.md` |
245
- | `package.json` with `"react-native"` | `react-native.md` |
246
- | `package.json` with `"next"` | `nextjs.md` |
247
- | `package.json` with `"vue"` | `vue.md` |
248
- | `package.json` with `"typescript"` or `tsconfig.json` | `typescript.md` |
249
- | `package.json` with `"tailwindcss"` | `tailwind.md` |
250
- | `package.json` with `"express"`, `"fastify"`, `"hono"`, or `"koa"` | `node-api.md`, `rest-api.md` |
251
- | `package.json` with `"vite"` | `vite.md` |
252
- | `package.json` with `"@supabase/supabase-js"` | `supabase.md` |
253
- | `package.json` with `"firebase"` | `firebase.md` |
254
- | `package.json` with `"graphql"` or `"@apollo/server"` | `graphql.md` |
255
- | `package.json` with `"zustand"` | `zustand.md` |
256
- | `package.json` with `"@reduxjs/toolkit"` | `redux.md` |
257
- | `package.json` with `"prisma"` or `"@prisma/client"` | `prisma.md` |
258
- | `package.json` with `"pg"`, `"knex"`, or `"drizzle-orm"` | `postgresql.md` |
259
- | `package.json` with `"neo4j-driver"` | `neo4j.md` |
260
- | `package.json` with `"bullmq"`, `"bull"`, `"amqplib"`, or `"@aws-sdk/client-sqs"` | `queues.md` |
261
- | `package.json` with `"openai"`, `"anthropic"`, `"langchain"` | `llm.md` |
262
- | `Dockerfile` or `compose.yaml` | `docker.md` |
263
- | `.github/workflows/*.yml` | `github-actions.md` |
264
- | `playwright.config.*` | `playwright.md` |
265
- | `requirements.txt` or `pyproject.toml` | `python.md` |
266
- | `requirements.txt` with `fastapi` | `fastapi.md` |
267
- | `requirements.txt` with `celery`, `dramatiq`, `rq`, or `arq` | `queues.md` |
268
- | `requirements.txt` with `openai`, `anthropic`, `langchain` | `llm.md` |
269
- | `pubspec.yaml` | `flutter.md` |
270
-
271
- ### Commands That Inject Stack Rules
272
-
273
- `gsd-t-execute`, `gsd-t-quick`, `gsd-t-integrate`, `gsd-t-wave`, `gsd-t-debug`
274
-
275
- ### Extending
276
-
277
- Drop a `.md` file into `templates/stacks/` to add a new stack. Files prefixed with `_` are universal (always injected). Files without a prefix are stack-specific (injected only when detected). If the `stacks/` directory is missing, detection skips silently — no error.
278
-
279
- ---
280
-
281
- ## Headless Mode
282
-
283
- Run GSD-T non-interactively in CI/CD pipelines or automated workflows.
284
-
285
- ### headless exec
286
-
287
- ```bash
288
- gsd-t headless verify --json --timeout=1200 # Run verify non-interactively
289
- gsd-t headless execute --json # Execute tasks without interactive prompts
290
- ```
291
-
292
- ### headless query
293
-
294
- ```bash
295
- gsd-t headless query status # Project state — no LLM, <100ms
296
- gsd-t headless query domains # Domain list with status
297
- ```
298
-
299
- ### headless debug-loop
300
-
301
- Compaction-proof automated test-fix-retest cycles. Each iteration runs as a separate `claude -p` session with fresh context. A cumulative debug ledger (`.gsd-t/debug-state.jsonl`) preserves all hypothesis/fix/learning history across sessions. An anti-repetition preamble is injected into each session to prevent retrying failed approaches.
302
-
303
- ```bash
304
- gsd-t headless --debug-loop [--max-iterations=N] [--test-cmd=CMD] [--fix-scope=PATTERN] [--json] [--log]
305
- ```
306
-
307
- **Flags:**
308
-
309
- | Flag | Default | Description |
310
- |--------------------|---------|-------------|
311
- | `--max-iterations` | 20 | Hard ceiling on iterations |
312
- | `--test-cmd` | (auto) | Override test command (auto-detected from project) |
313
- | `--fix-scope` | (all) | Limit fix scope to specific files or patterns |
314
- | `--json` | false | Structured JSON output after each iteration |
315
- | `--log` | false | Write per-iteration logs to `.gsd-t/` |
316
-
317
- **Escalation tiers:**
318
-
319
- | Iterations | Model | Behavior |
320
- |------------|--------|----------|
321
- | 1–5 | sonnet | Standard debug — one fix per session |
322
- | 6–15 | opus | Deeper reasoning — reads full ledger, may attempt multi-file fixes |
323
- | 16–20 | STOP | Write full diagnostic summary, present to user, exit code 4 |
324
-
325
- **Exit codes:** `0` all tests pass · `1` max iterations reached · `2` compaction error · `3` process error · `4` needs human decision
326
-
327
- **Auto-escalation from commands:** `gsd-t-execute`, `gsd-t-test-sync`, `gsd-t-verify`, `gsd-t-debug`, and `gsd-t-wave` delegate to `--debug-loop` automatically after 2 failed in-context fix attempts.
328
-
329
- ---
330
-
331
- ## Key Principles
332
-
333
- 1. **Contracts are the source of truth.** Code implements contracts, not the other way around. If code and contract disagree, fix one or the other — never leave them inconsistent.
334
-
335
- 2. **Domains own files exclusively.** No two domains should modify the same file. If they need shared state, that's a contract.
336
-
337
- 3. **Impact before execution.** Always analyze downstream effects before making changes. Surprises are expensive.
338
-
339
- 4. **Tests stay synced.** Every code change triggers test analysis. Gaps are caught immediately, not in production.
340
-
341
- 5. **State survives sessions.** Everything is in `.gsd-t/`. A fresh Claude Code session can resume from any point by reading the state files.
342
-
343
- 6. **Plan is single-brain, execute is multi-brain.** Planning, impact analysis, and integration require full context (always solo). Execution and verification can parallelize.
344
-
345
- 7. **Every decision is logged.** The Decision Log in progress.md captures why, not just what. Future sessions don't need to re-derive decisions.
346
-
347
- ---
348
-
349
- ## Enabling Agent Teams
350
-
351
- Agent Teams is an experimental feature. Enable it:
352
-
353
- ```bash
354
- # Environment variable
355
- export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
356
-
357
- # Or in settings.json
358
- { "experimental": { "agentTeams": true } }
359
- ```
360
-
361
- Teams are optional all commands work in solo mode without teams enabled.
362
-
363
- ### When to Use Teams
364
-
365
- - 3+ domains with independent starting work
366
- - Codebase scanning and feature impact analysis
367
- - Complex design questions with multiple viable approaches
368
- - Verification of large milestones
369
- - Debugging cross-domain issues
370
-
371
- ---
372
-
373
- ## Installation
374
-
375
- Copy all `.md` files from this package to `~/.claude/commands/`:
376
-
377
- ```bash
378
- # Windows
379
- copy *.md %USERPROFILE%\.claude\commands\
380
-
381
- # Mac/Linux
382
- cp *.md ~/.claude/commands/
383
- ```
384
-
385
- Verify with: `/user:gsd-t-help`
386
-
387
- ---
388
-
389
- ## Configuration
390
-
391
- GSD-T respects your project's `CLAUDE.md` for conventions and autonomy level.
392
-
393
- ### Autonomy Levels
394
-
395
- | Level | Phase Behavior |
396
- |-------|---------------|
397
- | **Level 1: Supervised** | Pauses at each phase for confirmation |
398
- | **Level 2: Standard** | Pauses at milestones |
399
- | **Level 3: Full Auto** (default) | Auto-advances through all phases. Only stops for: Destructive Action Guard, impact BLOCK verdicts, unrecoverable errors (after 2 fix attempts), and the Discuss phase |
400
-
401
- Set in your project's `CLAUDE.md` under `## Autonomy Level`.
402
-
403
- Recommended `.gsd-t/config.json`:
404
-
405
- ```json
406
- {
407
- "mode": "yolo",
408
- "model_profile": "quality",
409
- "workflow": {
410
- "research": true,
411
- "impact_check": true,
412
- "test_sync": true,
413
- "verifier": true
414
- }
415
- }
416
- ```
417
-
418
- ---
419
-
420
- ## License
421
-
422
- MIT
1
+ # GSD-T: Contract-Driven Development for Claude Code
2
+
3
+ A methodology for reliable, parallelizable development using Claude Code with optional Agent Teams support.
4
+
5
+ ## What It Does
6
+
7
+ **Solves context rot** — the quality degradation that happens as Claude fills its context window.
8
+
9
+ **Enables parallel execution** — contract-driven domains can be worked on simultaneously.
10
+
11
+ **Maintains test coverage** — automatically keeps tests aligned with code changes.
12
+
13
+ **Catches downstream effects** — analyzes impact before changes break things.
14
+
15
+ **Self-learning rule engine** — declarative rules detect failure patterns from task metrics. Patches progress through 5 lifecycle stages with measurable improvement gates before graduating into permanent methodology.
16
+
17
+ ---
18
+
19
+ ## Quick Start
20
+
21
+ ```bash
22
+ # 1. Start Claude Code in your project
23
+ cd my-project
24
+ claude
25
+
26
+ # 2. Full onboarding (git + init + scan + setup in one)
27
+ /user:gsd-t-init-scan-setup
28
+
29
+ # Or step by step:
30
+ /user:gsd-t-init my-project
31
+
32
+ # 3. Define what you're building
33
+ /user:gsd-t-milestone "User Authentication System"
34
+
35
+ # 5. Let it rip (auto-advances through all phases)
36
+ /user:gsd-t-wave
37
+
38
+ # Or go phase by phase for more control:
39
+ /user:gsd-t-partition
40
+ /user:gsd-t-discuss
41
+ /user:gsd-t-plan
42
+ /user:gsd-t-impact
43
+ /user:gsd-t-execute
44
+ /user:gsd-t-test-sync
45
+ /user:gsd-t-integrate
46
+ /user:gsd-t-verify
47
+ /user:gsd-t-complete-milestone
48
+ ```
49
+
50
+ ## Resuming After a Break
51
+
52
+ ```bash
53
+ claude
54
+ /user:gsd-t-resume
55
+ ```
56
+
57
+ GSD-T reads all state files and tells you exactly where you left off.
58
+
59
+ ---
60
+
61
+ ## Commands Reference
62
+
63
+ ### Smart Router
64
+
65
+ | Command | Purpose | Auto |
66
+ |---------|---------|------|
67
+ | `/user:gsd {request}` | Describe what you need → auto-routes to the right command | Manual |
68
+ | _(any plain text)_ | Auto-routed via UserPromptSubmit hook — no leading `/` needed | Auto |
69
+
70
+ ### Help & Onboarding
71
+
72
+ | Command | Purpose | Auto |
73
+ |---------|---------|------|
74
+ | `/user:gsd-t-help` | List all commands with descriptions | Manual |
75
+ | `/user:gsd-t-help {cmd}` | Detailed help for specific command | Manual |
76
+ | `/user:gsd-t-prompt` | Help formulate your idea before committing | Manual |
77
+ | `/user:gsd-t-brainstorm` | Creative exploration and idea generation | Manual |
78
+ | `/user:gsd-t-prd` | Generate a GSD-T-optimized Product Requirements Document | Manual |
79
+
80
+ ### Project Initialization
81
+
82
+ | Command | Purpose | Auto |
83
+ |---------|---------|------|
84
+ | `/user:gsd-t-setup` | Generate or restructure project CLAUDE.md | Manual |
85
+ | `/user:gsd-t-init` | Initialize GSD-T structure in project | Manual |
86
+ | `/user:gsd-t-init-scan-setup` | Full onboarding: git + init + scan + setup in one | Manual |
87
+ | `/user:gsd-t-project` | Full project → milestone roadmap | Manual |
88
+ | `/user:gsd-t-feature` | Major feature → impact analysis + milestones | Manual |
89
+ | `/user:gsd-t-scan` | Deep codebase analysis → techdebt.md | Manual |
90
+ | `/user:gsd-t-gap-analysis` | Requirements gap analysis — spec vs. existing code | Manual |
91
+ | `/user:gsd-t-promote-debt` | Convert techdebt items to milestones | Manual |
92
+ | `/user:gsd-t-populate` | Auto-populate docs from existing codebase | Manual |
93
+
94
+ ### Milestone Workflow
95
+
96
+ | Command | Purpose | Auto |
97
+ |---------|---------|------|
98
+ | `/user:gsd-t-milestone` | Define new milestone | Manual |
99
+ | `/user:gsd-t-partition` | Decompose into domains + contracts | In wave |
100
+ | `/user:gsd-t-discuss` | Multi-perspective design exploration | In wave |
101
+ | `/user:gsd-t-plan` | Create atomic task lists per domain (tasks auto-split to fit one context window) | In wave |
102
+ | `/user:gsd-t-impact` | Analyze downstream effects | In wave |
103
+ | `/user:gsd-t-execute` | Run tasks — task-level fresh dispatch, worktree isolation, adaptive replanning, stack rules injection | In wave |
104
+ | `/user:gsd-t-test-sync` | Sync tests with code changes | In wave |
105
+ | `/user:gsd-t-qa` | QA agent — test generation, execution, gap reporting | Auto-spawned |
106
+ | *Red Team* | Adversarial QAspawns after QA passes to find bugs the builder missed | Auto-spawned |
107
+ | `/user:gsd-t-doc-ripple` | Automated document ripple update downstream docs after code changes | Auto-spawned |
108
+ | `/user:gsd-t-integrate` | Wire domains together | In wave |
109
+ | `/user:gsd-t-verify` | Run quality gates + goal-backward verification auto-invokes complete-milestone | In wave |
110
+ | `/user:gsd-t-complete-milestone` | Archive + git tag (auto-invoked by verify, also standalone) | In wave |
111
+
112
+ ### Automation & Utilities
113
+
114
+ | Command | Purpose | Auto |
115
+ |---------|---------|------|
116
+ | `/user:gsd-t-wave` | Full cycle, auto-advances all phases | Manual |
117
+ | `/user:gsd-t-status` | Cross-domain progress view with token breakdown, global ELO and cross-project rankings | Manual |
118
+ | `/user:gsd-t-resume` | Restore context, continue | Manual |
119
+ | `/user:gsd-t-quick` | Fast task with GSD-T guarantees | Manual |
120
+ | `/user:gsd-t-reflect` | Generate retrospective from event stream, propose memory updates | Manual |
121
+ | `/user:gsd-t-visualize` | Launch browser dashboard SSE server + React Flow agent visualization | Manual |
122
+ | `/user:gsd-t-debug` | Systematic debugging with state | Manual |
123
+ | `/user:gsd-t-metrics` | View task telemetry, process ELO, signal distribution, domain health, and cross-project comparison (`--cross-project`) | Manual |
124
+ | `/user:gsd-t-health` | Validate .gsd-t/ structure, optionally repair | Manual |
125
+ | `/user:gsd-t-pause` | Save exact position for reliable resume | Manual |
126
+ | `/user:gsd-t-log` | Sync progress Decision Log with recent git activity | Manual |
127
+ | `/user:gsd-t-version-update` | Update GSD-T to latest version | Manual |
128
+ | `/user:gsd-t-version-update-all` | Update GSD-T + all registered projects | Manual |
129
+ | `/user:gsd-t-triage-and-merge` | Auto-review, merge, and publish GitHub branches | Manual |
130
+ | `/user:gsd-t-audit` | Harness self-audit — analyze cost/benefit of enforcement components | Manual |
131
+ | `/global-change` | Apply file changes (copy/insert/update/delete) across all GSD-T projects | Manual |
132
+
133
+ ### Backlog Management
134
+
135
+ | Command | Purpose | Auto |
136
+ |---------|---------|------|
137
+ | `/user:gsd-t-backlog-add` | Capture item, auto-categorize, append to backlog | Manual |
138
+ | `/user:gsd-t-backlog-list` | Filtered, ordered view of backlog items | Manual |
139
+ | `/user:gsd-t-backlog-move` | Reorder items by position (priority) | Manual |
140
+ | `/user:gsd-t-backlog-edit` | Modify backlog entry fields | Manual |
141
+ | `/user:gsd-t-backlog-remove` | Drop item with optional reason | Manual |
142
+ | `/user:gsd-t-backlog-promote` | Refine, classify, launch GSD-T workflow | Manual |
143
+ | `/user:gsd-t-backlog-settings` | Manage types, apps, categories, defaults | Manual |
144
+
145
+ ---
146
+
147
+ ## Workflow Phases
148
+
149
+ ```
150
+ ┌─────────────────────────────────────────────────────────────────────────────┐
151
+ GSD-T Wave Flow
152
+ ├─────────────────────────────────────────────────────────────────────────────┤
153
+
154
+ milestone → partition → discuss → plan → impact → execute → test-sync
155
+ │ │
156
+ │ │ └──────┐
157
+ │ │
158
+ │ │ ┌───────────────────┐
159
+ │ │ │ QA + Red Team │
160
+ │ │ │ (after each phase │ │
161
+ │ │ that writes code)
162
+ └───────────────────┘ │
163
+ │ ▼ │
164
+ │ verify+complete ◄──────────── integrate ◄──────────────────────┘ │
165
+ │ │
166
+ └─────────────────────────────────────────────────────────────────────────────┘
167
+ ```
168
+
169
+ | Phase | Purpose | Solo/Team |
170
+ |-------|---------|-----------|
171
+ | **Prompt** | Formulate idea (pre-workflow) | Solo |
172
+ | **Project/Feature/Scan** | Initialize work | Solo (team for large scans) |
173
+ | **Milestone** | Define deliverable | Solo |
174
+ | **Partition** | Decompose into domains + contracts | Solo |
175
+ | **Discuss** | Explore design decisions | Both |
176
+ | **Plan** | Create atomic task lists | Solo (always) |
177
+ | **Impact** | Downstream effect analysis | Solo |
178
+ | **Execute** | Build it (+ Red Team adversarial QA) | Both |
179
+ | **Test-Sync** | Maintain test coverage | Solo |
180
+ | **Integrate** | Wire domains together (+ Red Team adversarial QA) | Solo (always) |
181
+ | **Verify** | Quality gates | Both |
182
+ | **Complete** | Archive + tag | Solo |
183
+
184
+ ---
185
+
186
+ ## Project Structure
187
+
188
+ ```
189
+ your-project/
190
+ ├── CLAUDE.md # Project conventions + GSD-T reference
191
+ ├── docs/
192
+ ├── requirements.md # Functional + technical requirements
193
+ ├── architecture.md # System design, components, data flow
194
+ │ ├── workflows.md # User journeys, technical processes
195
+ └── infrastructure.md # Dev setup, DB, cloud, deployment
196
+ ├── .gsd-t/
197
+ │ ├── progress.md # Master state file
198
+ │ ├── roadmap.md # Milestone roadmap
199
+ │ ├── techdebt.md # Technical debt register
200
+ │ ├── verify-report.md # Latest verification results
201
+ │ ├── impact-report.md # Downstream effect analysis
202
+ │ ├── test-coverage.md # Test sync report
203
+ │ ├── contracts/
204
+ │ │ ├── api-contract.md # API endpoint specifications
205
+ ├── schema-contract.md # Database/data model specs
206
+ │ │ ├── component-contract.md # UI component interfaces
207
+ │ │ └── integration-points.md # Dependency graph + checkpoints
208
+ │ ├── domains/
209
+ │ │ └── {domain-name}/
210
+ ├── scope.md # What this domain owns
211
+ │ │ ├── tasks.md # Atomic task list
212
+ │ │ └── constraints.md # Rules and boundaries
213
+ │ ├── milestones/ # Archived completed milestones
214
+ │ │ └── {milestone-name}-{date}/
215
+ │ │ ├── summary.md
216
+ │ │ ├── progress.md
217
+ │ ├── verify-report.md
218
+ ├── contracts/
219
+ └── domains/
220
+ └── scan/ # Codebase analysis outputs
221
+ ├── architecture.md
222
+ │ ├── business-rules.md
223
+ │ ├── security.md
224
+ │ └── quality.md
225
+ └── src/
226
+ ```
227
+
228
+ ---
229
+
230
+ ## Stack Rules Engine
231
+
232
+ GSD-T auto-detects your project's tech stack and injects mandatory best-practice rules into subagent prompts at execute-time. This ensures stack conventions are enforced at the same weight as contract compliance — violations are task failures, not warnings.
233
+
234
+ ### How It Works
235
+
236
+ 1. At subagent spawn time, GSD-T reads project manifest files to detect the active stack(s).
237
+ 2. Universal rules (`templates/stacks/_security.md`, `_auth.md`) are **always** injected.
238
+ 3. Stack-specific rules are injected when the corresponding stack is detected.
239
+ 4. Project-level overrides in `.gsd-t/stacks/` replace global files of the same name.
240
+ 5. Rules are appended to the subagent prompt as a `## Stack Rules (MANDATORY)` section.
241
+
242
+ ### Stack Detection (27 files)
243
+
244
+ | Project File | Detected Stack(s) |
245
+ |---|---|
246
+ | *(always)* | `_security.md`, `_auth.md` |
247
+ | `package.json` with `"react"` | `react.md` |
248
+ | `package.json` with `"react-native"` | `react-native.md` |
249
+ | `package.json` with `"next"` | `nextjs.md` |
250
+ | `package.json` with `"vue"` | `vue.md` |
251
+ | `package.json` with `"typescript"` or `tsconfig.json` | `typescript.md` |
252
+ | `package.json` with `"tailwindcss"` | `tailwind.md` |
253
+ | `package.json` with `"express"`, `"fastify"`, `"hono"`, or `"koa"` | `node-api.md`, `rest-api.md` |
254
+ | `package.json` with `"vite"` | `vite.md` |
255
+ | `package.json` with `"@supabase/supabase-js"` | `supabase.md` |
256
+ | `package.json` with `"firebase"` | `firebase.md` |
257
+ | `package.json` with `"graphql"` or `"@apollo/server"` | `graphql.md` |
258
+ | `package.json` with `"zustand"` | `zustand.md` |
259
+ | `package.json` with `"@reduxjs/toolkit"` | `redux.md` |
260
+ | `package.json` with `"prisma"` or `"@prisma/client"` | `prisma.md` |
261
+ | `package.json` with `"pg"`, `"knex"`, or `"drizzle-orm"` | `postgresql.md` |
262
+ | `package.json` with `"neo4j-driver"` | `neo4j.md` |
263
+ | `package.json` with `"bullmq"`, `"bull"`, `"amqplib"`, or `"@aws-sdk/client-sqs"` | `queues.md` |
264
+ | `package.json` with `"openai"`, `"anthropic"`, `"langchain"` | `llm.md` |
265
+ | `Dockerfile` or `compose.yaml` | `docker.md` |
266
+ | `.github/workflows/*.yml` | `github-actions.md` |
267
+ | `playwright.config.*` | `playwright.md` |
268
+ | `requirements.txt` or `pyproject.toml` | `python.md` |
269
+ | `requirements.txt` with `fastapi` | `fastapi.md` |
270
+ | `requirements.txt` with `celery`, `dramatiq`, `rq`, or `arq` | `queues.md` |
271
+ | `requirements.txt` with `openai`, `anthropic`, `langchain` | `llm.md` |
272
+ | `pubspec.yaml` | `flutter.md` |
273
+
274
+ ### Commands That Inject Stack Rules
275
+
276
+ `gsd-t-execute`, `gsd-t-quick`, `gsd-t-integrate`, `gsd-t-wave`, `gsd-t-debug`
277
+
278
+ ### Extending
279
+
280
+ Drop a `.md` file into `templates/stacks/` to add a new stack. Files prefixed with `_` are universal (always injected). Files without a prefix are stack-specific (injected only when detected). If the `stacks/` directory is missing, detection skips silently — no error.
281
+
282
+ ---
283
+
284
+ ## Headless Mode
285
+
286
+ Run GSD-T non-interactively in CI/CD pipelines or automated workflows.
287
+
288
+ ### headless exec
289
+
290
+ ```bash
291
+ gsd-t headless verify --json --timeout=1200 # Run verify non-interactively
292
+ gsd-t headless execute --json # Execute tasks without interactive prompts
293
+ ```
294
+
295
+ ### headless query
296
+
297
+ ```bash
298
+ gsd-t headless query status # Project state — no LLM, <100ms
299
+ gsd-t headless query domains # Domain list with status
300
+ ```
301
+
302
+ ### headless debug-loop
303
+
304
+ Compaction-proof automated test-fix-retest cycles. Each iteration runs as a separate `claude -p` session with fresh context. A cumulative debug ledger (`.gsd-t/debug-state.jsonl`) preserves all hypothesis/fix/learning history across sessions. An anti-repetition preamble is injected into each session to prevent retrying failed approaches.
305
+
306
+ ```bash
307
+ gsd-t headless --debug-loop [--max-iterations=N] [--test-cmd=CMD] [--fix-scope=PATTERN] [--json] [--log]
308
+ ```
309
+
310
+ **Flags:**
311
+
312
+ | Flag | Default | Description |
313
+ |--------------------|---------|-------------|
314
+ | `--max-iterations` | 20 | Hard ceiling on iterations |
315
+ | `--test-cmd` | (auto) | Override test command (auto-detected from project) |
316
+ | `--fix-scope` | (all) | Limit fix scope to specific files or patterns |
317
+ | `--json` | false | Structured JSON output after each iteration |
318
+ | `--log` | false | Write per-iteration logs to `.gsd-t/` |
319
+
320
+ **Escalation tiers:**
321
+
322
+ | Iterations | Model | Behavior |
323
+ |------------|--------|----------|
324
+ | 1–5 | sonnet | Standard debug — one fix per session |
325
+ | 6–15 | opus | Deeper reasoning reads full ledger, may attempt multi-file fixes |
326
+ | 16–20 | STOP | Write full diagnostic summary, present to user, exit code 4 |
327
+
328
+ **Exit codes:** `0` all tests pass · `1` max iterations reached · `2` compaction error · `3` process error · `4` needs human decision
329
+
330
+ **Auto-escalation from commands:** `gsd-t-execute`, `gsd-t-test-sync`, `gsd-t-verify`, `gsd-t-debug`, and `gsd-t-wave` delegate to `--debug-loop` automatically after 2 failed in-context fix attempts.
331
+
332
+ ---
333
+
334
+ ## Key Principles
335
+
336
+ 1. **Contracts are the source of truth.** Code implements contracts, not the other way around. If code and contract disagree, fix one or the other — never leave them inconsistent.
337
+
338
+ 2. **Domains own files exclusively.** No two domains should modify the same file. If they need shared state, that's a contract.
339
+
340
+ 3. **Impact before execution.** Always analyze downstream effects before making changes. Surprises are expensive.
341
+
342
+ 4. **Tests stay synced.** Every code change triggers test analysis. Gaps are caught immediately, not in production.
343
+
344
+ 5. **State survives sessions.** Everything is in `.gsd-t/`. A fresh Claude Code session can resume from any point by reading the state files.
345
+
346
+ 6. **Plan is single-brain, execute is multi-brain.** Planning, impact analysis, and integration require full context (always solo). Execution and verification can parallelize.
347
+
348
+ 7. **Every decision is logged.** The Decision Log in progress.md captures why, not just what. Future sessions don't need to re-derive decisions.
349
+
350
+ ---
351
+
352
+ ## Enabling Agent Teams
353
+
354
+ Agent Teams is an experimental feature. Enable it:
355
+
356
+ ```bash
357
+ # Environment variable
358
+ export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
359
+
360
+ # Or in settings.json
361
+ { "experimental": { "agentTeams": true } }
362
+ ```
363
+
364
+ Teams are optional — all commands work in solo mode without teams enabled.
365
+
366
+ ### When to Use Teams
367
+
368
+ - 3+ domains with independent starting work
369
+ - Codebase scanning and feature impact analysis
370
+ - Complex design questions with multiple viable approaches
371
+ - Verification of large milestones
372
+ - Debugging cross-domain issues
373
+
374
+ ---
375
+
376
+ ## Installation
377
+
378
+ Copy all `.md` files from this package to `~/.claude/commands/`:
379
+
380
+ ```bash
381
+ # Windows
382
+ copy *.md %USERPROFILE%\.claude\commands\
383
+
384
+ # Mac/Linux
385
+ cp *.md ~/.claude/commands/
386
+ ```
387
+
388
+ Verify with: `/user:gsd-t-help`
389
+
390
+ ---
391
+
392
+ ## Configuration
393
+
394
+ GSD-T respects your project's `CLAUDE.md` for conventions and autonomy level.
395
+
396
+ ### Autonomy Levels
397
+
398
+ | Level | Phase Behavior |
399
+ |-------|---------------|
400
+ | **Level 1: Supervised** | Pauses at each phase for confirmation |
401
+ | **Level 2: Standard** | Pauses at milestones |
402
+ | **Level 3: Full Auto** (default) | Auto-advances through all phases. Only stops for: Destructive Action Guard, impact BLOCK verdicts, unrecoverable errors (after 2 fix attempts), and the Discuss phase |
403
+
404
+ Set in your project's `CLAUDE.md` under `## Autonomy Level`.
405
+
406
+ Recommended `.gsd-t/config.json`:
407
+
408
+ ```json
409
+ {
410
+ "mode": "yolo",
411
+ "model_profile": "quality",
412
+ "workflow": {
413
+ "research": true,
414
+ "impact_check": true,
415
+ "test_sync": true,
416
+ "verifier": true
417
+ }
418
+ }
419
+ ```
420
+
421
+ ---
422
+
423
+ ## License
424
+
425
+ MIT