cc-workspace 5.2.3 → 5.2.5
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 +45 -3
- package/README.md +19 -6
- package/global-skills/agents/implementer.md +43 -39
- package/global-skills/agents/team-lead.md +15 -13
- package/global-skills/dispatch-feature/SKILL.md +91 -40
- 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 +4 -4
- package/global-skills/rules/model-routing.md +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,50 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [5.2.
|
|
4
|
-
|
|
5
|
-
###
|
|
3
|
+
## [5.2.5] — 2026-03-11
|
|
4
|
+
|
|
5
|
+
### Fix: team-lead can now spawn teammates
|
|
6
|
+
|
|
7
|
+
- **Added `Agent` to team-lead tools** — the `Agent` tool was missing from the team-lead's
|
|
8
|
+
tool list, preventing it from spawning implementer teammates. The documented workflow
|
|
9
|
+
(`TeamCreate` → `Agent(subagent_type: "implementer", team_name: ...)` → `SendMessage`)
|
|
10
|
+
was broken because `Agent` was not in the allowed tools. Spawn constraints (implementer
|
|
11
|
+
only) remain enforced by team-lead rules, `validate-spawn-prompt.sh` hook, and
|
|
12
|
+
dispatch-feature documentation.
|
|
13
|
+
|
|
14
|
+
**Files changed:**
|
|
15
|
+
- `agents/team-lead.md` — added `Agent` to tools list, bumped `prompt_version` to 5.2.4
|
|
16
|
+
|
|
17
|
+
## [5.2.3] — 2026-03-10
|
|
18
|
+
|
|
19
|
+
### One implementer per commit unit + User review before commit
|
|
20
|
+
|
|
21
|
+
Two architectural changes to the dispatch workflow:
|
|
22
|
+
|
|
23
|
+
**One teammate per commit unit** (was: one per repo)
|
|
24
|
+
- Eliminates the unreliable "signal and wait" pattern where `SendMessage` doesn't
|
|
25
|
+
actually block the model — the implementer would continue without waiting.
|
|
26
|
+
- Each implementer now handles exactly ONE commit unit then STOPS.
|
|
27
|
+
- The team lead spawns a new implementer for each subsequent commit unit.
|
|
28
|
+
- Cross-repo parallelism is preserved; intra-repo is strictly sequential with user gate.
|
|
29
|
+
|
|
30
|
+
**Zero commits by implementer** (was: implementer commits, team lead verifies)
|
|
31
|
+
- Implementers write code and run tests but NEVER run `git add` or `git commit`.
|
|
32
|
+
- A `PreToolUse` hook in implementer frontmatter physically blocks `git add`/`git commit`.
|
|
33
|
+
- After micro-QA passes, the team lead presents changes to the user for review.
|
|
34
|
+
- The team lead commits via Bash only after user approval.
|
|
35
|
+
- Session JSON now tracks `user_committed` and `files_modified` per commit unit.
|
|
36
|
+
|
|
37
|
+
**Files changed:**
|
|
38
|
+
- `agents/implementer.md` — single commit unit scope, no-commit rules, PreToolUse hook
|
|
39
|
+
- `dispatch-feature/SKILL.md` — Phase 3 (one per unit) + Phase 4 (user review + team lead commits)
|
|
40
|
+
- `dispatch-feature/references/spawn-templates.md` — all 3 templates + Haiku micro-QA
|
|
41
|
+
- `agents/team-lead.md` — rule 2, 4, 8, 10, 13 + commit tracking + workflow table
|
|
42
|
+
- `dispatch-feature/references/anti-patterns.md` — AP 3, 14, 17 updated + AP 18, 19 added
|
|
43
|
+
- `dispatch-feature/references/rollback-protocol.md` — uncommitted changes discard section
|
|
44
|
+
- `hooks/validate-spawn-prompt.sh` — updated checks for new signal protocol
|
|
45
|
+
- `rules/model-routing.md` — updated implementer model description
|
|
46
|
+
|
|
47
|
+
### Agent Teams — correct tool mechanism (previous)
|
|
6
48
|
|
|
7
49
|
The `Teammate` tool referenced in previous versions does not exist in Claude Code.
|
|
8
50
|
Agent Teams actually works via `TeamCreate` + `Agent(subagent_type, team_name)` + `SendMessage`.
|
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,19 @@ With `--chrome`, the agent:
|
|
|
558
558
|
|
|
559
559
|
---
|
|
560
560
|
|
|
561
|
+
## Changelog v5.2.0 -> v5.2.5
|
|
562
|
+
|
|
563
|
+
| # | Feature | Detail |
|
|
564
|
+
|---|---------|--------|
|
|
565
|
+
| 1 | **Agent tool for team-lead** | Fixed missing `Agent` tool in team-lead's tool list — the team-lead can now spawn implementer teammates via `Agent(subagent_type: "implementer", team_name: ...)`. |
|
|
566
|
+
| 2 | **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. |
|
|
567
|
+
| 3 | **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. |
|
|
568
|
+
| 4 | **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. |
|
|
569
|
+
| 5 | **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. |
|
|
570
|
+
| 6 | **Sequential with user gate** | Intra-repo commit units are strictly sequential with a user review gate between each. Cross-repo parallelism is preserved. |
|
|
571
|
+
|
|
572
|
+
---
|
|
573
|
+
|
|
561
574
|
## Changelog v5.1.0 -> v5.2.0
|
|
562
575
|
|
|
563
576
|
| # | Feature | Detail |
|
|
@@ -590,8 +603,8 @@ With `--chrome`, the agent:
|
|
|
590
603
|
| # | Feature | Detail |
|
|
591
604
|
|---|---------|--------|
|
|
592
605
|
| 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
|
|
606
|
+
| 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)_ |
|
|
607
|
+
| 3 | **Micro-QA between every commit** | Bash tests + Haiku diff review after each commit. _(v5.2.3: user reviews before team lead commits)_ |
|
|
595
608
|
| 4 | **Worktrees after plan validation** | Branches and worktrees created by Opus only after user approves the plan. |
|
|
596
609
|
| 5 | **Worktrees persist** | `/tmp/` worktrees live until `session close`. No pruning during active sessions. |
|
|
597
610
|
| 6 | **cycle-retrospective mandatory** | Required Phase 5 step, not optional. |
|
|
@@ -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.5
|
|
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), TeamCreate, TeamDelete, SendMessage
|
|
12
|
+
tools: Read, Write, Edit, Bash, Glob, Grep, Task(Explore), Agent, 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 teammate per
|
|
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,12 +1,13 @@
|
|
|
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.
|
|
@@ -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,23 +176,33 @@ 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
|
-
|
|
182
|
-
Each
|
|
183
|
-
|
|
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.
|
|
184
185
|
|
|
185
|
-
|
|
186
|
-
|
|
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
|
|
187
192
|
|
|
188
193
|
### Teammate spawn — workflow
|
|
189
194
|
|
|
190
195
|
```
|
|
191
196
|
1. TeamCreate(team_name: "session-{name}")
|
|
192
|
-
2. For each
|
|
193
|
-
Agent(subagent_type: "implementer", team_name: "session-{name}", prompt
|
|
194
|
-
|
|
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
|
|
195
206
|
```
|
|
196
207
|
|
|
197
208
|
### Teammate spawn prompt — context tiering
|
|
@@ -201,10 +212,10 @@ See @references/spawn-templates.md for full templates.
|
|
|
201
212
|
**Always inject (Tier 1):**
|
|
202
213
|
1. `worktree_path`: /tmp/{repo}-{session-name}/ — ready, no git setup needed
|
|
203
214
|
2. `session_branch`: session/{name}
|
|
204
|
-
3.
|
|
215
|
+
3. This commit unit's tasks ONLY + summary of what previous units implemented
|
|
205
216
|
4. Constitution rules (all from constitution.md, translated to English)
|
|
206
|
-
5. SignalInstruction: "
|
|
207
|
-
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."
|
|
208
219
|
|
|
209
220
|
**Conditional (Tier 2):**
|
|
210
221
|
- Frontend repo with UI → inject full frontend-ux-standards.md
|
|
@@ -212,7 +223,7 @@ See @references/spawn-templates.md for full templates.
|
|
|
212
223
|
- Frontend commits → inject API contract as TypeScript interfaces
|
|
213
224
|
|
|
214
225
|
**Never inject (Tier 3 — already in CLAUDE.md or agent):**
|
|
215
|
-
- Git workflow (teammate has no git responsibility)
|
|
226
|
+
- Git workflow (teammate has no git responsibility and MUST NOT commit)
|
|
216
227
|
- Generic anti-patterns
|
|
217
228
|
- Full workspace context
|
|
218
229
|
|
|
@@ -221,26 +232,28 @@ See @references/spawn-templates.md for full templates.
|
|
|
221
232
|
|
|
222
233
|
### Parallelism
|
|
223
234
|
|
|
224
|
-
- Different repos in same wave → spawn
|
|
225
|
-
- 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 ❌
|
|
226
237
|
|
|
227
238
|
### Wave execution
|
|
228
239
|
|
|
229
|
-
1. Spawn
|
|
230
|
-
2.
|
|
231
|
-
3.
|
|
232
|
-
4.
|
|
233
|
-
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
|
|
234
246
|
|
|
235
|
-
## Phase 4: Micro-QA
|
|
247
|
+
## Phase 4: Micro-QA + User review + Team lead commits
|
|
236
248
|
|
|
237
|
-
After each
|
|
249
|
+
After each implementer signals "code ready":
|
|
238
250
|
|
|
239
251
|
### Step 1 — Bash verification (Opus direct)
|
|
240
252
|
|
|
241
253
|
```bash
|
|
242
|
-
# 1. Verify
|
|
243
|
-
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
|
|
244
257
|
|
|
245
258
|
# 2. Run scoped tests — adapt command to repo stack:
|
|
246
259
|
# PHP/Laravel:
|
|
@@ -252,8 +265,8 @@ cd /tmp/{repo}-{session-name} && go test ./... 2>&1 | tail -20
|
|
|
252
265
|
# Python:
|
|
253
266
|
cd /tmp/{repo}-{session-name} && pytest {scope_path} -v 2>&1 | tail -30
|
|
254
267
|
|
|
255
|
-
# 3. Check for debug artifacts
|
|
256
|
-
git -C /tmp/{repo}-{session-name} diff
|
|
268
|
+
# 3. Check for debug artifacts in uncommitted changes
|
|
269
|
+
git -C /tmp/{repo}-{session-name} diff \
|
|
257
270
|
| grep -E "(console\.log|dd\(|var_dump|\.only\(|TODO|FIXME|debugger|dump\()" \
|
|
258
271
|
| head -20
|
|
259
272
|
```
|
|
@@ -262,22 +275,58 @@ git -C /tmp/{repo}-{session-name} diff HEAD~1 HEAD \
|
|
|
262
275
|
|
|
263
276
|
Use the Haiku micro-QA template from @references/spawn-templates.md (section "Haiku micro-QA subagent template").
|
|
264
277
|
|
|
265
|
-
Spawn Task(Explore, model: haiku) with that template, injecting
|
|
278
|
+
Spawn Task(Explore, model: haiku) with that template, injecting `git diff` output (uncommitted changes).
|
|
266
279
|
|
|
267
280
|
**Do NOT rephrase or shorten the template** — copy it verbatim from the reference file.
|
|
268
281
|
Haiku needs the exact structured prompt to return clean JSON.
|
|
269
282
|
|
|
270
|
-
###
|
|
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)
|
|
271
320
|
|
|
272
321
|
| Bash | Haiku | Action |
|
|
273
322
|
|------|-------|--------|
|
|
274
|
-
| OK | OK |
|
|
275
|
-
| FAIL | any | Opus analyzes failure,
|
|
276
|
-
| 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 |
|
|
277
326
|
|
|
278
327
|
Retry limit: max 2 per commit unit → escalate to user, stop the wave.
|
|
279
328
|
|
|
280
|
-
### Update after each commit
|
|
329
|
+
### Update after each commit unit
|
|
281
330
|
|
|
282
331
|
```bash
|
|
283
332
|
# Update plan progress tracker
|
|
@@ -285,7 +334,7 @@ Retry limit: max 2 per commit unit → escalate to user, stop the wave.
|
|
|
285
334
|
|
|
286
335
|
# Update session.json commits tracking
|
|
287
336
|
# Add session log entry:
|
|
288
|
-
# [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
|
|
289
338
|
```
|
|
290
339
|
|
|
291
340
|
## Phase 5: Post-implementation (all mandatory)
|
|
@@ -317,8 +366,10 @@ For targeted fixes or single-repo work:
|
|
|
317
366
|
3. Check ./.sessions/ for active session JSON — worktrees should still exist in /tmp/
|
|
318
367
|
4. Read active plan — statuses and session log tell you where you are
|
|
319
368
|
5. Verify worktrees still exist: git worktree list for each repo
|
|
320
|
-
6.
|
|
321
|
-
|
|
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)
|
|
322
373
|
|
|
323
374
|
## Anti-patterns
|
|
324
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
|
|
|
@@ -48,8 +48,8 @@ if [ "$RULES_FOUND" -eq 0 ]; then
|
|
|
48
48
|
fi
|
|
49
49
|
|
|
50
50
|
# Check 2: Tasks / plan section must be present
|
|
51
|
-
if ! echo "$PROMPT" | grep -qiE '(your (complete )?plan|## (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
|
|
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"
|
|
53
53
|
fi
|
|
54
54
|
|
|
55
55
|
# Check 3: Worktree path (v5 — teammates receive a ready worktree)
|
|
@@ -58,8 +58,8 @@ if ! echo "$PROMPT" | grep -qiE '(worktree.path|worktree.ready|go directly|/tmp/
|
|
|
58
58
|
fi
|
|
59
59
|
|
|
60
60
|
# Check 4: Signal protocol instruction
|
|
61
|
-
if ! echo "$PROMPT" | grep -qiE '(SendMessage|signal protocol|commit N done|
|
|
62
|
-
BLOCKERS+="- Missing signal protocol instruction. Implementer must know to SendMessage
|
|
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"
|
|
63
63
|
fi
|
|
64
64
|
|
|
65
65
|
# Check 5: CLAUDE.md instruction
|
|
@@ -56,4 +56,4 @@ Constraint: Opus reads only files directly related to the feature scope.
|
|
|
56
56
|
|
|
57
57
|
## Implementer model
|
|
58
58
|
Implementation teammates use **Sonnet** via Agent Teams (`TeamCreate` + `Agent(subagent_type: "implementer", team_name: ...)`).
|
|
59
|
-
One teammate per
|
|
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