Session auto-restart with project context persistence
Summary
When running multiple Claude Code agents as domain teams on a long-running project, sessions eventually hit context limits or need refreshing. Currently the operator must manually restart each agent. All the context needed for a fresh session to pick up where the last left off already exists on disk (project instructions, handover docs, work queues), but there's no way to trigger "end this session, start a new one automatically."
Use Case
- Multi-agent architecture where 4-5 Claude Code desktop sessions run as independent domain teams
- Each agent reads
CLAUDE.md+ a work queue API + handover docs on startup to know what to do - Sessions degrade over time (context window fills, stale state accumulates)
- Operator wants agents to self-refresh: end session, immediately start a new one that reads the same project context and continues working
Proposed Behavior
A configuration option (in settings.json or .claude/config) that enables auto-restart:
- When a session ends (context limit, explicit
/exit, or idle timeout), automatically start a new session in the same project directory - The new session reads
CLAUDE.mdand any startup instructions as normal - Optional: a startup prompt file (e.g.,
.claude/startup.md) that the new session executes automatically
Why This Matters
The persistence layer already exists — CLAUDE.md, memory files, handover docs, work queues. The only missing piece is the trigger to start a fresh session that reads them. Without it, the operator becomes a manual restart button for N agents.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗