Show HN: Adrafinil – keep a lid-closed Mac awake only while agents work
TL;DR Highlight
Hooks keep a lid-closed Mac awake only while coding agents are working.
Who Should Read
Developers who close their MacBook lid while running long Claude Code or Codex agent sessions
Core Mechanics
- Awake only during agent work
- It keeps a closed-lid Mac running while an agent works.
- It releases the hold when the turn ends.
- Hooks track active work
- Hooks exist for Claude Code, Codex, Cursor, Gemini CLI, Devin, Aider, Hermes, OpenCode, Cline, and Pi.
- It supports per-session acquire/release, timed holds, and a manual Let it sleep control.
- Overlapping agents tracked separately
- Holds from multiple agents are tracked independently.
- Sleep resumes only after the last hold ends.
- Safeguards for unattended runs
- A thermal cutout is included.
- Holds from abandoned sessions are released automatically.
- Also available via CLI and MCP
- Custom integrations use hooks or command wrappers.
- Lid-close audio confirmation and a lid-open activity/temperature summary are optional.
- Requirements and telemetry
- It needs macOS 26.4+ and administrator approval for the privileged helper.
- Install with brew install --cask adrafinil; anonymous usage stats are sent only if you opt in.
Community Reactions
- Built-in caffeinate is enough, per one user
- A commenter uses caffeinate -dimsu to keep the Mac awake and use Claude remotely from a phone.
- They said you can also wrap the agent command directly.
- Pushback: existing tools overlap
- One commenter said Amphetamine has many triggers, including ending when an app closes.
- Another asked how this differs from cc-caffeine.
- Heat concerns from experience
- A commenter said a laptop in a backpack can't cool and shut down anyway.
- Another recalled that a closed lid put the GPU in power-save mode and hurt local LLM performance.
- pmset one-liner suggested
- A commenter suggested sudo pmset -a disablesleep 1 and 0 to revert.
- Another said Codex recently added a Prevent sleep while running toggle.
- One user reported it didn't work
- A commenter said it never worked for them on an overnight shift.
How to Apply
- Try caffeinate first as a stand-in
- Run your agent wrapped as caffeinate -dimsu your-agent-command in the terminal.
- Check that it releases when the command exits.
- Install via Homebrew and connect hooks
- On macOS 26.4+, run brew install --cask adrafinil.
- Install hooks for your agents in Settings.
- Verify the thermal cutout before unattended runs
- Close the lid during a short task and confirm the Mac stays awake.
- Check the lid-open activity and temperature summary.
Try It
# Paste in a terminal (built-in caffeinate approach from a comment, not Adrafinil)
caffeinate -dimsu {{your agent command}}Terminology
Related Papers
Frostbite: A new CPU architecture discovered, designed and verified by AI
AI agents designed a CPU from scratch, claiming 4.59x perf/W over a traditional core
Restricting AI agents in mobile operating systems platforms from capturing data
Signal now blocks OS-level AI agents from reading its screen on iOS 27 and Android
Actions Speak Louder than Words: Stateful Privacy Sniffing of LLM Agents via Behavioral Covert Channels in Web Interactions
Agents' link choices alone let attackers rebuild user queries at F1 0.89; SOR cuts it to 0.39.
Tracking and Limiting Unsupported Claim Propagation in Multi-Agent LLM Systems: A Provenance-Aware Framework
Passing claims with source, evidence and history kept equivalence at 5 agent stages at 96% versus 31%.
LLM assisted reverse engineering
Pointing an agent at binaries with skills and MD notes made years-long hacks feasible
Metrics-in-the-Loop: Complexity Feedback Reshapes Agent-Written Code
Injecting per-turn complexity reports into coding agents cut code erosion without changing correctness
Why is Gemini 4 Carbon taking so long?
Carbon took nearly an hour on bug fixes that Astra and Opus finished in minutes, mostly from extra unrequested work.
Weight-Space Programming builds neural networks like a 1990s researcher
LLM hand-wrote MNIST weights to 91.3%, using 1990s-style techniques