Does Claude Code keep running after you close your laptop?
A local Claude Code process cannot make progress while your laptop sleeps. Learn what terminal persistence and remote compute change.
If closing your laptop puts it to sleep, a locally running Claude Code process cannot continue making progress. The process may resume when the computer wakes, but commands, network activity, and agent work are paused while the machine is suspended.
The short answer is no for a normal local setup. To continue while the laptop is asleep, Claude Code must run on another computer or through a supported remote execution workflow.
Why Claude Code Stops When Your Laptop Closes
Claude Code runs as a process on the host machine. When a laptop suspends, the operating system pauses normal execution to conserve power. The process usually remains in memory, but it cannot run commands or reach the network until the machine wakes.
This is not a flaw in Claude Code specifically. It is a property of local execution. The terminal is local, the runtime is local, and the session is only as persistent as the device under it.
The Session Is the Wrong Unit
Most developers try to solve this by keeping their machine awake — disabling sleep, running caffeinate on macOS, or leaving the lid open. These are workarounds, not solutions. They trade battery life and hardware wear for marginal reliability.
The deeper issue is that a terminal session was never designed to be a durable unit of work. Sessions are ephemeral by construction. They exist to give a human a prompt. When the human leaves, the session's reason for existing goes with them.
An agent running a long task — refactoring a module, triaging a backlog of errors, generating release notes — needs something more durable than a session. It needs a computer that keeps running regardless of what any connected shell is doing.
What Persistence Actually Requires
Keeping an agent running after you close your laptop requires separating two things that local development conflates: the compute environment and the viewing surface.
On a local machine, these are the same thing. Your laptop is both the computer doing the work and the screen you use to inspect it. Close the screen and you interrupt the computer.
A persistent agent setup pulls these apart. The compute runs somewhere that does not sleep. The shell you use to steer the agent becomes a renderer — a window into work that is already happening. Shells come and go, but the computer keeps running.
This is the architectural principle behind cloud computers built for background AI agents. The agent's process lives on a hosted machine. Your laptop, phone, or any other device is just a surface for inspection and steering.
The tmux Approach and Its Limits
Some developers reach for tmux or screen to persist sessions across disconnections. These tools keep a terminal session alive on a remote server even after the SSH connection drops. For simple scripting tasks, this works.
For AI coding agents, this is a useful building block rather than a complete operating model. On a remote server, tmux survives an SSH disconnect and the agent can keep running. You still own server setup, security, updates, backups, repository access, observability, and the workflow for reviewing what the agent produced.
On the laptop itself, tmux cannot defeat system sleep. On a remote server, it can keep the terminal alive because the remote computer stays awake.
Running Claude Code on a Dedicated Cloud Computer
The approach that actually works is provisioning a dedicated cloud computer where Claude Code runs as a persistent process. You point the agent at that machine. It works continuously. When you open your laptop the next morning, the work is there.
Matrix OS is built specifically for this. It gives developers a hosted computer in the cloud where Claude Code, Codex, Cursor, Gemini CLI, and other agents run in persistent sessions. The agent keeps working after your laptop sleeps, after your connection drops, after you step away entirely. Your devices become viewers of work that lives on the cloud computer.
This is a different product shape than a remote IDE or a sandboxed execution environment. The compute is durable. The workspace persists between sessions. The agent's context does not reset when you reconnect.
What This Changes in Practice
When the compute is persistent and the shell is just a renderer, several things shift:
- a long refactor can run overnight without babysitting
- error triage can happen in the background while you work on something else
- multiple agents can run in parallel on the same workspace without competing for local resources
- reconnecting to an in-progress session is the same as opening a tab — the work is already there
This is the practical shape of AI-native computing — not a smarter chat window, but a persistent operating environment where agents and the people supervising them share the same durable workspace.
The local machine was never the right unit for this kind of work. The session was never the right unit either. The cloud computer is.
Frequently Asked Questions
Does Claude Code stop when I close my laptop?
If the laptop sleeps, a local Claude Code process stops making progress until the laptop wakes. Whether the process resumes cleanly depends on the task, terminal, and any commands or network connections that were active.
Can I use tmux or screen to keep Claude Code running?
Yes, when tmux or screen runs on a remote computer that remains awake. Running it locally preserves a terminal across detachments, but it does not keep the laptop executing during system sleep.
What does it mean for an agent to run persistently?
A persistent agent runs on compute that does not depend on your local device being awake or connected. The agent's process, filesystem state, and context survive across sessions. You reconnect to inspect or steer the work rather than restart it.
Is there a way to run Claude Code in the cloud?
Yes. Matrix OS provisions a dedicated hosted computer where Claude Code and other agents run in persistent sessions. You point the agent at the cloud computer and let it work. Your local device is only needed when you want to inspect or steer the agent.
Does this work with other AI coding agents besides Claude Code?
The same lifecycle applies to terminal agents such as Codex CLI and Gemini CLI when they run locally. Managed remote agents, including Cursor Background Agents, already run away from the laptop and follow their provider's lifecycle instead.
How is this different from a remote IDE or a cloud development environment?
A remote IDE gives you a browser-based editor backed by remote compute. A cloud computer for agents is designed around the agent as the primary actor, not the human. The workspace is built to host continuous agent processes, not to replicate a local development experience in a browser.
What happens to the agent's work if my internet connection drops?
On a cloud computer, the agent's process keeps running on the hosted machine regardless of your connection state. When you reconnect, the work is where you left it. The connection drop is invisible to the agent.