Adrafinil keeps a closed Mac awake only while AI agents work

Adrafinil keeps a closed Mac awake only while AI agents work

Adrafinil is a Mac app that keeps a MacBook awake with the lid closed only while such as Claude Code or Codex are still working. Fully closing a MacBook usually makes it sleep, which can stop long-running . Existing tools such as `caffeinate` do not solve this exact closed-lid case, while always-on sleep blockers such as can drain the battery if the user forgets to turn them off.

Adrafinil checks agent activity through hooks installed into Claude Code, Codex, and similar tools. It shows its active state in the and plays a sound when the lid is closed, so the user knows it is working. When the agent finishes, it lets the Mac sleep again.

It also allows sleep if the laptop gets too hot. An optional MCP can be installed for manual control through the agent.

Key points

  • Keeps a closed MacBook awake only while are active.
  • Works by adding hooks for tools such as Claude Code and Codex.
  • Lets the Mac sleep again after the agent finishes.
  • Shows status in the and plays a sound when the lid closes.
  • Allows sleep if the laptop becomes too hot.
Read original