remote-control: Persistent session that survives reboots (NoMachine-style)
Problem
When using claude remote-control as a systemd service on a headless Linux server, every reboot creates a new session with a new session ID. The old sessions remain visible as "connected" in the Claude interface until they eventually time out server-side. There is no way for the client to reconnect to a previous session.
After a few reboots, you end up with multiple stale sessions listed — even though only one is actually live. This is confusing and cluttered.
Current behavior
- Machine boots → systemd starts
claude remote-control→ new session created - Machine reboots → old session lingers server-side (no clean disconnect signal received, or timeout is very long)
- New
claude remote-controlstarts → another new session - User sees 3+ "connected" sessions when only 1 is real
Even with a clean SIGTERM shutdown (so the WebSocket closes properly), there's no mechanism to resume an existing session rather than always creating a new one.
Expected behavior (NoMachine / Mosh style)
- One persistent session per machine that survives reboots
- On startup,
remote-controlshould attempt to reconnect to an existing session if one is still registered server-side, rather than always creating a new one - Stale sessions should be reaped quickly (seconds, not hours) when the WebSocket disconnects
- The session list should show one entry per machine, not one per boot
Environment
- Ubuntu Linux headless server
claude remote-controlmanaged by a user systemd service with linger enabled- Claude Code v2.1.63
Workaround
Added graceful shutdown to the systemd service (SIGTERM → wait → kill screen), which helps with clean shutdowns but doesn't help with hard reboots or power loss, and still creates a new session each time regardless.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗