# Keep awake only while agents work

> Keep your computer awake while an agent, the queue or a workflow runs, then let it sleep. Shuriken's two settings: While working and Always.

Source: https://shuriken.sh/blog/keep-awake-while-working

Keep your computer awake while an agent, the queue or a workflow runs, then let it sleep. Shuriken's two settings: While working and Always.

Update By Shuriken Updated 27 October 2026 3 min read

**Contents**

Give an agent a long task and go for coffee, and the computer can be asleep four minutes in, with the agent stopped mid-thought. We kept hearing about it, and we kept doing it ourselves.

The usual fix is an app like Amphetamine, switched on and left on. Then the laptop never sleeps at all, and you find out later from a warm bag and an empty battery. We wanted less than that: awake while an agent works, asleep once it stops. In Shuriken that's a mode called While working.

## Two settings #

Each of your computers has a Keep awake setting on its page under Settings › Devices. Always means the computer never idles off, so your phone and your other computers can reach it at any hour. While working is the lighter one: awake while there's work, normal sleep when there isn't. There's no Off. A computer never naps while something in Shuriken is working, whichever you pick.

New computers start on Always, because a computer you can't reach from your phone is no use to you. A laptop you carry around is different; put it on While working and it naps between jobs.

## What counts as "working" #

"While working" has a precise meaning. Shuriken holds the computer awake when any of these is true:

- an agent is running a turn in one of your chats;
- a chat still has background work going: subagents, a workflow run, a shell command;
- the queue has a message waiting to send or sending.

Once none of that is true, Shuriken lets go and your normal sleep settings apply again. It re-checks whenever an agent or the queue changes, and every 30 seconds on top of that, because background work sometimes finishes without saying so.

Neither setting keeps the display on. The screen still turns off. If Shuriken crashes, the hold goes with it: the small process holding the computer awake watches Shuriken and exits when Shuriken does. You won't come back on Monday to a laptop that stayed up all weekend.

Shuriken uses each system's own switch for this: caffeinate on macOS, systemd-inhibit on Linux and the Windows power API on Windows. Both settings work on all three.

Shuriken's Cocaine mode keeps the computers you pick awake while your agents run.

[Try Shuriken](https://shuriken.sh/)

## How this differs from Cocaine mode #

Keep awake stops idle sleep with the lid open. It does not help when you close a MacBook and put it in your bag: on a normal setup, closing the lid sleeps a Mac whatever an app asks for.

That is what [Cocaine mode](https://shuriken.sh/blog/cocaine-mode-yes-really) is for. Yes, that is really its name. It lives behind the syringe in the top bar, and yes, its per-device switch is also labelled Keep awake, which we'll grant is one Keep awake too many. You choose which computers it covers, and on a Mac those keep running with the lid shut. Setting it up asks for an administrator password once. You can take that permission back later, and the mode stays on until you switch it off. Close the lid, walk to the train, and your agents are still typing (the lid-closed setup is in [keeping Claude Code running with the lid closed](https://shuriken.sh/guides/keep-claude-code-running-lid-closed)).

So the two work together. Keep awake answers "don't nap while I'm out of the room", and Cocaine mode answers "keep going while the laptop is shut in my bag".

Cocaine mode's lid-closed promise started on the Mac. Shuriken 5.1 brought Cocaine mode to Windows and Linux too. Laptops differ there, so each device says what it can do: "Keeps running with the lid closed", "needs a one-time permission" for the lid, or "No lid setting found". On Linux it needs systemd-logind. The [Cocaine mode](https://shuriken.sh/features/cocaine-mode) page has the details.

## Battery and heat: which to pick #

A computer that can't sleep draws power and gets warm. On battery, in a bag, we'd pick While working, since it only holds the computer during real work and a finished task doesn't eat the rest of your charge. Shuriken can also tell you if the charger comes out or the battery runs low while agents work (Settings › Notifications).

Plugged in at a desk, leave it on Always (the default) if you might check in from your phone later, and use While working if you won't. Desktops and servers that your other devices need to reach should stay on Always. A laptop that travels shut needs Cocaine mode, and some care about heat: a closed laptop in a soft bag has nowhere to send it.

Coming from Amphetamine? [Amphetamine alternatives for coding agents](https://shuriken.sh/compare/amphetamine-alternatives-for-coding-agents) puts it next to the other options. To see what's keeping your computer awake right now, open [Activity](https://shuriken.sh/features/activity): every running agent, workflow and background command is listed there.

Every computer you sign in starts on Always, and moving a laptop to While working is one click. [Try Shuriken](https://shuriken.sh/).

Share

[X](https://x.com/intent/post?url=https%3A%2F%2Fshuriken.sh%2Fblog%2Fkeep-awake-while-working&text=Keep%20awake%20only%20while%20agents%20work)[LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fshuriken.sh%2Fblog%2Fkeep-awake-while-working)[Hacker News](https://news.ycombinator.com/submitlink?u=https%3A%2F%2Fshuriken.sh%2Fblog%2Fkeep-awake-while-working&t=Keep%20awake%20only%20while%20agents%20work)[Reddit](https://www.reddit.com/submit?url=https%3A%2F%2Fshuriken.sh%2Fblog%2Fkeep-awake-while-working&title=Keep%20awake%20only%20while%20agents%20work)[E-mail](mailto:?subject=Keep%20awake%20only%20while%20agents%20work&body=https%3A%2F%2Fshuriken.sh%2Fblog%2Fkeep-awake-while-working)

## Frequently asked questions

**Which Keep awake setting should I pick?**

For a laptop you carry, While working: it only holds the computer awake while an agent, the queue or a workflow is running. For a computer you want to reach from your phone at any hour, Always, which is the default.

**Does keep awake also keep the screen on?**

No. It only stops the computer from sleeping. The display still turns off on its usual timer.

**What happens if Shuriken crashes while it holds the computer awake?**

The hold ends with it. The process that keeps the computer awake watches Shuriken and exits when Shuriken goes, so a crash never leaves a computer that cannot sleep.

**Is this the same as Cocaine mode?**

No. Keep awake stops idle sleep while the lid is open. Cocaine mode is the stronger promise: chosen computers keep running even with the lid closed.

Cocaine mode

Close the lid. Your agents keep working.

Pick which of your computers stay awake while agents work. On a Mac that holds with the lid closed, and on Windows and Linux where the laptop allows it.

[Try Shuriken](https://shuriken.sh/)

[How it works](https://shuriken.sh/features/cocaine-mode)

## Keep reading

- [Shuriken on Windows 10 and 11: Update 27 Oct 2026 3 min read Run Claude Code, Codex and 65 more coding agents in parallel on Windows 10 and 11. Installer or .zip, x64, with signed updates.](https://shuriken.sh/blog/shuriken-on-windows)
- [How to run Claude Code overnight: Guide 27 Oct 2026 5 min read Run Claude Code overnight: keep the computer awake, keep the session alive when the terminal closes, and plan for limits and permission prompts.](https://shuriken.sh/guides/run-claude-code-overnight)
- [What's new in Shuriken 5.1: Update 27 Oct 2026 16 min read Shuriken 5.1 adds sign-in with Google, Apple or an email code, passkeys, Allow and Always allow at a MacBook's notch, and billing and fuel in Sources.](https://shuriken.sh/blog/shuriken-5-1)

## Free tools

- [Claude limit reset tracker](https://shuriken.sh/tools/limit-resets/claude)
- [Codex limit reset tracker](https://shuriken.sh/tools/limit-resets/codex)
