Remote Control: Allow disconnect/reconnect from mobile app after session compaction

Resolved 💬 3 comments Opened Mar 13, 2026 by aksuke-work Closed Mar 17, 2026

Problem

When a Claude Code session hits the context limit and automatically continues in a new session (compaction), the mobile Remote Control connection becomes stale. The user is stuck connected to the old session, and there is no way to disconnect or switch sessions from the mobile side.

Current behavior

  1. User connects to a session via Remote Control (QR code / Code tab)
  2. Long conversation causes context overflow → new session starts automatically
  3. New session starts with remoteControlAtStartup: true → Remote Control is available
  4. But the phone is still connected to the old (dead) session
  5. "Disconnect this session" is only available on the PC side (interactive CLI menu)
  6. User cannot reconnect to the new session from mobile without PC access

Expected behavior

  • Mobile app should allow disconnecting from a stale session and reconnecting to a new one
  • Or: automatic reconnection to the new session when compaction occurs
  • Or: a "Switch to latest session" option in the mobile Code tab

Impact

This makes Remote Control unreliable for users who are away from their PC. Long-running sessions inevitably overflow, and at that point the mobile user is locked out with no recovery path.

Workaround (current)

We set up a SessionStart(compact) hook with ntfy.sh push notifications to alert the user that a session switch happened. But the actual reconnection still requires PC access.

Suggested solutions (any of these would help)

  1. Mobile-side disconnect: Let the mobile app disconnect from a stale session and pick a new one from the Code tab
  2. Auto-reconnect: When a session compacts and restarts with Remote Control enabled, automatically migrate the mobile connection
  3. Hook access to Remote URL: Expose the Remote Control URL in SessionStart hook input so it can be sent via push notification for one-tap reconnect

Environment

  • Claude Code CLI (latest)
  • macOS + iPhone (Claude iOS app)
  • remoteControlAtStartup: true in ~/.claude/settings.json
  • /remote-env configured

Thank you for the great product! 🙏

View original on GitHub ↗

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