Coordinate multi-agent swarm workflows. Use when working in parallel with other agents, managing shared resources, or orchestrating distributed tasks...
Protocols and patterns for consistent, conflict-free multi-agent development. Follow these guidelines when working alongside other Claude Code agents in the same codebase.
ISSUES.md); in-flight work lives in the orchestrator's native task list (TaskCreate/TaskUpdate/TaskList)ISSUES.md for repos without a tracker) hold the permanent history of work items: what was requested, why, and its final disposition..claude/rules/agent-constraints.md for the no-shared-state rule).Workers write results to scratchpad/<task-id>.md, not direct context. Only durable artifacts (ADRs, plans, PRDs) go to artifacts/. Orchestrator creates output targets before launching workers; workers write to assigned files; orchestrator reads and synthesizes.
.claude/hooks/.file-tracker.log for recent editsagent-constraints.md)ISSUES.mdHooks automatically acquire/release locks. If you encounter a lock:
# Check who holds the lock
cat .claude/hooks/.locks/<filename>.lock
# Lock automatically expires after 60 seconds
# If urgent, wait or pick a different task from the task list
When ending a session with incomplete work, leave a handoff pointing at a concrete artifact:
echo '{"message": "Continue implementing auth middleware. Tests passing but needs error handling in src/auth.ts:45", "artifact": "artifacts/plan_auth_middleware.md"}' > .claude/hooks/.state/handoff.json
For complex tasks, one agent orchestrates while others execute:
agent-constraints.md)For independent features:
Cost circuit-breaker only: this bounds runaway spend after the fact. It does not detect step-repetition or looping โ that is a different failure mode, out of scope here.
[Wave N/M] prefix (e.g., [Wave 1/3] Explore auth patterns) so spend and progress can be attributed to a wave at a glance| File | Purpose |
|---|---|
.claude/hooks/.state/session_*.json |
Active agent sessions |
.claude/hooks/.state/handoff.json |
Handoff messages between sessions |
.claude/hooks/.locks/*.lock |
File edit locks |
.claude/hooks/.file-tracker.log |
Recent file modifications |
If agents are waiting on each other:
# Check active sessions
ls -la .claude/hooks/.state/session_*.json
# Check active locks
ls -la .claude/hooks/.locks/
# Force release stale locks (use with caution)
find .claude/hooks/.locks -mmin +5 -delete
git fetch && git rebase origin/main