@tekyzinc/gsd-t 2.51.10 → 2.53.11

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 (100) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +379 -373
  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 -482
  34. package/commands/gsd-t-discuss.md +174 -174
  35. package/commands/gsd-t-execute.md +758 -715
  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-scan-setup.md +1 -5
  41. package/commands/gsd-t-init.md +314 -280
  42. package/commands/gsd-t-integrate.md +365 -333
  43. package/commands/gsd-t-milestone.md +87 -87
  44. package/commands/gsd-t-partition.md +442 -361
  45. package/commands/gsd-t-pause.md +82 -82
  46. package/commands/gsd-t-plan.md +345 -344
  47. package/commands/gsd-t-populate.md +111 -111
  48. package/commands/gsd-t-prd.md +326 -326
  49. package/commands/gsd-t-project.md +211 -211
  50. package/commands/gsd-t-promote-debt.md +123 -123
  51. package/commands/gsd-t-prompt.md +137 -137
  52. package/commands/gsd-t-qa.md +266 -266
  53. package/commands/gsd-t-quick.md +357 -315
  54. package/commands/gsd-t-reflect.md +134 -134
  55. package/commands/gsd-t-resume.md +72 -72
  56. package/commands/gsd-t-scan.md +615 -615
  57. package/commands/gsd-t-setup.md +76 -0
  58. package/commands/gsd-t-status.md +192 -166
  59. package/commands/gsd-t-test-sync.md +381 -381
  60. package/commands/gsd-t-triage-and-merge.md +171 -171
  61. package/commands/gsd-t-verify.md +382 -382
  62. package/commands/gsd-t-visualize.md +118 -118
  63. package/commands/gsd-t-wave.md +401 -378
  64. package/docs/GSD-T-README.md +425 -424
  65. package/docs/architecture.md +385 -369
  66. package/docs/harness-design-analysis.md +371 -0
  67. package/docs/infrastructure.md +205 -205
  68. package/docs/prd-graph-engine.md +398 -398
  69. package/docs/prd-gsd2-hybrid.md +559 -559
  70. package/docs/prd-harness-evolution.md +583 -0
  71. package/docs/requirements.md +14 -0
  72. package/docs/workflows.md +226 -226
  73. package/examples/.gsd-t/domains/example-domain/scope.md +13 -13
  74. package/package.json +40 -40
  75. package/scripts/gsd-t-auto-route.js +39 -39
  76. package/scripts/gsd-t-dashboard-mockup.html +1143 -1143
  77. package/scripts/gsd-t-dashboard-server.js +171 -171
  78. package/scripts/gsd-t-dashboard.html +262 -262
  79. package/scripts/gsd-t-event-writer.js +128 -128
  80. package/scripts/gsd-t-statusline.js +94 -94
  81. package/scripts/gsd-t-tools.js +175 -175
  82. package/templates/CLAUDE-global.md +638 -634
  83. package/templates/CLAUDE-project.md +24 -0
  84. package/templates/backlog-settings.md +18 -18
  85. package/templates/backlog.md +1 -1
  86. package/templates/progress.md +40 -40
  87. package/templates/shared-services-contract.md +60 -60
  88. package/templates/stacks/desktop.ini +2 -2
  89. package/bin/desktop.ini +0 -2
  90. package/commands/desktop.ini +0 -2
  91. package/docs/ci-examples/desktop.ini +0 -2
  92. package/docs/desktop.ini +0 -2
  93. package/examples/.gsd-t/contracts/desktop.ini +0 -2
  94. package/examples/.gsd-t/desktop.ini +0 -2
  95. package/examples/.gsd-t/domains/desktop.ini +0 -2
  96. package/examples/.gsd-t/domains/example-domain/desktop.ini +0 -2
  97. package/examples/desktop.ini +0 -2
  98. package/examples/rules/desktop.ini +0 -2
  99. package/scripts/desktop.ini +0 -2
  100. package/templates/desktop.ini +0 -2
@@ -1,424 +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
- | *Red Team* | Adversarial QA — spawns 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
- | `/global-change` | Apply file changes (copy/insert/update/delete) across all GSD-T projects | Manual |
131
-
132
- ### Backlog Management
133
-
134
- | Command | Purpose | Auto |
135
- |---------|---------|------|
136
- | `/user:gsd-t-backlog-add` | Capture item, auto-categorize, append to backlog | Manual |
137
- | `/user:gsd-t-backlog-list` | Filtered, ordered view of backlog items | Manual |
138
- | `/user:gsd-t-backlog-move` | Reorder items by position (priority) | Manual |
139
- | `/user:gsd-t-backlog-edit` | Modify backlog entry fields | Manual |
140
- | `/user:gsd-t-backlog-remove` | Drop item with optional reason | Manual |
141
- | `/user:gsd-t-backlog-promote` | Refine, classify, launch GSD-T workflow | Manual |
142
- | `/user:gsd-t-backlog-settings` | Manage types, apps, categories, defaults | Manual |
143
-
144
- ---
145
-
146
- ## Workflow Phases
147
-
148
- ```
149
- ┌─────────────────────────────────────────────────────────────────────────────┐
150
- │ GSD-T Wave Flow │
151
- ├─────────────────────────────────────────────────────────────────────────────┤
152
- │ │
153
- milestone → partition → discuss → plan → impact → execute → test-sync
154
- │ │
155
- │ │ └──────┐
156
- │ │
157
- │ │ ┌───────────────────┐
158
- │ │ │ QA + Red Team │
159
- │ │ │ (after each phase │ │
160
- │ │ │ that writes code)│ │
161
- │ │ └───────────────────┘
162
-
163
- verify+complete ◄──────────── integrate ◄──────────────────────┘
164
-
165
- └─────────────────────────────────────────────────────────────────────────────┘
166
- ```
167
-
168
- | Phase | Purpose | Solo/Team |
169
- |-------|---------|-----------|
170
- | **Prompt** | Formulate idea (pre-workflow) | Solo |
171
- | **Project/Feature/Scan** | Initialize work | Solo (team for large scans) |
172
- | **Milestone** | Define deliverable | Solo |
173
- | **Partition** | Decompose into domains + contracts | Solo |
174
- | **Discuss** | Explore design decisions | Both |
175
- | **Plan** | Create atomic task lists | Solo (always) |
176
- | **Impact** | Downstream effect analysis | Solo |
177
- | **Execute** | Build it (+ Red Team adversarial QA) | Both |
178
- | **Test-Sync** | Maintain test coverage | Solo |
179
- | **Integrate** | Wire domains together (+ Red Team adversarial QA) | Solo (always) |
180
- | **Verify** | Quality gates | Both |
181
- | **Complete** | Archive + tag | Solo |
182
-
183
- ---
184
-
185
- ## Project Structure
186
-
187
- ```
188
- your-project/
189
- ├── CLAUDE.md # Project conventions + GSD-T reference
190
- ├── docs/
191
- ├── requirements.md # Functional + technical requirements
192
- │ ├── architecture.md # System design, components, data flow
193
- │ ├── workflows.md # User journeys, technical processes
194
- └── infrastructure.md # Dev setup, DB, cloud, deployment
195
- ├── .gsd-t/
196
- ├── progress.md # Master state file
197
- │ ├── roadmap.md # Milestone roadmap
198
- │ ├── techdebt.md # Technical debt register
199
- │ ├── verify-report.md # Latest verification results
200
- │ ├── impact-report.md # Downstream effect analysis
201
- │ ├── test-coverage.md # Test sync report
202
- │ ├── contracts/
203
- ├── api-contract.md # API endpoint specifications
204
- │ │ ├── schema-contract.md # Database/data model specs
205
- │ │ ├── component-contract.md # UI component interfaces
206
- │ │ └── integration-points.md # Dependency graph + checkpoints
207
- ├── domains/
208
- │ └── {domain-name}/
209
- │ │ ├── scope.md # What this domain owns
210
- │ │ ├── tasks.md # Atomic task list
211
- │ │ └── constraints.md # Rules and boundaries
212
- ├── milestones/ # Archived completed milestones
213
- │ └── {milestone-name}-{date}/
214
- │ │ ├── summary.md
215
- │ │ ├── progress.md
216
- │ │ ├── verify-report.md
217
- │ │ ├── contracts/
218
- │ │ └── domains/
219
- │ └── scan/ # Codebase analysis outputs
220
- ├── architecture.md
221
- │ ├── business-rules.md
222
- │ ├── security.md
223
- └── quality.md
224
- └── src/
225
- ```
226
-
227
- ---
228
-
229
- ## Stack Rules Engine
230
-
231
- 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.
232
-
233
- ### How It Works
234
-
235
- 1. At subagent spawn time, GSD-T reads project manifest files to detect the active stack(s).
236
- 2. Universal rules (`templates/stacks/_security.md`, `_auth.md`) are **always** injected.
237
- 3. Stack-specific rules are injected when the corresponding stack is detected.
238
- 4. Project-level overrides in `.gsd-t/stacks/` replace global files of the same name.
239
- 5. Rules are appended to the subagent prompt as a `## Stack Rules (MANDATORY)` section.
240
-
241
- ### Stack Detection (27 files)
242
-
243
- | Project File | Detected Stack(s) |
244
- |---|---|
245
- | *(always)* | `_security.md`, `_auth.md` |
246
- | `package.json` with `"react"` | `react.md` |
247
- | `package.json` with `"react-native"` | `react-native.md` |
248
- | `package.json` with `"next"` | `nextjs.md` |
249
- | `package.json` with `"vue"` | `vue.md` |
250
- | `package.json` with `"typescript"` or `tsconfig.json` | `typescript.md` |
251
- | `package.json` with `"tailwindcss"` | `tailwind.md` |
252
- | `package.json` with `"express"`, `"fastify"`, `"hono"`, or `"koa"` | `node-api.md`, `rest-api.md` |
253
- | `package.json` with `"vite"` | `vite.md` |
254
- | `package.json` with `"@supabase/supabase-js"` | `supabase.md` |
255
- | `package.json` with `"firebase"` | `firebase.md` |
256
- | `package.json` with `"graphql"` or `"@apollo/server"` | `graphql.md` |
257
- | `package.json` with `"zustand"` | `zustand.md` |
258
- | `package.json` with `"@reduxjs/toolkit"` | `redux.md` |
259
- | `package.json` with `"prisma"` or `"@prisma/client"` | `prisma.md` |
260
- | `package.json` with `"pg"`, `"knex"`, or `"drizzle-orm"` | `postgresql.md` |
261
- | `package.json` with `"neo4j-driver"` | `neo4j.md` |
262
- | `package.json` with `"bullmq"`, `"bull"`, `"amqplib"`, or `"@aws-sdk/client-sqs"` | `queues.md` |
263
- | `package.json` with `"openai"`, `"anthropic"`, `"langchain"` | `llm.md` |
264
- | `Dockerfile` or `compose.yaml` | `docker.md` |
265
- | `.github/workflows/*.yml` | `github-actions.md` |
266
- | `playwright.config.*` | `playwright.md` |
267
- | `requirements.txt` or `pyproject.toml` | `python.md` |
268
- | `requirements.txt` with `fastapi` | `fastapi.md` |
269
- | `requirements.txt` with `celery`, `dramatiq`, `rq`, or `arq` | `queues.md` |
270
- | `requirements.txt` with `openai`, `anthropic`, `langchain` | `llm.md` |
271
- | `pubspec.yaml` | `flutter.md` |
272
-
273
- ### Commands That Inject Stack Rules
274
-
275
- `gsd-t-execute`, `gsd-t-quick`, `gsd-t-integrate`, `gsd-t-wave`, `gsd-t-debug`
276
-
277
- ### Extending
278
-
279
- 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.
280
-
281
- ---
282
-
283
- ## Headless Mode
284
-
285
- Run GSD-T non-interactively in CI/CD pipelines or automated workflows.
286
-
287
- ### headless exec
288
-
289
- ```bash
290
- gsd-t headless verify --json --timeout=1200 # Run verify non-interactively
291
- gsd-t headless execute --json # Execute tasks without interactive prompts
292
- ```
293
-
294
- ### headless query
295
-
296
- ```bash
297
- gsd-t headless query status # Project state — no LLM, <100ms
298
- gsd-t headless query domains # Domain list with status
299
- ```
300
-
301
- ### headless debug-loop
302
-
303
- 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.
304
-
305
- ```bash
306
- gsd-t headless --debug-loop [--max-iterations=N] [--test-cmd=CMD] [--fix-scope=PATTERN] [--json] [--log]
307
- ```
308
-
309
- **Flags:**
310
-
311
- | Flag | Default | Description |
312
- |--------------------|---------|-------------|
313
- | `--max-iterations` | 20 | Hard ceiling on iterations |
314
- | `--test-cmd` | (auto) | Override test command (auto-detected from project) |
315
- | `--fix-scope` | (all) | Limit fix scope to specific files or patterns |
316
- | `--json` | false | Structured JSON output after each iteration |
317
- | `--log` | false | Write per-iteration logs to `.gsd-t/` |
318
-
319
- **Escalation tiers:**
320
-
321
- | Iterations | Model | Behavior |
322
- |------------|--------|----------|
323
- | 1–5 | sonnet | Standard debug — one fix per session |
324
- | 615 | opus | Deeper reasoningreads full ledger, may attempt multi-file fixes |
325
- | 1620 | STOP | Write full diagnostic summary, present to user, exit code 4 |
326
-
327
- **Exit codes:** `0` all tests pass · `1` max iterations reached · `2` compaction error · `3` process error · `4` needs human decision
328
-
329
- **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.
330
-
331
- ---
332
-
333
- ## Key Principles
334
-
335
- 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.
336
-
337
- 2. **Domains own files exclusively.** No two domains should modify the same file. If they need shared state, that's a contract.
338
-
339
- 3. **Impact before execution.** Always analyze downstream effects before making changes. Surprises are expensive.
340
-
341
- 4. **Tests stay synced.** Every code change triggers test analysis. Gaps are caught immediately, not in production.
342
-
343
- 5. **State survives sessions.** Everything is in `.gsd-t/`. A fresh Claude Code session can resume from any point by reading the state files.
344
-
345
- 6. **Plan is single-brain, execute is multi-brain.** Planning, impact analysis, and integration require full context (always solo). Execution and verification can parallelize.
346
-
347
- 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.
348
-
349
- ---
350
-
351
- ## Enabling Agent Teams
352
-
353
- Agent Teams is an experimental feature. Enable it:
354
-
355
- ```bash
356
- # Environment variable
357
- export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
358
-
359
- # Or in settings.json
360
- { "experimental": { "agentTeams": true } }
361
- ```
362
-
363
- Teams are optional — all commands work in solo mode without teams enabled.
364
-
365
- ### When to Use Teams
366
-
367
- - 3+ domains with independent starting work
368
- - Codebase scanning and feature impact analysis
369
- - Complex design questions with multiple viable approaches
370
- - Verification of large milestones
371
- - Debugging cross-domain issues
372
-
373
- ---
374
-
375
- ## Installation
376
-
377
- Copy all `.md` files from this package to `~/.claude/commands/`:
378
-
379
- ```bash
380
- # Windows
381
- copy *.md %USERPROFILE%\.claude\commands\
382
-
383
- # Mac/Linux
384
- cp *.md ~/.claude/commands/
385
- ```
386
-
387
- Verify with: `/user:gsd-t-help`
388
-
389
- ---
390
-
391
- ## Configuration
392
-
393
- GSD-T respects your project's `CLAUDE.md` for conventions and autonomy level.
394
-
395
- ### Autonomy Levels
396
-
397
- | Level | Phase Behavior |
398
- |-------|---------------|
399
- | **Level 1: Supervised** | Pauses at each phase for confirmation |
400
- | **Level 2: Standard** | Pauses at milestones |
401
- | **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 |
402
-
403
- Set in your project's `CLAUDE.md` under `## Autonomy Level`.
404
-
405
- Recommended `.gsd-t/config.json`:
406
-
407
- ```json
408
- {
409
- "mode": "yolo",
410
- "model_profile": "quality",
411
- "workflow": {
412
- "research": true,
413
- "impact_check": true,
414
- "test_sync": true,
415
- "verifier": true
416
- }
417
- }
418
- ```
419
-
420
- ---
421
-
422
- ## License
423
-
424
- 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 QA — spawns 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
+ | 15 | sonnet | Standard debugone fix per session |
325
+ | 615 | 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