# Keep Claude Code running with your laptop closed

> Why closing the lid stops Claude Code, the ways to keep it working, and how to run it on a box that stays on while your laptop sleeps, with what it costs.

URL: https://prized.dev/docs/keep-claude-code-running

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 and Team, and Enterprise seats with Claude Code). A VM that Anthropic runs clones your GitHub repository at the pushed branch ([Anthropic's docs](https://code.claude.com/docs/en/claude-code-on-the-web)).
* **A Prized box.** A Linux machine that stays on, with your project folder synced both ways and its ports on your localhost. The steps follow.

## 1. Put your project on a box [#1-put-your-project-on-a-box]

```bash
cd ~/code/myproject
npx prized
```

It signs you up (GitHub or Google), starts a box on $30 of free credit with no card, and syncs this folder with `~/code/myproject` on the box. Pick **Terminal**, then **Claude Code**: after asking, it copies your Claude Code sign-in to the box and starts Claude Code there, in a tmux session named `claude` ([Sign up from your terminal](https://prized.dev/docs/terminal-signup)). Already signed in on this machine? Run `prized setup` in the folder instead.

## 2. Close the lid [#2-close-the-lid]

Give Claude Code its task, then close the terminal or the laptop. The session belongs to the box, so Claude Code keeps working, and its edits sync to your laptop when it wakes ([Sync](https://prized.dev/docs/sync#offline)). If the session is gone, this starts it again:

```bash
prized agents run claude --attach --dir code/myproject
```

## 3. Check on it from anywhere [#3-check-on-it-from-anywhere]

* **From a computer:** `prized ssh -s claude`. On another computer, install the CLI and run `prized login` first.
* **From your phone or any browser:** open the box on the [dashboard](https://prized.dev/dashboard). The arrow beside **Open terminal** lists **Claude Code**, which opens the box's terminal in the `claude` session.

## 4. Get notified [#4-get-notified]

Type `/remote-control` in the session to follow it from the Claude app, then turn on push notifications in `/config`; this needs a Claude subscription sign-in, not an API key ([Anthropic's docs](https://code.claude.com/docs/en/remote-control)). On your computer, agents you run in [herdr](https://prized.dev/docs/herdr) post a notification when they finish or need you.

## Or hand it a task and walk away [#or-hand-it-a-task-and-walk-away]

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

This runs Claude Code headless on the box and returns at once; `prized events --follow` follows the run. `--auto` lets it run commands without asking ([Prompt an agent remotely](https://prized.dev/docs/remote-agents#approvals)).

## What it costs [#what-it-costs]

|                                                           | Small (4 vCPU, 16 GB) | Nano (2 vCPU, 2 GB) |
| --------------------------------------------------------- | --------------------- | ------------------- |
| Awake, per hour                                           | $0.137                | $0.014              |
| A 10 hour run overnight                                   | $1.37                 | $0.14               |
| How long $30 of free credit lasts, awake around the clock | About nine days       | About three months  |

Asleep, a box pays only for its disk ([Billing](https://prized.dev/docs/billing)). On the free credit, a box sleeps after 2 hours idle, never in its first 24 hours; a working agent counts as use, so the box stays up while Claude Code works ([Auto-pause](https://prized.dev/docs/boxes#auto-pause)). A Small keeps Claude Code's session through a pause, and `prized box pause` sleeps it at once ([Pause and resume](https://prized.dev/docs/boxes#pause-and-resume)).
