Back to list
Adrafinil: A New macOS Utility Designed to Keep Laptops Awake Exclusively During AI Agent Activity
Product LaunchmacOSAI AgentsOpen Source

Adrafinil: A New macOS Utility Designed to Keep Laptops Awake Exclusively During AI Agent Activity

Adrafinil is an innovative macOS menu bar application that introduces a "eugeroic" approach to machine power management. Unlike traditional utilities that keep a computer awake indefinitely, Adrafinil prevents a Mac from sleeping—including in clamshell (lid-closed) mode—only while an AI coding agent is actively performing a task. Supporting popular agents such as Claude Code, Codex, and Cursor, the tool ensures that long-running AI sessions are not interrupted when the user closes the laptop lid. Once the agent completes its work and releases the session, Adrafinil allows the system to return to its normal sleep behavior immediately. By utilizing a secure, audited helper for privileged sleep control and standard system assertions, Adrafinil offers a specialized solution for developers and AI users who require automated, task-aware system wakefulness.

Hacker News

Key Takeaways

  • Agent-Aware Power Management: Adrafinil only prevents sleep when at least one AI agent session is active, distinguishing it from "always-on" utilities.
  • Clamshell Mode Support: The tool allows a Mac to continue working with the lid closed, specifically overriding default macOS sleep behavior for active tasks.
  • Broad Integration: It features hook integration for nine different agents, including Claude Code, Codex, and Cursor.
  • Security-First Architecture: To handle privileged sleep overrides, Adrafinil uses a tiny, audited helper to isolate root-level commands from the main application logic.
  • Automated Efficiency: The system returns to normal sleep settings the moment the last active agent session finishes, ensuring no unnecessary power consumption.

In-Depth Analysis

The "Eugeroic" Philosophy vs. Traditional Stimulants

In the realm of macOS power management, tools like caffeinate and Amphetamine have long served as "stimulants" for hardware, keeping the machine "wired" and awake regardless of whether actual work is being performed. Adrafinil introduces a different philosophy, described by its creators as a "eugeroic" for machines. In medical terms, a eugeroic is a wakefulness-promoting agent; applied to software, Adrafinil acts as a smart intermediary that only intervenes when there is a specific reason for the machine to stay awake.

The primary use case addressed is the late-night developer workflow. When a user starts a complex AI agent session at 3 a.m. and decides to go to sleep, they often close the laptop lid. Under normal circumstances, this would suspend the AI's progress. Adrafinil solves this by monitoring the state of the AI agent. If an agent is "mid-thought," the utility keeps the system active. The moment the agent finishes its task, the utility "gets out of the way," allowing both the user and the machine to sleep normally. This "agent-aware" logic ensures that the hardware state is always synchronized with the software's workload.

Technical Implementation and Security

Overriding the macOS "clamshell" sleep (lid-closed sleep) is a privileged operation that requires root access. To maintain a high standard of security, Adrafinil does not run the entire application with elevated privileges. Instead, it employs a bifurcated architecture. All policy decisions and user interface elements live in an unprivileged daemon. The actual sleep override is handled by a "tiny, audited helper" that only exposes a single function: setSleepBlocked(Bool).

Technically, the application manages sleep through two primary mechanisms. For standard idle sleep, it holds a standard IOPMAssertion. For the more complex task of preventing sleep when the lid is closed, it utilizes the pmset disablesleep command. The developers noted that they verified this approach on-device after determining that cleaner, private IOPMrootDomain paths were insufficient for keeping a displayless, lid-closed Mac awake. This robust technical foundation ensures that the utility works reliably across different macOS power states while minimizing the security surface area.

Integration and User Experience

Adrafinil is designed for ease of use within the modern AI development ecosystem. It includes a one-click installer that wires the utility into a hook system, allowing it to detect sessions from various AI tools automatically. Currently, the project supports nine different agents, specifically mentioning high-profile tools like Claude Code, Codex, and Cursor.

The user experience is centered around a menu bar app that provides a "zero-intervention" workflow. Once installed and configured, the user does not need to manually toggle the app on or off. The transition from "blocked sleep" to "normal sleep" is entirely dependent on the presence of active agent sessions. This automation removes the cognitive load of remembering to disable a wake utility after a task is finished, preventing the common issue of a laptop staying awake in a bag and overheating or draining its battery.

Industry Impact

The release of Adrafinil highlights a growing trend in the AI industry: the shift from interactive AI to autonomous, long-running agents. As AI agents move from simple chat interfaces to complex, multi-hour coding and reasoning tasks, the underlying operating systems and hardware management tools must evolve to support these "background" workloads.

Adrafinil represents a niche but essential category of "agent-aware infrastructure." By bridging the gap between high-level AI task states and low-level system power management, it enables a more seamless integration of autonomous agents into the daily lives of developers. Furthermore, its open-source nature and focus on audited, minimal-privilege code set a standard for how third-party utilities should handle sensitive system controls in an era where security is paramount.

Frequently Asked Questions

Question: How does Adrafinil differ from apps like Amphetamine or the native 'caffeinate' command?

Adrafinil is "agent-aware" rather than "always-on." While Amphetamine and caffeinate keep a Mac awake until a timer runs out or a user manually toggles them off, Adrafinil only blocks sleep while an AI agent (like Claude Code or Cursor) is actively working. It automatically allows the Mac to sleep the moment the agent finishes its task.

Question: Does Adrafinil require special permissions to work with the lid closed?

Yes. Preventing a Mac from sleeping when the lid is closed (clamshell mode) requires root privileges. Adrafinil handles this securely by using a small, audited helper tool that specifically manages the setSleepBlocked command, while the rest of the app runs without elevated privileges.

Question: Which AI agents are currently supported by Adrafinil?

Adrafinil features hook integration for nine agents. The documentation specifically highlights support for Claude Code, Codex, and Cursor, ensuring that these tools can maintain active sessions even if the user closes their laptop lid.

Related News

LangChain Introduces LangSmith Tuned Evaluators to Streamline AI Agent Error Detection and Production Trace Analysis
Product Launch

LangChain Introduces LangSmith Tuned Evaluators to Streamline AI Agent Error Detection and Production Trace Analysis

LangChain has officially unveiled LangSmith Tuned Evaluators, a sophisticated toolset aimed at enhancing the observability and reliability of AI agents. By integrating quality feedback directly into production traces—beginning with the "Perceived Error" metric—LangSmith provides developers with the necessary context to identify, analyze, and resolve agent-driven errors. This update represents a significant step forward in the LLMops space, offering a structured approach to feedback that bridges the gap between execution and evaluation. The primary goal of this release is to empower development teams to find and fix agent mistakes more efficiently, ensuring that production-level AI applications maintain high standards of accuracy and performance through continuous feedback loops.

fx: A Tiny Open-Source Native Coding Agent Built with Zig for High-Performance AI Workflows
Product Launch

fx: A Tiny Open-Source Native Coding Agent Built with Zig for High-Performance AI Workflows

fx is a newly released, experimental open-source coding agent harness and CLI (v0.0.3) designed for minimalism and extreme performance. Written in Zig, the tool features a remarkably small 6.39MB binary and a cold start time of just 10 microseconds. It is optimized for research, embeddability, and resource-constrained environments like agent sandboxes. Supporting WebAssembly (Wasm) and model-agnostic inference, fx offers a shell-like user interface rather than a heavy TUI. Its design focuses on context efficiency with minimal system prompts to reduce token costs and improve time-to-first-token (TTFT) performance. Currently available under the Apache-2.0 license, fx aims to provide a lightweight alternative for both local and cloud-based AI coding tasks.

Comcast Transforms Millions of Xfinity Routers into Wi-Fi Motion Detectors via Xfinity Shield Update
Product Launch

Comcast Transforms Millions of Xfinity Routers into Wi-Fi Motion Detectors via Xfinity Shield Update

Comcast has officially launched a significant update to its Xfinity Internet app, enabling Wi-Fi motion sensing capabilities across millions of existing customer routers. This new feature, integrated into the Xfinity Shield service, allows compatible routers to act as activity monitors by detecting disruptions in Wi-Fi signals caused by movement. Released on August 18, 2026, the update is being rolled out at no additional cost to customers with supported hardware. By repurposing existing networking equipment into home monitoring tools, Comcast is expanding the utility of its Xfinity ecosystem without requiring users to purchase new devices. This move highlights a growing trend in the telecommunications industry to provide value-added security and monitoring services through software-defined updates to hardware already present in the home.