cc-workspace 5.2.1 → 5.2.3

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 CHANGED
@@ -1,5 +1,41 @@
1
1
  # Changelog
2
2
 
3
+ ## [5.2.3] — 2026-03-09
4
+
5
+ ### Agent Teams — correct tool mechanism
6
+
7
+ The `Teammate` tool referenced in previous versions does not exist in Claude Code.
8
+ Agent Teams actually works via `TeamCreate` + `Agent(subagent_type, team_name)` + `SendMessage`.
9
+
10
+ - **Replaced all `Teammate` references with real Agent Teams tools** — team-lead,
11
+ e2e-validator, dispatch-feature, qa-ruthless, incident-debug now use `TeamCreate`,
12
+ `TeamDelete`, and `SendMessage` instead of the non-existent `Teammate` tool.
13
+
14
+ - **Teammate spawn workflow documented** — dispatch-feature now includes the explicit
15
+ 3-step workflow: `TeamCreate` → `Agent(implementer, team_name)` → `SendMessage`.
16
+
17
+ - **validate-spawn-prompt hook updated** — matcher changed from `Teammate` to `Agent`,
18
+ with a `subagent_type` filter to only validate implementer spawns (skips Explore).
19
+
20
+ - **model-routing rule updated** — routing table now documents the real mechanism.
21
+
22
+ - **Auto-enable Agent Teams on install** — `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` is
23
+ now automatically injected into `~/.claude/settings.json` during install/update.
24
+
25
+ ## [5.2.2] — 2026-03-09
26
+
27
+ ### Agent Teams enforcement
28
+
29
+ - **Removed `Task(implementer)` from agent tools** — team-lead and e2e-validator can no
30
+ longer spawn implementers as subagents via Task. Implementers must be spawned through
31
+ Agent Teams (TeamCreate + Agent with team_name).
32
+
33
+ - **e2e-validator gains Agent Teams tools** — can now delegate `--fix` repairs
34
+ through the proper teammate protocol.
35
+
36
+ - **Auto-enable Agent Teams on install** — `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` is
37
+ now automatically injected into `~/.claude/settings.json` during `npx cc-workspace install`.
38
+
3
39
  ## [5.2.1] — 2026-03-06
4
40
 
5
41
  ### Prompt quality improvements
package/bin/cli.js CHANGED
@@ -195,10 +195,30 @@ function installGlobals(force) {
195
195
  // ── Migration: clean old global skills & rules from previous versions ──
196
196
  cleanLegacyGlobals();
197
197
 
198
+ // Ensure Agent Teams env var is in global settings
199
+ ensureGlobalEnv("CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS", "1");
200
+
198
201
  writeVersion(PKG.version);
199
202
  return true;
200
203
  }
201
204
 
205
+ // ─── Ensure env var in global ~/.claude/settings.json ────────
206
+ function ensureGlobalEnv(key, value) {
207
+ const globalSettingsPath = path.join(CLAUDE_DIR, "settings.json");
208
+ let settings = {};
209
+ try { settings = JSON.parse(fs.readFileSync(globalSettingsPath, "utf8")); }
210
+ catch { /* file missing or invalid — start fresh */ }
211
+
212
+ if (!settings.env) settings.env = {};
213
+ if (settings.env[key] === value) return; // already set
214
+
215
+ settings.env[key] = value;
216
+ if (DRY_RUN) { dryOk(`set ${key}=${value} in ~/.claude/settings.json`); return; }
217
+ mkdirp(CLAUDE_DIR);
218
+ writeFile(globalSettingsPath, JSON.stringify(settings, null, 2) + "\n");
219
+ ok(`${key} ${c.dim}(~/.claude/settings.json)${c.reset}`);
220
+ }
221
+
202
222
  // ─── Clean legacy global skills & rules ─────────────────────
203
223
  // Previous versions installed skills and rules into ~/.claude/skills/
204
224
  // and ~/.claude/rules/. These now live in orchestrator/.claude/ locally.
@@ -271,7 +291,7 @@ function generateSettings(orchDir) {
271
291
  // guard-session-checkout.sh is NOT here — it's in implementer agent
272
292
  // frontmatter only. team-lead doesn't have Bash, and teammates don't
273
293
  // inherit orchestrator hooks.
274
- withMatcher("Teammate", "validate-spawn-prompt.sh", 5)
294
+ withMatcher("Agent", "validate-spawn-prompt.sh", 5)
275
295
  ],
276
296
  SessionStart: [
277
297
  withoutMatcher("orphan-cleanup.sh", 10),
@@ -311,7 +331,7 @@ You are the tech lead. You never write application code in repos.
311
331
  You clarify, plan, manage git directly, delegate to teammates, run micro-QA.
312
332
 
313
333
  ## Security
314
- - \`tools\`: Read, Write, Edit, Bash, Glob, Grep, Task(implementer, Explore), Teammate, SendMessage
334
+ - \`tools\`: Read, Write, Edit, Bash, Glob, Grep, Task(Explore), TeamCreate, TeamDelete, SendMessage
315
335
  - Bash allowed for: git (branch, worktree, log), test/typecheck in /tmp/ worktrees (micro-QA)
316
336
  - Hook \`PreToolUse\` path-aware: Write/Edit/MultiEdit only allowed in orchestrator/
317
337
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: e2e-validator
3
- prompt_version: 5.2.1
3
+ prompt_version: 5.2.2
4
4
  description: >
5
5
  E2E validation agent for completed plans. On first boot, sets up the E2E
6
6
  environment (docker-compose, test config). On subsequent boots, validates
@@ -11,7 +11,7 @@ description: >
11
11
  model: opus
12
12
  tools: >
13
13
  Read, Write, Edit, Bash, Glob, Grep,
14
- Task(implementer, 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` + Teammate(implementer)
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. Spawn one **Teammate(implementer)** per failing repo with:
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,6 +1,6 @@
1
1
  ---
2
2
  name: team-lead
3
- prompt_version: 5.2.1
3
+ prompt_version: 5.2.2
4
4
  description: >
5
5
  Main orchestrator for multi-service workspaces. Clarifies specs,
6
6
  plans in markdown, manages git (branches, worktrees) directly,
@@ -9,7 +9,7 @@ description: >
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(implementer, Explore), Teammate, SendMessage
12
+ tools: Read, Write, Edit, Bash, Glob, Grep, Task(Explore), TeamCreate, TeamDelete, SendMessage
13
13
  memory: project
14
14
  maxTurns: 200
15
15
  hooks:
@@ -135,7 +135,7 @@ This table is your quick reference — **defer to the skill for specifics**.
135
135
  | 2 — Plan | Write ./plans/{name}.md from _TEMPLATE.md | Wait for user validation |
136
136
  | 2.5 — Git setup | `git branch` + `git worktree add` via Bash | Only after plan validation |
137
137
  | 2.9 — Pre-dispatch | Verify branches + worktrees exist and are clean | Auto-fix simple cases |
138
- | 3 — Dispatch | ONE Teammate per repo, all commits sequential | See @dispatch-feature/references/spawn-templates.md |
138
+ | 3 — Dispatch | ONE teammate per repo (via TeamCreate + Agent), all commits sequential | See @dispatch-feature/references/spawn-templates.md |
139
139
  | 4 — Micro-QA | Bash tests + Haiku diff after each commit | Green light or fix instruction |
140
140
  | 5 — Post-impl | cross-service → qa-ruthless → reviewer → (security-auditor if needed) → merge-prep → retro | All mandatory except security-auditor |
141
141
 
@@ -12,7 +12,7 @@ description: >
12
12
  "dispatch", "start dev", "launch teammates", or provides a spec.
13
13
  argument-hint: "[feature description]"
14
14
  context: fork
15
- allowed-tools: Read, Write, Bash, Glob, Grep, Task, Teammate, SendMessage
15
+ allowed-tools: Read, Write, Bash, Glob, Grep, Task, TeamCreate, TeamDelete, SendMessage
16
16
  ---
17
17
 
18
18
  # Dispatch Feature — Clarify, Plan, Git, Delegate, Track
@@ -177,12 +177,23 @@ Only proceed to Phase 3 once all checks pass.
177
177
 
178
178
  ## Phase 3: Dispatch — one teammate per repo
179
179
 
180
- **ONE teammate per repo.** Each teammate receives the complete repo plan and handles
181
- all its commit units sequentially. It signals after each commit and waits for green light.
180
+ **ONE teammate per repo.** Use `TeamCreate` to create a team for the session, then spawn
181
+ each repo's implementer via `Agent(subagent_type: "implementer", team_name: ...)`.
182
+ Each teammate receives the complete repo plan and handles all its commit units sequentially.
183
+ It signals after each commit via `SendMessage` and waits for green light.
182
184
 
183
185
  This is fundamentally different from the old model (one subagent per commit unit).
184
186
  The teammate has the full picture of its repo and can escalate intelligently at any point.
185
187
 
188
+ ### Teammate spawn — workflow
189
+
190
+ ```
191
+ 1. TeamCreate(team_name: "session-{name}")
192
+ 2. For each repo in wave:
193
+ Agent(subagent_type: "implementer", team_name: "session-{name}", prompt: "...")
194
+ 3. SendMessage to coordinate (green light, fix instructions, STOP)
195
+ ```
196
+
186
197
  ### Teammate spawn prompt — context tiering
187
198
 
188
199
  See @references/spawn-templates.md for full templates.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
  # validate-spawn-prompt.sh
3
- # PreToolUse hook (matcher: Teammate): validates that teammate spawn prompts
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
 
@@ -48,12 +54,12 @@ 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. Teammate needs the /tmp/ path prepared by Opus.\n"
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
61
  if ! echo "$PROMPT" | grep -qiE '(SendMessage|signal protocol|commit N done|green light|wait for)' 2>/dev/null; then
56
- BLOCKERS+="- Missing signal protocol instruction. Teammate must know to SendMessage after each commit and wait for green light.\n"
62
+ BLOCKERS+="- Missing signal protocol instruction. Implementer must know to SendMessage after each commit and wait for green light.\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, Teammate, SendMessage
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, Teammate, SendMessage
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** | `Teammate` tool via Agent Teams |
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** | `Teammate` tool via Agent Teams (spawned by qa-ruthless) |
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 the `Teammate` tool.
58
+ Implementation teammates use **Sonnet** via Agent Teams (`TeamCreate` + `Agent(subagent_type: "implementer", team_name: ...)`).
59
59
  One teammate per repo. The teammate handles all commit units for its repo sequentially.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-workspace",
3
- "version": "5.2.1",
3
+ "version": "5.2.3",
4
4
  "description": "Claude Code multi-workspace orchestrator \u2014 skills, hooks, agents, and templates for multi-service projects",
5
5
  "bin": {
6
6
  "cc-workspace": "./bin/cli.js"