@tekyzinc/gsd-t 2.46.11 → 2.50.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.
- package/CHANGELOG.md +11 -0
- package/README.md +22 -2
- package/bin/debug-ledger.js +193 -0
- package/bin/gsd-t.js +259 -1
- package/commands/gsd-t-debug.md +26 -1
- package/commands/gsd-t-execute.md +31 -3
- package/commands/gsd-t-help.md +18 -2
- package/commands/gsd-t-integrate.md +16 -0
- package/commands/gsd-t-quick.md +18 -1
- package/commands/gsd-t-test-sync.md +5 -1
- package/commands/gsd-t-verify.md +6 -1
- package/commands/gsd-t-wave.md +26 -0
- package/docs/GSD-T-README.md +83 -1
- package/docs/architecture.md +9 -1
- package/docs/requirements.md +30 -0
- package/package.json +1 -1
- package/templates/CLAUDE-global.md +19 -2
- package/templates/stacks/_security.md +243 -0
- package/templates/stacks/desktop.ini +2 -0
- package/templates/stacks/docker.md +202 -0
- package/templates/stacks/firebase.md +166 -0
- package/templates/stacks/flutter.md +205 -0
- package/templates/stacks/github-actions.md +201 -0
- package/templates/stacks/graphql.md +216 -0
- package/templates/stacks/neo4j.md +218 -0
- package/templates/stacks/nextjs.md +184 -0
- package/templates/stacks/node-api.md +196 -0
- package/templates/stacks/playwright.md +528 -0
- package/templates/stacks/postgresql.md +225 -0
- package/templates/stacks/python.md +243 -0
- package/templates/stacks/react-native.md +216 -0
- package/templates/stacks/react.md +293 -0
- package/templates/stacks/redux.md +193 -0
- package/templates/stacks/rest-api.md +202 -0
- package/templates/stacks/supabase.md +188 -0
- package/templates/stacks/tailwind.md +169 -0
- package/templates/stacks/typescript.md +176 -0
- package/templates/stacks/vite.md +176 -0
- package/templates/stacks/vue.md +189 -0
- package/templates/stacks/zustand.md +203 -0
|
@@ -119,6 +119,22 @@ Run via Bash:
|
|
|
119
119
|
If rules fire: inject up to 10 lines of rule warnings into each task subagent prompt (concise format: `RULE: {name} — {description}`). These inform the subagent of known patterns — non-blocking.
|
|
120
120
|
If no rules fire: log "No active rules for {domain-name}" and continue.
|
|
121
121
|
|
|
122
|
+
**Stack Rules Detection (before spawning subagent):**
|
|
123
|
+
Run via Bash to detect project stack and collect matching rules:
|
|
124
|
+
`GSD_T_DIR=$(npm root -g 2>/dev/null)/@tekyzinc/gsd-t; STACKS_DIR="$GSD_T_DIR/templates/stacks"; STACK_RULES=""; if [ -d "$STACKS_DIR" ]; then for f in "$STACKS_DIR"/_*.md; do [ -f "$f" ] && STACK_RULES="${STACK_RULES}$(cat "$f")"$'\n\n'; done; if [ -f "package.json" ]; then grep -q '"react-native"' package.json 2>/dev/null && [ -f "$STACKS_DIR/react-native.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/react-native.md")"$'\n\n'; grep -q '"react"' package.json 2>/dev/null && ! grep -q '"react-native"' package.json 2>/dev/null && [ -f "$STACKS_DIR/react.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/react.md")"$'\n\n'; grep -q '"next"' package.json 2>/dev/null && [ -f "$STACKS_DIR/nextjs.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/nextjs.md")"$'\n\n'; grep -q '"vue"' package.json 2>/dev/null && [ -f "$STACKS_DIR/vue.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/vue.md")"$'\n\n'; (grep -q '"typescript"' package.json 2>/dev/null || [ -f "tsconfig.json" ]) && [ -f "$STACKS_DIR/typescript.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/typescript.md")"$'\n\n'; grep -qE '"(express|fastify|hono|koa)"' package.json 2>/dev/null && [ -f "$STACKS_DIR/node-api.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/node-api.md")"$'\n\n'; grep -qE '"(express|fastify|hono|koa)"' package.json 2>/dev/null && [ -f "$STACKS_DIR/rest-api.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/rest-api.md")"$'\n\n'; grep -q '"tailwindcss"' package.json 2>/dev/null && [ -f "$STACKS_DIR/tailwind.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/tailwind.md")"$'\n\n'; grep -q '"vite"' package.json 2>/dev/null && [ -f "$STACKS_DIR/vite.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/vite.md")"$'\n\n'; grep -q '"@supabase/supabase-js"' package.json 2>/dev/null && [ -f "$STACKS_DIR/supabase.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/supabase.md")"$'\n\n'; grep -q '"firebase"' package.json 2>/dev/null && [ -f "$STACKS_DIR/firebase.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/firebase.md")"$'\n\n'; grep -qE '"(graphql|@apollo/client|urql)"' package.json 2>/dev/null && [ -f "$STACKS_DIR/graphql.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/graphql.md")"$'\n\n'; grep -q '"zustand"' package.json 2>/dev/null && [ -f "$STACKS_DIR/zustand.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/zustand.md")"$'\n\n'; grep -q '"@reduxjs/toolkit"' package.json 2>/dev/null && [ -f "$STACKS_DIR/redux.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/redux.md")"$'\n\n'; grep -q '"neo4j-driver"' package.json 2>/dev/null && [ -f "$STACKS_DIR/neo4j.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/neo4j.md")"$'\n\n'; grep -qE '"(pg|prisma|drizzle-orm|knex)"' package.json 2>/dev/null && [ -f "$STACKS_DIR/postgresql.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/postgresql.md")"$'\n\n'; fi; ([ -f "requirements.txt" ] || [ -f "pyproject.toml" ] || [ -f "Pipfile" ]) && [ -f "$STACKS_DIR/python.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/python.md")"$'\n\n'; ([ -f "requirements.txt" ] && grep -q "psycopg" requirements.txt 2>/dev/null || [ -f "pyproject.toml" ] && grep -q "psycopg" pyproject.toml 2>/dev/null) && [ -f "$STACKS_DIR/postgresql.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/postgresql.md")"$'\n\n'; ([ -f "requirements.txt" ] && grep -q "neo4j" requirements.txt 2>/dev/null) && [ -f "$STACKS_DIR/neo4j.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/neo4j.md")"$'\n\n'; [ -f "pubspec.yaml" ] && [ -f "$STACKS_DIR/flutter.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/flutter.md")"$'\n\n'; [ -f "Dockerfile" ] && [ -f "$STACKS_DIR/docker.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/docker.md")"$'\n\n'; [ -d ".github/workflows" ] && [ -f "$STACKS_DIR/github-actions.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/github-actions.md")"$'\n\n'; ([ -f "playwright.config.ts" ] || [ -f "playwright.config.js" ]) && [ -f "$STACKS_DIR/playwright.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/playwright.md")"$'\n\n'; [ -f "go.mod" ] && [ -f "$STACKS_DIR/go.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/go.md")"$'\n\n'; [ -f "Cargo.toml" ] && [ -f "$STACKS_DIR/rust.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/rust.md")"$'\n\n'; fi`
|
|
125
|
+
|
|
126
|
+
If STACK_RULES is non-empty, append to the subagent prompt:
|
|
127
|
+
```
|
|
128
|
+
## Stack Rules (MANDATORY — violations fail this task)
|
|
129
|
+
|
|
130
|
+
{STACK_RULES}
|
|
131
|
+
|
|
132
|
+
These standards have the same enforcement weight as contract compliance.
|
|
133
|
+
Violations are task failures, not warnings.
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
If STACK_RULES is empty (no templates/stacks/ dir or no matches), skip silently.
|
|
137
|
+
|
|
122
138
|
**Domain task-dispatcher (lightweight — sequences tasks, passes summaries):**
|
|
123
139
|
|
|
124
140
|
For each task in `.gsd-t/domains/{domain-name}/tasks.md` (in order, skip completed):
|
|
@@ -150,6 +166,9 @@ Task subagent (general-purpose, model: sonnet, mode: bypassPermissions):
|
|
|
150
166
|
## Prior Task Summaries (most recent first, max 5)
|
|
151
167
|
{contents of task-{N}-summary.md files — 10-20 lines each}
|
|
152
168
|
|
|
169
|
+
## Stack Rules
|
|
170
|
+
{STACK_RULES if non-empty — omit entire section if empty}
|
|
171
|
+
|
|
153
172
|
## Instructions
|
|
154
173
|
|
|
155
174
|
Execute the task above:
|
|
@@ -212,7 +231,9 @@ Execute the task above:
|
|
|
212
231
|
behavior (state changes, data loaded, content updated after actions), flag it as
|
|
213
232
|
"SHALLOW TEST — needs functional assertions" in the gap report. A test suite where
|
|
214
233
|
every spec passes but no feature actually works is a QA FAILURE.
|
|
215
|
-
Report format: "Unit: X/Y pass | E2E: X/Y pass (or N/A if no config) | Contract: compliant/violations | Shallow tests: N (list)"
|
|
234
|
+
Report format: "Unit: X/Y pass | E2E: X/Y pass (or N/A if no config) | Contract: compliant/violations | Shallow tests: N (list) | Stack rules: compliant/N violations"
|
|
235
|
+
f. Validate compliance with Stack Rules (if injected in the work subagent's prompt).
|
|
236
|
+
Stack rule violations have the same severity as contract violations — report as failures, not warnings.'
|
|
216
237
|
If QA fails OR shallow tests are found, fix before proceeding. Append issues to .gsd-t/qa-issues.md.
|
|
217
238
|
12. Write task summary to .gsd-t/domains/{domain-name}/task-{task-id}-summary.md:
|
|
218
239
|
## Task {task-id} Summary — {domain-name}
|
|
@@ -223,8 +244,15 @@ Execute the task above:
|
|
|
223
244
|
- **Notes**: {10-20 lines max — key decisions, patterns, warnings}
|
|
224
245
|
|
|
225
246
|
Deviation rules:
|
|
226
|
-
- Bug blocking progress → fix, max 3 attempts;
|
|
227
|
-
.gsd-t/
|
|
247
|
+
- Bug blocking progress → fix, max 3 attempts; after fix attempt 2 fails:
|
|
248
|
+
1. Write current failure context to .gsd-t/debug-state.jsonl via appendEntry
|
|
249
|
+
2. Log: "Delegating to headless debug-loop (2 in-context attempts exhausted)"
|
|
250
|
+
3. Run: `gsd-t headless --debug-loop --max-iterations 15`
|
|
251
|
+
4. Check exit code:
|
|
252
|
+
- 0: Tests pass, continue with task
|
|
253
|
+
- 1/4: Log to .gsd-t/deferred-items.md and stop (report FAIL in summary)
|
|
254
|
+
- 3: Report error, stop
|
|
255
|
+
If still blocked after debug-loop, log to .gsd-t/deferred-items.md and stop (report FAIL in summary)
|
|
228
256
|
- Missing dependency → add minimum needed, document in commit message
|
|
229
257
|
- Non-trivial blocker → log to .gsd-t/deferred-items.md
|
|
230
258
|
- Architectural change required → write NEEDS-APPROVAL to .gsd-t/deferred-items.md,
|
package/commands/gsd-t-help.md
CHANGED
|
@@ -65,6 +65,12 @@ UTILITIES Manual
|
|
|
65
65
|
triage-and-merge Auto-review, merge, and publish GitHub branches
|
|
66
66
|
global-change Apply file changes across all registered GSD-T projects
|
|
67
67
|
|
|
68
|
+
HEADLESS (CI/CD) CLI
|
|
69
|
+
───────────────────────────────────────────────────────────────────────────────
|
|
70
|
+
headless exec Run any GSD-T command non-interactively via claude -p
|
|
71
|
+
headless query Read project state without LLM (<100ms)
|
|
72
|
+
headless --debug-loop Compaction-proof test-fix-retest loop (fresh sessions)
|
|
73
|
+
|
|
68
74
|
BACKLOG Manual
|
|
69
75
|
───────────────────────────────────────────────────────────────────────────────
|
|
70
76
|
backlog-add Capture item, auto-categorize, append to backlog
|
|
@@ -252,6 +258,7 @@ Use these when user asks for help on a specific command:
|
|
|
252
258
|
- **Use when**: Ready to implement
|
|
253
259
|
- **Note (M22)**: Task-level fresh dispatch (one subagent per task, ~10-20% context each). Team mode uses worktree isolation (`isolation: "worktree"`) — zero file conflicts. Adaptive replanning between domain completions.
|
|
254
260
|
- **Note (M26)**: Active rule injection — evaluates declarative rules from rules.jsonl before dispatching each domain's tasks. Fires matching rules as warnings in subagent prompts.
|
|
261
|
+
- **Note (M29)**: Stack Rules Engine — auto-detects project tech stack from manifest files and injects mandatory best-practice rules into each task subagent prompt. Universal rules (`_security.md`) always apply; stack-specific rules layer on top. Violations are task failures (same weight as contract violations).
|
|
255
262
|
|
|
256
263
|
### test-sync
|
|
257
264
|
- **Summary**: Keep tests aligned with code changes
|
|
@@ -339,11 +346,20 @@ Use these when user asks for help on a specific command:
|
|
|
339
346
|
- **Use when**: Reviewing process health, first-pass rates, ELO trends, anomaly flags, or comparing signal distributions across projects
|
|
340
347
|
|
|
341
348
|
### debug
|
|
342
|
-
- **Summary**: Systematic debugging with persistent state
|
|
349
|
+
- **Summary**: Systematic debugging with persistent state; delegates to `gsd-t headless --debug-loop` after 2 failed in-context fix attempts
|
|
343
350
|
- **Auto-invoked**: No
|
|
344
|
-
- **Creates**: Debug session state
|
|
351
|
+
- **Creates**: Debug session state, `.gsd-t/debug-state.jsonl` (when delegating to headless loop)
|
|
345
352
|
- **Use when**: Tracking down a bug methodically
|
|
346
353
|
|
|
354
|
+
### headless --debug-loop
|
|
355
|
+
- **Summary**: Compaction-proof automated test-fix-retest loop — each iteration is a fresh `claude -p` session; a cumulative ledger (`.gsd-t/debug-state.jsonl`) preserves all hypothesis/fix/learning history; anti-repetition preamble prevents retrying failed approaches
|
|
356
|
+
- **Auto-invoked**: Yes — by `execute`, `test-sync`, `verify`, `debug`, and `wave` after 2 failed in-context fix attempts
|
|
357
|
+
- **Flags**: `--max-iterations=N` (default 20), `--test-cmd=CMD`, `--fix-scope=PATTERN`, `--json`, `--log`
|
|
358
|
+
- **Escalation**: sonnet (iterations 1–5) → opus (6–15) → STOP with diagnostic summary (16–20)
|
|
359
|
+
- **Exit codes**: `0` pass · `1` max iterations · `2` compaction error · `3` process error · `4` needs human
|
|
360
|
+
- **Creates**: `.gsd-t/debug-state.jsonl`, optional `.gsd-t/headless-{ts}.log`
|
|
361
|
+
- **Use when**: Running automated fix loops in CI, or delegated from in-context commands that exhausted fix attempts
|
|
362
|
+
|
|
347
363
|
### promote-debt
|
|
348
364
|
- **Summary**: Convert techdebt.md items into milestones
|
|
349
365
|
- **Auto-invoked**: No
|
|
@@ -62,6 +62,22 @@ If rolled-back domains exist, report them to the user (or if Level 3: log to `.g
|
|
|
62
62
|
|
|
63
63
|
## Step 3: Wire Integration Points
|
|
64
64
|
|
|
65
|
+
**Stack Rules Detection (before spawning subagent):**
|
|
66
|
+
Run via Bash to detect project stack and collect matching rules:
|
|
67
|
+
`GSD_T_DIR=$(npm root -g 2>/dev/null)/@tekyzinc/gsd-t; STACKS_DIR="$GSD_T_DIR/templates/stacks"; STACK_RULES=""; if [ -d "$STACKS_DIR" ]; then for f in "$STACKS_DIR"/_*.md; do [ -f "$f" ] && STACK_RULES="${STACK_RULES}$(cat "$f")"$'\n\n'; done; if [ -f "package.json" ]; then grep -q '"react"' package.json 2>/dev/null && [ -f "$STACKS_DIR/react.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/react.md")"$'\n\n'; (grep -q '"typescript"' package.json 2>/dev/null || [ -f "tsconfig.json" ]) && [ -f "$STACKS_DIR/typescript.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/typescript.md")"$'\n\n'; grep -qE '"(express|fastify|hono|koa)"' package.json 2>/dev/null && [ -f "$STACKS_DIR/node-api.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/node-api.md")"$'\n\n'; fi; [ -f "requirements.txt" ] || [ -f "pyproject.toml" ] && [ -f "$STACKS_DIR/python.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/python.md")"$'\n\n'; [ -f "go.mod" ] && [ -f "$STACKS_DIR/go.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/go.md")"$'\n\n'; [ -f "Cargo.toml" ] && [ -f "$STACKS_DIR/rust.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/rust.md")"$'\n\n'; fi`
|
|
68
|
+
|
|
69
|
+
If STACK_RULES is non-empty, append to the subagent prompt:
|
|
70
|
+
```
|
|
71
|
+
## Stack Rules (MANDATORY — violations fail this task)
|
|
72
|
+
|
|
73
|
+
{STACK_RULES}
|
|
74
|
+
|
|
75
|
+
These standards have the same enforcement weight as contract compliance.
|
|
76
|
+
Violations are task failures, not warnings.
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
If STACK_RULES is empty (no templates/stacks/ dir or no matches), skip silently.
|
|
80
|
+
|
|
65
81
|
Work through each integration point in `integration-points.md`. If integration work spans multiple domains with independent tasks, use the **task-level dispatch pattern** (per fresh-dispatch-contract.md): spawn one Task subagent per integration task, passing only the relevant contracts, the specific integration point to wire, and summaries from prior integration tasks (max 5, 10-20 lines each). This prevents context accumulation across integration tasks.
|
|
66
82
|
|
|
67
83
|
**Multi-domain integration merging**: If integration work itself requires merging domain outputs that weren't merged during execute (e.g., domains executed in separate waves and integration needs to combine them), use the Sequential Merge Protocol from `.gsd-t/contracts/worktree-isolation-contract.md`:
|
package/commands/gsd-t-quick.md
CHANGED
|
@@ -12,12 +12,29 @@ To give this task a fresh context window and prevent compaction during consecuti
|
|
|
12
12
|
Before spawning — run via Bash:
|
|
13
13
|
`T_START=$(date +%s) && DT_START=$(date +"%Y-%m-%d %H:%M") && TOK_START=${CLAUDE_CONTEXT_TOKENS_USED:-0} && TOK_MAX=${CLAUDE_CONTEXT_TOKENS_MAX:-200000}`
|
|
14
14
|
|
|
15
|
+
**Stack Rules Detection (before spawning subagent):**
|
|
16
|
+
Run via Bash to detect project stack and collect matching rules:
|
|
17
|
+
`GSD_T_DIR=$(npm root -g 2>/dev/null)/@tekyzinc/gsd-t; STACKS_DIR="$GSD_T_DIR/templates/stacks"; STACK_RULES=""; if [ -d "$STACKS_DIR" ]; then for f in "$STACKS_DIR"/_*.md; do [ -f "$f" ] && STACK_RULES="${STACK_RULES}$(cat "$f")"$'\n\n'; done; if [ -f "package.json" ]; then grep -q '"react-native"' package.json 2>/dev/null && [ -f "$STACKS_DIR/react-native.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/react-native.md")"$'\n\n'; grep -q '"react"' package.json 2>/dev/null && ! grep -q '"react-native"' package.json 2>/dev/null && [ -f "$STACKS_DIR/react.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/react.md")"$'\n\n'; grep -q '"next"' package.json 2>/dev/null && [ -f "$STACKS_DIR/nextjs.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/nextjs.md")"$'\n\n'; grep -q '"vue"' package.json 2>/dev/null && [ -f "$STACKS_DIR/vue.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/vue.md")"$'\n\n'; (grep -q '"typescript"' package.json 2>/dev/null || [ -f "tsconfig.json" ]) && [ -f "$STACKS_DIR/typescript.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/typescript.md")"$'\n\n'; grep -qE '"(express|fastify|hono|koa)"' package.json 2>/dev/null && [ -f "$STACKS_DIR/node-api.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/node-api.md")"$'\n\n'; grep -q '"tailwindcss"' package.json 2>/dev/null && [ -f "$STACKS_DIR/tailwind.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/tailwind.md")"$'\n\n'; grep -q '"vite"' package.json 2>/dev/null && [ -f "$STACKS_DIR/vite.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/vite.md")"$'\n\n'; grep -q '"@supabase/supabase-js"' package.json 2>/dev/null && [ -f "$STACKS_DIR/supabase.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/supabase.md")"$'\n\n'; grep -q '"firebase"' package.json 2>/dev/null && [ -f "$STACKS_DIR/firebase.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/firebase.md")"$'\n\n'; grep -qE '"(graphql|@apollo/client|urql)"' package.json 2>/dev/null && [ -f "$STACKS_DIR/graphql.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/graphql.md")"$'\n\n'; grep -q '"zustand"' package.json 2>/dev/null && [ -f "$STACKS_DIR/zustand.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/zustand.md")"$'\n\n'; grep -q '"@reduxjs/toolkit"' package.json 2>/dev/null && [ -f "$STACKS_DIR/redux.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/redux.md")"$'\n\n'; grep -q '"neo4j-driver"' package.json 2>/dev/null && [ -f "$STACKS_DIR/neo4j.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/neo4j.md")"$'\n\n'; grep -qE '"(pg|prisma|drizzle-orm|knex)"' package.json 2>/dev/null && [ -f "$STACKS_DIR/postgresql.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/postgresql.md")"$'\n\n'; grep -qE '"(express|fastify|hono|koa)"' package.json 2>/dev/null && [ -f "$STACKS_DIR/rest-api.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/rest-api.md")"$'\n\n'; fi; ([ -f "requirements.txt" ] || [ -f "pyproject.toml" ] || [ -f "Pipfile" ]) && [ -f "$STACKS_DIR/python.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/python.md")"$'\n\n'; ([ -f "requirements.txt" ] && grep -q "psycopg" requirements.txt 2>/dev/null || [ -f "pyproject.toml" ] && grep -q "psycopg" pyproject.toml 2>/dev/null) && [ -f "$STACKS_DIR/postgresql.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/postgresql.md")"$'\n\n'; ([ -f "requirements.txt" ] && grep -q "neo4j" requirements.txt 2>/dev/null) && [ -f "$STACKS_DIR/neo4j.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/neo4j.md")"$'\n\n'; [ -f "pubspec.yaml" ] && [ -f "$STACKS_DIR/flutter.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/flutter.md")"$'\n\n'; [ -f "Dockerfile" ] && [ -f "$STACKS_DIR/docker.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/docker.md")"$'\n\n'; [ -d ".github/workflows" ] && [ -f "$STACKS_DIR/github-actions.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/github-actions.md")"$'\n\n'; ([ -f "playwright.config.ts" ] || [ -f "playwright.config.js" ]) && [ -f "$STACKS_DIR/playwright.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/playwright.md")"$'\n\n'; [ -f "go.mod" ] && [ -f "$STACKS_DIR/go.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/go.md")"$'\n\n'; [ -f "Cargo.toml" ] && [ -f "$STACKS_DIR/rust.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/rust.md")"$'\n\n'; fi`
|
|
18
|
+
|
|
19
|
+
If STACK_RULES is non-empty, append to the subagent prompt:
|
|
20
|
+
```
|
|
21
|
+
## Stack Rules (MANDATORY — violations fail this task)
|
|
22
|
+
|
|
23
|
+
{STACK_RULES}
|
|
24
|
+
|
|
25
|
+
These standards have the same enforcement weight as contract compliance.
|
|
26
|
+
Violations are task failures, not warnings.
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
If STACK_RULES is empty (no templates/stacks/ dir or no matches), skip silently.
|
|
30
|
+
|
|
15
31
|
Spawn a fresh subagent using the Task tool:
|
|
16
32
|
```
|
|
17
33
|
subagent_type: general-purpose
|
|
18
34
|
prompt: "You are running gsd-t-quick for this request: {$ARGUMENTS}
|
|
19
35
|
Working directory: {current project root}
|
|
20
|
-
Read CLAUDE.md and .gsd-t/progress.md for project context, then execute gsd-t-quick starting at Step 1.
|
|
36
|
+
Read CLAUDE.md and .gsd-t/progress.md for project context, then execute gsd-t-quick starting at Step 1.
|
|
37
|
+
{STACK_RULES block — if non-empty, append the ## Stack Rules section defined above; omit if empty}"
|
|
21
38
|
```
|
|
22
39
|
|
|
23
40
|
After subagent returns — run via Bash:
|
|
@@ -296,7 +296,11 @@ After each task completes:
|
|
|
296
296
|
2. **If new code paths have zero test coverage: write tests NOW** — do not defer
|
|
297
297
|
3. Run ALL affected unit/integration tests
|
|
298
298
|
4. Run ALL affected Playwright E2E tests
|
|
299
|
-
5. If failures: fix immediately (up to 2 attempts) before continuing
|
|
299
|
+
5. If failures: fix immediately (up to 2 attempts) before continuing. If both attempts fail:
|
|
300
|
+
1. Write failure context to `.gsd-t/debug-state.jsonl` via `node -e "require('./bin/debug-ledger.js').appendEntry('.', {iteration:1,timestamp:new Date().toISOString(),test:'test-sync-failure',error:'2 in-context fix attempts exhausted',hypothesis:'see test-coverage.md',fix:'n/a',fixFiles:[],result:'STILL_FAILS',learning:'delegating to headless debug-loop',model:'sonnet',duration:0})"`
|
|
301
|
+
2. Log: "Delegating to headless debug-loop (2 in-context attempts exhausted)"
|
|
302
|
+
3. Run: `gsd-t headless --debug-loop --max-iterations 10`
|
|
303
|
+
4. Exit code 0 → tests pass, continue; 1/4 → log to `.gsd-t/deferred-items.md`, report failure; 3 → report error
|
|
300
304
|
6. If E2E specs are missing for new features/modes/flows: **create them NOW**, not later
|
|
301
305
|
7. If E2E specs need updating for changed behavior: update them before continuing
|
|
302
306
|
8. **No task is complete until its tests exist and pass** — do not move to the next task with test gaps
|
package/commands/gsd-t-verify.md
CHANGED
|
@@ -309,7 +309,12 @@ Update `.gsd-t/progress.md`:
|
|
|
309
309
|
|
|
310
310
|
**All Levels**:
|
|
311
311
|
- VERIFIED or CONDITIONAL PASS → **Auto-invoke complete-milestone** (see Step 8 below). Completing a verified milestone is mechanical — there is no judgment call that benefits from user review.
|
|
312
|
-
- FAIL → **Level 3**: Auto-execute remediation tasks (up to 2 fix attempts). If still failing after 2 attempts
|
|
312
|
+
- FAIL → **Level 3**: Auto-execute remediation tasks (up to 2 fix attempts). If still failing after 2 attempts:
|
|
313
|
+
1. Write failure context to `.gsd-t/debug-state.jsonl` via `node -e "require('./bin/debug-ledger.js').appendEntry('.', {iteration:1,timestamp:new Date().toISOString(),test:'verify-remediation',error:'2 in-context fix attempts exhausted',hypothesis:'see verify-report.md',fix:'n/a',fixFiles:[],result:'STILL_FAILS',learning:'delegating to headless debug-loop',model:'sonnet',duration:0})"`
|
|
314
|
+
2. Log: "Delegating to headless debug-loop (2 in-context attempts exhausted)"
|
|
315
|
+
3. Run: `gsd-t headless --debug-loop --max-iterations 10`
|
|
316
|
+
4. Exit code 0 → re-run verification; 1/4 → log to `.gsd-t/deferred-items.md`, STOP and report to user; 3 → report error
|
|
317
|
+
**Level 1–2**: Return to execute phase for remediation tasks.
|
|
313
318
|
|
|
314
319
|
## Document Ripple
|
|
315
320
|
|
package/commands/gsd-t-wave.md
CHANGED
|
@@ -52,6 +52,22 @@ If `.gsd-t/graph/meta.json` exists, the code graph is available for all phases.
|
|
|
52
52
|
|
|
53
53
|
For each phase, spawn the agent like this:
|
|
54
54
|
|
|
55
|
+
**Stack Rules Detection (before spawning subagent):**
|
|
56
|
+
Run via Bash to detect project stack and collect matching rules:
|
|
57
|
+
`GSD_T_DIR=$(npm root -g 2>/dev/null)/@tekyzinc/gsd-t; STACKS_DIR="$GSD_T_DIR/templates/stacks"; STACK_RULES=""; if [ -d "$STACKS_DIR" ]; then for f in "$STACKS_DIR"/_*.md; do [ -f "$f" ] && STACK_RULES="${STACK_RULES}$(cat "$f")"$'\n\n'; done; if [ -f "package.json" ]; then grep -q '"react"' package.json 2>/dev/null && [ -f "$STACKS_DIR/react.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/react.md")"$'\n\n'; (grep -q '"typescript"' package.json 2>/dev/null || [ -f "tsconfig.json" ]) && [ -f "$STACKS_DIR/typescript.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/typescript.md")"$'\n\n'; grep -qE '"(express|fastify|hono|koa)"' package.json 2>/dev/null && [ -f "$STACKS_DIR/node-api.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/node-api.md")"$'\n\n'; fi; [ -f "requirements.txt" ] || [ -f "pyproject.toml" ] && [ -f "$STACKS_DIR/python.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/python.md")"$'\n\n'; [ -f "go.mod" ] && [ -f "$STACKS_DIR/go.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/go.md")"$'\n\n'; [ -f "Cargo.toml" ] && [ -f "$STACKS_DIR/rust.md" ] && STACK_RULES="${STACK_RULES}$(cat "$STACKS_DIR/rust.md")"$'\n\n'; fi`
|
|
58
|
+
|
|
59
|
+
If STACK_RULES is non-empty, append to the subagent prompt:
|
|
60
|
+
```
|
|
61
|
+
## Stack Rules (MANDATORY — violations fail this task)
|
|
62
|
+
|
|
63
|
+
{STACK_RULES}
|
|
64
|
+
|
|
65
|
+
These standards have the same enforcement weight as contract compliance.
|
|
66
|
+
Violations are task failures, not warnings.
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
If STACK_RULES is empty (no templates/stacks/ dir or no matches), skip silently.
|
|
70
|
+
|
|
55
71
|
**OBSERVABILITY LOGGING (MANDATORY) — repeat for every phase spawn:**
|
|
56
72
|
Before spawning — run via Bash:
|
|
57
73
|
`T_START=$(date +%s) && DT_START=$(date +"%Y-%m-%d %H:%M") && TOK_START=${CLAUDE_CONTEXT_TOKENS_USED:-0} && TOK_MAX=${CLAUDE_CONTEXT_TOKENS_MAX:-200000}`
|
|
@@ -265,6 +281,11 @@ If the user interrupts or a phase agent fails:
|
|
|
265
281
|
- Report blocking issues to user
|
|
266
282
|
|
|
267
283
|
**Level 3**: Spawn a remediation agent to fix blocking issues, then re-spawn impact agent. Max 2 attempts.
|
|
284
|
+
If both attempts fail:
|
|
285
|
+
1. Write failure context to `.gsd-t/debug-state.jsonl` via `node -e "require('./bin/debug-ledger.js').appendEntry('.', {iteration:1,timestamp:new Date().toISOString(),test:'impact-remediation',error:'2 in-context fix attempts exhausted',hypothesis:'see impact-report.md',fix:'n/a',fixFiles:[],result:'STILL_FAILS',learning:'delegating to headless debug-loop',model:'sonnet',duration:0})"`
|
|
286
|
+
2. Log: "Delegating to headless debug-loop (2 in-context attempts exhausted)"
|
|
287
|
+
3. Run: `gsd-t headless --debug-loop --max-iterations 10`
|
|
288
|
+
4. Exit code 0 → continue; 1/4 → log to `.gsd-t/deferred-items.md`, report to user; 3 → report error
|
|
268
289
|
**Level 1–2**: Ask user for direction.
|
|
269
290
|
|
|
270
291
|
### If tests fail during execute:
|
|
@@ -276,6 +297,11 @@ If the user interrupts or a phase agent fails:
|
|
|
276
297
|
- Read verify report for failure details
|
|
277
298
|
|
|
278
299
|
**Level 3**: Spawn remediation agent, then re-spawn verify agent. Max 2 attempts.
|
|
300
|
+
If both attempts fail:
|
|
301
|
+
1. Write failure context to `.gsd-t/debug-state.jsonl` via `node -e "require('./bin/debug-ledger.js').appendEntry('.', {iteration:1,timestamp:new Date().toISOString(),test:'verify-remediation',error:'2 in-context fix attempts exhausted',hypothesis:'see verify-report.md',fix:'n/a',fixFiles:[],result:'STILL_FAILS',learning:'delegating to headless debug-loop',model:'sonnet',duration:0})"`
|
|
302
|
+
2. Log: "Delegating to headless debug-loop (2 in-context attempts exhausted)"
|
|
303
|
+
3. Run: `gsd-t headless --debug-loop --max-iterations 10`
|
|
304
|
+
4. Exit code 0 → re-spawn verify agent; 1/4 → log to `.gsd-t/deferred-items.md`, report to user; 3 → report error
|
|
279
305
|
**Level 1–2**: Ask user for direction.
|
|
280
306
|
|
|
281
307
|
## Why Agent-Per-Phase
|
package/docs/GSD-T-README.md
CHANGED
|
@@ -100,7 +100,7 @@ GSD-T reads all state files and tells you exactly where you left off.
|
|
|
100
100
|
| `/user:gsd-t-discuss` | Multi-perspective design exploration | In wave |
|
|
101
101
|
| `/user:gsd-t-plan` | Create atomic task lists per domain (tasks auto-split to fit one context window) | In wave |
|
|
102
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 | In wave |
|
|
103
|
+
| `/user:gsd-t-execute` | Run tasks — task-level fresh dispatch, worktree isolation, adaptive replanning, stack rules injection | In wave |
|
|
104
104
|
| `/user:gsd-t-test-sync` | Sync tests with code changes | In wave |
|
|
105
105
|
| `/user:gsd-t-qa` | QA agent — test generation, execution, gap reporting | Auto-spawned |
|
|
106
106
|
| `/user:gsd-t-doc-ripple` | Automated document ripple — update downstream docs after code changes | Auto-spawned |
|
|
@@ -224,6 +224,88 @@ your-project/
|
|
|
224
224
|
|
|
225
225
|
---
|
|
226
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`) are **always** injected.
|
|
235
|
+
3. Stack-specific rules are injected when the corresponding stack is detected.
|
|
236
|
+
4. Rules are appended to the subagent prompt as a `## Stack Rules (MANDATORY)` section.
|
|
237
|
+
|
|
238
|
+
### Stack Detection
|
|
239
|
+
|
|
240
|
+
| Project File | Detected Stack |
|
|
241
|
+
|---|---|
|
|
242
|
+
| `package.json` with `"react"` | React |
|
|
243
|
+
| `package.json` with `"typescript"` or `tsconfig.json` | TypeScript |
|
|
244
|
+
| `package.json` with `"express"`, `"fastify"`, `"hono"`, or `"koa"` | Node API |
|
|
245
|
+
| `requirements.txt` or `pyproject.toml` | Python |
|
|
246
|
+
| `go.mod` | Go |
|
|
247
|
+
| `Cargo.toml` | Rust |
|
|
248
|
+
|
|
249
|
+
### Commands That Inject Stack Rules
|
|
250
|
+
|
|
251
|
+
`gsd-t-execute`, `gsd-t-quick`, `gsd-t-integrate`, `gsd-t-wave`, `gsd-t-debug`
|
|
252
|
+
|
|
253
|
+
### Extending
|
|
254
|
+
|
|
255
|
+
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.
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Headless Mode
|
|
260
|
+
|
|
261
|
+
Run GSD-T non-interactively in CI/CD pipelines or automated workflows.
|
|
262
|
+
|
|
263
|
+
### headless exec
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
gsd-t headless verify --json --timeout=1200 # Run verify non-interactively
|
|
267
|
+
gsd-t headless execute --json # Execute tasks without interactive prompts
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### headless query
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
gsd-t headless query status # Project state — no LLM, <100ms
|
|
274
|
+
gsd-t headless query domains # Domain list with status
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### headless debug-loop
|
|
278
|
+
|
|
279
|
+
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.
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
gsd-t headless --debug-loop [--max-iterations=N] [--test-cmd=CMD] [--fix-scope=PATTERN] [--json] [--log]
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
**Flags:**
|
|
286
|
+
|
|
287
|
+
| Flag | Default | Description |
|
|
288
|
+
|--------------------|---------|-------------|
|
|
289
|
+
| `--max-iterations` | 20 | Hard ceiling on iterations |
|
|
290
|
+
| `--test-cmd` | (auto) | Override test command (auto-detected from project) |
|
|
291
|
+
| `--fix-scope` | (all) | Limit fix scope to specific files or patterns |
|
|
292
|
+
| `--json` | false | Structured JSON output after each iteration |
|
|
293
|
+
| `--log` | false | Write per-iteration logs to `.gsd-t/` |
|
|
294
|
+
|
|
295
|
+
**Escalation tiers:**
|
|
296
|
+
|
|
297
|
+
| Iterations | Model | Behavior |
|
|
298
|
+
|------------|--------|----------|
|
|
299
|
+
| 1–5 | sonnet | Standard debug — one fix per session |
|
|
300
|
+
| 6–15 | opus | Deeper reasoning — reads full ledger, may attempt multi-file fixes |
|
|
301
|
+
| 16–20 | STOP | Write full diagnostic summary, present to user, exit code 4 |
|
|
302
|
+
|
|
303
|
+
**Exit codes:** `0` all tests pass · `1` max iterations reached · `2` compaction error · `3` process error · `4` needs human decision
|
|
304
|
+
|
|
305
|
+
**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.
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
227
309
|
## Key Principles
|
|
228
310
|
|
|
229
311
|
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.
|
package/docs/architecture.md
CHANGED
|
@@ -16,7 +16,7 @@ The framework has no runtime — it is consumed entirely by Claude Code's slash
|
|
|
16
16
|
- **Purpose**: Install, update, diagnose, and manage GSD-T across projects
|
|
17
17
|
- **Location**: `bin/gsd-t.js` (1,798 lines, 90+ functions, all ≤ 30 lines)
|
|
18
18
|
- **Dependencies**: Node.js built-ins only (fs, path, os, child_process, https, crypto)
|
|
19
|
-
- **Subcommands**: install, update, status, doctor, init, uninstall, update-all, register, changelog, graph (index/status/query), headless (exec/query)
|
|
19
|
+
- **Subcommands**: install, update, status, doctor, init, uninstall, update-all, register, changelog, graph (index/status/query), headless (exec/query/--debug-loop)
|
|
20
20
|
- **Organization**: Configuration → Guard section → Helpers → Heartbeat → Commands → Install/Update → Init → Status → Uninstall → Update-All → Doctor → Register → Update Check → Help → Main dispatch
|
|
21
21
|
- **All functions ≤ 30 lines** (M6 refactoring). Largest: `doRegister()` at 30 lines, `summarize()` at 30 lines.
|
|
22
22
|
|
|
@@ -78,6 +78,14 @@ The framework has no runtime — it is consumed entirely by Claude Code's slash
|
|
|
78
78
|
- **Exit codes**: 0=success, 1=verify-fail, 2=context-budget-exceeded, 3=error, 4=blocked-needs-human
|
|
79
79
|
- **CI/CD examples**: `docs/ci-examples/github-actions.yml` (GitHub Actions), `docs/ci-examples/gitlab-ci.yml` (GitLab CI)
|
|
80
80
|
|
|
81
|
+
### Compaction-Proof Debug Loop (M29 — complete)
|
|
82
|
+
- **bin/debug-ledger.js** (193 lines): JSONL-based debug persistence layer. 6 exported functions: `readLedger`, `appendEntry`, `compactLedger`, `generateAntiRepetitionPreamble`, `getLedgerStats`, `clearLedger`. Ledger file: `.gsd-t/debug-state.jsonl` (11-field schema per entry). Compaction triggers at 50KB — haiku session condenses history, last 5 raw entries preserved. Anti-repetition preamble lists all STILL_FAILS hypotheses, current narrowing direction, and tests still failing. Zero external deps.
|
|
83
|
+
- **doHeadlessDebugLoop(flags)**: External iteration manager in `bin/gsd-t.js`. Runs test-fix-retest as separate `claude -p` sessions — each session starts with zero accumulated context. Escalation tiers: sonnet (iterations 1-5), opus (6-15), STOP with full diagnostic output (16-20). `--max-iterations N` flag (default 20) enforced by external process.
|
|
84
|
+
- **parseDebugLoopFlags(args)**: Extracts `--max-iterations`, `--test-cmd`, `--fix-scope`, `--json`, `--log` from args. Defaults: maxIterations=20.
|
|
85
|
+
- **getEscalationModel(iteration)**: Returns "sonnet" for 1-5, "opus" for 6-15, null for 16-20 (STOP tier).
|
|
86
|
+
- **Command integration**: execute, wave, test-sync, verify, debug all delegate fix-retest loops to `gsd-t headless --debug-loop` after 2 in-context fix attempts.
|
|
87
|
+
- **Exit codes (debug-loop specific)**: 0=all tests pass (ledger cleared), 1=max iterations reached, 3=process error, 4=escalation stop (needs human)
|
|
88
|
+
|
|
81
89
|
### Graph Engine (M20 — complete)
|
|
82
90
|
- **`bin/graph-store.js`** (147 lines): File-based graph storage in `.gsd-t/graph/`. 8 JSON files (index, calls, imports, contracts, requirements, tests, surfaces, meta). Read/write operations, MD5 file hashing for incremental indexing, staleness detection. Zero external deps. Note: no symlink protection (TD-099).
|
|
83
91
|
- **`bin/graph-parsers.js`** (327 lines): Language-specific entity parsers. JS/TS: function declarations, arrow functions, classes, methods, imports (ES/CJS), exports. Python: def/class/import. Regex-based (no Tree-sitter). Returns `{ entities, imports, calls }`.
|
package/docs/requirements.md
CHANGED
|
@@ -61,6 +61,13 @@
|
|
|
61
61
|
| REQ-050 | Functional E2E Test Quality Standard — Playwright specs MUST verify functional behavior (state changes, data flow, content updates after actions), NOT just element existence (isVisible, toBeEnabled). Shallow layout tests that would pass on an empty HTML page are flagged and block verification. QA subagent audits for shallow tests. | P1 | complete | enforced in execute, qa, test-sync, verify, quick, debug, integrate, complete-milestone + global CLAUDE.md + CLAUDE-global template |
|
|
62
62
|
| REQ-051 | Document Ripple Completion Gate — when a change affects multiple files, identify the full blast radius BEFORE starting, complete ALL updates in one pass, and only report completion after every downstream document is updated. Partial delivery is never acceptable. The user should never need to ask "did you update everything?" | P1 | complete | enforced in global CLAUDE.md + CLAUDE-global template + project CLAUDE.md |
|
|
63
63
|
| REQ-052 | Doc-Ripple Subagent — dedicated agent auto-spawned after code-modifying commands (execute, integrate, quick, debug, wave) that analyzes git diff, identifies full blast radius of affected documents, and spawns parallel subagents to update them. Produces manifest audit trail. Threshold logic skips trivial changes. | P1 | complete | M28: contract ACTIVE, command file, 43 tests, wired into execute/integrate/quick/debug/wave |
|
|
64
|
+
| REQ-053 | Debug Ledger Protocol — structured JSONL ledger (.gsd-t/debug-state.jsonl) persists hypothesis/fix/learning entries across debug sessions. Supports read, append, compact (at 50KB), anti-repetition preamble generation, and clear. | P1 | complete | M29: bin/debug-ledger.js, test/debug-ledger.test.js (46 tests) |
|
|
65
|
+
| REQ-054 | Headless Debug-Loop — `gsd-t headless --debug-loop` runs test-fix-retest cycles as separate `claude -p` sessions with fresh context each. External loop controller (pure Node.js, zero AI context). Escalation tiers: sonnet 1-5, opus 6-15, STOP 16-20. --max-iterations enforced externally. | P1 | complete | M29: bin/gsd-t.js headless extension, test/headless-debug-loop.test.js (37 tests) |
|
|
66
|
+
| REQ-055 | Anti-Repetition Preamble — each debug-loop iteration injects a preamble listing all failed hypotheses, current narrowing direction, and tests still failing. Prevents repeat of eliminated approaches. | P1 | complete | M29: bin/debug-ledger.js generateAntiRepetitionPreamble, test/debug-ledger.test.js |
|
|
67
|
+
| REQ-056 | Debug-Loop Command Integration — execute, wave, test-sync, verify, and debug commands delegate to headless debug-loop after 2 in-context fix attempts fail. Preserves existing try-twice behavior for quick fixes. | P1 | complete | M29: 5 command files (execute, debug, wave, test-sync, verify) |
|
|
68
|
+
| REQ-057 | Stack Rule Templates — best practice rule files in `templates/stacks/` for React, TypeScript, and Node.js API. Each file follows a standard structure (mandatory framing, numbered sections, GOOD/BAD examples, verification checklist) and stays under 200 lines. Universal templates (`_` prefix) always injected; stack-specific templates injected when detected. | P1 | complete | M30: templates/stacks/ (4 files: _security.md, react.md, typescript.md, node-api.md) |
|
|
69
|
+
| REQ-058 | Stack Detection Engine — auto-detect project tech stack from manifest files (package.json, requirements.txt, go.mod, Cargo.toml) at subagent spawn time. Match detected stacks against available templates. Inject matched rules into subagent prompts with mandatory enforcement framing. Resilient: skip silently if no templates exist or no matches found. | P1 | complete | M30: 5 command files (execute, quick, integrate, wave, debug) |
|
|
70
|
+
| REQ-059 | Stack Rule QA Enforcement — QA subagent prompts include stack rule compliance validation. Stack rule violations have the same severity as contract violations — they fail the task, not warn. Report format includes "Stack rules: compliant/N violations". | P1 | complete | M30: execute QA prompt + all 5 commands |
|
|
64
71
|
|
|
65
72
|
## Technical Requirements
|
|
66
73
|
|
|
@@ -166,6 +173,29 @@
|
|
|
166
173
|
**Orphaned requirements**: None — all M27 REQs mapped to tasks.
|
|
167
174
|
**Unanchored tasks**: global-metrics Task 4 (tests) and cross-project-sync Task 3 (tests) are QA infrastructure supporting REQ-043 through REQ-045. command-extensions Task 4 (reference docs) supports Pre-Commit Gate compliance.
|
|
168
175
|
|
|
176
|
+
## Requirements Traceability (updated by plan phase — M29)
|
|
177
|
+
|
|
178
|
+
| REQ-ID | Requirement Summary | Domain | Task(s) | Status |
|
|
179
|
+
|---------|--------------------------------------------------------------|----------------------|----------------|---------|
|
|
180
|
+
| REQ-053 | Debug Ledger Protocol — JSONL ledger with read/write/compact | debug-state-protocol | Task 1, 2, 3 | complete |
|
|
181
|
+
| REQ-054 | Headless Debug-Loop — external loop controller | headless-loop | Task 1, 2, 3 | complete |
|
|
182
|
+
| REQ-055 | Anti-Repetition Preamble — failed hypothesis injection | debug-state-protocol, headless-loop | dsp Task 2, hl Task 2 | complete |
|
|
183
|
+
| REQ-056 | Debug-Loop Command Integration — delegate after 2 failures | command-integration | Task 1, 2 | complete |
|
|
184
|
+
|
|
185
|
+
**Orphaned requirements**: None — all M29 REQs mapped to tasks.
|
|
186
|
+
**Unanchored tasks**: debug-state-protocol Task 3 (tests) and headless-loop Task 3 (tests) are QA infrastructure supporting REQ-053 through REQ-055. command-integration Task 3 (reference docs) supports Pre-Commit Gate compliance.
|
|
187
|
+
|
|
188
|
+
## Requirements Traceability (updated by plan phase — M30)
|
|
189
|
+
|
|
190
|
+
| REQ-ID | Requirement Summary | Domain | Task(s) | Status |
|
|
191
|
+
|---------|--------------------------------------------------------------|----------------------|----------------|---------|
|
|
192
|
+
| REQ-057 | Stack Rule Templates — react.md, typescript.md, node-api.md | stack-templates | Task 1, 2, 3 | complete |
|
|
193
|
+
| REQ-058 | Stack Detection Engine — auto-detect + prompt injection | command-integration | Task 1, 2 | complete |
|
|
194
|
+
| REQ-059 | Stack Rule QA Enforcement — QA validates compliance | command-integration | Task 1, 2 | complete |
|
|
195
|
+
|
|
196
|
+
**Orphaned requirements**: None — all M30 REQs mapped to tasks.
|
|
197
|
+
**Unanchored tasks**: command-integration Task 3 (tests) is QA infrastructure supporting REQ-057 through REQ-059. command-integration Task 4 (reference docs) supports Pre-Commit Gate compliance.
|
|
198
|
+
|
|
169
199
|
---
|
|
170
200
|
|
|
171
201
|
## M17: Scan Visual Output — Feature Specification
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tekyzinc/gsd-t",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.50.10",
|
|
4
4
|
"description": "GSD-T: Contract-Driven Development for Claude Code — 51 slash commands with headless CI/CD mode, graph-powered code analysis, real-time agent dashboard, execution intelligence, task telemetry, doc-ripple enforcement, backlog management, impact analysis, test sync, milestone archival, and PRD generation",
|
|
5
5
|
"author": "Tekyz, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -339,7 +339,7 @@ This applies during: `gsd-t-execute`, `gsd-t-quick`, `gsd-t-integrate`, `gsd-t-w
|
|
|
339
339
|
|
|
340
340
|
## Prime Rule
|
|
341
341
|
KEEP GOING. Only stop for:
|
|
342
|
-
1. Unrecoverable errors after 2 fix attempts
|
|
342
|
+
1. Unrecoverable errors after 2 fix attempts (delegate to `gsd-t headless --debug-loop` first — only stop if exit code 4)
|
|
343
343
|
2. Ambiguity that fundamentally changes project direction
|
|
344
344
|
3. Milestone completion (checkpoint for user review)
|
|
345
345
|
4. Destructive actions (see Destructive Action Guard above — ALWAYS stop)
|
|
@@ -431,7 +431,7 @@ BEFORE reporting "done" or presenting a summary:
|
|
|
431
431
|
- NEVER pause to show verification steps — execute them.
|
|
432
432
|
- NEVER ask "should I continue?" — just continue.
|
|
433
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.
|
|
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
435
|
|
|
436
436
|
## Autonomy Levels
|
|
437
437
|
|
|
@@ -583,6 +583,23 @@ Also pad all cell values in a column to the width of the widest value:
|
|
|
583
583
|
```
|
|
584
584
|
|
|
585
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
|
+
|
|
586
603
|
# Recovery After Interruption
|
|
587
604
|
|
|
588
605
|
When resuming work (new session or after /clear):
|