Coordinate 3 Claude Code sessions on the same monorepo without merge hell
When to use: You spawn agents per feature branch and they keep grabbing the same files.
Prerequisites
- Docker host reachable from each agent —
docker compose up --buildexposes :8765 - Each agent gets a unique identity — First call to
whoamiregisters; pin it in CLAUDE.md
Flow
-
IdentifyUse mcp-agent-mail. Register me as
claude-feature-authand list active leases.✓ Copied→ Identity persisted; lease list returned -
Claim files before editBefore editing src/auth/*, take a 30-min lease and announce intent in the #refactor thread.✓ Copied→ Lease granted; message visible to other agents
-
Hand offDone with the auth module. Release leases, post a summary to #refactor with the diff range.✓ Copied→ Lease released; thread updated
Outcome: Three agents finish parallel work on the same repo without overwriting each other's edits.
Pitfalls
- Leases are advisory — agents can still ignore them — Add a CLAUDE.md rule: 'Always check leases before edit, post intent first'