notes on adrafinil ・ rx no.006 ・ for macOS
You can close
your laptop now.
adrafinil keeps your Mac awake only while AI agents are working, lid fully closed. the instant the last session ends, it sleeps like it always did.
macOS · free · open source · MIT
01 ・ the ailment
Engineers are carrying laptops
half-open through airports.
you've seen the photos. lids held ajar like trays of water, through terminals and offices, because closing the MacBook kills the agent mid-task. someone sells a little silicone hand to prop the hinge. funny, until you see what it is: an unlocked machine, mid-session, in a public place.
Every wake utility you've tried is a stimulant. caffeinate, Amphetamine (named with refreshing honesty): always-on until you remember to switch them off, wired all night whether or not anyone's home.
adrafinil is the other thing. close the lid all the way: the screen locks, the machine becomes pocketable, and underneath, the work continues. the moment it finishes, real sleep. no toggle to forget.
02 ・ the eugeroic
Nothing happens
until an agent asks.
adrafinil, the drug, is a prodrug: inert until the body metabolizes it, wakefulness only when called for. the app holds to that at the API level. nothing happens until an agent acquires an assertion; sleep is blocked while ≥1 session holds one; the last release clears like a metabolite, and the Mac is asleep within moments.
adrafinil release <session-key> # the agent goes idle
adrafinil hold --for 30m --reason "deploy" # a task that outlives the reply
One click wires it into the hook systems of Claude Code, Codex, Hermes, and the rest. a turn starting acquires; idle releases; overlapping sessions are refcounted, so sleep unblocks when the last one finishes. holds are scoped to activity, not to having a window open. an agent sitting at its prompt lets the Mac sleep normally. and the closed lid doesn't slow the work: foreground processes run at full speed under a hold, verified on-device.
03 ・ the label
A chime
in the dark.
close the lid on a working agent and a chime confirms the hold. the screen is already off, so it tells you the only way it can. open it in the morning and it tells you what happened while you slept.
- alocks on lid-close: shut means locked and pocketable.
- ba chime when the hold engages, so you can walk away sure.
- ca morning summary: what ran, for how long, how hot it got.
- da thermal cutout: a bag-bound Mac is force-released before it cooks.
- eidle release: assertions whose owner died or went quiet are dropped.
- fclean uninstall: removes every hook entry it added, in every agent it touched.
setSleepBlocked(Bool). all policy lives unprivileged, and the helper fits in one sitting of reading. while work is live, it uses pmset disablesleep, blunt by necessity: it also suppresses idle sleep while held. the helper resets it on respawn, so a crash can't leak a sleepless Mac; the manual escape hatch is sudo pmset -a disablesleep 0.
It sleeps when there's
nothing left undone.
macOS · free · open source · rx no.006
Download Adrafinil ↓