Guides

Keep Codex and Claude Code running when your laptop sleeps

Codex and Claude Code run on the machine that started them, so when the laptop sleeps or drops off the network, the agent stops mid task. To keep one working with the lid closed, run it somewhere that stays awake: a desktop that never sleeps, a server inside tmux, or a cloud workspace such as Murmell.

Step by step

  1. For a short task, keep the laptop awake. On a Mac, run caffeinate -i in a terminal and leave the laptop plugged in and on the same network until the agent is done.
  2. For a long task, move the agent. Start it on a machine that stays on: a desktop, a Linux server inside tmux, or a cloud workspace.
  3. Start the task, then close the lid. Give the agent its task on that machine. Your laptop only shows the session, so closing it no longer stops anything.
  4. Check on it from anywhere. Reattach to the tmux session over SSH, or open the cloud workspace in a browser, on any computer or a phone.

Why the agent stops

A coding agent is a process on the computer that launched it. It holds the conversation with the model, runs your tests and edits your files from there. Close the lid and the operating system freezes it; take the laptop out of Wi-Fi range and its requests to the model fail. Either way, a long refactor you left running is half done when you open the laptop again.

Three ways to keep it working

Keep the machine awake

On a Mac, caffeinate -i in a terminal, or a desktop that never sleeps, keeps the process alive. Nothing to set up, but the agent is still tied to that machine and that network.

Run it on a server

Put the agent on a Linux server inside tmux and it keeps going after you disconnect. You take on the server: updates, disk space, credentials, and a worktree per agent if you run several. Run Claude Code on a server has the steps, and they are the same for Codex.

Run it in a cloud workspace

Murmell runs Codex and Claude Code in their real terminals on a cloud machine. You start a task from the browser, close the laptop, and find the work done when you come back, from the same laptop, another computer or your phone. Several agents can share the project, each with the files it is editing reserved so they do not write over each other.

Which one to pick

For a task that finishes before your next meeting, keeping the laptop awake is enough. For agents that run for hours, or overnight, move them off the laptop: a server if you want to maintain one, a cloud option if you do not.

Straight answers

Why does Codex stop when my MacBook goes to sleep?

The Codex process lives on the laptop. Sleep freezes it and cuts its connection to the model, so the request in flight fails and the task stops where it was.

Can I keep my Mac awake instead?

Yes, with caffeinate or a setting that prevents sleep on power. It works at a desk, but not in a bag, and the agent still stops the moment the laptop leaves the network.

Does a Murmell canvas go to sleep while an agent is working?

No. A canvas sleeps only when no agent is active and nobody has acted in it for a while, ten minutes by default. Its files are kept, and it wakes when you come back.