Does Claude Code keep running when you close your laptop?

No. When the laptop sleeps, Claude Code sleeps with it, and a request in flight usually fails. To keep a session working, run it on a machine that stays on, such as an EnvHaven workspace.

Updated November 23, 2026

Claude Code is a program running on your computer. Close the lid and the operating system suspends it along with everything else. Nothing happens while the computer sleeps. When you open it again the session is still on screen, but the work stopped where it was, and a request that was waiting on Anthropic’s API when the network dropped usually comes back as an error you have to retry.

So the honest answer is no, and the useful question is where the session should run instead. An EnvHaven workspace is a Linux machine of its own that never sleeps, with Claude Code built in.

Keep it running in a workspace

  1. Open your workspace from the EnvHaven dashboard.
  2. Open the Launch menu at the top left, choose Claude Code and choose Sign in. It opens claude.ai so you can approve the workspace, then takes the short code the page shows, so your Claude plan works with no API key. For an API key, choose Set key instead.
  3. Give it the task. In a workspace Claude Code starts without permission prompts, so it does not stop to ask before running a command.
  4. Close the laptop. The session keeps going on the workspace.
  5. Open the workspace from any device to read where it got to, or to answer a question it asked.

The sign-in is saved on the workspace, so every device you open it from is signed in. Whatever the session builds is reachable at the workspace’s preview address, which lets you check the result on your phone too.

Your options

OptionKeeps working with the lid closed?What it takes
An EnvHaven workspaceYesOpen it in a browser tab and sign in from the Launch menu
Claude Code on the webYes, for repositories on GitHubA cloud session on Anthropic’s infrastructure
A server you manage, with tmuxYesA VPS, SSH, tmux, an install and a sign-in
Claude Code Remote ControlNo: the session still runs on your computerclaude --remote-control, then the Claude app
Keep the laptop awakeOnly with the lid open, or plugged into power and a displaycaffeinate on macOS, a power setting elsewhere

Remote Control is worth knowing about, because it is often mistaken for the answer. It lets your phone drive a session, but the session lives on the computer that started it, so that computer has to stay on and online.

On a server you manage yourself

The general recipe works on any Linux server:

# on the server
tmux new -s work
claude
# start the task, then detach with Ctrl+B, then D

The first run asks you to sign in. On a remote machine, press c to copy the sign-in URL, open it on any device and paste back the code it shows; /login does the same later. Close your laptop, open a terminal anywhere later, and tmux attach -t work puts you back in the same session.

The catch is the setup: the server, SSH keys, Node or the native installer, the sign-in, tmux itself, and a way to see whatever the agent builds. A workspace arrives with all of it done.