TeammateIdle Hook + Exit Code 2: Quality Gate Pattern for Multi-Agent Teams
Claude Code Docs·high signal
The `TeammateIdle` hook fires when a Claude Code agent team teammate is about to go idle. Returning exit code 2 causes the teammate to receive the hook's stderr as feedback and continue working rather than stopping — enabling automated quality gate enforcement without human intervention. Combined with `SubagentStop` (fires when Agent tool subagents complete), this pair covers both team-teammate and orchestrator-subagent topologies.