SETTINGS · multi-agent-orchestration

Settings: agent teams, gated

The settings.json that enables experimental agent teams with quality-gate hooks on teammate idle and task completion, plus the limitations a team should read before turning it on.

✓ verified 2026-07-18 · stack: claude-code · source

Agent teams are experimental and disabled by default; nothing team-shaped happens without the flag (agent teams). This is the committed configuration for a team that has decided to trial them deliberately: the enable flag, the display mode, and the three team hooks wired to quality gates so “done” means checked, not claimed.

.claude/settings.json (fragment)
{
"env": {
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
},
"teammateMode": "in-process",
"hooks": {
"TeammateIdle": [
{
"hooks": [
{
"type": "command",
"command": "node .claude/hooks/teammate-idle-gate.mjs",
"timeout": 60
}
]
}
],
"TaskCompleted": [
{
"hooks": [
{
"type": "command",
"command": "node .claude/hooks/task-completed-gate.mjs",
"timeout": 60
}
]
}
]
}
}
.claude/hooks/task-completed-gate.mjs
#!/usr/bin/env node
// TaskCompleted gate: exit 2 blocks the completion and sends feedback.
// Keep the check cheap and deterministic: this fires on every task.
import { execSync } from 'node:child_process';
try {
execSync('npm run --silent lint && npm test --silent', {
stdio: ['ignore', 'ignore', 'pipe'],
timeout: 50_000,
});
process.exit(0);
} catch (err) {
console.error(
`Task cannot be marked complete: the gate is red.\n${String(err.stderr ?? '').split('\n').slice(-15).join('\n')}`,
);
process.exit(2);
}

What it does

  • The flag is explicit and committed. CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 in settings enables teams for everyone on the repo, which is the honest form: an experimental capability a team adopted on purpose, visible in review, removable in one line.
  • in-process display mode works in any terminal with no tmux dependency, which is the right default for a mixed team; individuals who live in tmux or iTerm2 can set "auto" in their user settings.
  • TaskCompleted exit 2 blocks the completion and returns feedback, so a teammate cannot mark work done while the gate is red. TeammateIdle exit 2 keeps a teammate working with feedback instead of letting it stop quietly. These are the deterministic backstop for the known limitation that “teammates sometimes fail to mark tasks as completed” accurately.
  • Teammates read CLAUDE.md from their working directory like any session, so the deterministic guardrails estate (hooks, permissions) applies to every teammate unchanged.

Failure modes

  • Permissions are inherited at spawn. Teammates start with the lead’s permission settings; a lead running --dangerously-skip-permissions spawns teammates that do too. Decide the lead’s mode as if deciding it for the whole team, and pre-approve common operations to avoid a permission-prompt storm bubbling up to the lead.
  • Token cost scales linearly with teammates. Each teammate is a full Claude instance. The docs’ guidance stands: three to five teammates, tasks sized to a clear deliverable, teams only where parallel exploration genuinely pays.
  • Resumption does not restore in-process teammates. After /resume, the lead may message teammates that no longer exist; tell it to spawn new ones. Task status can also lag, blocking dependent tasks until nudged.
  • Version sensitivity. This artifact describes behaviour as of Claude Code v2.1.178 or later (spawning needs no setup step; cleanup is automatic; TeamCreate/TeamDelete no longer exist). On earlier versions the flow differs; check claude --version before adopting.
  • Cheap gates only. The TaskCompleted hook runs on every completion; a slow suite there throttles the whole team. Keep it to lint plus fast tests, and leave the full regression run to the eval-gate Stop hook or CI.

Verified against the enable flag, teammateMode values, team hook events and exit-code semantics, permission inheritance, and the limitations list at code.claude.com/docs/en/agent-teams, 2026-07-18.