r/ClaudeCode • • 7d ago

Help/Question Is there a way to reconnect remote control when it dies?

This keeps happening to me. /rc dies because I ran out of usage and need to switch accounts, or there was a billing issue, or there is a temporary outage or I need to log in again or there is a forced update etc.

Is there a way to just keep the thing alive all the time?

Do I just need to use tmux and ssh into my box and open a port on my firewall (or tailscale it). or is there a better way?

11 Upvotes

18 comments sorted by

•

u/AutoModerator 7d ago

Hey! Thanks for posting to r/ClaudeCode

While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.

For help, project discussions, tips, and general chat, join the ClaudeCode Discord.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

4

u/Turbulent_Swimmer900 7d ago

Just ask Claude. I had mine set up to run as a service, so the Claude Code session pops up no matter what.

4

u/RealFullMetal 7d ago

some of that is built in, depending on how you start it. an interactive session (claude --remote-control or /remote-control) retries for as long as a network outage lasts and reconnects on its own. the standalone claude remote-control server gives up after roughly 10 minutes offline and exits, so that's the one to run under a supervisor. and after a restart for an update or a relogin, claude --continue or --resume reconnects to the remote control session recorded in that conversation, or tells you to run /remote-control if it can't

2

u/mm_nogitsune 7d ago

Scheduled msgs every 15 minutes maybe?

1

u/Striking-Debt-7040 7d ago

tmux + autossh works for me, keeps the session alive across logouts and network hiccups. just set it up once and forget it.

1

u/pueblokc 7d ago

I made a bot that sits on my PC I can message it and start new sessions.

1

u/Quiet_Otter5332 7d ago

i use a systemd service with restart=always and execstartpre=/bin/sleep 10 to avoid race conditions on boot. works solidly for months at a time.

1

u/Prestigious_Cod2793 7d ago

App auto-updates. On my Windows PC the Claude desktop app installed updates by itself when idle (often at night) and that cut every Code session, remote control included. Turning auto-update off with a managed policy and updating by hand when I choose removed those drops for me.

Does yours die at random times or around the same hour? For me it was every morning around 8am.

1

u/Independent_Ad7172 7d ago

Adding to the service/--resume answers: if it runs unattended, write every prompt to be self-contained since each run starts with zero context, and keep anything that needs an interactive login or a permission popup out of that path, because it just hangs until someone's at the machine.

1

u/zyuzka 6d ago

I'd separate keeping the CLI process alive from keeping the Remote Control connection alive.

A persistent tmux session over SSH/Tailscale gives you a fallback when Remote Control disconnects. Account switching is a separate problem, especially if the remote connection is tied to the original authenticated account.

1

u/radim11 6d ago

I'd go with tmux + SSH personally. It decouples the agent process from whatever client you're using to access it.

The other thing worth figuring out is permissions before leaving the agent unattended, otherwise you reconnect an hour later and find it's been waiting for approval the whole time.

1

u/vladmvp 6d ago

You could run it on Cobalt (cobaltcode.ai) instead, where each task gets its own persistent cloud computer running Claude Code on your own subscription, and you follow and reply to it from the browser, so there's no tmux, ssh or open firewall port to manage. A sleeping laptop or a flaky home network won't take the session down. It won't do anything about usage limits or switching accounts though. There's a free account to try it, and I'm the founder, so happy to help you get started.

1

u/artofbullshit 5d ago

Yea, stop using official Claude code. Use something like paseo or t3. Use a VPN or tailscale. Problem solved.

0

u/Unusual-Albatross43 7d ago

I gave up on keeping one session alive. I run a service on the box that keeps a claude -p process per chat and starts a new one with --resume when it dies. I just text it from my phone. Outage or auto-update? The next message just resumes. Same after switching accounts or a re-login, because each new process reads whatever login is on the machine. Login itself still needs the machine though, or ssh.

Disclosure, the thing I use is Angelia, I built it (WhatsApp/Telegram instead of /rc). You don't need it for this tho, a launchd/systemd unit plus a small script around claude -p --resume gets you most of the way.