Keeping Claude Code running after you close the laptop

Updated August 2026

Close the lid and the work stops. Everyone tries the same four fixes, and only one of them addresses what is actually wrong — so here is what each one really does, and what it leaves broken.

What is actually happening

Claude Code is a program running on your computer. Not a service you are connected to — a process, on that machine, holding your files open. When the machine sleeps, every process on it is frozen mid-step, including that one. When it shuts down, they are gone.

That is the entire problem, and it is why so many fixes miss: they change where you type, or how you reach the session, without changing where the work is happening. The work is happening on the laptop in your bag.

Fix 1 — stop the machine sleeping

The immediate one. On a Mac you keep it awake for the length of a command:

caffeinate -dimsu claude

On Linux, systemd-inhibit does the same job, and on Windows it is a power-plan setting.

This genuinely works, and for an hour's job while you make dinner it is the right answer. What it costs you is the machine: it has to stay open, plugged in, and un-restarted for as long as the work runs. A laptop that sleeps anyway because the battery ran out takes the session with it, and closing the lid is now a thing you have to remember not to do.

Fix 2 — tmux (the one people get wrong)

The standard advice, and it is good advice for the problem it solves:

tmux new -s work
claude
# Ctrl-b then d to detach; tmux attach -t work to come back

Inside tmux, the session survives a closed terminal window and a dropped SSH connection. Neither of those is what killed your agent.

tmux on your laptop still dies when your laptop sleeps. It is a program on the same machine, suspended by the same sleep. tmux only buys you a session that outlives you if it is running on something that stays awake — which is a statement about the machine, not about tmux.

Fix 3 — Channels

Anthropic's Channels connects a running Claude Code session to Telegram, Discord or iMessage, so you can send it work from your phone. It is free, it is official, and it is genuinely good.

It moves where you type. It does not move where it runs — the session is still the one on your desk, and the chat is a window onto it. Close the laptop and the chat stays there looking perfectly healthy while nothing answers, which is the most confusing version of this failure. We have written up where Channels stops in more detail.

Fix 4 — scheduled cloud runs

Anthropic will also run tasks on their own infrastructure on a schedule, which genuinely does not need your machine. If your job is “every morning, do this same thing”, that is a real answer and you should use it.

It is a schedule rather than a conversation, though. You cannot hand it something at eleven at night, go to bed, and find the finished work and a question waiting for you.

What actually fixes it

A computer that stays awake. There is no clever version of this — the only real cure for “the machine it runs on goes to sleep” is a machine that does not.

Rent one and run it yourself. A small Linux box for a few dollars a month, Claude Code installed on it, a session in tmux — the tmux advice, finally aimed at the right machine. Our full setup guide covers the install, the awkward part where you have to sign in without a browser, and the things that break later.

Or let the agent own the machine. Same idea, none of the administration: the agent has its own cloud computer with Claude Code already installed and signed in, and you have a chat. That is what we build.

The half of the problem nobody mentions

Suppose you fix the sleeping. A session that stays alive can still spend the night doing nothing.

When an agent reaches something it wants approval for, it stops and waits. If you are asleep, it waits until morning — so the job you started before bed can be exactly where you left it, eight hours later, having asked one question into an empty room.

Staying awake and being allowed to get on with it are two different problems, and moving to a server only solves the first. What closes the second is standing permission: the agent does the work, and messages you when there is something to see rather than stopping to ask whether it may continue.

So, tonight

One long job, you are home: keep the machine awake and leave it open. Done.

This keeps happening and you like servers: rent a VPS. It is a real afternoon of setup and then it is yours.

This keeps happening and you would rather it just worked: give the agent its own machine and stop thinking about lids.

The version of this with nothing to set up: an engineer with its own cloud machine and Claude Code already signed in, which keeps working after you close the laptop and messages you when it is done. From $20 a month, cancel any time.

See how it works

From $20 a month · cancel any time · ready in two minutes

Keep reading