cc-workspace 5.2.2 → 5.2.4
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 +54 -6
- package/README.md +18 -6
- package/bin/cli.js +2 -2
- package/global-skills/agents/e2e-validator.md +3 -3
- package/global-skills/agents/implementer.md +43 -39
- package/global-skills/agents/team-lead.md +15 -13
- package/global-skills/dispatch-feature/SKILL.md +98 -36
- package/global-skills/dispatch-feature/references/anti-patterns.md +16 -8
- package/global-skills/dispatch-feature/references/rollback-protocol.md +13 -0
- package/global-skills/dispatch-feature/references/spawn-templates.md +55 -61
- package/global-skills/hooks/test_hooks.sh +6 -6
- package/global-skills/hooks/validate-spawn-prompt.sh +12 -6
- package/global-skills/incident-debug/SKILL.md +1 -1
- package/global-skills/qa-ruthless/SKILL.md +1 -1
- package/global-skills/rules/model-routing.md +4 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,20 +1,68 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [5.2.3] — 2026-03-10
|
|
4
|
+
|
|
5
|
+
### One implementer per commit unit + User review before commit
|
|
6
|
+
|
|
7
|
+
Two architectural changes to the dispatch workflow:
|
|
8
|
+
|
|
9
|
+
**One teammate per commit unit** (was: one per repo)
|
|
10
|
+
- Eliminates the unreliable "signal and wait" pattern where `SendMessage` doesn't
|
|
11
|
+
actually block the model — the implementer would continue without waiting.
|
|
12
|
+
- Each implementer now handles exactly ONE commit unit then STOPS.
|
|
13
|
+
- The team lead spawns a new implementer for each subsequent commit unit.
|
|
14
|
+
- Cross-repo parallelism is preserved; intra-repo is strictly sequential with user gate.
|
|
15
|
+
|
|
16
|
+
**Zero commits by implementer** (was: implementer commits, team lead verifies)
|
|
17
|
+
- Implementers write code and run tests but NEVER run `git add` or `git commit`.
|
|
18
|
+
- A `PreToolUse` hook in implementer frontmatter physically blocks `git add`/`git commit`.
|
|
19
|
+
- After micro-QA passes, the team lead presents changes to the user for review.
|
|
20
|
+
- The team lead commits via Bash only after user approval.
|
|
21
|
+
- Session JSON now tracks `user_committed` and `files_modified` per commit unit.
|
|
22
|
+
|
|
23
|
+
**Files changed:**
|
|
24
|
+
- `agents/implementer.md` — single commit unit scope, no-commit rules, PreToolUse hook
|
|
25
|
+
- `dispatch-feature/SKILL.md` — Phase 3 (one per unit) + Phase 4 (user review + team lead commits)
|
|
26
|
+
- `dispatch-feature/references/spawn-templates.md` — all 3 templates + Haiku micro-QA
|
|
27
|
+
- `agents/team-lead.md` — rule 2, 4, 8, 10, 13 + commit tracking + workflow table
|
|
28
|
+
- `dispatch-feature/references/anti-patterns.md` — AP 3, 14, 17 updated + AP 18, 19 added
|
|
29
|
+
- `dispatch-feature/references/rollback-protocol.md` — uncommitted changes discard section
|
|
30
|
+
- `hooks/validate-spawn-prompt.sh` — updated checks for new signal protocol
|
|
31
|
+
- `rules/model-routing.md` — updated implementer model description
|
|
32
|
+
|
|
33
|
+
### Agent Teams — correct tool mechanism (previous)
|
|
34
|
+
|
|
35
|
+
The `Teammate` tool referenced in previous versions does not exist in Claude Code.
|
|
36
|
+
Agent Teams actually works via `TeamCreate` + `Agent(subagent_type, team_name)` + `SendMessage`.
|
|
37
|
+
|
|
38
|
+
- **Replaced all `Teammate` references with real Agent Teams tools** — team-lead,
|
|
39
|
+
e2e-validator, dispatch-feature, qa-ruthless, incident-debug now use `TeamCreate`,
|
|
40
|
+
`TeamDelete`, and `SendMessage` instead of the non-existent `Teammate` tool.
|
|
41
|
+
|
|
42
|
+
- **Teammate spawn workflow documented** — dispatch-feature now includes the explicit
|
|
43
|
+
3-step workflow: `TeamCreate` → `Agent(implementer, team_name)` → `SendMessage`.
|
|
44
|
+
|
|
45
|
+
- **validate-spawn-prompt hook updated** — matcher changed from `Teammate` to `Agent`,
|
|
46
|
+
with a `subagent_type` filter to only validate implementer spawns (skips Explore).
|
|
47
|
+
|
|
48
|
+
- **model-routing rule updated** — routing table now documents the real mechanism.
|
|
49
|
+
|
|
50
|
+
- **Auto-enable Agent Teams on install** — `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` is
|
|
51
|
+
now automatically injected into `~/.claude/settings.json` during install/update.
|
|
52
|
+
|
|
3
53
|
## [5.2.2] — 2026-03-09
|
|
4
54
|
|
|
5
55
|
### Agent Teams enforcement
|
|
6
56
|
|
|
7
57
|
- **Removed `Task(implementer)` from agent tools** — team-lead and e2e-validator can no
|
|
8
|
-
longer spawn implementers as subagents.
|
|
9
|
-
|
|
10
|
-
(SendMessage/wait loop, micro-QA between commits).
|
|
58
|
+
longer spawn implementers as subagents via Task. Implementers must be spawned through
|
|
59
|
+
Agent Teams (TeamCreate + Agent with team_name).
|
|
11
60
|
|
|
12
|
-
- **e2e-validator gains
|
|
13
|
-
through the proper teammate protocol
|
|
61
|
+
- **e2e-validator gains Agent Teams tools** — can now delegate `--fix` repairs
|
|
62
|
+
through the proper teammate protocol.
|
|
14
63
|
|
|
15
64
|
- **Auto-enable Agent Teams on install** — `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` is
|
|
16
65
|
now automatically injected into `~/.claude/settings.json` during `npx cc-workspace install`.
|
|
17
|
-
Users no longer need to set this environment variable manually.
|
|
18
66
|
|
|
19
67
|
## [5.2.1] — 2026-03-06
|
|
20
68
|
|
package/README.md
CHANGED
|
@@ -232,7 +232,7 @@ parallel in each repo via Agent Teams.
|
|
|
232
232
|
|------|-------|-------------|
|
|
233
233
|
| **Orchestrator** | Opus 4.6 | Clarifies, plans, manages git, delegates, micro-QA between commits. Writes in orchestrator/ only. |
|
|
234
234
|
| **Init** | Sonnet 4.6 | Diagnostic + interactive workspace configuration. Run once. |
|
|
235
|
-
| **Teammates** | Sonnet 4.6 | Implement in an isolated worktree. One per
|
|
235
|
+
| **Teammates** | Sonnet 4.6 | Implement in an isolated worktree. One per commit unit, writes code without committing, signals when ready for review. |
|
|
236
236
|
| **Data extractors** | Haiku | Read-only. Collect raw data (types, configs, logs). Never judge or conclude. |
|
|
237
237
|
| **QA** | Opus 4.6 | Hostile mode. Spawns Sonnet investigators. Min 3 problems found per service. |
|
|
238
238
|
| **Reviewer** | Opus 4.6 | Evidence-based code review. Scope check + architecture + constitution compliance. |
|
|
@@ -254,10 +254,10 @@ parallel in each repo via Agent Teams.
|
|
|
254
254
|
CLARIFY -> ask max 5 questions if ambiguity
|
|
255
255
|
PLAN -> write the plan in ./plans/, wait for approval
|
|
256
256
|
SESSION -> create session branches + worktrees in impacted repos (Phase 2.5)
|
|
257
|
-
SPAWN -> Wave 1: API/data (one teammate per
|
|
257
|
+
SPAWN -> Wave 1: API/data (one teammate per commit unit, user reviews between)
|
|
258
258
|
Wave 2: frontend with validated API contract
|
|
259
259
|
Wave 3: infra/config if applicable
|
|
260
|
-
MICRO-QA -> Bash tests + Haiku diff after EVERY commit
|
|
260
|
+
MICRO-QA -> Bash tests + Haiku diff after EVERY commit unit, user review, team lead commits
|
|
261
261
|
VERIFY -> cross-service-check + qa-ruthless + reviewer + (security-auditor)
|
|
262
262
|
MERGE -> merge-prep (PRs, conflict detection)
|
|
263
263
|
RETRO -> cycle-retrospective (mandatory)
|
|
@@ -272,7 +272,7 @@ dynamically checks if the target path is inside orchestrator/ before allowing wr
|
|
|
272
272
|
Protection layers:
|
|
273
273
|
1. `tools` whitelist in agent frontmatter
|
|
274
274
|
2. `PreToolUse` path-aware hook in agent frontmatter (team-lead only — teammates write freely in their worktrees)
|
|
275
|
-
3. `PreToolUse` Bash guard in implementer frontmatter (blocks git checkout on main working trees)
|
|
275
|
+
3. `PreToolUse` Bash guard in implementer frontmatter (blocks git checkout on main working trees + blocks git add/commit)
|
|
276
276
|
|
|
277
277
|
---
|
|
278
278
|
|
|
@@ -558,6 +558,18 @@ With `--chrome`, the agent:
|
|
|
558
558
|
|
|
559
559
|
---
|
|
560
560
|
|
|
561
|
+
## Changelog v5.2.0 -> v5.2.3
|
|
562
|
+
|
|
563
|
+
| # | Feature | Detail |
|
|
564
|
+
|---|---------|--------|
|
|
565
|
+
| 1 | **One teammate per commit unit** | Shift from one teammate per repo (handling all commits) to one implementer per commit unit. Eliminates the unreliable "signal and wait" pattern — each implementer handles exactly one unit then stops. |
|
|
566
|
+
| 2 | **User reviews before commit** | Implementers write code without committing. After micro-QA, the team lead presents changes to the user for review. The team lead commits only after user approval. |
|
|
567
|
+
| 3 | **PreToolUse hook blocks git add/commit** | Implementer frontmatter now includes a Bash hook that physically blocks `git add` and `git commit`. Even if the model ignores instructions, commits are prevented. |
|
|
568
|
+
| 4 | **Team lead commits** | The team lead (not the implementer) runs `git add` + `git commit` in the worktree after user approval. Commit tracking includes `user_committed` and `files_modified` fields. |
|
|
569
|
+
| 5 | **Sequential with user gate** | Intra-repo commit units are strictly sequential with a user review gate between each. Cross-repo parallelism is preserved. |
|
|
570
|
+
|
|
571
|
+
---
|
|
572
|
+
|
|
561
573
|
## Changelog v5.1.0 -> v5.2.0
|
|
562
574
|
|
|
563
575
|
| # | Feature | Detail |
|
|
@@ -590,8 +602,8 @@ With `--chrome`, the agent:
|
|
|
590
602
|
| # | Feature | Detail |
|
|
591
603
|
|---|---------|--------|
|
|
592
604
|
| 1 | **Opus has Bash** | `disallowedTools: Bash` removed from team-lead. Opus manages git (branches, worktrees) and micro-QA directly. |
|
|
593
|
-
| 2 | **One teammate per repo** | Shift from one subagent per commit unit to one teammate per repo. Sequential commits with signal+wait protocol. |
|
|
594
|
-
| 3 | **Micro-QA between every commit** | Bash tests + Haiku diff review after each commit before
|
|
605
|
+
| 2 | **One teammate per repo** | Shift from one subagent per commit unit to one teammate per repo. Sequential commits with signal+wait protocol. _(v5.2.3: changed to one teammate per commit unit with user review gate)_ |
|
|
606
|
+
| 3 | **Micro-QA between every commit** | Bash tests + Haiku diff review after each commit. _(v5.2.3: user reviews before team lead commits)_ |
|
|
595
607
|
| 4 | **Worktrees after plan validation** | Branches and worktrees created by Opus only after user approves the plan. |
|
|
596
608
|
| 5 | **Worktrees persist** | `/tmp/` worktrees live until `session close`. No pruning during active sessions. |
|
|
597
609
|
| 6 | **cycle-retrospective mandatory** | Required Phase 5 step, not optional. |
|
package/bin/cli.js
CHANGED
|
@@ -291,7 +291,7 @@ function generateSettings(orchDir) {
|
|
|
291
291
|
// guard-session-checkout.sh is NOT here — it's in implementer agent
|
|
292
292
|
// frontmatter only. team-lead doesn't have Bash, and teammates don't
|
|
293
293
|
// inherit orchestrator hooks.
|
|
294
|
-
withMatcher("
|
|
294
|
+
withMatcher("Agent", "validate-spawn-prompt.sh", 5)
|
|
295
295
|
],
|
|
296
296
|
SessionStart: [
|
|
297
297
|
withoutMatcher("orphan-cleanup.sh", 10),
|
|
@@ -331,7 +331,7 @@ You are the tech lead. You never write application code in repos.
|
|
|
331
331
|
You clarify, plan, manage git directly, delegate to teammates, run micro-QA.
|
|
332
332
|
|
|
333
333
|
## Security
|
|
334
|
-
- \`tools\`: Read, Write, Edit, Bash, Glob, Grep, Task(Explore),
|
|
334
|
+
- \`tools\`: Read, Write, Edit, Bash, Glob, Grep, Task(Explore), TeamCreate, TeamDelete, SendMessage
|
|
335
335
|
- Bash allowed for: git (branch, worktree, log), test/typecheck in /tmp/ worktrees (micro-QA)
|
|
336
336
|
- Hook \`PreToolUse\` path-aware: Write/Edit/MultiEdit only allowed in orchestrator/
|
|
337
337
|
|
|
@@ -11,7 +11,7 @@ description: >
|
|
|
11
11
|
model: opus
|
|
12
12
|
tools: >
|
|
13
13
|
Read, Write, Edit, Bash, Glob, Grep,
|
|
14
|
-
Task(Explore),
|
|
14
|
+
Task(Explore), TeamCreate, TeamDelete, SendMessage,
|
|
15
15
|
mcp__chrome-devtools__navigate_page,
|
|
16
16
|
mcp__chrome-devtools__click,
|
|
17
17
|
mcp__chrome-devtools__fill,
|
|
@@ -40,7 +40,7 @@ maxTurns: 150
|
|
|
40
40
|
|
|
41
41
|
## CRITICAL — Non-negotiable rules (read FIRST)
|
|
42
42
|
|
|
43
|
-
1. **NEVER modify application code** — delegate via `--fix` +
|
|
43
|
+
1. **NEVER modify application code** — delegate via `--fix` + Agent Teams (TeamCreate + Agent(implementer, team_name))
|
|
44
44
|
2. **No worktrees** — work directly on repos at the correct branch (merged or session)
|
|
45
45
|
3. **Health checks BEFORE tests** — never run tests against unhealthy services
|
|
46
46
|
4. **Always teardown** — `docker compose down -v` even on failure
|
|
@@ -242,7 +242,7 @@ Not tied to a specific plan — runs all existing E2E tests.
|
|
|
242
242
|
If failures exist after report and user confirms:
|
|
243
243
|
|
|
244
244
|
1. Read session JSON for the plan → get `worktree_path` per repo (still exists if session not closed)
|
|
245
|
-
2.
|
|
245
|
+
2. Create a team (`TeamCreate`), then spawn one **Agent(subagent_type: "implementer", team_name: ...)** per failing repo with:
|
|
246
246
|
- `worktree_path` from session JSON (or source branch if already merged)
|
|
247
247
|
- Failure details from the E2E report
|
|
248
248
|
- Session branch
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: implementer
|
|
3
|
-
prompt_version: 5.2.
|
|
3
|
+
prompt_version: 5.2.3
|
|
4
4
|
description: >
|
|
5
|
-
Implementation teammate for a single
|
|
6
|
-
from the orchestrator and
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
Implementation teammate for a single commit unit. Receives a ready worktree
|
|
6
|
+
from the orchestrator and ONE commit unit to implement. Writes code without
|
|
7
|
+
committing, signals when code is ready for review. No git setup, no git
|
|
8
|
+
add, no git commit. The team lead commits after user review.
|
|
9
9
|
model: sonnet
|
|
10
10
|
tools: Read, Write, Edit, MultiEdit, Bash, Glob, Grep, SendMessage
|
|
11
11
|
memory: project
|
|
@@ -19,6 +19,11 @@ hooks:
|
|
|
19
19
|
INPUT=$(cat)
|
|
20
20
|
CMD=$(echo "$INPUT" | jq -r '.tool_input.command // empty') || true
|
|
21
21
|
[ -z "$CMD" ] && exit 0
|
|
22
|
+
# Block git add/commit (user commits manually after review)
|
|
23
|
+
if echo "$CMD" | grep -qE 'git\s+(add|commit)\s'; then
|
|
24
|
+
printf '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"BLOCKED: Do NOT commit. Leave changes uncommitted for user review."}}'
|
|
25
|
+
exit 0
|
|
26
|
+
fi
|
|
22
27
|
# Block git checkout/switch in sibling repos (would disrupt main working tree)
|
|
23
28
|
if echo "$CMD" | grep -qE 'git\s+(-C\s+\.\./\S+\s+)?(checkout|switch)\s'; then
|
|
24
29
|
# Allow checkout inside /tmp/ worktrees (macOS: /tmp -> /private/tmp)
|
|
@@ -37,27 +42,26 @@ hooks:
|
|
|
37
42
|
## CRITICAL — Non-negotiable rules (read FIRST)
|
|
38
43
|
|
|
39
44
|
1. **Your worktree is already set up** — the orchestrator created it. Go directly to it. No git branch creation, no worktree creation.
|
|
40
|
-
2. **Handle
|
|
41
|
-
3. **Signal
|
|
42
|
-
4. **
|
|
45
|
+
2. **Handle the SINGLE commit unit you received** — you have ONE commit unit to implement. Focus on it entirely.
|
|
46
|
+
3. **Signal when code is written and tests pass — then STOP** — SendMessage with results, then stop. Do NOT wait for further instructions.
|
|
47
|
+
4. **NEVER run git add or git commit** — the team lead will commit after user review. Leave all changes uncommitted.
|
|
43
48
|
5. **NEVER git checkout outside your worktree** — your worktree path is in /tmp/. Never touch ../repo directly.
|
|
44
49
|
6. **Escalate architectural decisions** not covered by the plan — STOP and SendMessage immediately.
|
|
45
50
|
7. **Every new behavior needs tests** — at least one success test and one error test.
|
|
46
51
|
8. **Read the repo CLAUDE.md FIRST** — follow its conventions strictly.
|
|
47
|
-
9. **For each commit: read only its scope** — do not reload files unrelated to the current commit unit.
|
|
48
52
|
|
|
49
53
|
## Identity
|
|
50
54
|
|
|
51
|
-
You are a focused implementer for one
|
|
52
|
-
|
|
53
|
-
The orchestrator
|
|
55
|
+
You are a focused implementer for one commit unit. You write code and run tests for a single
|
|
56
|
+
commit unit, then signal that the code is ready for review.
|
|
57
|
+
The orchestrator and user will review your work and commit it.
|
|
54
58
|
|
|
55
59
|
## Startup — go directly to your worktree
|
|
56
60
|
|
|
57
61
|
The orchestrator provides:
|
|
58
62
|
- `worktree_path`: the /tmp/ path of your ready worktree
|
|
59
63
|
- `session_branch`: the branch already checked out in that worktree
|
|
60
|
-
-
|
|
64
|
+
- Your single commit unit to implement
|
|
61
65
|
|
|
62
66
|
```bash
|
|
63
67
|
# 1. Go to your worktree — it's ready
|
|
@@ -66,60 +70,60 @@ cd {worktree_path}
|
|
|
66
70
|
# 2. Verify you're on the right branch
|
|
67
71
|
git branch --show-current # must show session/{name}
|
|
68
72
|
|
|
69
|
-
# 3. Check what's already on the branch (from previous
|
|
73
|
+
# 3. Check what's already on the branch (from previous commits)
|
|
70
74
|
git log --oneline -5
|
|
71
75
|
|
|
72
|
-
# 4. Check for
|
|
76
|
+
# 4. Check for existing uncommitted changes
|
|
73
77
|
git status --short
|
|
74
|
-
#
|
|
78
|
+
# Uncommitted changes may exist from a previous unit — this is normal in this workflow.
|
|
79
|
+
# Assess: if they look like work from a previous unit, leave them. If junk, ask orchestrator.
|
|
75
80
|
```
|
|
76
81
|
|
|
77
82
|
**macOS note**: /tmp is a symlink to /private/tmp. Both paths are valid.
|
|
78
83
|
|
|
79
|
-
## Workflow — commit
|
|
84
|
+
## Workflow — single commit unit
|
|
80
85
|
|
|
81
|
-
### For
|
|
86
|
+
### For your commit unit:
|
|
82
87
|
|
|
83
|
-
**Phase 1: Load context
|
|
84
|
-
1. Read the repo CLAUDE.md (
|
|
85
|
-
2. Read only the files in scope for
|
|
88
|
+
**Phase 1: Load context**
|
|
89
|
+
1. Read the repo CLAUDE.md (apply its conventions throughout)
|
|
90
|
+
2. Read only the files in scope for your commit unit
|
|
86
91
|
3. Check git log to understand what previous commits already did — do NOT redo their work
|
|
87
92
|
|
|
88
93
|
**Phase 2: Implement**
|
|
89
|
-
1. Implement ONLY the tasks for
|
|
94
|
+
1. Implement ONLY the tasks for your commit unit
|
|
90
95
|
2. Run tests scoped to the changed area — fix regressions you introduce
|
|
91
96
|
3. Identify dead code exposed by your changes
|
|
92
97
|
|
|
93
|
-
**Phase 3:
|
|
98
|
+
**Phase 3: Verify (NO commit)**
|
|
94
99
|
```bash
|
|
95
|
-
|
|
96
|
-
git
|
|
100
|
+
# Review your changes
|
|
101
|
+
git status --short
|
|
102
|
+
git diff --stat
|
|
97
103
|
|
|
98
|
-
#
|
|
99
|
-
|
|
100
|
-
|
|
104
|
+
# Run tests on uncommitted changes
|
|
105
|
+
# (adapt to repo stack: php artisan test, npm test, go test, pytest, etc.)
|
|
106
|
+
|
|
107
|
+
# Do NOT run git add or git commit
|
|
101
108
|
```
|
|
102
109
|
|
|
103
|
-
If >300 lines changed:
|
|
104
|
-
|
|
110
|
+
If >300 lines changed: note this in your signal — the orchestrator may ask you to
|
|
111
|
+
restructure, but do NOT split into commits yourself.
|
|
105
112
|
|
|
106
|
-
**Phase 4: Signal and
|
|
113
|
+
**Phase 4: Signal and STOP**
|
|
107
114
|
```
|
|
108
115
|
SendMessage to orchestrator:
|
|
109
|
-
"
|
|
116
|
+
"code ready — {N files changed} — tests: {pass/fail} — {any blockers or dead code found}"
|
|
110
117
|
```
|
|
111
118
|
|
|
112
|
-
Then **
|
|
113
|
-
|
|
114
|
-
Orchestrator will respond either:
|
|
115
|
-
- "green light, proceed to commit N+1" → continue
|
|
116
|
-
- "fix this before commit N+1: {detail}" → fix and re-commit, then signal again
|
|
119
|
+
Then **STOP**. Your work is done. The orchestrator and user will review and commit.
|
|
117
120
|
|
|
118
|
-
###
|
|
121
|
+
### When your commit unit is done
|
|
119
122
|
```
|
|
120
123
|
SendMessage to orchestrator:
|
|
121
|
-
"
|
|
124
|
+
"code ready for commit {N} of {repo} — {summary of what was implemented}"
|
|
122
125
|
```
|
|
126
|
+
Then STOP. Do NOT run git add or git commit.
|
|
123
127
|
|
|
124
128
|
## Escalation protocol
|
|
125
129
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: team-lead
|
|
3
|
-
prompt_version: 5.2.
|
|
3
|
+
prompt_version: 5.2.3
|
|
4
4
|
description: >
|
|
5
5
|
Main orchestrator for multi-service workspaces. Clarifies specs,
|
|
6
6
|
plans in markdown, manages git (branches, worktrees) directly,
|
|
7
|
-
delegates implementation to one teammate per
|
|
8
|
-
via micro-QA
|
|
7
|
+
delegates implementation to one teammate per commit unit, tracks progress
|
|
8
|
+
via micro-QA, presents code for user review, commits after approval.
|
|
9
9
|
Never codes in repos — can write in orchestrator/ and run git commands.
|
|
10
10
|
Triggered via claude --agent team-lead.
|
|
11
11
|
model: opus
|
|
12
|
-
tools: Read, Write, Edit, Bash, Glob, Grep, Task(Explore),
|
|
12
|
+
tools: Read, Write, Edit, Bash, Glob, Grep, Task(Explore), TeamCreate, TeamDelete, SendMessage
|
|
13
13
|
memory: project
|
|
14
14
|
maxTurns: 200
|
|
15
15
|
hooks:
|
|
@@ -39,17 +39,18 @@ hooks:
|
|
|
39
39
|
## CRITICAL — Non-negotiable rules (read FIRST)
|
|
40
40
|
|
|
41
41
|
1. **NEVER write code in repos** — delegate ALL repo code work to teammates
|
|
42
|
-
2. **ONE teammate per
|
|
42
|
+
2. **ONE teammate per COMMIT UNIT** — one implementer per commit unit, sequentially within each repo
|
|
43
43
|
3. **Opus manages ALL git** — branches, worktrees, verification. Teammates receive a ready worktree path
|
|
44
|
-
4. **Micro-QA after EVERY commit** — Bash tests + Haiku diff review
|
|
44
|
+
4. **Micro-QA after EVERY commit unit, then ask user to review** — Bash tests + Haiku diff review, then present to user for approval before committing
|
|
45
45
|
5. **Worktrees live until session close** — never prune active session worktrees
|
|
46
46
|
6. **Full constitution in EVERY spawn prompt** — teammates don't receive it automatically
|
|
47
47
|
7. **UX standards for frontend teammates** — inject frontend-ux-standards.md content
|
|
48
|
-
8. **Sequential within a service** — commit N+1 only after commit N is micro-QA validated. Cross-service parallelism OK
|
|
48
|
+
8. **Sequential within a service** — commit N+1 only after commit N is micro-QA validated AND user has committed. Cross-service parallelism OK
|
|
49
49
|
9. **git branch, NEVER git checkout -b** in repos — checkout disrupts parallel sessions
|
|
50
|
-
10. **Teammates must run tests before signaling** — a "
|
|
50
|
+
10. **Teammates must run tests before signaling** — a "code ready" signal without test results is rejected. Re-spawn for retest
|
|
51
51
|
11. **Max 2 re-dispatches** per commit unit — then escalate to user, never loop
|
|
52
52
|
12. **Source branch from workspace.md** unless user specifies an override in initial prompt
|
|
53
|
+
13. **NEVER let implementer commit** — only the team lead commits, after user has reviewed the code
|
|
53
54
|
|
|
54
55
|
## Identity
|
|
55
56
|
|
|
@@ -115,11 +116,11 @@ Store the effective source branch in session.json under source_branch_override i
|
|
|
115
116
|
```
|
|
116
117
|
|
|
117
118
|
### Commit tracking
|
|
118
|
-
Update after each micro-QA:
|
|
119
|
+
Update after each micro-QA + user review:
|
|
119
120
|
```json
|
|
120
121
|
"commits": {
|
|
121
|
-
"1": { "status": "✅", "hash": "abc123", "qa": "OK" },
|
|
122
|
-
"2": { "status": "⏳", "hash": null, "qa": null }
|
|
122
|
+
"1": { "status": "✅", "hash": "abc123", "files_modified": ["src/foo.ts", "src/bar.ts"], "user_committed": true, "qa": "OK" },
|
|
123
|
+
"2": { "status": "⏳", "hash": null, "files_modified": null, "user_committed": false, "qa": null }
|
|
123
124
|
}
|
|
124
125
|
```
|
|
125
126
|
|
|
@@ -135,8 +136,8 @@ This table is your quick reference — **defer to the skill for specifics**.
|
|
|
135
136
|
| 2 — Plan | Write ./plans/{name}.md from _TEMPLATE.md | Wait for user validation |
|
|
136
137
|
| 2.5 — Git setup | `git branch` + `git worktree add` via Bash | Only after plan validation |
|
|
137
138
|
| 2.9 — Pre-dispatch | Verify branches + worktrees exist and are clean | Auto-fix simple cases |
|
|
138
|
-
| 3 — Dispatch | ONE
|
|
139
|
-
| 4 — Micro-QA |
|
|
139
|
+
| 3 — Dispatch | ONE teammate per COMMIT UNIT — user reviews between units, team lead commits after approval | See @dispatch-feature/references/spawn-templates.md |
|
|
140
|
+
| 4 — Micro-QA | Verify changes + tests + present to user for review. Team lead commits after user approval | See @dispatch-feature/SKILL.md Phase 4 |
|
|
140
141
|
| 5 — Post-impl | cross-service → qa-ruthless → reviewer → (security-auditor if needed) → merge-prep → retro | All mandatory except security-auditor |
|
|
141
142
|
|
|
142
143
|
## Rollback & failure handling
|
|
@@ -153,6 +154,7 @@ Quick reference:
|
|
|
153
154
|
- Plans, sessions, workspace.md, constitution.md — anything in orchestrator/
|
|
154
155
|
- Git commands on sibling repos (branch, worktree, log — never checkout on main trees)
|
|
155
156
|
- Test/typecheck commands in /tmp/ worktrees for micro-QA
|
|
157
|
+
- `git add` + `git commit` in /tmp/ worktrees AFTER user has approved the changes
|
|
156
158
|
|
|
157
159
|
## Memory hygiene
|
|
158
160
|
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: dispatch-feature
|
|
3
|
-
prompt_version: 5.2.
|
|
3
|
+
prompt_version: 5.2.3
|
|
4
4
|
description: >
|
|
5
5
|
Orchestrate multi-service feature implementation. Clarifies ambiguities,
|
|
6
6
|
explores repos directly (no upfront Haiku scan), writes a persistent
|
|
7
7
|
markdown plan, sets up git branches and worktrees after plan validation,
|
|
8
|
-
spawns one teammate per
|
|
9
|
-
|
|
8
|
+
spawns one teammate per commit unit with full context, runs micro-QA on
|
|
9
|
+
uncommitted changes, presents to user for review, then team lead commits
|
|
10
|
+
after approval. Runs cross-service-check, qa-ruthless, reviewer,
|
|
10
11
|
security-auditor (when needed), merge-prep, and cycle-retrospective.
|
|
11
12
|
Use whenever the user describes a feature, says "implement", "new feature",
|
|
12
13
|
"dispatch", "start dev", "launch teammates", or provides a spec.
|
|
13
14
|
argument-hint: "[feature description]"
|
|
14
15
|
context: fork
|
|
15
|
-
allowed-tools: Read, Write, Bash, Glob, Grep, Task,
|
|
16
|
+
allowed-tools: Read, Write, Bash, Glob, Grep, Task, TeamCreate, TeamDelete, SendMessage
|
|
16
17
|
---
|
|
17
18
|
|
|
18
19
|
# Dispatch Feature — Clarify, Plan, Git, Delegate, Track
|
|
@@ -121,7 +122,7 @@ commit units per repo, API contract (exact shapes), progress tracker.
|
|
|
121
122
|
|
|
122
123
|
### Commit unit sizing (CRITICAL — each unit = one teammate commit)
|
|
123
124
|
|
|
124
|
-
|
|
125
|
+
Each commit unit gets its own implementer. Size them for clarity:
|
|
125
126
|
|
|
126
127
|
| Service complexity | Recommended commit units |
|
|
127
128
|
|--------------------|--------------------------|
|
|
@@ -175,13 +176,34 @@ Verify via Bash for each repo. Abort and fix before proceeding:
|
|
|
175
176
|
|
|
176
177
|
Only proceed to Phase 3 once all checks pass.
|
|
177
178
|
|
|
178
|
-
## Phase 3: Dispatch — one teammate per
|
|
179
|
+
## Phase 3: Dispatch — one teammate per COMMIT UNIT
|
|
179
180
|
|
|
180
|
-
**ONE teammate per
|
|
181
|
-
|
|
181
|
+
**ONE teammate per commit unit.** Use `TeamCreate` to create a team for the session, then
|
|
182
|
+
spawn one implementer per commit unit via `Agent(subagent_type: "implementer", team_name: ...)`.
|
|
183
|
+
Each implementer receives ONLY its commit unit's tasks + a summary of previous units.
|
|
184
|
+
The implementer writes code without committing, signals when ready, then STOPS.
|
|
182
185
|
|
|
183
|
-
|
|
184
|
-
|
|
186
|
+
After the implementer signals "code ready":
|
|
187
|
+
1. Run micro-QA (Phase 4)
|
|
188
|
+
2. Present results to user for review (worktree path, diff, tests)
|
|
189
|
+
3. Wait for user approval
|
|
190
|
+
4. Team lead commits via Bash (git add + git commit in worktree)
|
|
191
|
+
5. Verify commit, update session.json, proceed to next unit
|
|
192
|
+
|
|
193
|
+
### Teammate spawn — workflow
|
|
194
|
+
|
|
195
|
+
```
|
|
196
|
+
1. TeamCreate(team_name: "session-{name}")
|
|
197
|
+
2. For each commit unit (sequentially within a repo):
|
|
198
|
+
a. Agent(subagent_type: "implementer", team_name: "session-{name}", prompt with ONE commit unit)
|
|
199
|
+
b. Wait for "code ready" signal
|
|
200
|
+
c. Run micro-QA (Phase 4 Steps 1-2)
|
|
201
|
+
d. Present to user for review (Phase 4 Step 3)
|
|
202
|
+
e. Wait for user approval
|
|
203
|
+
f. Team lead commits: git -C /tmp/{repo}-{session-name} add {files} && git commit -m "..."
|
|
204
|
+
g. Verify commit, update session.json
|
|
205
|
+
h. Proceed to next commit unit
|
|
206
|
+
```
|
|
185
207
|
|
|
186
208
|
### Teammate spawn prompt — context tiering
|
|
187
209
|
|
|
@@ -190,10 +212,10 @@ See @references/spawn-templates.md for full templates.
|
|
|
190
212
|
**Always inject (Tier 1):**
|
|
191
213
|
1. `worktree_path`: /tmp/{repo}-{session-name}/ — ready, no git setup needed
|
|
192
214
|
2. `session_branch`: session/{name}
|
|
193
|
-
3.
|
|
215
|
+
3. This commit unit's tasks ONLY + summary of what previous units implemented
|
|
194
216
|
4. Constitution rules (all from constitution.md, translated to English)
|
|
195
|
-
5. SignalInstruction: "
|
|
196
|
-
6. ScopeInstruction: "
|
|
217
|
+
5. SignalInstruction: "When code is written and tests pass, SendMessage: 'code ready — {files} — tests: {pass/fail}'. Then STOP. Do NOT run git add or git commit."
|
|
218
|
+
6. ScopeInstruction: "Read only files in scope for your commit unit."
|
|
197
219
|
|
|
198
220
|
**Conditional (Tier 2):**
|
|
199
221
|
- Frontend repo with UI → inject full frontend-ux-standards.md
|
|
@@ -201,7 +223,7 @@ See @references/spawn-templates.md for full templates.
|
|
|
201
223
|
- Frontend commits → inject API contract as TypeScript interfaces
|
|
202
224
|
|
|
203
225
|
**Never inject (Tier 3 — already in CLAUDE.md or agent):**
|
|
204
|
-
- Git workflow (teammate has no git responsibility)
|
|
226
|
+
- Git workflow (teammate has no git responsibility and MUST NOT commit)
|
|
205
227
|
- Generic anti-patterns
|
|
206
228
|
- Full workspace context
|
|
207
229
|
|
|
@@ -210,26 +232,28 @@ See @references/spawn-templates.md for full templates.
|
|
|
210
232
|
|
|
211
233
|
### Parallelism
|
|
212
234
|
|
|
213
|
-
- Different repos in same wave → spawn
|
|
214
|
-
- Same repo →
|
|
235
|
+
- Different repos in same wave → spawn commit units in parallel ✅
|
|
236
|
+
- Same repo → sequential, one commit unit at a time with user review gate ❌
|
|
215
237
|
|
|
216
238
|
### Wave execution
|
|
217
239
|
|
|
218
|
-
1. Spawn
|
|
219
|
-
2.
|
|
220
|
-
3.
|
|
221
|
-
4.
|
|
222
|
-
5.
|
|
240
|
+
1. Spawn wave 1 commit units (parallel across repos, sequential within each repo)
|
|
241
|
+
2. For each commit unit: implementer writes → micro-QA → user review → team lead commits
|
|
242
|
+
3. Wait for ALL wave 1 commit units to be user-committed
|
|
243
|
+
4. Collect validated API contracts from wave 1 results
|
|
244
|
+
5. Spawn wave 2 commit units with validated contracts
|
|
245
|
+
6. Repeat for wave 3
|
|
223
246
|
|
|
224
|
-
## Phase 4: Micro-QA
|
|
247
|
+
## Phase 4: Micro-QA + User review + Team lead commits
|
|
225
248
|
|
|
226
|
-
After each
|
|
249
|
+
After each implementer signals "code ready":
|
|
227
250
|
|
|
228
251
|
### Step 1 — Bash verification (Opus direct)
|
|
229
252
|
|
|
230
253
|
```bash
|
|
231
|
-
# 1. Verify
|
|
232
|
-
git -C /tmp/{repo}-{session-name}
|
|
254
|
+
# 1. Verify uncommitted changes exist
|
|
255
|
+
git -C /tmp/{repo}-{session-name} status --short
|
|
256
|
+
git -C /tmp/{repo}-{session-name} diff --stat
|
|
233
257
|
|
|
234
258
|
# 2. Run scoped tests — adapt command to repo stack:
|
|
235
259
|
# PHP/Laravel:
|
|
@@ -241,8 +265,8 @@ cd /tmp/{repo}-{session-name} && go test ./... 2>&1 | tail -20
|
|
|
241
265
|
# Python:
|
|
242
266
|
cd /tmp/{repo}-{session-name} && pytest {scope_path} -v 2>&1 | tail -30
|
|
243
267
|
|
|
244
|
-
# 3. Check for debug artifacts
|
|
245
|
-
git -C /tmp/{repo}-{session-name} diff
|
|
268
|
+
# 3. Check for debug artifacts in uncommitted changes
|
|
269
|
+
git -C /tmp/{repo}-{session-name} diff \
|
|
246
270
|
| grep -E "(console\.log|dd\(|var_dump|\.only\(|TODO|FIXME|debugger|dump\()" \
|
|
247
271
|
| head -20
|
|
248
272
|
```
|
|
@@ -251,22 +275,58 @@ git -C /tmp/{repo}-{session-name} diff HEAD~1 HEAD \
|
|
|
251
275
|
|
|
252
276
|
Use the Haiku micro-QA template from @references/spawn-templates.md (section "Haiku micro-QA subagent template").
|
|
253
277
|
|
|
254
|
-
Spawn Task(Explore, model: haiku) with that template, injecting
|
|
278
|
+
Spawn Task(Explore, model: haiku) with that template, injecting `git diff` output (uncommitted changes).
|
|
255
279
|
|
|
256
280
|
**Do NOT rephrase or shorten the template** — copy it verbatim from the reference file.
|
|
257
281
|
Haiku needs the exact structured prompt to return clean JSON.
|
|
258
282
|
|
|
259
|
-
###
|
|
283
|
+
### Step 3 — User review, then team lead commits
|
|
284
|
+
|
|
285
|
+
If Step 1 and Step 2 pass, present to the user:
|
|
286
|
+
|
|
287
|
+
```
|
|
288
|
+
## Commit unit {N}/{total} for {repo} — ready for review
|
|
289
|
+
|
|
290
|
+
📂 Worktree: /tmp/{repo}-{session-name}
|
|
291
|
+
📝 Files modified: {git diff --stat output}
|
|
292
|
+
✅ Tests: {pass/fail summary}
|
|
293
|
+
🔍 Micro-QA: {OK or issues}
|
|
294
|
+
|
|
295
|
+
You can review the code at the worktree path above.
|
|
296
|
+
Approve to commit, or request changes.
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
**WAIT for user approval.**
|
|
300
|
+
|
|
301
|
+
After user approves, the **team lead commits via Bash**:
|
|
302
|
+
```bash
|
|
303
|
+
git -C /tmp/{repo}-{session-name} add {files}
|
|
304
|
+
git -C /tmp/{repo}-{session-name} commit -m "type(scope): description"
|
|
305
|
+
|
|
306
|
+
# Verify commit
|
|
307
|
+
git -C /tmp/{repo}-{session-name} log --oneline -1
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
Update session.json with the commit hash:
|
|
311
|
+
```json
|
|
312
|
+
"commits": {
|
|
313
|
+
"N": { "status": "✅", "hash": "abc123", "files_modified": [...], "user_committed": true, "qa": "OK" }
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
If the user requests modifications → re-spawn implementer for the same commit unit with fix instructions.
|
|
318
|
+
|
|
319
|
+
### Decision (Steps 1-2)
|
|
260
320
|
|
|
261
321
|
| Bash | Haiku | Action |
|
|
262
322
|
|------|-------|--------|
|
|
263
|
-
| OK | OK |
|
|
264
|
-
| FAIL | any | Opus analyzes failure,
|
|
265
|
-
| OK | BLOCKER | Opus evaluates blocker severity,
|
|
323
|
+
| OK | OK | Present to user for review (Step 3). Team lead commits after approval |
|
|
324
|
+
| FAIL | any | Opus analyzes failure, re-spawns implementer with fix instructions OR escalates |
|
|
325
|
+
| OK | BLOCKER | Opus evaluates blocker severity, re-spawns with fix instructions or escalates |
|
|
266
326
|
|
|
267
327
|
Retry limit: max 2 per commit unit → escalate to user, stop the wave.
|
|
268
328
|
|
|
269
|
-
### Update after each commit
|
|
329
|
+
### Update after each commit unit
|
|
270
330
|
|
|
271
331
|
```bash
|
|
272
332
|
# Update plan progress tracker
|
|
@@ -274,7 +334,7 @@ Retry limit: max 2 per commit unit → escalate to user, stop the wave.
|
|
|
274
334
|
|
|
275
335
|
# Update session.json commits tracking
|
|
276
336
|
# Add session log entry:
|
|
277
|
-
# [HH:MM] {repo}-commit-{N}: {status}, {hash}, {N} files, tests {pass/fail}
|
|
337
|
+
# [HH:MM] {repo}-commit-{N}: {status}, {hash}, {N} files, tests {pass/fail}, user_committed: true
|
|
278
338
|
```
|
|
279
339
|
|
|
280
340
|
## Phase 5: Post-implementation (all mandatory)
|
|
@@ -306,8 +366,10 @@ For targeted fixes or single-repo work:
|
|
|
306
366
|
3. Check ./.sessions/ for active session JSON — worktrees should still exist in /tmp/
|
|
307
367
|
4. Read active plan — statuses and session log tell you where you are
|
|
308
368
|
5. Verify worktrees still exist: git worktree list for each repo
|
|
309
|
-
6.
|
|
310
|
-
|
|
369
|
+
6. Check `user_committed` field in session.json to determine where to resume:
|
|
370
|
+
- If last unit has `user_committed: true` → spawn next unit's implementer
|
|
371
|
+
- If last unit has `user_committed: false` or missing → check worktree for uncommitted changes, present to user for review
|
|
372
|
+
7. Resume from the appropriate step (implementer spawn, micro-QA, or user review)
|
|
311
373
|
|
|
312
374
|
## Anti-patterns
|
|
313
375
|
|
|
@@ -9,8 +9,9 @@ Reference file for dispatch-feature and team-lead. Loaded on-demand.
|
|
|
9
9
|
|
|
10
10
|
2. **NEVER skip clarify on ambiguous requests** — if in doubt, ask.
|
|
11
11
|
|
|
12
|
-
3. **NEVER spawn more than one teammate per
|
|
13
|
-
for
|
|
12
|
+
3. **NEVER spawn more than one teammate per commit unit for the same repo at the same time** —
|
|
13
|
+
commit units for the same repo are handled sequentially, one teammate at a time.
|
|
14
|
+
Two teammates on the same repo = guaranteed conflicts.
|
|
14
15
|
|
|
15
16
|
4. **NEVER skip the plan file** — everything is tracked on disk.
|
|
16
17
|
|
|
@@ -35,8 +36,8 @@ Reference file for dispatch-feature and team-lead. Loaded on-demand.
|
|
|
35
36
|
13. **NEVER use git checkout -b in repos** — use git branch {name} {source} (no checkout).
|
|
36
37
|
Checkout changes the working directory, which disrupts other sessions running in parallel.
|
|
37
38
|
|
|
38
|
-
14. **NEVER skip micro-QA between
|
|
39
|
-
Waiting until the final QA is too late — issues compound across
|
|
39
|
+
14. **NEVER skip micro-QA between commit units** — Bash tests + Haiku diff after every commit unit, before user review.
|
|
40
|
+
Waiting until the final QA is too late — issues compound across units.
|
|
40
41
|
|
|
41
42
|
15. **NEVER prune worktrees during an active session** — worktrees persist until session close.
|
|
42
43
|
The session-start-context.sh hook only cleans worktrees that are truly orphaned (no session JSON).
|
|
@@ -44,8 +45,14 @@ Reference file for dispatch-feature and team-lead. Loaded on-demand.
|
|
|
44
45
|
16. **NEVER over-split commit units** — 10+ commit units per service is excessive.
|
|
45
46
|
Sweet spot: 2-5 per repo. Each spawn has context loading overhead.
|
|
46
47
|
|
|
47
|
-
17. **NEVER
|
|
48
|
-
|
|
48
|
+
17. **NEVER spawn the next commit unit before user has committed the previous** — micro-QA must pass,
|
|
49
|
+
user must review and approve, team lead must commit — only then spawn the next unit's implementer.
|
|
50
|
+
|
|
51
|
+
18. **NEVER let implementer run git add or git commit** — the implementer writes code and runs tests.
|
|
52
|
+
The team lead commits after user review. The PreToolUse hook blocks git add/commit as a safety net.
|
|
53
|
+
|
|
54
|
+
19. **NEVER spawn the next commit unit before user has committed the previous** — each commit unit
|
|
55
|
+
requires: implementer writes code → micro-QA → user review → team lead commits → next unit.
|
|
49
56
|
|
|
50
57
|
## Common mistakes to watch for
|
|
51
58
|
|
|
@@ -56,8 +63,9 @@ Reference file for dispatch-feature and team-lead. Loaded on-demand.
|
|
|
56
63
|
| Plan has vague tasks like "implement feature" | Each task should have a clear input→output | Rewrite plan with specific tasks before dispatch |
|
|
57
64
|
| API contract has {} placeholder | Frontend can't build types | Complete the contract shapes before wave 2 |
|
|
58
65
|
| Two teammates spawned on same repo | Git conflicts guaranteed | Kill one, let the remaining handle all commits |
|
|
59
|
-
|
|
|
60
|
-
|
|
|
66
|
+
| Implementer runs git add/commit | Code committed without user review | PreToolUse hook should block it; if bypassed, reset with git reset HEAD~1 and re-present for review |
|
|
67
|
+
| Next unit spawned before user committed previous | Uncommitted changes from unit N conflict with unit N+1 | Wait for user approval + team lead commit before spawning next unit |
|
|
68
|
+
| No signal from teammate after implementation | Silent failure | Check worktree git status/diff, ask teammate to signal or escalate |
|
|
61
69
|
| Worktree missing after crash | git worktree list shows nothing | Recreate worktree from session branch: git worktree add /tmp/... session/{name} |
|
|
62
70
|
| Giant commit (500+ lines) | Unreadable PR | Note in session log; teammate should split next time |
|
|
63
71
|
| Commit unit not self-contained | Teammate can't understand scope | Rewrite: each unit must be understandable with only previous context |
|
|
@@ -20,6 +20,19 @@ If the branch is unrecoverable:
|
|
|
20
20
|
3. Re-dispatch ALL commit units for this service from scratch
|
|
21
21
|
4. Warn the user — this resets all progress on this service
|
|
22
22
|
|
|
23
|
+
## Discarding uncommitted changes (failed commit unit)
|
|
24
|
+
|
|
25
|
+
If an implementer produces bad code that fails micro-QA and cannot be fixed:
|
|
26
|
+
|
|
27
|
+
1. Discard all uncommitted changes in the worktree:
|
|
28
|
+
```bash
|
|
29
|
+
git -C /tmp/{repo}-{session-name} checkout -- .
|
|
30
|
+
git -C /tmp/{repo}-{session-name} clean -fd # remove untracked files if needed
|
|
31
|
+
```
|
|
32
|
+
2. Mark the commit unit ❌ in the plan with reason
|
|
33
|
+
3. Re-spawn implementer with corrected instructions
|
|
34
|
+
4. If 2 retries fail → escalate to user
|
|
35
|
+
|
|
23
36
|
## Failed dispatch tracking
|
|
24
37
|
|
|
25
38
|
After 2 failed re-dispatches of a commit unit:
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
Reference file for dispatch-feature and team-lead. Loaded on-demand.
|
|
4
4
|
|
|
5
|
-
> v5 model: ONE teammate per
|
|
6
|
-
>
|
|
7
|
-
> Teammates receive a ready worktree — NO git setup in
|
|
8
|
-
> Implementers do NOT receive the constitution automatically.
|
|
9
|
-
> template below includes a "Constitution" section that you MUST
|
|
10
|
-
> all rules from your workspace's constitution.md.
|
|
5
|
+
> v5.2.3 model: ONE teammate per COMMIT UNIT. The teammate writes code without
|
|
6
|
+
> committing, then signals when code is ready for review. The team lead commits
|
|
7
|
+
> after user approval. Teammates receive a ready worktree — NO git setup in
|
|
8
|
+
> spawn prompts. Implementers do NOT receive the constitution automatically.
|
|
9
|
+
> Every spawn template below includes a "Constitution" section that you MUST
|
|
10
|
+
> fill with all rules from your workspace's constitution.md.
|
|
11
11
|
|
|
12
12
|
## Context tiering — what to inject per repo type
|
|
13
13
|
|
|
14
14
|
| Context | Backend repo | Frontend repo | Infra repo |
|
|
15
15
|
|---------|:-:|:-:|:-:|
|
|
16
16
|
| worktree_path + session_branch | ALWAYS | ALWAYS | ALWAYS |
|
|
17
|
-
|
|
|
17
|
+
| This commit unit's tasks ONLY + context summary | ALWAYS | ALWAYS | ALWAYS |
|
|
18
18
|
| Constitution rules | ALWAYS | ALWAYS | ALWAYS |
|
|
19
|
-
| Signal
|
|
19
|
+
| Signal-when-ready instruction (no commit) | ALWAYS | ALWAYS | ALWAYS |
|
|
20
20
|
| API contract shapes | If API commits | ALWAYS (TypeScript) | Never |
|
|
21
21
|
| UX standards | Never | If UI commits | Never |
|
|
22
22
|
|
|
@@ -40,36 +40,31 @@ You are the implementer teammate for [{repo}].
|
|
|
40
40
|
{paste the exact request/response shapes for all endpoints in this plan}
|
|
41
41
|
{note: frontend will build TypeScript interfaces from these shapes}
|
|
42
42
|
|
|
43
|
-
## Your
|
|
43
|
+
## Your commit unit — {N} of {total} for this repo
|
|
44
|
+
{summary of what previous units already implemented, if any}
|
|
44
45
|
|
|
45
|
-
### Commit
|
|
46
|
+
### Commit {N}: {title}
|
|
46
47
|
{tasks}
|
|
47
48
|
~{N} files, ~{N} lines
|
|
48
49
|
|
|
49
|
-
### Commit 2: {title}
|
|
50
|
-
{tasks}
|
|
51
|
-
~{N} files, ~{N} lines
|
|
52
|
-
|
|
53
|
-
{...}
|
|
54
|
-
|
|
55
50
|
## Signal protocol (MANDATORY)
|
|
56
|
-
|
|
57
|
-
SendMessage: "
|
|
58
|
-
Then
|
|
59
|
-
If you hit an architectural decision not covered by the plan: SendMessage immediately and
|
|
51
|
+
When code is written and tests pass:
|
|
52
|
+
SendMessage: "code ready — {N files changed} — tests: {pass/fail} — {blockers}"
|
|
53
|
+
Then STOP. Do NOT run git add or git commit.
|
|
54
|
+
If you hit an architectural decision not covered by the plan: SendMessage immediately and STOP.
|
|
60
55
|
|
|
61
|
-
##
|
|
62
|
-
|
|
63
|
-
|
|
56
|
+
## CRITICAL: No committing
|
|
57
|
+
Do NOT run git add or git commit. Leave all changes uncommitted.
|
|
58
|
+
The team lead will commit after user review.
|
|
64
59
|
|
|
65
60
|
## Instructions
|
|
66
61
|
1. Go directly to your worktree: cd {worktree_path}
|
|
67
62
|
2. Read the repo CLAUDE.md — follow its conventions throughout
|
|
68
63
|
3. Check git log to see what's already on the branch (if resuming)
|
|
69
|
-
4.
|
|
70
|
-
5.
|
|
71
|
-
6. List dead code found
|
|
72
|
-
7. If >300 lines
|
|
64
|
+
4. Implement your commit unit — run tests and report results
|
|
65
|
+
5. Do NOT run git add or git commit
|
|
66
|
+
6. List dead code found
|
|
67
|
+
7. If >300 lines changed, note it in your signal
|
|
73
68
|
8. Escalate immediately if you hit an architectural decision not in the plan
|
|
74
69
|
```
|
|
75
70
|
|
|
@@ -92,37 +87,33 @@ You are the implementer teammate for [{repo}].
|
|
|
92
87
|
## API contract (TypeScript interfaces)
|
|
93
88
|
{paste exact response shapes as TypeScript interfaces for all endpoints used in this plan}
|
|
94
89
|
|
|
95
|
-
## Your
|
|
90
|
+
## Your commit unit — {N} of {total} for this repo
|
|
91
|
+
{summary of what previous units already implemented, if any}
|
|
96
92
|
|
|
97
|
-
### Commit
|
|
98
|
-
{tasks}
|
|
99
|
-
~{N} files, ~{N} lines
|
|
100
|
-
|
|
101
|
-
### Commit 2: {title}
|
|
93
|
+
### Commit {N}: {title}
|
|
102
94
|
{tasks — if UI components: MUST handle 4 states: skeleton, empty+CTA, error+retry, success}
|
|
103
95
|
~{N} files, ~{N} lines
|
|
104
96
|
|
|
105
|
-
{...}
|
|
106
|
-
|
|
107
97
|
## Signal protocol (MANDATORY)
|
|
108
|
-
|
|
109
|
-
SendMessage: "
|
|
110
|
-
Then
|
|
111
|
-
If you hit an architectural decision not covered by the plan: SendMessage immediately and
|
|
98
|
+
When code is written and tests pass:
|
|
99
|
+
SendMessage: "code ready — {N files changed} — tests: {pass/fail} — UX states: {compliant/issues} — {blockers}"
|
|
100
|
+
Then STOP. Do NOT run git add or git commit.
|
|
101
|
+
If you hit an architectural decision not covered by the plan: SendMessage immediately and STOP.
|
|
112
102
|
|
|
113
|
-
##
|
|
114
|
-
|
|
115
|
-
|
|
103
|
+
## CRITICAL: No committing
|
|
104
|
+
Do NOT run git add or git commit. Leave all changes uncommitted.
|
|
105
|
+
The team lead will commit after user review.
|
|
116
106
|
|
|
117
107
|
## Instructions
|
|
118
108
|
1. Go directly to your worktree: cd {worktree_path}
|
|
119
109
|
2. Read the repo CLAUDE.md — follow its conventions throughout
|
|
120
110
|
3. Check git log to see what's already on the branch (if resuming)
|
|
121
|
-
4.
|
|
111
|
+
4. Implement your commit unit
|
|
122
112
|
5. For every UI component: implement all 4 states (skeleton, empty+CTA, error+retry, success)
|
|
123
|
-
6. Run tests
|
|
124
|
-
7.
|
|
125
|
-
8.
|
|
113
|
+
6. Run tests — report pass/fail in your signal
|
|
114
|
+
7. Do NOT run git add or git commit
|
|
115
|
+
8. List dead code (unused components, composables, store actions, CSS)
|
|
116
|
+
9. Escalate immediately if you hit an architectural decision not in the plan
|
|
126
117
|
```
|
|
127
118
|
|
|
128
119
|
## Infra/Config teammate spawn template
|
|
@@ -138,33 +129,36 @@ You are the implementer teammate for [{repo}] (infrastructure/configuration).
|
|
|
138
129
|
## Constitution (non-negotiable)
|
|
139
130
|
{paste all rules from constitution.md, translated to English}
|
|
140
131
|
|
|
141
|
-
## Your
|
|
132
|
+
## Your commit unit — {N} of {total} for this repo
|
|
133
|
+
{summary of what previous units already implemented, if any}
|
|
142
134
|
|
|
143
|
-
### Commit
|
|
135
|
+
### Commit {N}: {title}
|
|
144
136
|
{tasks — typically gateway routes, env vars, docker configs}
|
|
145
137
|
~{N} files
|
|
146
138
|
|
|
147
|
-
{...}
|
|
148
|
-
|
|
149
139
|
## Signal protocol (MANDATORY)
|
|
150
|
-
|
|
151
|
-
SendMessage: "
|
|
152
|
-
Then
|
|
140
|
+
When code is written and checks pass:
|
|
141
|
+
SendMessage: "code ready — {N files changed} — consistency check: {OK/issues} — {blockers}"
|
|
142
|
+
Then STOP. Do NOT run git add or git commit.
|
|
143
|
+
|
|
144
|
+
## CRITICAL: No committing
|
|
145
|
+
Do NOT run git add or git commit. Leave all changes uncommitted.
|
|
146
|
+
The team lead will commit after user review.
|
|
153
147
|
|
|
154
148
|
## Instructions
|
|
155
149
|
1. Go directly to your worktree: cd {worktree_path}
|
|
156
150
|
2. Implement ONLY configuration changes — no application code
|
|
157
|
-
3. Verify consistency with other services
|
|
158
|
-
4.
|
|
151
|
+
3. Verify consistency with other services (env vars, routes, schemas)
|
|
152
|
+
4. Do NOT run git add or git commit
|
|
159
153
|
5. Escalate if you hit configuration decisions not covered by the plan
|
|
160
154
|
```
|
|
161
155
|
|
|
162
156
|
## Haiku micro-QA subagent template
|
|
163
157
|
|
|
164
|
-
Used by Opus in Phase 4 micro-QA
|
|
158
|
+
Used by Opus in Phase 4 micro-QA on uncommitted changes (git diff, not git diff HEAD~1 HEAD).
|
|
165
159
|
|
|
166
160
|
```
|
|
167
|
-
Read the following git diff and return ONLY a JSON object — no markdown, no preamble:
|
|
161
|
+
Read the following git diff (uncommitted changes) and return ONLY a JSON object — no markdown, no preamble:
|
|
168
162
|
|
|
169
163
|
If no issues found:
|
|
170
164
|
{"status":"OK"}
|
|
@@ -180,7 +174,7 @@ Check for:
|
|
|
180
174
|
|
|
181
175
|
Return ONLY the JSON object. No text before or after it.
|
|
182
176
|
|
|
183
|
-
Diff:
|
|
177
|
+
Diff (uncommitted):
|
|
184
178
|
{git diff output}
|
|
185
179
|
```
|
|
186
180
|
|
|
@@ -190,9 +184,9 @@ When a teammate signals a failure or when Bash/Haiku micro-QA fails:
|
|
|
190
184
|
|
|
191
185
|
| Situation | Action |
|
|
192
186
|
|-----------|--------|
|
|
193
|
-
| Tests fail on commit N |
|
|
194
|
-
| Haiku BLOCKER on commit N | Opus evaluates — if fixable:
|
|
187
|
+
| Tests fail on commit unit N | Re-spawn implementer with fix instructions for the same commit unit |
|
|
188
|
+
| Haiku BLOCKER on commit unit N | Opus evaluates — if fixable: re-spawn with instructions; if architectural: escalate to user |
|
|
195
189
|
| Architectural decision not in plan | STOP the wave, escalate to user, resume after direction |
|
|
196
|
-
| Teammate silent / no signal | Check worktree git
|
|
190
|
+
| Teammate silent / no signal | Check worktree git status/diff, re-spawn or escalate |
|
|
197
191
|
| Max 2 retries on same commit | Mark ❌ ESCALATED, stop the wave, present to user |
|
|
198
192
|
| Corrupted branch | Use rollback protocol (see team-lead agent / rollback-protocol.md) |
|
|
@@ -135,32 +135,32 @@ echo ""
|
|
|
135
135
|
echo "▸ validate-spawn-prompt.sh"
|
|
136
136
|
|
|
137
137
|
# Complete prompt should have no warnings
|
|
138
|
-
GOOD_PROMPT='{"tool_input":{"prompt":"## Constitution\n1. **Multi-tenancy** is sacred.\n2. **No hardcoded secrets.**\n\n## Your
|
|
138
|
+
GOOD_PROMPT='{"tool_input":{"subagent_type":"implementer","prompt":"## Constitution\n1. **Multi-tenancy** is sacred.\n2. **No hardcoded secrets.**\n\n## Your commit unit — 1 of 3 for this repo\n### Commit 1: Data layer\nCreate models\n\n## Your workspace\n- Worktree (ready, go directly here): /tmp/svc-feature-auth\n- Session branch: session/feature-auth\n\n## Signal protocol (MANDATORY)\nWhen code is written and tests pass: SendMessage code ready. Then STOP. Do NOT run git add or git commit.\n\nRead the repo CLAUDE.md first.\nIf you hit an architectural decision not in the plan: SendMessage immediately and STOP."}}'
|
|
139
139
|
OUT=$(run_hook "validate-spawn-prompt.sh" "$GOOD_PROMPT")
|
|
140
140
|
assert_empty "complete prompt (non-API/non-frontend) — no warnings" "$OUT"
|
|
141
141
|
|
|
142
142
|
# Missing constitution should warn
|
|
143
|
-
NO_CONST='{"tool_input":{"prompt":"## Your
|
|
143
|
+
NO_CONST='{"tool_input":{"subagent_type":"implementer","prompt":"## Your commit unit\n### Commit 1: stuff\nworktree_path: /tmp/api-x\nSendMessage code ready. Do NOT run git add or git commit."}}'
|
|
144
144
|
OUT=$(run_hook "validate-spawn-prompt.sh" "$NO_CONST")
|
|
145
145
|
assert_contains "warns on missing constitution" "$OUT" "project-specific rules"
|
|
146
146
|
|
|
147
147
|
# Missing plan should warn
|
|
148
|
-
NO_PLAN='{"tool_input":{"prompt":"## Constitution\n1. **Rule one.**\nworktree_path: /tmp/api-x\nSendMessage after each commit."}}'
|
|
148
|
+
NO_PLAN='{"tool_input":{"subagent_type":"implementer","prompt":"## Constitution\n1. **Rule one.**\nworktree_path: /tmp/api-x\nSendMessage after each commit."}}'
|
|
149
149
|
OUT=$(run_hook "validate-spawn-prompt.sh" "$NO_PLAN")
|
|
150
150
|
assert_contains "warns on missing plan/tasks" "$OUT" "plan/tasks"
|
|
151
151
|
|
|
152
152
|
# Missing worktree path should warn
|
|
153
|
-
NO_WT='{"tool_input":{"prompt":"## Constitution\n1. **Rule one.**\n## Your
|
|
153
|
+
NO_WT='{"tool_input":{"subagent_type":"implementer","prompt":"## Constitution\n1. **Rule one.**\n## Your commit unit\n### Commit 1: stuff\nSendMessage code ready."}}'
|
|
154
154
|
OUT=$(run_hook "validate-spawn-prompt.sh" "$NO_WT")
|
|
155
155
|
assert_contains "warns on missing worktree_path" "$OUT" "worktree_path"
|
|
156
156
|
|
|
157
157
|
# Missing signal protocol should warn
|
|
158
|
-
NO_SIGNAL='{"tool_input":{"prompt":"## Constitution\n1. **Rule one.**\n## Your
|
|
158
|
+
NO_SIGNAL='{"tool_input":{"subagent_type":"implementer","prompt":"## Constitution\n1. **Rule one.**\n## Your commit unit\n### Commit 1: stuff\nWorktree ready: /tmp/api-x"}}'
|
|
159
159
|
OUT=$(run_hook "validate-spawn-prompt.sh" "$NO_SIGNAL")
|
|
160
160
|
assert_contains "warns on missing signal protocol" "$OUT" "signal protocol"
|
|
161
161
|
|
|
162
162
|
# Frontend without UX standards should warn
|
|
163
|
-
FRONT_NO_UX='{"tool_input":{"prompt":"## Constitution\n1. **Rule one.**\nfrontend Vue component\n## Your
|
|
163
|
+
FRONT_NO_UX='{"tool_input":{"subagent_type":"implementer","prompt":"## Constitution\n1. **Rule one.**\nfrontend Vue component\n## Your commit unit\n### Commit 1: UI\n/tmp/front-x\nSendMessage code ready. Do NOT run git add or git commit."}}'
|
|
164
164
|
OUT=$(run_hook "validate-spawn-prompt.sh" "$FRONT_NO_UX")
|
|
165
165
|
assert_contains "warns frontend without UX standards" "$OUT" "UX standards"
|
|
166
166
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# validate-spawn-prompt.sh
|
|
3
|
-
# PreToolUse hook (matcher:
|
|
3
|
+
# PreToolUse hook (matcher: Agent): validates that teammate spawn prompts
|
|
4
4
|
# contain the required context before allowing the spawn.
|
|
5
5
|
# v5.0: Updated for one-teammate-per-repo model with worktree_path and signal protocol.
|
|
6
6
|
# ALL checks are non-blocking warnings (exit 0 + stdout).
|
|
@@ -8,6 +8,12 @@ set -euo pipefail
|
|
|
8
8
|
|
|
9
9
|
INPUT=$(cat)
|
|
10
10
|
|
|
11
|
+
# Only validate implementer spawns (skip Explore and other subagent types)
|
|
12
|
+
SUBAGENT_TYPE=$(echo "$INPUT" | jq -r '.tool_input.subagent_type // empty' 2>/dev/null) || true
|
|
13
|
+
if [ "$SUBAGENT_TYPE" != "implementer" ]; then
|
|
14
|
+
exit 0
|
|
15
|
+
fi
|
|
16
|
+
|
|
11
17
|
# Extract the spawn prompt from tool input
|
|
12
18
|
PROMPT=$(echo "$INPUT" | jq -r '.tool_input.prompt // empty' 2>/dev/null) || true
|
|
13
19
|
|
|
@@ -42,18 +48,18 @@ if [ "$RULES_FOUND" -eq 0 ]; then
|
|
|
42
48
|
fi
|
|
43
49
|
|
|
44
50
|
# Check 2: Tasks / plan section must be present
|
|
45
|
-
if ! echo "$PROMPT" | grep -qiE '(your (complete )?plan|## (commit|tasks|plan)|commit [0-9]+:|all [0-9]+ commit)' 2>/dev/null; then
|
|
46
|
-
BLOCKERS+="- Missing plan/tasks section in spawn prompt. Include the
|
|
51
|
+
if ! echo "$PROMPT" | grep -qiE '(your (complete )?plan|your commit unit|## (commit|tasks|plan)|commit [0-9]+:|all [0-9]+ commit)' 2>/dev/null; then
|
|
52
|
+
BLOCKERS+="- Missing plan/tasks section in spawn prompt. Include the commit unit tasks.\n"
|
|
47
53
|
fi
|
|
48
54
|
|
|
49
55
|
# Check 3: Worktree path (v5 — teammates receive a ready worktree)
|
|
50
56
|
if ! echo "$PROMPT" | grep -qiE '(worktree.path|worktree.ready|go directly|/tmp/[a-z])' 2>/dev/null; then
|
|
51
|
-
BLOCKERS+="- Missing worktree_path in spawn prompt.
|
|
57
|
+
BLOCKERS+="- Missing worktree_path in spawn prompt. Implementer needs the /tmp/ path prepared by Opus.\n"
|
|
52
58
|
fi
|
|
53
59
|
|
|
54
60
|
# Check 4: Signal protocol instruction
|
|
55
|
-
if ! echo "$PROMPT" | grep -qiE '(SendMessage|signal protocol|commit N done|
|
|
56
|
-
BLOCKERS+="- Missing signal protocol instruction.
|
|
61
|
+
if ! echo "$PROMPT" | grep -qiE '(SendMessage|signal protocol|code ready|commit N done|no commit)' 2>/dev/null; then
|
|
62
|
+
BLOCKERS+="- Missing signal protocol instruction. Implementer must know to SendMessage when code is ready and NOT commit.\n"
|
|
57
63
|
fi
|
|
58
64
|
|
|
59
65
|
# Check 5: CLAUDE.md instruction
|
|
@@ -8,7 +8,7 @@ description: >
|
|
|
8
8
|
stack traces or error logs. Also French triggers: "erreur", "ça marche pas".
|
|
9
9
|
argument-hint: "[error description or stack trace]"
|
|
10
10
|
context: fork
|
|
11
|
-
allowed-tools: Read, Write, Glob, Grep, Task,
|
|
11
|
+
allowed-tools: Read, Write, Glob, Grep, Task, TeamCreate, TeamDelete, SendMessage
|
|
12
12
|
---
|
|
13
13
|
|
|
14
14
|
# Incident Debug — Multi-Layer Investigation
|
|
@@ -10,7 +10,7 @@ description: >
|
|
|
10
10
|
argument-hint: "[plan-name or 'all']"
|
|
11
11
|
context: fork
|
|
12
12
|
model: opus
|
|
13
|
-
allowed-tools: Read, Write, Glob, Grep, Task,
|
|
13
|
+
allowed-tools: Read, Write, Glob, Grep, Task, TeamCreate, TeamDelete, SendMessage
|
|
14
14
|
---
|
|
15
15
|
|
|
16
16
|
# QA Ruthless — Adversarial Quality Review
|
|
@@ -20,9 +20,9 @@ If you write application code in a repo (not a markdown plan, not a git command,
|
|
|
20
20
|
| Role | Model | Mechanism |
|
|
21
21
|
|------|-------|-----------|
|
|
22
22
|
| Orchestrator | **Opus** | `claude --agent team-lead` (frontmatter `model: opus`) |
|
|
23
|
-
| Implementation teammates | **Sonnet** | `
|
|
23
|
+
| Implementation teammates | **Sonnet** | `TeamCreate` + `Agent(implementer, team_name)` via Agent Teams |
|
|
24
24
|
| QA orchestration | **Opus** | `qa-ruthless` skill (frontmatter `model: opus`) |
|
|
25
|
-
| QA investigators | **Sonnet** | `
|
|
25
|
+
| QA investigators | **Sonnet** | `TeamCreate` + `Agent(implementer, team_name)` via Agent Teams (spawned by qa-ruthless) |
|
|
26
26
|
| Code reviewer | **Opus** | `claude --agent reviewer` (evidence-based review, architecture judgment) |
|
|
27
27
|
| Security auditor | **Opus** | `claude --agent security-auditor` (auth flows, tenant isolation, secrets, CVEs) |
|
|
28
28
|
| Plan review | **Sonnet** | `plan-review` skill (constitution compliance needs reasoning) |
|
|
@@ -55,5 +55,5 @@ Rationale: Opus knows what to look for based on the feature. Haiku summaries los
|
|
|
55
55
|
Constraint: Opus reads only files directly related to the feature scope.
|
|
56
56
|
|
|
57
57
|
## Implementer model
|
|
58
|
-
Implementation teammates use **Sonnet** via
|
|
59
|
-
One teammate per
|
|
58
|
+
Implementation teammates use **Sonnet** via Agent Teams (`TeamCreate` + `Agent(subagent_type: "implementer", team_name: ...)`).
|
|
59
|
+
One teammate per commit unit. Each implementer handles a single commit unit, writes code without committing, and signals when ready for review.
|
package/package.json
CHANGED