Sign in

Keep Claude Code running with your laptop closed

Updated

Why closing the lid stops Claude Code, the ways to keep it working, and how to run it on a box that stays on: your sign-in carried over, permission modes for a run you leave alone, following it from the Claude app, how your plan's limits affect a long run, and what it costs.

On this page8

A sleeping laptop runs nothing, so closing the lid stops Claude Code mid-task. Over SSH, the lid drops the connection, and Claude Code ends with it unless it runs inside tmux. To keep working, it needs a persistent session on a machine that stays on:

  • tmux on a server you run. You maintain the machine and move your code there with git.
  • Claude Code cloud sessions (claude --cloud, on Claude Pro, Max, Ultra and Team, and Enterprise premium or Chat + Claude Code seats). A VM that Anthropic runs clones your GitHub repository at the pushed branch (Anthropic's docs). On Team and Enterprise, they can run on Prized instead (Run the Claude Code self-hosted runner on Prized).
  • A Prized box. A Linux machine that stays on, with Claude Code preinstalled, your project folder synced both ways, and its ports on your localhost. The steps follow.

Already running it on your laptop?

prized teleport

Run in the project folder, or as ! prized teleport -y inside Claude Code (prized v0.21.12 or later), it moves the conversation to your box mid-task: Claude Code stops here and resumes there with its full history, in the claude session, and carries on with the step it was on. Then close the lid (Move Claude Code to the cloud mid-task); prized teleport back brings it home again. It needs a box; the steps below set one up.

1. Start Claude Code on a box

New to Prized? Sign up: the tour starts a box on $30 of free credit and gives you the command that installs the CLI (Quickstart). Then, in your project folder:

cd ~/code/myproject
prized setup --sync --agent claude --attach

Setup syncs the folder with ~/code/myproject on the box, copies your Claude Code sign-in, MCP servers and settings there, starts Claude Code in a tmux session named claude, and opens it in this terminal. Plain prized setup gets you there too: it ends by asking to start Claude Code on the box.

Rather have Claude Code set it up? Paste the prompt from /claude-code into it. It copies your project to the box once, without sync.

2. Your sign-in on the box

Setup copies the sign-in from your Mac's Keychain or ~/.claude/.credentials.json, and the box refreshes its copy from then on, so one side eventually asks you to /login again (Credentials). prized agents run claude offers the same copy at a terminal when the box has no sign-in. Other ways to sign the box in:

  • /login on the box. Claude Code prints a sign-in link: select it and press c, and it lands on your laptop's clipboard through prized ssh or prized agents run --attach (Copy out). Open it in your browser, then paste the code it shows back into Claude Code.
  • A token that lasts a year. claude setup-token prints one for your Claude subscription; set it on the box as CLAUDE_CODE_OAUTH_TOKEN, and runs nobody watches never stop at /login. Every new session then signs in with the token, which only makes model requests, so Remote Control doesn't work on that box (Anthropic's docs).
  • An API key. An Anthropic Connector sets ANTHROPIC_API_KEY on the box without the key touching its disk. Claude Code asks once whether to use it instead of your subscription, and headless runs always do, so usage bills to the key.

3. Permission modes for a run you leave alone

Recent versions of Claude Code start in auto mode: a second model reviews each action instead of you and blocks anything beyond what you asked for. After 3 blocks in a row, or 20 in a session, it goes back to asking you, and a question waits until you come back (Anthropic's docs). Shift+Tab cycles the session through manual, accept edits and plan. To start it in a mode instead, quit Claude Code (/exit), then start it again with its flags after --:

prized agents run claude --attach --dir code/myproject -- --permission-mode acceptEdits

Allow and deny rules for single commands, such as Bash(npm test), go in .claude/settings.json in your project, which syncs to the box with it.

4. Close the lid, and follow it from your phone

Give Claude Code its task and close the laptop: the claude session belongs to the box, and its edits reach your laptop when it wakes (Sync).

  • The Claude app: type /remote-control in the session to follow and steer it from the app, then turn on push notifications in /config. This needs a Claude subscription sign-in, not an API key or a setup-token token; on Team and Enterprise, an owner turns it on (Anthropic's docs).
  • Any browser: open the box on the dashboard and pick Claude Code from the arrow beside Open terminal; it works on a phone too (Use Claude Code and Codex from your phone).
  • A terminal: prized ssh -s claude. If the session is gone, prized agents run claude --attach --dir code/myproject starts Claude Code again, and claude --continue there picks the last conversation back up.

On the free credit an idle box sleeps after 2 hours. Claude Code printing in its session counts as use, and prized box auto-pause BOX off keeps the box up through a quiet stretch of up to 12 hours, and with no limit on a plan or after a top-up (Auto-pause).

Hand it a task without a terminal

prized prompt --provider claude --cwd code/myproject --auto --detach "run the test suite and fix what fails"

This runs claude -p on the box and returns at once; prized events --follow follows it. Without --auto it runs in accept-edits mode, so it edits files and runs common file commands such as mkdir and mv, but other commands are refused; --auto runs claude --dangerously-skip-permissions. --model takes Claude Code's own ids and aliases, or a Bedrock, OpenRouter or DeepSeek model (Prompt an agent remotely).

Long runs and your plan's limits

Claude Code on a box uses the same Claude plan limits as on your laptop, and a box adds none. Verified Ultra accounts have no five-hour limit, only weekly ones (Anthropic). When a limit does stop a run, Claude Code by default waits in the open session and continues by itself after the reset, on a Claude subscription sign-in and version 2.1.234 or later (Anthropic's docs). The wait needs the session open on a machine that is awake, which a closed laptop is not and a box is. A wait can be a long quiet stretch, so on the free credit run prized box auto-pause BOX off before you leave it. That holds the box through 12 idle hours; a wait for a weekly limit can be longer, and needs a plan or a top-up to stay up.

What it costs

Claude Code runs on your Claude plan or Anthropic API key, as on your laptop. Prized bills the box: a Small (4 vCPU, 16 GB) is $0.137 an hour awake, $1.37 for a 10 hour run overnight, and only its disk while it sleeps (Billing).

Running Codex too? Run multiple Claude Code and Codex agents in parallel puts several on one box.