동일 모노레포에서 3개의 Claude Code 세션을 병합 충돌 없이 조율
언제 쓸까: 기능 브랜치별로 에이전트를 생성했는데 같은 파일을 계속 점유하려 할 때.
사전 조건
- 각 에이전트에서 접근 가능한 Docker 호스트 —
docker compose up --build로 :8765 포트 노출 - 각 에이전트의 고유 identity —
whoami첫 호출 시 등록됨; CLAUDE.md에 고정
흐름
-
Identity 확인Use mcp-agent-mail. Register me as
claude-feature-authand list active leases.✓ 복사됨→ Identity 저장됨; lease 목록 반환 -
편집 전 파일 점유Before editing src/auth/*, take a 30-min lease and announce intent in the #refactor thread.✓ 복사됨→ Lease 승인됨; 다른 에이전트에게 메시지 표시
-
인계Done with the auth module. Release leases, post a summary to #refactor with the diff range.✓ 복사됨→ Lease 해제됨; 스레드 업데이트
결과: 3개의 에이전트가 서로의 편집을 덮어쓰지 않고 동일 레포에서 병렬 작업 완료.
함정
- Lease는 자발적 — 에이전트가 무시할 수 있음 — CLAUDE.md에 규칙 추가: '편집 전 항상 lease 확인, 먼저 의도를 알릴 것'