On this page · 9 min
Running Claude Code remotely, so that a test run survives your laptop going into a bag, comes down to where the process lives. Here is the problem, why sessions stop, and how to pick a place where yours keeps going.
The problem: work that outlives the lid
Say you start a migration at your desk. Forty tests fail, and Claude Code is halfway through fixing them when you need to leave. The run needs another three hours. If the session stops when the laptop sleeps, the work sits there until you open the lid again, and you can't check the result from your phone.
What you want is simple: the run finishes, and you can see the result from anywhere.
What stops a session, and what doesn't
A session has a process behind it. The process needs a machine that is awake and online, and it needs the connection to its terminal or to the service that relays it. When any of those goes away, the session stops or pauses.
Remote Control keeps the process on your own computer. The official docs say that if you close the terminal or stop the claude process, "the session goes offline until you bring it back." It also reconnects by itself once the machine is awake again, and the docs say it does so "if your laptop sleeps or your network drops." If your machine stays unreachable for a long time, the server-mode process gives up after about 10 minutes (Remote Control docs).
Cloud sessions run on Anthropic's infrastructure instead. The session "keeps running after you close your laptop," so you can check it or steer it from any device. The trade-off is that a session that sits idle for a long time is reclaimed, which the table below covers.
A machine you control keeps running while it is on. Its processes live on that machine, not on your laptop. An idle machine can hibernate, though, so you need to set that for long work.
Claude Code remote: where the session can run
| Remote Control | Cloud sessions | Persistent machine | |
|---|---|---|---|
| Where Claude Code runs | Your computer | Anthropic's cloud | A Linux machine you control |
| What keeps it alive | Your computer staying awake | Anthropic's infrastructure | The machine staying up |
| What ends it | Closing the terminal, or about 10 minutes offline in server mode | Long idle time; the environment is reclaimed | Stopping the machine; idle hibernation pauses it |
| Your setup | A paid plan and one command | A paid plan, and GitHub connected | A Linux machine and tmux |
| Access from a phone | Yes, from claude.ai/code | Yes, from claude.ai/code | Only through a terminal app |
Read the table by the question you're asking: where should the process live, and who has to keep it up?
Option 1: keep your own computer awake with Remote Control
Remote Control shows your local session on claude.ai/code or in the Claude app. Your files, your MCP servers (plug-ins that give Claude Code extra tools) and your project settings stay on your machine, so nothing needs to be copied anywhere. Start it from the project folder:
claude --remote-control "Migration fixes"The terminal shows a session URL and a QR code. Open the URL on another device to follow the work and send messages. You'll see the conversation and tool activity in both places.
Remote Control needs a paid claude.ai plan: Pro, Max, Ultra, Team or Enterprise. API keys don't work for it. On Team and Enterprise, an owner has to switch it on first.
It fits short work while you are at your desk. It stops fitting when your laptop has to leave, because the session needs the lid up, the network on, and the terminal open.
Option 2: Anthropic's cloud sessions
A cloud session runs Claude Code on Anthropic's infrastructure. You start it from a terminal, the browser, the mobile app or the desktop app. From a terminal, it looks like this:
claude --cloud "Fix the failing migration tests"The cloud session clones your GitHub repo at your current branch. Commits that exist only on your machine don't reach it, so push first. If your repo isn't on GitHub, the CLI can upload a copy of it instead, including its git history, up to 100 MB. When you want the work back in your terminal, claude --teleport pulls the session into a local checkout.
Three limits matter before you rely on it. A session that sits idle for long enough is reclaimed, and its machine goes with it. Your conversation comes back when you reopen the session, but shell commands that were still running don't, so Claude has to rerun them. In Anthropic-hosted environments, network access is limited by default, so a task that downloads from an unlisted host needs a change to the environment's settings. And cloud sessions draw on the same rate limits as your other Claude work, so several tasks at once use up more of them.
It fits work on a GitHub repo that doesn't need your local files, when your team accepts those rules. Organizations that want the session on their own infrastructure can route it to a self-hosted environment instead (cloud sessions docs).
Option 3: a persistent machine you control
This option is the one for work that runs for hours, uses your team's own network rules, or needs several agents at once. The approach is the same on any Linux server you run: put Claude Code in a tmux session on a machine that stays up, so the session outlives your connection. Community tools such as 247-claude-code-remote use the same idea, running the agent on your own machine behind a web terminal.
The steps below use boxd for the machine. On a server you run, skip steps 1 and 2 and start at step 3.
-
Install the CLI on your laptop, then sign in. Run these on your laptop, not on the machine:
Terminal curl -fsSL https://boxd.sh/downloads/install.sh | sh boxd auth loginThe first command installs
boxd, andboxd auth loginsigns you in. Read the install script first if you prefer to inspect it. -
Create a machine for the task, with hibernation off:
Terminal boxd machine new migration-agent --auto-hibernate-timeout=0By default an idle machine hibernates after four hours without network traffic. Hibernating writes its memory to disk and pauses the work until your next connection wakes the machine. A long test run can look idle to the platform, so turn hibernation off for it. Standby, a separate and shorter timer, is off by default. Suspend, resume, and hibernate explains both, and the commands reference lists every flag.
-
Connect to it and start the agent in tmux:
Terminal boxd connect migration-agent tmux new -s migration claude "Fix the failing migration tests"tmux new -s migrationopens a named session that stays alive when your connection drops. Claude Code starts inside it. If Claude Code asks you to sign in, run/login. Iftmuxis missing, install it withsudo apt install tmux. -
Detach and close your laptop. Press Ctrl-b, then d. You'll see the shell again, and the agent keeps running on the machine. Close the lid.
-
Check on it later from any laptop:
Terminal boxd connect migration-agent tmux attach -t migrationYou see the agent where you left it, with the output so far.
The two settings that matter for a long run are these. The machine has no session cap of its own, so the run isn't cut off at a fixed time, although your Claude plan's usage limits still apply. And hibernation is set for this machine, not left at the four-hour default. If you skip the second, the run can pause without you noticing.
Unattended runs
For a run no one watches, use print mode instead of the interactive prompt. claude -p "Fix the failing migration tests, then push a branch" runs the task, prints the result and exits. The machine needs git access to the repo before the run starts, and gh pr create can open a pull request from the branch the agent pushed. Set that access up before the run, not inside it. The steps above don't cover triggering a run from an issue; that needs a script or a service on top of this.
If the agent runs code you didn't write, create the machine with --isolated. An isolated machine can't reach your other machines and has no integration tokens, but it also loses agent logins and git credentials, so use it for runs that don't need to push.
For several agents at once, give each task its own machine. Each one has its own files and its own agent. When the task is done, stop the machine, or set a delete-after timer for one-off work.
Which one to pick
Use this checklist, in order:
- If your laptop is on, the work is short, and you want to check it from your phone, use Remote Control.
- If the work runs for hours, the repo is on GitHub, and you accept Anthropic's cloud rules, use cloud sessions.
- If the work has to run on a machine of its own, or you run several agents at once, use a persistent machine: boxd, or a server you run.
Remote Control keeps your local files and tools in reach. Cloud sessions need no machine of yours. A persistent machine gives you the most say over network rules and how long the machine lives. Pick the option whose limits you can live with.
Next step
Whichever option you picked, start with one task on one machine. If you want the boxd machine from the steps above, install the CLI:
curl -fsSL https://boxd.sh/downloads/install.sh | shThen run steps 2 to 5 of option 3, or read about agents on their own machines.
Frequently asked
- Does Claude Code keep running when my laptop is closed?
- With Remote Control, no. The session runs on your computer, so it goes offline when the terminal closes or the computer sleeps, and it reconnects once the computer is awake and online. Cloud sessions run on Anthropic's infrastructure and keep going after you close the laptop, but they expire after a period of inactivity.
- How do I keep a Claude Code session running after I disconnect from SSH?
- Start claude inside tmux or screen on the remote machine, as the Claude Code docs recommend. In tmux, press Ctrl-b then d to detach, and run tmux attach -t <name> to come back.
- Why isn't Claude Code Remote Control working?
- Remote Control needs a paid claude.ai plan (Pro, Max, Ultra, Team or Enterprise), and API keys aren't supported. On Team and Enterprise, an owner has to turn it on. Run /status to see which plan and organization your sign-in uses.
- How do I continue a Claude Code session on another computer?
- With Remote Control, open the session's claude.ai/code link on the other device while the session runs on your computer. For a cloud session, run claude --teleport to pull it into a local checkout of the same repository.



