Yes, it's called Cocaine mode
Cocaine mode keeps your Mac awake with the lid closed, so your coding agents keep working. Why it has that name, how it works, and the honest warnings.
Contents
Cocaine mode keeps your Mac awake with the lid closed, so your coding agents keep working while the laptop is in your bag, on the train, or shut on the desk overnight. We called it that because that's roughly what it does to your laptop: no sleep, a lot of work, slightly warm.
Yes, we've talked about renaming it. No, we won't.
The problem: the lid#
You start a long task. The agent is planning, editing, running the tests. Your stop comes up, you close the lid, you get off the train.
The Mac goes to sleep. The agent stops mid-step. The network drops, the tests never finish, and when you open the lid forty minutes later the chat is exactly where you left it. Nothing happened. You paid for a plan that sat there.
If you run several agents at once, that's several tasks frozen, not one.
Why caffeinate isn't enough#
macOS ships a tool for staying awake: caffeinate. It's good at what it does, which is stopping idle sleep, the kind where the Mac nods off because nobody touched it.
Closing the lid is a different trigger. Without an external display, keyboard and power set up for closed-display use, a MacBook still goes to sleep when you shut it, caffeinate or not. Our guide on keeping Claude Code running with the lid closed goes through every option, free ones first. We also compared the keep-awake apps people use for this.
How it works#
- Pick your computers. The syringe button in the top bar opens the list of your devices. Turn Cocaine mode on for the ones that should stay awake. A pill in the sidebar shows when it's on, so you never wonder.
- One password, once. On a Mac, running with the lid closed needs an admin password the first time. That's macOS asking, not us. You grant it once, and you can take it back whenever you want.
- It stays on until you turn it off. No timers to babysit. And when Shuriken isn't running, your Mac sleeps like normal.
- Lid open? That's a different setting. Each device's page also has Keep awake: While working (held only while an agent, the queue or a workflow runs) or Always. A computer signed in to Shuriken starts on Always, so it stays reachable. That one works with the lid open; closing the lid is Cocaine mode's job. More in Keep awake only while agents work.

So the train scene becomes: close the lid, the agents keep working, open it at home and read what they did. Or don't open it, and check from your phone in the web app.
The honest warnings#
A laptop that works with its lid shut is still a computer doing work. Three things to know:
- Heat. A closed MacBook running agents in a closed bag or a tight sleeve gets warm, and it has nowhere to put that heat. For long runs, leave it somewhere with air: on a desk, lid shut, is fine. Zipped into a backpack under your seat all afternoon is not a great idea.
- Battery. Awake means using power. Agents, the network and your test suite all draw on it. On battery, expect it to drain like it would with the lid open. For an overnight run, plug it in. Our guide on running Claude Code overnight has the rest.
- The network. Agents need the network to reach the model, so a tunnel stops them as surely as a sleeping Mac. Expect gaps on a train. For a long run, a desk with steady Wi-Fi wins.
If your laptop just shouldn't be on, there's another way: put the agents on a computer that's always on. Shuriken can run headless on a server.
Windows and Linux#
Cocaine mode started on the Mac. Windows and Linux got it in Shuriken 5.1. Laptops differ there, so we won't promise lid-closed on every one: each device says what it can do. "Keeps running with the lid closed", "Stays awake with the lid open; with the lid closed it needs a one-time permission", or "Stays awake. No lid setting found". On Linux it needs systemd-logind.
About the name#
It's a joke about your laptop, not advice for you. Nobody is getting anything but a computer that refuses to sleep. We could have called it "Extended Power Management Preferences". We'd have forgotten what it does by Thursday. You won't forget this one.
The name stays, on purpose. Try Shuriken, close the lid, and let the agents keep working.
Frequently asked questions
What does Cocaine mode do?
It keeps the computers you pick awake until you turn it off, so your agents keep working. On a Mac that includes running with the lid closed.
Why doesn't caffeinate do the same thing?
caffeinate holds off idle sleep. Closing a MacBook's lid is a different trigger, and without an external display set up, the Mac still goes to sleep.
Do I have to enter my password every time?
No. A one-time admin password grants it on a Mac. You can take that permission back at any time.
Does my Mac sleep when Shuriken isn't running?
Yes. Cocaine mode only holds the computer awake while Shuriken runs. Quit it and the Mac sleeps as usual.
Does it work on Windows and Linux?
Yes, since Shuriken 5.1. Each laptop says what it can do: keep running with the lid closed, need a one-time permission first, or stay awake only with the lid open.