HeadlinesBriefing favicon HeadlinesBriefing.com

Adrafinil Keeps Macs Awake Only for AI Agents

Hacker News •
×

Developers tired of keeping MacBooks awake while AI coding agents run have a new option. Adrafinil is a menu‑bar utility that blocks sleep only when an agent holds an active session, even with the lid closed. It replaces blunt tools like caffeinate and Amphetamine with a targeted approach, preventing accidental battery drain in bags. It runs silently in the background.

The app installs hooks into agents such as Claude Code, Codex, Cursor and others. When a hook calls the bundled CLI, a daemon registers an assertion and a privileged helper invokes pmset disablesleep 1 to override clamshell sleep. The latency stays under 50 ms per call. Once the last session releases, the helper resets the flag, and a thermal monitor forces release if the laptop overheats.

Adrafinil’s architecture isolates privileged sleep control in a tiny root helper while all policy lives in an unprivileged daemon, keeping the attack surface small. The tool is fully open source under MIT, notarized for macOS 13.4 and later, and includes a one‑click installer that registers the helper via SMApp Service. It gives developers precise power‑management without sacrificing workflow. It also logs each hold for audit.