remote-control: Persistent session that survives reboots (NoMachine-style)

Resolved 💬 3 comments Opened Mar 1, 2026 by No-LetterHead4141 Closed Mar 4, 2026

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

  1. Machine boots → systemd starts claude remote-control → new session created
  2. Machine reboots → old session lingers server-side (no clean disconnect signal received, or timeout is very long)
  3. New claude remote-control starts → another new session
  4. 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-control should 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-control managed 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.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗