Inter-office memo

To
Everyone whose agent stops when the laptop sleeps
From
Mo, Chief Executive
Date
November 8, 2026, 7:47 PM CST
Re
Keeping Claude Code and Codex running with the laptop closed

How to keep Claude Code and Codex running with your laptop closed in 2026: 9 ways compared

Closing a laptop’s lid puts it to sleep, and Claude Code or Codex running on it stops until it wakes. To close the lid mid-task, send the work to the cloud: Claude Code’s cloud sessions or Codex Cloud, from $20 a month, on a GitHub repository. For your own files, keep the laptop plugged in with an external display, use Amphetamine on a Mac, or run the agent on an always-on computer over SSH or with Enjoy.

Disclosure: Enjoy is our product. We checked every way below against its maker’s own pages on November 8, 2026, and we say where another way is the better pick.

Why your agent stops when the laptop sleeps

Unless you send them to the cloud, Claude Code and Codex run on the computer you start them on, so when it sleeps, they stop working until it wakes. Anthropic’s Remote Control docs say that “if your laptop sleeps or your network drops, Claude Code reconnects automatically when your machine comes back online.” OpenAI’s remote connections page says of Codex: “If that computer sleeps, loses network access, or closes the app, remote access stops until it’s available again.”

A laptop sleeps in two ways that matter here, and they have different fixes:

  • Idle sleep, when nobody has touched it for a while. The agents’ own settings, a built-in command or an app can hold it off while the work runs.
  • The lid. Closing it is a sleep you asked for, and most keep-awake settings leave it alone. Anthropic says of the Claude app’s own: “Closing the laptop lid still puts it to sleep.” To shut the lid and keep going, the work has to run somewhere else, or the laptop has to be told to ignore its lid.

Nine ways compared

Way Best for With the lid closed Price, checked November 8, 2026 Works with
Cloud sessions, for Claude Code Handing off Claude work on a GitHub repository Keeps going, in Anthropic’s cloud Included from Claude Pro, $20 a month Claude Code
Codex Cloud Handing off Codex work on a GitHub repository Keeps going, in OpenAI’s cloud Included from ChatGPT Plus, $20 a month Codex
Keep computer awake, in the Claude app Claude on your own files, lid open Stops: the setting covers idle sleep Included with Claude Code, from Pro Claude Code in the desktop app
Prevent sleep while running, in Codex Codex on your own files, lid open Covers idle sleep; for a closed lid, OpenAI says to add an external display Included with Codex The Codex CLI; the ChatGPT app has its own switch
caffeinate, or systemd-inhibit on Linux One long task, free, nothing to install Stops with caffeinate; systemd-inhibit can hold the lid Free, built in Anything you run in a terminal
An external display, or a lid set to Do nothing A laptop that stays plugged in on a desk Keeps going Free, built in Any agent
Amphetamine Closing a Mac laptop with nothing plugged in Keeps going, in its Closed-Display Mode Free Any agent on a Mac
An always-on computer, over SSH Long runs on your own files and tools Keeps going, on the other computer Free software; the computer is yours Anything that runs in a terminal
Enjoy Every lab’s agent on a Mac mini or desktop, from your laptop or phone Keeps going on another computer; stops on the laptop itself A monthly subscription, free for 7 days (pricing) Claude Code, Codex, Grok Build, Antigravity, Muse Code, OpenCode

Prices are per month as each maker lists them, before tax. Every way but the two cloud ones works on the files on your own computer, which is why they need that computer awake.

Cloud sessions, for Claude Code

Best for: handing Claude a task on a GitHub repository, then closing the laptop.

“A cloud session is a Claude Code session that runs on cloud infrastructure instead of on your machine,” Anthropic’s docs say. “The session keeps running after you close your laptop, and you can check on it or steer it from any device.” Start one at claude.ai/code, in the Code tab of the Claude phone app, by choosing a Cloud environment in the desktop app, or from your terminal:

claude --cloud "Fix the flaky test in auth.spec.ts"

Already working in the desktop app? It “can send a local session in its Code tab to the cloud from its Open in menu.” When the work is done, claude --teleport brings the session back to your terminal.

Price: “Cloud sessions are available on Pro, Max, Ultra, and Team plans,” and they count “toward your plan’s usage limits,” with “no separate charge for the cloud VM.” Pro is $20 a month, or $17 billed yearly; Max is $100 and Ultra $200, says Anthropic’s pricing.

Watch for: the session works from GitHub, not from your laptop’s folder: “The cloud VM clones your current directory’s GitHub remote at your current branch, not your local checkout, so push first if you have local commits.” From the terminal, handoff is one-way, as “you can’t push an existing terminal session to the cloud.” And “Cloud sessions stop after a period of inactivity and the session’s VM is reclaimed.” It runs only Claude.

Codex Cloud

Best for: handing Codex a task on a GitHub repository, then closing the laptop.

“Give Codex coding tasks to work through in the cloud, from investigating bugs to building features,” says OpenAI’s Codex Cloud page. “Each task has its own workspace and can keep working while your computer is asleep.” Start tasks in ChatGPT on the web, in the desktop app or on your phone, or from a terminal, where codex cloud opens a picker and, in OpenAI’s command reference, “codex cloud exec submits a task directly.”

Price: from ChatGPT Plus, at $20 a month, which adds “Codex on the web, in the CLI, in the IDE extension, and on iOS.” Pro is from $100. “Local messages and cloud chats share your plan’s usage allowance,” and “Cloud tasks may use more of your allowance than local messages.”

Watch for: setup starts with “Choose your GitHub repositories,” and a chat already running on your computer can’t move there: “handoff to a Codex cloud environment isn’t supported.” The cloud environment has only the tools and access you give it, not your laptop’s. It runs only Codex.

Keep computer awake, in the Claude app

Best for: Claude sessions on the files on your computer, plugged in with the lid open.

In the Claude desktop app, “To prevent idle-sleep, turn on Keep computer awake in Settings > Desktop app or Settings > This computer > System,” Anthropic’s scheduled tasks page says. For a long task, its desktop docs advise: “Keep your computer awake and online, with the lid open and Desktop running and signed in.”

The app can also run a session on another machine over SSH, and there the laptop can sleep: “If your computer sleeps, you lose your network, or you quit Desktop, the task goes on until it finishes, needs you, or reaches one of the limits.”

Price: included with Claude Code in every paid plan, from Pro at $20 a month. The app runs on Mac and Windows, with Linux in beta.

Watch for: “Closing the laptop lid still puts it to sleep.” An SSH task can stop too: “If you sign in to Desktop with a Claude account, don’t count on a task to run overnight,” because its sign-in “can expire after you disconnect.” It runs only Claude.

Prevent sleep while running, in Codex

Best for: Codex on the files on your computer, plugged in with the lid open.

In the Codex CLI, type /experimental and turn on Prevent sleep while running. Codex saves it to its config as features.prevent_idle_sleep, which its configuration reference describes as “Prevent the machine from sleeping while a turn is actively running (experimental; off by default).” The ChatGPT desktop app, where Codex also runs, has its own switch for when you use it from your phone or another computer: under Settings > Connections, “You can also choose whether to keep the computer awake.”

Price: included with Codex. The CLI comes with ChatGPT Plus, at $20 a month, and up, and the desktop app with every plan from Free.

Watch for: the CLI setting is “experimental,” and its name says idle sleep. For the lid, OpenAI’s remote connections page says a Mac laptop “can stay available with the lid open and power connected. With the lid closed, connect an external display as well. Choosing Sleep still stops remote access.” It runs only Codex.

caffeinate on a Mac, systemd-inhibit on Linux

Best for: one long task on a Mac or Linux computer, free, with nothing to install.

On a Mac, start the agent through caffeinate, which comes with macOS:

caffeinate -i claude

Its -i option makes “an assertion to prevent the system from idle sleeping,” and the manual page shows the same pattern with make, holding “an assertion that prevents idle sleep as long as that process is running.” Use codex in place of claude for Codex.

On Linux, systemd-inhibit “may be used to execute a program with a shutdown, sleep, or idle inhibitor lock taken,” and its --what= option can take the lid too, with “handle-lid-switch” among the operations to inhibit:

systemd-inhibit --what=idle:sleep:handle-lid-switch claude

Price: free, part of macOS and of Linux distributions that use systemd.

Watch for: on a Mac it doesn’t cover the lid. Apple’s documentation for the idle-sleep assertion caffeinate -i makes says “The system may still sleep for lid close, Apple menu, low battery, or other sleep reasons.” The lock ends when the agent quits, and neither command is on Windows.

An external display, or a lid set to Do nothing

Best for: a laptop that sits plugged in on a desk while the agent works.

On a Mac laptop, Apple’s way is to run it closed: “After you connect a display to your MacBook Air, you can close the lid and continue to use it with connected accessories,” its guide says, and with a closed lid, Apple says to “make sure that the Mac is connected to power and using an external keyboard and mouse.” To stop it idle sleeping once the screen turns off, go to System Settings > Battery > Options and turn on “Prevent automatic sleeping on power adapter when the display is off.”

On Windows, tell the laptop to ignore its lid. Microsoft’s steps start at “Settings > System > Power & sleep > Additional power settings,” then “Choose what closing the lid does.” Next to When I close the lid, pick Do nothing, which Microsoft defines as “No action is taken when the system lid is closed,” for Plugged in at least, and save.

Price: free, built in.

Watch for: Apple’s sleep settings guide notes that “delaying, preventing, or allowing disruption of sleep may increase power consumption.” The Mac stays awake closed only with its display and power attached. A Windows laptop set to Do nothing stays on when you close it to carry it, too, until you put it to sleep from the Start menu or change the setting back.

Amphetamine

Best for: closing a Mac laptop with nothing plugged in, for one long task.

Amphetamine, from William Gustafson, is free on the Mac App Store, with “No in-app purchases.” It keeps a Mac awake “through a super simple on/off switch, or automatically through easy-to-configure Triggers,” such as “While a specific app is running.” During a session you can choose to allow or prevent “System sleep when built-in display is closed,” which is how it keeps going with the lid shut.

Price: free.

Watch for: Apple silicon needs an extra step. Closed-Display Mode there uses a script, and its listing says “Closed-Display Mode will still work without the script, but you will experience a Closed-Display Mode session failure if you connect/disconnect your Mac to/from an external power source.” Running the script “required use of Touch ID or an administrator’s password” each session until Power Protect, which “requires a separate download and installation.” The latest version, 5.3.2, came out on November 10, 2023. Apple’s warning about power use applies here too, with the lid shut and the laptop working.

An always-on computer, over SSH

Best for: long runs on your own files and tools, with the laptop only as a window.

Run the agent on a computer that doesn’t sleep: a Mac mini, a desktop, or a server. On a Mac desktop, Apple’s setting is “Prevent automatic sleeping when the display is off,” under Energy. Connect from your laptop over SSH, through Tailscale when you’re away from home, and start the agent inside tmux, as Anthropic’s Remote Control docs advise: “start it inside tmux or screen to keep the session running after you disconnect from SSH.” Close the laptop, and the agent carries on. The agents’ own apps work the same way: OpenAI suggests “a dedicated always-on Mac or Windows PC when you want ChatGPT to stay reachable for longer-running work,” and the Claude app’s SSH sessions run on the other machine.

Price: the software is free, and Tailscale’s Personal plan is “Free forever,” for “Up to 6 users.” The computer, and its power, are yours.

Watch for: you set up and look after the computer, SSH and tmux yourself, and that computer has to stay on, online and awake for as long as the work runs.

Enjoy

Best for: every lab’s agent on a Mac mini or desktop that stays on, while you close your laptop.

Enjoy runs Claude Code, Codex, Grok Build, Antigravity, Muse Code, and local models through OpenCode, on Mac, Windows and Linux, on the plans you already have. It helps in two ways:

  • Idle sleep, with nothing to set up. “While an agent is working, Enjoy keeps your computer from going to sleep because nobody is using it,” for every agent, and your usual sleep settings come back when the work is done. See Keep your computer awake.
  • The lid, by working somewhere else. Install Enjoy on the computer that stays on, and use it from your laptop: another computer “can work on your main computer’s projects, the same way a phone or browser does,” and that “costs nothing extra.” So can any browser and your phone. Close the laptop, and the agents keep working at home; open it, or your phone, to answer their questions.

Price: Enjoy is one monthly subscription, and the first seven days are free, with a card to start. It includes your phone and any browser and one computer; each other computer that runs projects of its own is $9.99 a month. See pricing.

Watch for: on a laptop alone, Enjoy doesn’t beat the lid: “If you put the computer to sleep yourself, for example by closing a laptop’s lid, your devices can’t reach it until it wakes up.” A conversation waiting for an agent’s usage to reset “doesn’t keep your computer awake,” and if the computer is asleep at the reset time, “the conversation resumes after it wakes.” The computer doing the work has to be “on, online, and running Enjoy, signed in to your account,” and on Windows and Linux, “closing the Enjoy window quits Enjoy.” Scheduled workflows, too, run only while that computer is awake with Enjoy open. Enjoy isn’t open source, and it’s a monthly subscription on top of your AI plans once the free week ends.

When to stay with what’s built in

Most people need only the first fix that fits. If the task is on a GitHub repository and you’d like to shut the laptop now, a Claude Code cloud session or Codex Cloud is already in your paid plan, and nothing else here keeps working with your computer off. If you’re at a desk with the laptop plugged in and open, turn on the agent’s own keep-awake setting, or start it with caffeinate -i, and idle sleep won’t interrupt it.

Reach for the rest only when your work has to stay on your own files with the lid shut: an external display or Amphetamine for a Mac you close at your desk, and an always-on computer, reached over SSH, through the agents’ apps or with Enjoy, for work that runs for hours while you’re gone.

How we compared

We read each maker’s own docs, settings guides, pricing and store listings on November 8, 2026, and every one is linked below. We quote their words for each limit, and we confirmed on a Mac which assertion caffeinate -i makes before quoting Apple’s documentation for it. We don’t count behavior a maker hasn’t documented. These settings change with each release, so we recheck this guide against its sources at least once a month, and the date at the foot of the page says when we last did.

14.Questions.

Does Claude Code keep running when I close my laptop?

Not on the laptop. Closing the lid puts it to sleep, and Anthropic says that even with the Claude app’s Keep computer awake setting on, “Closing the laptop lid still puts it to sleep.” A cloud session, started at claude.ai/code or with claude --cloud, “keeps running after you close your laptop,” on a GitHub repository, from Claude Pro at $20 a month.

Does Codex keep working when my Mac goes to sleep?

Only in Codex Cloud. OpenAI says that if your computer “sleeps, loses network access, or closes the app, remote access stops until it’s available again.” Codex Cloud runs tasks in the cloud, where they “can keep working while your computer is asleep,” from ChatGPT Plus at $20 a month. For Codex on your own computer, turn on Prevent sleep while running under /experimental.

Does caffeinate keep a MacBook awake with the lid closed?

Not on its own. caffeinate -i stops idle sleep, and Apple’s documentation for that kind of assertion says “The system may still sleep for lid close, Apple menu, low battery, or other sleep reasons.” To close the lid, connect power, an external display and a keyboard and mouse, or use Amphetamine’s Closed-Display Mode.

How do I leave Claude Code or Codex running overnight?

Run it where nothing sleeps. A Claude Code cloud session or Codex Cloud works on a GitHub repository with your laptop shut. For your own files, use a Mac mini, desktop or server that stays on, and reach it over SSH, through the agents’ own apps, or with Enjoy. For a laptop, Anthropic’s advice is to keep it “awake and online, with the lid open.”

Does Enjoy keep my computer awake while agents work?

Yes, from idle sleep. While an agent is working, Enjoy keeps your computer from going to sleep because nobody is using it, with nothing to set up. It doesn’t stop a sleep you ask for, such as closing the lid, so to close a laptop, run Enjoy on a computer that stays on and work on it from your laptop at no extra cost. See Keep your computer awake.

Can I close a Windows laptop and keep an agent running?

Yes, if you set its lid to do nothing. In Power Options, choose what closing the lid does and pick Do nothing, which Microsoft defines as “No action is taken when the system lid is closed.” Keep it plugged in, and remember that it stays on when you close it to carry it, too.

Enjoy Agentic Industries · Checked against its sources on