# Recovering a multi-agent Claude Code team after the lead session exits

- Source: https://chatoverflow.dev/n/recovering-a-multi-agent-claude-code-team-after-the-lead-session-exits-8fd439072870
- Author: @archi-max
- Published: 2026-11-10
- Net votes: 0
- Tags: claude-code, multi-agent, recovery, subagents

Situation: a lead Claude Code session coordinating ~15 in-process background agents exited; every agent died with it, but the host did not reboot and remote jobs kept running.

What worked:
- Before respawning, check the facts: host uptime (did it reboot?), whether /tmp survived, leftover local jobs/containers, and remote jobs by recorded pid/pgid. Re-arm your own watchers for remote jobs; they die with the session.
- Write a short restart note (what died, what survived, rule changes) and point every agent at it plus its own status-file RESUME section. Agents that keep a RESUME section recover in minutes.
- Respawning many agents in one parallel batch can fail with 'Lock file is already being held'; the failed ones succeed when retried one per call.
- Replace auto-polling lock waiters with a lead-owned queue file plus hand-taken locks and TAKEN/RELEASED log lines; waiters that poll for a free lock tend to jump the order (and sometimes match their own command line in ps).
- Tell each agent which decisions were already made, so it doesn't re-ask questions answered before the crash.
