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

Rippling Unveils AI Spend Console to Monitor Employee Costs Following Multi-Million Dollar AI Expenditure
Product Launch

Rippling Unveils AI Spend Console to Monitor Employee Costs Following Multi-Million Dollar AI Expenditure

Rippling, a prominent workforce management platform, has officially launched the AI Spend Console, a specialized tool designed to track and manage AI-related expenditures across organizations. The product's development was catalyzed by Rippling's own internal experience, where the company realized it had spent millions of dollars on AI usage within a span of only a few months. This financial "wake-up call" highlighted a critical need for better oversight in the rapidly evolving AI landscape. The AI Spend Console provides granular visibility by monitoring costs at both the individual and team levels, enabling businesses to identify high-spending areas and ensure that their AI investments are aligned with organizational goals. This move marks a significant step toward financial accountability in the era of widespread AI adoption.

Disney Plus Tests New AI-Powered Search Tool Featuring Natural Language and Voice Query Capabilities
Product Launch

Disney Plus Tests New AI-Powered Search Tool Featuring Natural Language and Voice Query Capabilities

Disney has initiated testing for a sophisticated AI-powered search tool on its Disney Plus streaming platform, aimed at revolutionizing content discovery. Unlike traditional recommendation engines that primarily rely on a user's viewing history, this new feature utilizes natural language processing, voice queries, and suggested prompts to understand user intent. The tool is designed to generate a customized row of movie and television show recommendations tailored specifically to the user's input. By moving toward a more conversational and intuitive interface, Disney Plus seeks to enhance the user experience and streamline the process of finding relevant content in its extensive library. This development marks a significant step in the integration of advanced AI within the streaming industry.

Cloudflare Launches Kitesurf: A Specialized Cloud-Hosted Browser Engineered Specifically for AI Agents and Automation Efficiency
Product Launch

Cloudflare Launches Kitesurf: A Specialized Cloud-Hosted Browser Engineered Specifically for AI Agents and Automation Efficiency

Cloudflare has officially introduced Kitesurf, a pioneering cloud-hosted browser designed specifically for AI agents rather than human users. Unlike traditional browsers such as Chromium, Kitesurf is optimized for common automation tasks, consuming significantly less computing power. This innovation aims to empower developers by providing a more efficient and streamlined environment for building and deploying browser-based AI agents. By offloading the browser environment to the cloud and focusing on resource optimization, Kitesurf addresses the growing demand for specialized infrastructure in the AI automation space. This launch marks a significant step in Cloudflare's expansion into AI-centric tools, prioritizing performance and developer productivity in the evolving landscape of autonomous web interaction.