[BUG/FEATURE] claude rc doesn't recover sessions when killed
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
All of the behaviors described are in the worktree mode of claude rc.
When one of the sessions served by or claude rc itself gets killed (e.g. kill -9 or OOM crash), claude rc makes no visible attempt at recovering sessions either while still running or when restarted. Sending messages to the sessions' chat just time out.
Note: controlled shutdown and restart (e.g. Ctrl-C in claude rc window) does recover the session. Additional messages will eventually start being received and the sessions re-appear in claude rc. This does not appear to be the case if the shutdown wasn't clean.
What Should Happen?
Ideally claude rc would just try to restart an individual session/agent if it got killed or upon a restart of claude rc itself would just figure out which sessions and worktrees exist and start serving them again.
Error Messages/Logs
Steps to Reproduce
- Run
claude rc - Start a new session from chat UI
- kill -9 $CLAUDE_EXE_PID
- See session die.
- claude rc doesn't restore the session. Not automatically. Not upon sending more messages to the chat window.
- Rerunning claude rc also never reclaims the session (whose process died uncleanly). With
--session-idit does -- so the state is recoverable -- but--session-idserves exactly one session, so recovering 1+N killed sessions is apparently not possible.
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.234 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
The documentation for claude rc in this regard is really hard to understand for both myself and any agents I've tried to help me figure this out. The documentation around claude rc -c and claude rc --session-id is confuseing and unclear. The different operating modes of claude rc (single session and multi-session) are significantly contributing to this and should probably be unified or requiring explicity, e.g. single session mode just being claude rc --capacity 1 or always requiring explicit argument --spawn session.
The current single slot commands (e.g. -c or --session-id) should all either require explicit single-slot server (see above) or work with multi-session server. E.g. claude rc -c continues all sessions previously. To only serve the most recent session explicit single session flag would be required, e.g.claude rc -c --spawn session (old claude rc -c behavior). Allow for passing of multiple --session-id to start multiple sessions in a single call (to either explicitly recover sessions that auto-discovery failed or to start a server which only recovers a subset of sessions).
--spawn worktree should probably also imply --