ericporres

Cocaffeinate — Development skill for Claude Code

Development community

Keep your Mac (or PC) awake while Claude or Codex works, lid closed, without cooking it.

How to install Cocaffeinate

This entry records only its repository, not the path inside it, so there is no exact command to give. Open ericporres/cocaffeinate and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Cocaffeinate does

Keep your Mac (or PC) awake while Claude or Codex works, lid closed, without cooking it.

Alternatives in Development

  • Cc Caffeine — ☕️ Prevents your computer from sleeping while Claude Code works hard 70 ★
  • Code With Quran — Read the Qur'an while Claude Code works 48 ★
  • Goguma — Wakes your Mac for scheduled jobs, holds it awake while long work finishes, and lets it sleep otherwise 29 ★

README

cocaffeinate

Keep your Mac awake while your coding agent is working — even with the lid closed — without cooking it.

`caffeinate` keeps a Mac from dozing, but the moment you close the lid it sleeps anyway, and your long-running agent task dies with it. `cocaffeinate` holds the machine open through a closed lid for exactly as long as **Claude or Codex** is actually running, then hands sleep back to the OS the instant the agent quits. It watches the battery and the temperature while it does, so a laptop left running in a bag puts itself to sleep instead of overheating.

The name is the joke: **co-** as in **Co**dex and **C**laude **Co**de, and as in *collaborator* — the machine stays awake for the agent you're working with, not forever.

Where this came from

A friend texted me a LinkedIn post: Huel has a "laptops closed" mandate so people stay present in meetings. The one exception that keeps coming up is their Finance Director, who told the room "I can't close my laptop — I've got Claude running a big task for me." The post's punchline was a photo of a 3D-printed plastic hand you wedge under the lid to prop it open, and a joke about buying everyone one.

A plastic hand is a hardware patch for a software problem. It props the lid open with zero awareness — it will happily let your MacBook bake in a backpack on battery. So: a script instead. One that knows *why* it's keeping the lid open, and stops the moment the reason goes away.

What it does

There are two macOS levers, and then there's what cocaffeinate decides to do with them.

The levers:

  1. caffeinate can block idle, disk, display, and system sleep. No admin. But it does not survive a physical lid close.
  2. pmset disablesleep sets the kernel flag that does survive a closed lid on battery with no external display. Needs sudo. This is the part --lid turns on.

What cocaffeinate decides on top of them:

  • System awake, screen asleep — it pulls caffeinate so the system stays