A new open-source utility called Adrafinil aims to solve a niche but growing pain point for developers running AI agents on MacBooks. The tool, published on GitHub, keeps a laptop awake even with the lid closed, but only while an agent is actively working.

The project emerged after a wave of posts and tweets last month showed engineers propping their MacBooks half-open in cafes and parks. The behavior stems from macOS forcing lid-closed sleep, which kills AI agent processes. Snarky responses suggested using tmux or Amphetamine, but some defended the practice, noting that forgetting to disable those tools can leave a laptop discharged in a bag.

Unlike Apple's caffeinate command, Adrafinil uses pmset disablesleep 1 to prevent sleep with the lid closed, no external power or display required. It detects agent activity through hooks installed into Claude Code, Codex, and other tools. An active status appears in the menu bar, and a chime plays when the lid closes.

Once the agent finishes, Adrafinil resets pmset disablesleep to 0, allowing the laptop to sleep normally. It also triggers sleep in case of overheating. Users can optionally install an MCP server to let agents manually toggle the feature via a command.

The tool addresses a transient workflow problem—developers who need intermittent, unattended uptime for AI agents. Critics, however, may argue the real solution is better remote execution, not defeating a power-saving feature designed to protect battery life.