Keeping Claude Code working when you walk away

A long agentic task and a closing laptop lid are natural enemies. There are four ways to fix it, and which one is right depends on whether you own a machine that can stay awake.

You give Claude Code something that will take twenty minutes. You need to leave. Everything about the situation is ordinary, and the default outcome is that the work dies with your session.

Three separate things can kill it, and they are worth keeping apart because different fixes address different ones:

  • The process stops — the machine sleeps, or the shell that owned it exits.
  • The connection drops — you lost signal, or your phone suspended the app. The process may be fine; you just cannot see it.
  • The session is forgotten — the process survived but nothing knows how to reattach you to it.

1. tmux on a machine that stays on

The classic answer. tmux owns the process, so detaching your terminal does not kill it:

tmux new -s work
# start claude, then Ctrl-B then D to detach
tmux attach -t work

This solves the connection problem and the forgetting problem outright. It does not solve the first one: tmux on your laptop still dies when your laptop sleeps. It only works if it runs on something that stays awake — which in practice means a VPS or a desktop you leave on. See running Claude Code on a VPS.

The catch on a phone is ergonomic rather than technical: you are reattaching to a full-screen terminal UI and driving it with a soft keyboard.

2. A session daemon on the server

Same idea, one layer up. Instead of a terminal multiplexer, a small long-lived process on the server owns each Claude Code session and keeps a transcript. Clients attach and detach; the session neither notices nor cares.

The practical gains over tmux are that reattaching is instant and stateful rather than "here is a screen buffer, find your place", several devices can watch the same session, and the daemon can push a notification when a task finishes — because something is still watching even when you are not.

This is how Maude works: a per-server daemon owns every session's process, so closing the app is a detach rather than a disconnection, and you get a push when the work is done.

3. Anthropic's cloud sessions

If you own no machine that can stay awake, move the work off your machines entirely. Claude Code on the web runs tasks on Anthropic-managed infrastructure, so a session continues after you put the phone away and with your laptop shut. Start it on a laptop, review it on a phone.

The constraints: your repository has to be on GitHub, the work happens in an environment Anthropic provisions, and it cannot see your private network or database. Compared in more detail in Maude vs Claude Code on the web.

4. Remote Control (with a caveat)

Remote Control connects the Claude app to a session running on your own computer, and it is included with a Pro or Max plan. It fixes the connection problem well — Anthropic notes that if the machine sleeps mid-session, the session reconnects when it comes back online.

It cannot fix the first problem, because it is definitionally driving your machine: that machine has to stay on with Claude Code running. If the laptop in question is the one going into a bag, this is not the answer for that laptop. It is an excellent answer if you have a desktop at home that is always on.

Choosing

ApproachSurvives a closed laptopNeedsNotifies you
tmux on a VPSYesA serverNo
tmux on your laptopNoNothingNo
Session daemon (Maude)YesA server + the appYes
Cloud sessionsYesRepo on GitHubYes
Remote ControlNo — machine must stay onAn always-on computerYes
The deciding question

Do you own a machine that can stay awake? If yes, put the session on it and use tmux or a daemon. If no, the work has to move to infrastructure that is awake by default — either a cheap VPS you rent, or Anthropic's cloud sessions.

One thing that helps regardless

Whatever you choose, a task you cannot supervise should be written so it does not need supervising. Say where to stop, what to do on failure, and what not to touch. "Fix the failing tests in api/; if a fix needs a schema change, stop and explain instead" survives being left alone far better than "fix the tests" — the specific instruction is what stops a twenty-minute unattended run from wandering somewhere you did not want it.

Frequently asked questions

Does Claude Code keep running if I close my laptop?
Not by itself — when the machine sleeps, the process stops. It keeps running only if the session lives somewhere that stays awake: a VPS, an always-on desktop, or Anthropic's cloud infrastructure.
Is tmux enough?
tmux solves detaching and reattaching, which covers a dropped connection or a closed terminal. It does not keep anything alive through a sleeping machine, so it only helps on hardware that stays on.
Can I get a notification when a task finishes?
Yes, depending on the route. Anthropic's app sends push notifications when Remote Control is active or when a Dispatch session finishes. Maude pushes when a task completes or needs approval. A bare tmux session cannot notify you at all.
What happens when my phone suspends the app?
With a plain SSH connection the connection drops and you re-dial and reattach. With a server-side session daemon the session carries on regardless and the app resumes where it was — the phone was never what was holding it open.

Sessions that outlive the app

Maude keeps them on your server and pushes when they finish. iOS and Android.