@tekyzinc/gsd-t 2.39.13 → 2.45.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.
- package/README.md +17 -9
- package/bin/desktop.ini +2 -0
- package/bin/global-sync-manager.js +350 -0
- package/bin/gsd-t.js +592 -2
- package/bin/metrics-collector.js +167 -0
- package/bin/metrics-rollup.js +200 -0
- package/bin/patch-lifecycle.js +195 -0
- package/bin/rule-engine.js +160 -0
- package/commands/desktop.ini +2 -0
- package/commands/gsd-t-complete-milestone.md +192 -5
- package/commands/gsd-t-debug.md +16 -2
- package/commands/gsd-t-execute.md +257 -52
- package/commands/gsd-t-help.md +25 -10
- package/commands/gsd-t-integrate.md +35 -7
- package/commands/gsd-t-metrics.md +143 -0
- package/commands/gsd-t-plan.md +49 -2
- package/commands/gsd-t-quick.md +15 -3
- package/commands/gsd-t-status.md +78 -0
- package/commands/gsd-t-test-sync.md +2 -2
- package/commands/gsd-t-verify.md +140 -9
- package/commands/gsd-t-visualize.md +11 -1
- package/commands/gsd-t-wave.md +34 -19
- package/docs/GSD-T-README.md +9 -6
- package/docs/architecture.md +84 -2
- package/docs/ci-examples/desktop.ini +2 -0
- package/docs/ci-examples/github-actions.yml +104 -0
- package/docs/ci-examples/gitlab-ci.yml +116 -0
- package/docs/desktop.ini +2 -0
- package/docs/infrastructure.md +87 -1
- package/docs/prd-graph-engine.md +2 -2
- package/docs/prd-gsd2-hybrid.md +258 -135
- package/docs/requirements.md +63 -2
- package/examples/.gsd-t/contracts/desktop.ini +2 -0
- package/examples/.gsd-t/desktop.ini +2 -0
- package/examples/.gsd-t/domains/desktop.ini +2 -0
- package/examples/.gsd-t/domains/example-domain/desktop.ini +2 -0
- package/examples/desktop.ini +2 -0
- package/examples/rules/.gitkeep +0 -0
- package/package.json +40 -40
- package/scripts/desktop.ini +2 -0
- package/scripts/gsd-t-dashboard-server.js +19 -2
- package/scripts/gsd-t-dashboard.html +63 -0
- package/scripts/gsd-t-event-writer.js +1 -0
- package/templates/CLAUDE-global.md +30 -9
- package/templates/desktop.ini +2 -0
|
@@ -60,11 +60,19 @@ Before choosing solo or team mode, read the `## Wave Execution Groups` section i
|
|
|
60
60
|
|
|
61
61
|
**If no wave groups are defined** (older plans): fall back to the `Execution Order` list.
|
|
62
62
|
|
|
63
|
-
### Solo Mode (default) — Domain
|
|
63
|
+
### Solo Mode (default) — Domain Task-Dispatcher Pattern
|
|
64
64
|
|
|
65
|
-
Each domain's work runs
|
|
65
|
+
Each domain's work runs via a lightweight domain task-dispatcher. The dispatcher spawns one Task subagent PER TASK within that domain, giving each task a completely fresh context window with only the minimum required context. The orchestrator (this agent) stays lightweight — it only spawns dispatchers, collects summaries, verifies checkpoints, and updates progress.
|
|
66
66
|
|
|
67
|
-
**
|
|
67
|
+
**Context provided to each task subagent (fresh-dispatch-contract.md payload):**
|
|
68
|
+
- `scope.md` for the domain
|
|
69
|
+
- Relevant contracts (only those referenced by the task)
|
|
70
|
+
- The single task from `tasks.md`
|
|
71
|
+
- Graph context for the task's files (if available)
|
|
72
|
+
- Up to 5 prior task summaries (10-20 lines each, most recent first)
|
|
73
|
+
- Past failure/learning entries for this domain (max 5 lines)
|
|
74
|
+
|
|
75
|
+
**OBSERVABILITY LOGGING (MANDATORY) — repeat for every task subagent spawn:**
|
|
68
76
|
|
|
69
77
|
Before spawning — run via Bash:
|
|
70
78
|
`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}`
|
|
@@ -76,39 +84,80 @@ Compute tokens and compaction:
|
|
|
76
84
|
- No compaction (TOK_END >= TOK_START): `TOKENS=$((TOK_END-TOK_START))`, COMPACTED=null
|
|
77
85
|
- Compaction detected (TOK_END < TOK_START): `TOKENS=$(((TOK_MAX-TOK_START)+TOK_END))`, COMPACTED=$DT_END
|
|
78
86
|
|
|
79
|
-
|
|
80
|
-
|
|
87
|
+
Compute context utilization — run via Bash:
|
|
88
|
+
`if [ "${CLAUDE_CONTEXT_TOKENS_MAX:-0}" -gt 0 ]; then CTX_PCT=$(echo "scale=1; ${CLAUDE_CONTEXT_TOKENS_USED:-0} * 100 / ${CLAUDE_CONTEXT_TOKENS_MAX}" | bc); else CTX_PCT="N/A"; fi`
|
|
89
|
+
|
|
90
|
+
Alert on context thresholds (display to user inline):
|
|
91
|
+
- If CTX_PCT is a number and >= 85: `echo "🔴 CRITICAL: Context at ${CTX_PCT}% — compaction likely. Task MUST be split."`
|
|
92
|
+
- If CTX_PCT is a number and >= 70: `echo "⚠️ WARNING: Context at ${CTX_PCT}% — approaching compaction threshold. Consider splitting in plan."`
|
|
93
|
+
|
|
94
|
+
Append to `.gsd-t/token-log.md` (create with header `| Datetime-start | Datetime-end | Command | Step | Model | Duration(s) | Notes | Tokens | Compacted | Domain | Task | Ctx% |` if missing):
|
|
95
|
+
`| {DT_START} | {DT_END} | gsd-t-execute | task:{task-id} | sonnet | {DURATION}s | {pass/fail} | {TOKENS} | {COMPACTED} | {domain-name} | task-{task-id} | {CTX_PCT} |`
|
|
81
96
|
|
|
82
|
-
**For each domain (in wave order),
|
|
97
|
+
**For each domain (in wave order), run the domain task-dispatcher:**
|
|
83
98
|
|
|
84
|
-
**Pre-
|
|
99
|
+
**Pre-dispatch experience retrieval (before dispatching each domain's tasks):**
|
|
85
100
|
Run via Bash:
|
|
86
101
|
`grep -i "\[failure\]\|\[learning\]" .gsd-t/progress.md | grep -i "{domain-name}" | tail -5`
|
|
87
102
|
|
|
88
103
|
If results found:
|
|
89
|
-
-
|
|
104
|
+
- Store as `PAST_FAILURES` — prepend to each task subagent prompt (max 5 lines)
|
|
90
105
|
- Write event via Bash: `node ~/.claude/scripts/gsd-t-event-writer.js --type experience_retrieval --command gsd-t-execute --reasoning "{N past failures found for {domain-name}}" --outcome null || true`
|
|
91
106
|
|
|
92
107
|
If no results found: proceed normally (no warning block, no event write).
|
|
93
108
|
|
|
109
|
+
**Pre-flight intelligence check (before dispatching each domain's tasks):**
|
|
110
|
+
Run via Bash:
|
|
111
|
+
`node -e "const m = require('./bin/metrics-collector.js'); const w = m.getPreFlightWarnings('{domain-name}'); if(w.length) w.forEach(x => console.log('⚠️ ' + x));" 2>/dev/null || true`
|
|
112
|
+
|
|
113
|
+
Display any warnings inline (non-blocking — execution proceeds regardless).
|
|
114
|
+
|
|
115
|
+
**Active Rule Injection (before dispatching each domain's tasks):**
|
|
116
|
+
Run via Bash:
|
|
117
|
+
`node -e "const re = require('./bin/rule-engine.js'); const m = re.evaluateRules('{domain-name}', { projectDir: '.' }); if(m.length) m.forEach(x => console.log('RULE: ' + x.rule.name + ' — ' + x.rule.description + ' [' + x.severity + ']')); else console.log('No active rules for {domain-name}');" 2>/dev/null || true`
|
|
118
|
+
|
|
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
|
+
If no rules fire: log "No active rules for {domain-name}" and continue.
|
|
121
|
+
|
|
122
|
+
**Domain task-dispatcher (lightweight — sequences tasks, passes summaries):**
|
|
123
|
+
|
|
124
|
+
For each task in `.gsd-t/domains/{domain-name}/tasks.md` (in order, skip completed):
|
|
125
|
+
|
|
126
|
+
1. Load prior summaries: Read up to 5 most recent `.gsd-t/domains/{domain-name}/task-*-summary.md` files (10-20 lines each)
|
|
127
|
+
2. Load graph context (if `.gsd-t/graph/meta.json` exists): query task's files for relevant graph context
|
|
128
|
+
3. Display: `⚙ [sonnet] gsd-t-execute → domain: {domain-name}, task-{task-id}`
|
|
129
|
+
4. Run observability Bash (T_START / DT_START / TOK_START / TOK_MAX)
|
|
130
|
+
5. Spawn task subagent:
|
|
131
|
+
|
|
94
132
|
```
|
|
95
133
|
Task subagent (general-purpose, model: sonnet, mode: bypassPermissions):
|
|
96
|
-
"You are executing
|
|
134
|
+
"You are executing a single task for the {domain-name} domain.
|
|
97
135
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
136
|
+
{PAST_FAILURES block if any — ## ⚠️ Past Failures (read before acting)\n{lines}}
|
|
137
|
+
|
|
138
|
+
## Your Task
|
|
139
|
+
{full task block from tasks.md — id, description, files, contract refs, dependencies, acceptance criteria}
|
|
140
|
+
|
|
141
|
+
## Domain Scope
|
|
142
|
+
{contents of .gsd-t/domains/{domain-name}/scope.md}
|
|
143
|
+
|
|
144
|
+
## Relevant Contracts
|
|
145
|
+
{contents of each contract file referenced by this task}
|
|
146
|
+
|
|
147
|
+
## Graph Context (if available)
|
|
148
|
+
{graph query results for this task's files — omit section if unavailable}
|
|
105
149
|
|
|
106
|
-
|
|
107
|
-
|
|
150
|
+
## Prior Task Summaries (most recent first, max 5)
|
|
151
|
+
{contents of task-{N}-summary.md files — 10-20 lines each}
|
|
152
|
+
|
|
153
|
+
## Instructions
|
|
154
|
+
|
|
155
|
+
Execute the task above:
|
|
156
|
+
1. Read the task description, files list, and contract refs carefully
|
|
108
157
|
2. Read relevant contracts — implement EXACTLY what they specify
|
|
109
|
-
3. Destructive Action Guard: if task involves DROP TABLE, schema changes that lose
|
|
158
|
+
3. Destructive Action Guard: if the task involves DROP TABLE, schema changes that lose
|
|
110
159
|
data, removing working modules, or replacing architecture patterns → write a
|
|
111
|
-
NEEDS-APPROVAL entry to .gsd-t/deferred-items.md, skip the task,
|
|
160
|
+
NEEDS-APPROVAL entry to .gsd-t/deferred-items.md, skip the task, stop here
|
|
112
161
|
4. Implement the task
|
|
113
162
|
5. Verify acceptance criteria are met
|
|
114
163
|
6. Write comprehensive tests (MANDATORY — no feature code without test code):
|
|
@@ -116,42 +165,101 @@ Execute each incomplete task in order:
|
|
|
116
165
|
- Playwright E2E (if UI/routes/flows changed): new specs for new features, cover
|
|
117
166
|
all modes, form validation, empty/loading/error states, common edge cases
|
|
118
167
|
- If no test framework exists: set one up as part of this task
|
|
119
|
-
|
|
168
|
+
- If the project has a UI but no Playwright E2E specs exist for the features being
|
|
169
|
+
touched: WRITE THEM. A placeholder spec is not sufficient — write real E2E tests
|
|
170
|
+
that exercise the actual UI functionality being built or changed.
|
|
171
|
+
7. Run ALL test suites — this is NOT optional, not conditional, not "if applicable":
|
|
172
|
+
a. Detect configured test runners: check for vitest/jest config, playwright.config.*, cypress.config.*
|
|
173
|
+
b. Run EVERY detected suite. Unit tests alone are NEVER sufficient when E2E exists.
|
|
174
|
+
c. If `playwright.config.*` exists → run `npx playwright test` (full suite, not just affected specs)
|
|
175
|
+
d. If E2E tests fail → fix (up to 2 attempts) before proceeding
|
|
176
|
+
e. Report ALL suite results: "Unit: X/Y pass | E2E: X/Y pass" — never report just one
|
|
120
177
|
8. Run Pre-Commit Gate checklist from CLAUDE.md — update all affected docs BEFORE committing
|
|
121
|
-
9. Commit immediately: feat({domain-name}/task-{
|
|
122
|
-
10. Update .gsd-t/progress.md — mark task complete; prefix the Decision Log entry
|
|
123
|
-
-
|
|
124
|
-
-
|
|
125
|
-
-
|
|
126
|
-
-
|
|
127
|
-
11. Spawn QA subagent (model: haiku) after
|
|
128
|
-
'Run
|
|
129
|
-
|
|
178
|
+
9. Commit immediately: feat({domain-name}/task-{task-id}): {description}
|
|
179
|
+
10. Update .gsd-t/progress.md — mark this task complete; prefix the Decision Log entry:
|
|
180
|
+
- Completed successfully on first attempt → prefix `[success]`
|
|
181
|
+
- Completed after a fix → prefix `[learning]`
|
|
182
|
+
- Deferred to .gsd-t/deferred-items.md → prefix `[deferred]`
|
|
183
|
+
- Failed after 3 attempts → prefix `[failure]`
|
|
184
|
+
11. Spawn QA subagent (model: haiku) after completing the task:
|
|
185
|
+
'Run ALL configured test suites — detect and run every one:
|
|
186
|
+
a. Unit tests (vitest/jest/mocha): run the full suite, report pass/fail counts
|
|
187
|
+
b. E2E tests: check for playwright.config.* or cypress.config.* — if found, run the FULL E2E suite
|
|
188
|
+
c. NEVER skip E2E when a config file exists. Running only unit tests is a QA FAILURE.
|
|
189
|
+
d. Read .gsd-t/contracts/ for contract definitions. Check contract compliance.
|
|
190
|
+
Report format: "Unit: X/Y pass | E2E: X/Y pass (or N/A if no config) | Contract: compliant/violations"'
|
|
130
191
|
If QA fails, fix before proceeding. Append issues to .gsd-t/qa-issues.md.
|
|
192
|
+
12. Write task summary to .gsd-t/domains/{domain-name}/task-{task-id}-summary.md:
|
|
193
|
+
## Task {task-id} Summary — {domain-name}
|
|
194
|
+
- **Status**: PASS | FAIL
|
|
195
|
+
- **Files modified**: {list}
|
|
196
|
+
- **Constraints discovered**: {any new constraints or surprises}
|
|
197
|
+
- **Tests**: {pass/fail count}
|
|
198
|
+
- **Notes**: {10-20 lines max — key decisions, patterns, warnings}
|
|
131
199
|
|
|
132
200
|
Deviation rules:
|
|
133
201
|
- Bug blocking progress → fix, max 3 attempts; if still blocked, log to
|
|
134
|
-
.gsd-t/deferred-items.md and
|
|
135
|
-
- Missing dependency
|
|
136
|
-
- Non-trivial blocker →
|
|
202
|
+
.gsd-t/deferred-items.md and stop (report FAIL in summary)
|
|
203
|
+
- Missing dependency → add minimum needed, document in commit message
|
|
204
|
+
- Non-trivial blocker → log to .gsd-t/deferred-items.md
|
|
137
205
|
- Architectural change required → write NEEDS-APPROVAL to .gsd-t/deferred-items.md,
|
|
138
|
-
skip the task,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
-
|
|
206
|
+
skip the task, stop here — never self-approve structural changes
|
|
207
|
+
|
|
208
|
+
Report back:
|
|
209
|
+
- Task: {task-id}
|
|
210
|
+
- Status: PASS | FAIL
|
|
211
|
+
- Files modified: {list}
|
|
212
|
+
- Tests: {pass/fail count}
|
|
213
|
+
- Commit: {hash}
|
|
214
|
+
- Deferred items (if any)"
|
|
145
215
|
```
|
|
146
216
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
217
|
+
6. After task subagent returns:
|
|
218
|
+
- Run observability Bash (T_END / TOK_END / DURATION / CTX_PCT)
|
|
219
|
+
- Append to token-log.md (per-task row)
|
|
220
|
+
- Alert on CTX_PCT thresholds (display to user inline)
|
|
221
|
+
- **Emit task-metrics record** — run via Bash:
|
|
222
|
+
`node bin/metrics-collector.js --milestone {milestone} --domain {domain-name} --task task-{task-id} --command execute --duration_s $DURATION --tokens_used $TOKENS --context_pct ${CTX_PCT:-0} --pass {true|false} --fix_cycles {0|N} --signal_type {pass-through|fix-cycle} --notes "{brief outcome}" 2>/dev/null || true`
|
|
223
|
+
Signal type: `pass-through` if task passed on first attempt; `fix-cycle` if rework was needed.
|
|
224
|
+
- **Emit task_complete event** — run via Bash:
|
|
225
|
+
`node ~/.claude/scripts/gsd-t-event-writer.js --type task_complete --command gsd-t-execute --reasoning "signal_type={signal_type}, domain={domain-name}" --outcome {success|failure} || true`
|
|
226
|
+
- Check `.gsd-t/deferred-items.md` for `NEEDS-APPROVAL` — if found, STOP and present to user before proceeding to the next task
|
|
227
|
+
- Read the task summary from `.gsd-t/domains/{domain-name}/task-{task-id}-summary.md` to use as prior summary for the next task
|
|
228
|
+
|
|
229
|
+
**After all tasks in a domain complete (orchestrator responsibilities):**
|
|
230
|
+
1. Check `.gsd-t/deferred-items.md` for any `NEEDS-APPROVAL` entries — if found, STOP and present to user before spawning the next domain
|
|
231
|
+
2. If a CHECKPOINT is reached per `integration-points.md`, verify contract compliance (see Step 4) before proceeding to the next wave/domain
|
|
232
|
+
3. Update `.gsd-t/progress.md` with domain completion status
|
|
233
|
+
4. **Adaptive Replan Check** (per `adaptive-replan-contract.md`) — run after EVERY domain completes, before dispatching the next domain:
|
|
234
|
+
|
|
235
|
+
a. **Read domain summaries**: Read all `.gsd-t/domains/{completed-domain}/task-*-summary.md` files. Extract every `**Constraints discovered**:` field. If ALL are empty or "none", skip to the next domain (fast path — no replan needed).
|
|
236
|
+
|
|
237
|
+
b. **Assess affected domains** — two modes:
|
|
238
|
+
- **Graph available** (`.gsd-t/graph/meta.json` exists): For each changed module mentioned in the constraints, run `query('getImporters', { file })` to find which remaining domains import it. Also run `query('getDomainBoundaryViolations', {})` to check if constraint changes affect domain boundaries. Scope replan to ONLY those domains.
|
|
239
|
+
- **Graph unavailable** (fallback): Check ALL remaining unexecuted domains' `tasks.md` files — less precise but functional.
|
|
240
|
+
|
|
241
|
+
c. **Check for invalidated assumptions**: Read each affected remaining domain's `.gsd-t/domains/{domain}/tasks.md`. For each task, check whether any assumption is invalidated by the discovered constraints (e.g., wrong column name, deprecated API, wrong library, missing prerequisite, throughput limits).
|
|
242
|
+
|
|
243
|
+
d. **If invalidated assumptions found**: Revise the affected domain's `tasks.md` on disk. Append a Revision block at the end of the file (do NOT overwrite existing tasks — append only):
|
|
244
|
+
```markdown
|
|
245
|
+
## Revision (Replan Cycle {N})
|
|
246
|
+
- **Trigger**: {completed-domain} — constraint discovered during execution
|
|
247
|
+
- **Constraint**: {exact constraint text from summary}
|
|
248
|
+
- **Changes**: {what was revised in this domain's tasks — list specific task IDs and what changed}
|
|
249
|
+
- **Rationale**: {why this revision is needed — what would break without it}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
e. **Increment replan cycle counter** (track as `REPLAN_CYCLES` in orchestrator state, starting at 0).
|
|
253
|
+
|
|
254
|
+
f. **Cycle guard**: If `REPLAN_CYCLES > 2`, STOP and pause for user input:
|
|
255
|
+
"Replan cycle limit (2) exceeded. {N} constraints are still propagating. Please review `.gsd-t/domains/*/tasks.md` and resolve manually, then re-run execute."
|
|
256
|
+
|
|
257
|
+
g. **Log to Decision Log** in `.gsd-t/progress.md`: `- {date}: [replan] Cycle {N} — {completed-domain} constraint propagated to {list of affected domains}: {brief constraint summary}`
|
|
258
|
+
|
|
259
|
+
h. The revised `tasks.md` files are now on disk — the next domain's dispatcher will read the updated version automatically (disk-based handoff, no in-memory state sharing needed).
|
|
152
260
|
|
|
153
261
|
### Team Mode (when agent teams are enabled)
|
|
154
|
-
Spawn teammates for domains within the same wave. Only domains in the same wave can run in parallel — do not spawn teammates for domains in different waves simultaneously
|
|
262
|
+
Spawn teammates for domains within the same wave. Only domains in the same wave can run in parallel — do not spawn teammates for domains in different waves simultaneously. Each teammate uses the **domain task-dispatcher pattern** — one subagent per task within their domain (same as solo mode).
|
|
155
263
|
|
|
156
264
|
```
|
|
157
265
|
Create an agent team for execution:
|
|
@@ -173,16 +281,37 @@ RULES FOR ALL TEAMMATES:
|
|
|
173
281
|
- Tests are part of the deliverable, not a follow-up
|
|
174
282
|
- If a task is marked BLOCKED, message the lead and wait
|
|
175
283
|
- Run the Pre-Commit Gate checklist from CLAUDE.md BEFORE every commit — update all affected docs
|
|
176
|
-
- After completing each task, message the lead with:
|
|
177
|
-
"DONE: {domain} Task {N} - {summary of what was created/modified}"
|
|
178
|
-
- If you need to deviate from a contract, STOP and message the lead
|
|
179
284
|
- **Commit immediately after each task**: `feat({domain}/task-{N}): {description}` — do NOT batch commits
|
|
180
285
|
- **Deviation Rules**: (1) Bug blocking progress → fix, 3 attempts max; (2) Missing dependency → add minimum needed; (3) Blocker → fix and log to deferred-items.md; (4) Architectural change → STOP, message lead, never self-approve
|
|
181
286
|
|
|
287
|
+
**Task-dispatcher pattern per teammate:**
|
|
288
|
+
For each task in your domain's tasks.md (in order, skip completed):
|
|
289
|
+
1. Load prior summaries: read up to 5 most recent `.gsd-t/domains/{your-domain}/task-*-summary.md` files
|
|
290
|
+
2. Load graph context for task's files (if .gsd-t/graph/meta.json exists)
|
|
291
|
+
3. Spawn one Task subagent (model: sonnet) with ONLY:
|
|
292
|
+
- scope.md, relevant contracts, the single task, graph context, prior summaries
|
|
293
|
+
- Instruction to write task summary to `.gsd-t/domains/{domain}/task-{id}-summary.md`
|
|
294
|
+
(format per fresh-dispatch-contract.md Task Summary Format)
|
|
295
|
+
4. After task subagent returns, read the summary and pass it as prior context to the next task
|
|
296
|
+
5. After completing each task, message the lead with:
|
|
297
|
+
"DONE: {domain} Task {N} - {summary of what was created/modified}"
|
|
298
|
+
6. If you need to deviate from a contract, STOP and message the lead
|
|
299
|
+
|
|
182
300
|
Teammate assignments:
|
|
183
|
-
- Teammate "{domain-1}": Execute .gsd-t/domains/{domain-1}/tasks.md
|
|
184
|
-
- Teammate "{domain-2}": Execute .gsd-t/domains/{domain-2}/tasks.md
|
|
185
|
-
- Teammate "{domain-3}": Execute .gsd-t/domains/{domain-3}/tasks.md
|
|
301
|
+
- Teammate "{domain-1}": Execute .gsd-t/domains/{domain-1}/tasks.md (task-dispatcher pattern, isolated worktree)
|
|
302
|
+
- Teammate "{domain-2}": Execute .gsd-t/domains/{domain-2}/tasks.md (task-dispatcher pattern, isolated worktree)
|
|
303
|
+
- Teammate "{domain-3}": Execute .gsd-t/domains/{domain-3}/tasks.md (task-dispatcher pattern, isolated worktree)
|
|
304
|
+
|
|
305
|
+
**Worktree isolation (per domain teammate):**
|
|
306
|
+
Each domain teammate MUST be spawned with `isolation: "worktree"` on the Agent tool:
|
|
307
|
+
```
|
|
308
|
+
Agent({
|
|
309
|
+
prompt: "{domain execution prompt — include: 'You are working in an isolated git worktree. All your changes are isolated to this worktree branch. Do not push; the lead will merge your branch after all domains complete.'}",
|
|
310
|
+
isolation: "worktree"
|
|
311
|
+
})
|
|
312
|
+
```
|
|
313
|
+
Each teammate works in its own isolated copy of the repository. Changes from one domain do not affect another domain's working tree. This is required for parallel safety — see `.gsd-t/contracts/worktree-isolation-contract.md`.
|
|
314
|
+
|
|
186
315
|
Lead responsibilities (QA is handled via Task subagent — spawn one after each domain checkpoint):
|
|
187
316
|
- Use delegate mode (Shift+Tab)
|
|
188
317
|
- Track completions from teammate messages
|
|
@@ -192,6 +321,82 @@ Lead responsibilities (QA is handled via Task subagent — spawn one after each
|
|
|
192
321
|
3. Unblock waiting teammates
|
|
193
322
|
- Update .gsd-t/progress.md after each completion
|
|
194
323
|
- Resolve any contract conflicts immediately
|
|
324
|
+
|
|
325
|
+
**Sequential Merge Protocol (lead runs after ALL domain agents complete):**
|
|
326
|
+
|
|
327
|
+
Once all domain teammates report completion, the lead performs sequential atomic merges. This is the critical integration step — see `.gsd-t/contracts/worktree-isolation-contract.md` for the full merge protocol.
|
|
328
|
+
|
|
329
|
+
1. **Determine merge order**: Read `.gsd-t/contracts/integration-points.md` — use the dependency graph to sort domains. Domains with no upstream dependencies merge first. Example: if domain-A has no deps and domain-B depends on domain-A's output, merge order is [domain-A, domain-B].
|
|
330
|
+
|
|
331
|
+
2. **For each domain (in dependency order)**:
|
|
332
|
+
|
|
333
|
+
a. **File ownership validation (pre-merge)**: Check files the domain agent modified against the domain's `.gsd-t/domains/{domain}/scope.md`:
|
|
334
|
+
- If `.gsd-t/graph/meta.json` exists: run `query('getDomainBoundaryViolations', { domain })` — flag any files modified outside the domain's declared ownership
|
|
335
|
+
- If graph unavailable: list files changed in the worktree branch via `git diff --name-only` and compare against scope.md manually
|
|
336
|
+
- If violations found: log them in `.gsd-t/progress.md` as `[violation] {domain}: modified {file} outside scope`, but do NOT block merge — flag for immediate review after merge
|
|
337
|
+
|
|
338
|
+
b. **Merge the domain's worktree branch**:
|
|
339
|
+
```bash
|
|
340
|
+
# The worktree branch name is returned by the Agent tool when isolation: "worktree" is used
|
|
341
|
+
git merge --no-ff {domain-worktree-branch} -m "integrate({domain}): merge worktree branch"
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
c. **Contract validation (post-merge)**: Read each contract in `.gsd-t/contracts/` — verify the merged code still satisfies all contract shapes (API shapes, schemas, interfaces). If a contract is violated, log it immediately.
|
|
345
|
+
|
|
346
|
+
d. **Run integration tests**:
|
|
347
|
+
```bash
|
|
348
|
+
node --test test/
|
|
349
|
+
# or project's test command from package.json
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
e. **If tests PASS**: Continue to the next domain in merge order.
|
|
353
|
+
|
|
354
|
+
f. **If tests FAIL**: Roll back this domain's merge:
|
|
355
|
+
```bash
|
|
356
|
+
git reset --hard HEAD~1
|
|
357
|
+
# or: git revert HEAD --no-edit
|
|
358
|
+
```
|
|
359
|
+
Log failure: `[rollback] {domain}: merge rolled back — integration tests failed after merge`
|
|
360
|
+
Record in `.gsd-t/progress.md` Decision Log.
|
|
361
|
+
Continue with remaining domains (other domains' merges are not affected).
|
|
362
|
+
|
|
363
|
+
3. **Post-merge ownership report**: After all merges complete (successful or rolled back), log a summary in `.gsd-t/progress.md`:
|
|
364
|
+
```
|
|
365
|
+
## Worktree Merge Summary — {date}
|
|
366
|
+
- {domain-1}: MERGED | tests: PASS | violations: {N}
|
|
367
|
+
- {domain-2}: ROLLED BACK | reason: integration tests failed
|
|
368
|
+
- {domain-3}: MERGED | tests: PASS | violations: 0
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
**Worktree Cleanup (MANDATORY — run after merge protocol, success or failure):**
|
|
372
|
+
|
|
373
|
+
After all merges complete (whether all passed, some rolled back, or errors occurred):
|
|
374
|
+
|
|
375
|
+
1. List all worktree branches created during this execution run:
|
|
376
|
+
```bash
|
|
377
|
+
git worktree list
|
|
378
|
+
git branch --list "gsd-t-worktree-*"
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
2. Remove each domain worktree:
|
|
382
|
+
```bash
|
|
383
|
+
git worktree remove --force {worktree-path}
|
|
384
|
+
git branch -D {worktree-branch}
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
3. **Orphaned worktree detection**: If any worktrees remain after cleanup (can happen if an agent crashed):
|
|
388
|
+
```bash
|
|
389
|
+
git worktree prune
|
|
390
|
+
```
|
|
391
|
+
Log: `[cleanup] Pruned {N} orphaned worktrees via git worktree prune`
|
|
392
|
+
|
|
393
|
+
4. Verify no worktrees remain except the main working tree:
|
|
394
|
+
```bash
|
|
395
|
+
git worktree list
|
|
396
|
+
# should show only: {main-path} {commit} [branch]
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
Cleanup is not optional — orphaned worktrees waste disk space and can confuse subsequent executions. Always run cleanup, even if earlier steps failed.
|
|
195
400
|
```
|
|
196
401
|
|
|
197
402
|
## Step 4: Checkpoint Handling
|
package/commands/gsd-t-help.md
CHANGED
|
@@ -39,8 +39,8 @@ MILESTONE WORKFLOW [auto] = in wave
|
|
|
39
39
|
test-sync [auto] Sync tests with code changes
|
|
40
40
|
qa [auto] QA agent — test generation, execution, gap reporting
|
|
41
41
|
integrate [auto] Wire domains together at boundaries
|
|
42
|
-
verify [auto] Run quality gates
|
|
43
|
-
complete-milestone [auto] Archive milestone + git tag
|
|
42
|
+
verify [auto] Run quality gates → auto-invokes complete-milestone
|
|
43
|
+
complete-milestone [auto] Archive milestone + git tag (auto-invoked by verify)
|
|
44
44
|
|
|
45
45
|
AUTOMATION Auto
|
|
46
46
|
───────────────────────────────────────────────────────────────────────────────
|
|
@@ -231,10 +231,12 @@ Use these when user asks for help on a specific command:
|
|
|
231
231
|
- **Use when**: Architectural decisions need exploration
|
|
232
232
|
|
|
233
233
|
### plan
|
|
234
|
-
- **Summary**: Create atomic task lists for each domain
|
|
234
|
+
- **Summary**: Create atomic task lists for each domain (each task must fit in one context window)
|
|
235
235
|
- **Auto-invoked**: Yes (in wave, after discuss)
|
|
236
236
|
- **Creates**: `.gsd-t/domains/*/tasks.md`
|
|
237
237
|
- **Use when**: Ready to define specific implementation tasks
|
|
238
|
+
- **Note (M22)**: Tasks auto-split if estimated scope exceeds 70% context window — guarantees fresh dispatch works
|
|
239
|
+
- **Note (M26)**: Pre-mortem step now also reads rules.jsonl for historical failure patterns via getPreMortemRules
|
|
238
240
|
|
|
239
241
|
### impact
|
|
240
242
|
- **Summary**: Analyze downstream effects of planned changes
|
|
@@ -247,6 +249,8 @@ Use these when user asks for help on a specific command:
|
|
|
247
249
|
- **Auto-invoked**: Yes (in wave, after impact)
|
|
248
250
|
- **Updates**: Domain tasks, progress.md, source code
|
|
249
251
|
- **Use when**: Ready to implement
|
|
252
|
+
- **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.
|
|
253
|
+
- **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.
|
|
250
254
|
|
|
251
255
|
### test-sync
|
|
252
256
|
- **Summary**: Keep tests aligned with code changes
|
|
@@ -267,27 +271,32 @@ Use these when user asks for help on a specific command:
|
|
|
267
271
|
- **Use when**: Domains are complete and need to work together
|
|
268
272
|
|
|
269
273
|
### verify
|
|
270
|
-
- **Summary**: Run quality gates across all dimensions
|
|
274
|
+
- **Summary**: Run quality gates across all dimensions, including goal-backward behavior verification
|
|
271
275
|
- **Auto-invoked**: Yes (in wave, after integrate)
|
|
272
276
|
- **Creates**: `.gsd-t/verify-report.md`
|
|
273
277
|
- **Use when**: Checking that milestone meets requirements
|
|
278
|
+
- **Note (M22)**: Goal-backward verification step added — checks for placeholder implementations (console.log/TODO/hardcoded returns) after structural gates pass
|
|
274
279
|
|
|
275
280
|
### complete-milestone
|
|
276
281
|
- **Summary**: Archive milestone documentation and create git tag
|
|
277
|
-
- **Auto-invoked**: Yes (
|
|
282
|
+
- **Auto-invoked**: Yes — by verify (Step 8, all autonomy levels) and in wave
|
|
278
283
|
- **Creates**: `.gsd-t/milestones/{name}/`, git tag
|
|
279
|
-
- **Use when**:
|
|
284
|
+
- **Use when**: Auto-runs after verify passes. Can also be invoked standalone to manually close a milestone.
|
|
285
|
+
- **Note (M22)**: Goal-backward gate runs as final check before archiving — blocks completion if placeholders remain
|
|
286
|
+
- **Note (M26)**: Distillation extended with rule engine evaluation, patch candidate generation, promotion gate checks, graduation, consolidation, and quality budget governance
|
|
280
287
|
|
|
281
288
|
### wave
|
|
282
|
-
- **Summary**: Run complete cycle automatically: partition through complete
|
|
289
|
+
- **Summary**: Run complete cycle automatically: partition through verify+complete
|
|
283
290
|
- **Auto-invoked**: No (user triggers)
|
|
284
|
-
- **Runs**: partition → discuss → plan → impact → execute → test-sync → integrate → verify
|
|
291
|
+
- **Runs**: partition → discuss → plan → impact → execute → test-sync → integrate → verify+complete
|
|
285
292
|
- **Use when**: Ready to execute a full milestone hands-off
|
|
286
293
|
|
|
287
294
|
### status
|
|
288
|
-
- **Summary**: Show current progress across all domains
|
|
295
|
+
- **Summary**: Show current progress across all domains, including token breakdown by domain/task/phase, global ELO and cross-project rankings
|
|
289
296
|
- **Auto-invoked**: No
|
|
290
|
-
- **
|
|
297
|
+
- **Note (M22)**: Displays context observability data — token usage by domain, avg tokens/task, peak Ctx% per domain
|
|
298
|
+
- **Note (M27)**: Displays global ELO and cross-project rankings when global metrics exist
|
|
299
|
+
- **Reads**: All `.gsd-t/` files, `~/.claude/metrics/` (global metrics)
|
|
291
300
|
- **Use when**: Need to see where things stand
|
|
292
301
|
|
|
293
302
|
### resume
|
|
@@ -316,6 +325,12 @@ Use these when user asks for help on a specific command:
|
|
|
316
325
|
- **Creates**: `.gsd-t/dashboard.pid` (when starting server)
|
|
317
326
|
- **Use when**: Monitoring live agent activity during execute/wave phases; run `gsd-t-visualize stop` to stop the server
|
|
318
327
|
|
|
328
|
+
### metrics
|
|
329
|
+
- **Summary**: View task telemetry, process ELO, signal distribution, domain health, and cross-project comparison (with `--cross-project` flag)
|
|
330
|
+
- **Auto-invoked**: No
|
|
331
|
+
- **Reads**: `.gsd-t/metrics/task-metrics.jsonl`, `.gsd-t/metrics/rollup.jsonl`, `~/.claude/metrics/` (when `--cross-project`)
|
|
332
|
+
- **Use when**: Reviewing process health, first-pass rates, ELO trends, anomaly flags, or comparing signal distributions across projects
|
|
333
|
+
|
|
319
334
|
### debug
|
|
320
335
|
- **Summary**: Systematic debugging with persistent state
|
|
321
336
|
- **Auto-invoked**: No
|
|
@@ -50,9 +50,26 @@ For each contract file:
|
|
|
50
50
|
|
|
51
51
|
Fix any mismatches BEFORE proceeding to integration.
|
|
52
52
|
|
|
53
|
+
## Step 2.5: Worktree Merge Status Check
|
|
54
|
+
|
|
55
|
+
Before wiring integration points, check whether team mode execution left any domains with rolled-back worktree merges:
|
|
56
|
+
|
|
57
|
+
1. Read `.gsd-t/progress.md` — look for `[rollback]` entries in the Decision Log from the execute phase
|
|
58
|
+
2. If any domains were rolled back: list them and their failure reasons before proceeding
|
|
59
|
+
3. Integration point wiring should only proceed for domains whose worktree merges PASSED — rolled-back domains are not yet in the main working tree
|
|
60
|
+
|
|
61
|
+
If rolled-back domains exist, report them to the user (or if Level 3: log to `.gsd-t/deferred-items.md` as `[integration-gap] {domain}: not yet merged — worktree rollback during execute`). Do NOT attempt to re-merge rolled-back domains here; that requires re-running execute for the affected domain.
|
|
62
|
+
|
|
53
63
|
## Step 3: Wire Integration Points
|
|
54
64
|
|
|
55
|
-
Work through each integration point in `integration-points.md
|
|
65
|
+
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
|
+
|
|
67
|
+
**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`:
|
|
68
|
+
1. Sort domains by dependency order (from integration-points.md)
|
|
69
|
+
2. Merge domain A's branch → run tests → merge domain B's branch → run tests
|
|
70
|
+
3. If tests fail after a merge, roll back that domain's merge and log the failure
|
|
71
|
+
4. Contract validation runs between merges
|
|
72
|
+
5. All temporary branches cleaned up after integration completes
|
|
56
73
|
|
|
57
74
|
For each connection:
|
|
58
75
|
1. Identify the producing domain (provides the interface)
|
|
@@ -105,8 +122,11 @@ Spawn a QA subagent via the Task tool to verify contract compliance at all domai
|
|
|
105
122
|
Task subagent (general-purpose, model: haiku):
|
|
106
123
|
"Run contract compliance tests for this integration. Read .gsd-t/contracts/ for all contract definitions.
|
|
107
124
|
Test every domain boundary: verify that producers and consumers match their contract shapes.
|
|
108
|
-
Run
|
|
109
|
-
|
|
125
|
+
Run ALL configured test suites — detect and run every one:
|
|
126
|
+
a. Unit tests (vitest/jest/mocha): run the full suite
|
|
127
|
+
b. E2E tests: check for playwright.config.* or cypress.config.* — if found, run the FULL E2E suite
|
|
128
|
+
c. NEVER skip E2E when a config file exists. Running only unit tests is a QA FAILURE.
|
|
129
|
+
Report: 'Unit: X/Y pass | E2E: X/Y pass (or N/A if no config) | Boundary: pass/fail by contract'"
|
|
110
130
|
```
|
|
111
131
|
|
|
112
132
|
**OBSERVABILITY LOGGING (MANDATORY):**
|
|
@@ -117,8 +137,13 @@ After subagent returns — run via Bash:
|
|
|
117
137
|
Compute tokens and compaction:
|
|
118
138
|
- No compaction (TOK_END >= TOK_START): `TOKENS=$((TOK_END-TOK_START))`, COMPACTED=null
|
|
119
139
|
- Compaction detected (TOK_END < TOK_START): `TOKENS=$(((TOK_MAX-TOK_START)+TOK_END))`, COMPACTED=$DT_END
|
|
120
|
-
|
|
121
|
-
|
|
140
|
+
Compute context utilization — run via Bash:
|
|
141
|
+
`if [ "${CLAUDE_CONTEXT_TOKENS_MAX:-0}" -gt 0 ]; then CTX_PCT=$(echo "scale=1; ${CLAUDE_CONTEXT_TOKENS_USED:-0} * 100 / ${CLAUDE_CONTEXT_TOKENS_MAX}" | bc); else CTX_PCT="N/A"; fi`
|
|
142
|
+
Alert on context thresholds (display to user inline):
|
|
143
|
+
- If CTX_PCT >= 85: `echo "🔴 CRITICAL: Context at ${CTX_PCT}% — compaction likely. Task MUST be split."`
|
|
144
|
+
- If CTX_PCT >= 70: `echo "⚠️ WARNING: Context at ${CTX_PCT}% — approaching compaction threshold. Consider splitting in plan."`
|
|
145
|
+
Append to `.gsd-t/token-log.md` (create with header `| Datetime-start | Datetime-end | Command | Step | Model | Duration(s) | Notes | Tokens | Compacted | Domain | Task | Ctx% |` if missing):
|
|
146
|
+
`| {DT_START} | {DT_END} | gsd-t-integrate | Step 5 | haiku | {DURATION}s | {pass/fail}, {N} boundaries tested | {TOKENS} | {COMPACTED} | | | {CTX_PCT} |`
|
|
122
147
|
If QA found issues, append each to `.gsd-t/qa-issues.md` (create with header `| Date | Command | Step | Model | Duration(s) | Severity | Finding |` if missing):
|
|
123
148
|
`| {DT_START} | gsd-t-integrate | Step 5 | haiku | {DURATION}s | {severity} | {finding} |`
|
|
124
149
|
|
|
@@ -145,9 +170,12 @@ Integration is where the real system takes shape. Verify documentation matches r
|
|
|
145
170
|
After integration and doc ripple, verify everything works together:
|
|
146
171
|
|
|
147
172
|
1. **Update tests**: Add or update integration tests for newly wired domain boundaries
|
|
148
|
-
2. **Run
|
|
173
|
+
2. **Run ALL configured test suites** — detect and run every one:
|
|
174
|
+
a. Unit/integration tests (vitest/jest/mocha)
|
|
175
|
+
b. If `playwright.config.*` exists → run `npx playwright test` (full suite, not just affected specs)
|
|
176
|
+
c. Unit tests alone are NEVER sufficient when E2E exists
|
|
177
|
+
d. Report: "Unit: X/Y pass | E2E: X/Y pass"
|
|
149
178
|
3. **Verify passing**: All tests must pass. If any fail, fix before proceeding (up to 2 attempts)
|
|
150
|
-
4. **Run E2E tests**: If an E2E framework exists, run the full E2E suite — integration is where end-to-end flows break
|
|
151
179
|
5. **Smoke test results**: Ensure the Step 4 smoke test results are still valid after any fixes
|
|
152
180
|
|
|
153
181
|
## Step 8: Handle Integration Issues
|