Adrafinil은 Claude Code, Cursor 등 AI 코딩 에이전트가 작업을 수행 중일 때만 뚜껑을 닫은 macOS 기기를 절전 모드로 넘어가지 않게 막아주는 메뉴 바 애플리케이션입니다. 작업이 완료되거나 에이전트 세션이 종료되면 시스템의 정상적인 절전 기능을 방해하지 않으므로, 기존의 항상 켜두는 방식의 단점을 해결합니다. 발열 문제 방지 및 안전한 권한 분리 등 맥북 사용자들이 백그라운드에서 AI 작업을 안전하게 돌릴 수 있도록 돕는 매우 유용한 도구입니다.
번역된 본문
adrafinil rx no. 006 ・ a·draf·i·nil /əˈdræfɪnɪl/ ・ 기계를 위한 각성제 ♡ 깨어있음 ・ 에이전트가 작업 중임 ・ 잠자는 중 ・ 에이전트 없음, 정상적인 수면
服用注意 (복용 주의) ・ 당신이 잠든 후에도 감시를 유지하는 기계를 위한 약입니다. 새벽 3시입니다. 당신은 잠들어 있습니다. 하지만 에이전트는 잠들지 않았습니다. 몇 시간 전에 시작한 세션에서 여전히 생각하는 중이며, 당신은 완전히 닫히지 않는 눈꺼풀처럼 그 위로 맥북 뚜껑을 덮었습니다. caffeinate와 Amphetamine은 흥분제입니다. 아무도 기기를 사용하지 않아도 기계를 영원히 깨어있게 만듭니다. Adrafinil은 각성제(eugeroic)입니다. 에이전트가 이를 인식하기 전까지는 아무 작업도 하지 않습니다. 오직 해당 작업이 진행되는 동안에만 뚜껑을 닫은 맥을 깨어있게 하며, 마지막 세션이 종료되는 순간 즉시 해제됩니다. 오직 작업을 위해서만 깨어날 뿐입니다. 그 후에는 당신과 기계 모두 잠듭니다.
♡ AI 에이전트가 작동 중일 때만 맥을 깨어있게 유지하세요.
Adrafinil은 macOS 메뉴 막대 앱으로, AI 코딩 에이전트가 활성 세션을 갖고 있는 동안에만 시스템이 절전 모드로 전환되는 것(뚜껑을 닫았을 때의 절전 모드 포함)을 방지합니다. 에이전트가 작동하지 않을 때는 절전 동작에 전혀 영향을 주지 않아 뚜껑을 닫으면 맥이 정상적으로 잠듭니다. 이는 caffeinate나 Amphetamine 같은 '상시 켜짐' 유틸리티와는 정반대입니다. Adrafinil은 에이전트(Claude Code, Codex, Cursor, …)가 작업을 수행하는 도중에만 개입하며, 작업이 끝나는 순간 즉시 물러납니다.
⚠️ 권한이 필요한 수면 제어. 뚜껑을 닫은 상태에서의 절전 모드를 무시하려면 root 권한이 필요합니다. Adrafinil은 이를 오직 setSleepBlocked(Bool)만 노출하는 작고 검증된 특권 도우미(helper)에 격리합니다. 모든 정책은 권한이 없는 데몬(daemon)에서 처리됩니다. 기기 내부에서 화면이 없는 뚜껑 닫힌 맥을 깨어있게 만드는 더 깔끔한 private IOPMrootDomain 경로가 작동하지 않음을 확인한 후, 유휴 상태 절전을 위해 표준 IOPMAssertion을 유지하고 뚜껑 닫힘(clamshell) 절전을 위해 pmset disablesleep를 사용합니다. Docs/ARCHITECTURE.md §2를 참조하세요.
주요 기능
에이전트 인식, 상시 켜짐 아님. 1개 이상의 에이전트 세션이 어설션(assertion)을 유지하는 동안에만 절전이 차단됩니다. 세션이 0개이면 → 뚜껑을 닫아도 정상적으로 절전 모드에 들어갑니다.
9개 에이전트에 대한 훅(Hook) 통합. 원클릭 설치 프로그램은 Claude Code, Codex, Cursor, Gemini CLI, Aider, Hermes, OpenCode, Cline, Pi의 훅 시스템에 Adrafinil을 연결합니다.
50ms 미만의 CLI. adrafinil acquire / release 명령은 에이전트 훅에서 호출되며 데몬과의 왕복이 50ms 이내에 이루어지므로 에이전트의 워크플로우가 지연되지 않습니다.
참조 카운트 방식 어설션. 겹치는 세션들이 깔끔하게 누적되며, 마지막 세션이 종료될 때만 절전 차단이 해제됩니다.
과열 방지 기능(Thermal cutout). 뚜껑을 닫은 상태에서 피부/CPU 온도가 임계값을 넘으면 모든 어설션이 강제로 해제되어 가방 속의 맥북이 과열되는 것을 막아줍니다.
유휴 해제(Idle release). 어설션을 소유한 프로세스가 종료되거나 N분 동안 CPU가 유휴 상태이면 자동으로 해제됩니다.
프로세스 탐지(선택 사항). 데몬은 훅이 설치되지 않았더라도 알려진 에이전트 바이너리가 실행 중인 것을 감지하면 자동으로 어설션을 획득할 수 있습니다.
뚜껑 닫기 사운드 및 뚜껑 열기 요약. 뚜껑을 닫을 때 어설션이 유지되고 있음을 차임벨로 확인해 줍니다(화면이 꺼져 있어 알림을 볼 수 없으므로). 다시 열면 당신이 없는 동안 실행된 작업, 최고 온도, 과열 방지 기능이 작동했는지 여부를 보여줍니다.
깔끔한 삭제. 모든 에이전트 구성에 추가된 모든 훅 항목을 완벽하게 제거합니다.
요구 사항
macOS Tahoe 26.4. 이 버전에서 빌드 및 테스트가 이루어졌습니다. 이전 26.x 버전에서도 아마 실행되겠지만 테스트하지는 않았습니다.
빌드를 위한 Xcode 26+. Swift 6 엄격한 동시성(strict concurrency) 활성화 필요.
표준 설치를 위한 관리자 권한(특권 도우미는 SMAppService를 통해 설치됨).
관리자 권한이 없는 설치 경로는 CLI를 /usr/local/bin 대신 ~/.local/bin에 배치합니다.
다운로드
Adrafinil 다운로드 — 서명 및 공증된 디스크 이미지. 열고 Adrafinil을 응용 프로그램으로 드래그한 다음 실행하세요.
첫 실행 시 특권 도우미를 등록하기 위해 관리자 권한을 한 번 요청합니다.
macOS 26.4 이상이 필요합니다.
직접 빌드하는 것을 선호하시나요? 빌드하기 섹션을 참조하세요.
빌드하기
git clone https://github.com/kageroumado/adrafinil.git
cd adrafinil
open Adrafinil.xcodeproj
Xcode에서 Adrafinil 스킴(scheme)을 선택하고 실행(Run)하세요. 코드 서명을 위해 개발 팀(development team)을 설정해야 합니다. 데몬(LaunchAgent)과 도우미(LaunchDaemon)는 앱 번들에 내장되어 등록됩니다.
adrafinil rx no. 006 ・ a·draf·i·nil /əˈdræfɪnɪl/ ・ a eugeroic for machines ♡ awake ・ an agent is working sleeping ・ no agents, normal sleep 服用注意 ・ for machines that keep watch after you've gone to sleep. It's 3 a.m. You're asleep. The agent isn't — it's still mid-thought in a session you started hours ago, and you've closed the lid over it like an eyelid that won't quite shut. caffeinate and Amphetamine are stimulants: they keep the machine wired forever , whether or not anyone's home. Adrafinil is the eugeroic. It does nothing until an agent acquires it, keeps your Mac awake through a closed lid only for as long as that work lives, and clears the moment the last session releases. It only ever wakes for the work — then you both sleep. ♡ Keep your Mac awake only while AI agents are working . Adrafinil is a macOS menu bar app that prevents the system from sleeping — including clamshell (lid-closed) sleep — exclusively while an AI coding agent has an active session . When no agent is working, sleep behavior is untouched: close the lid and the Mac sleeps normally. It's the opposite of always-on wake utilities like caffeinate or Amphetamine. Adrafinil only intervenes when an agent (Claude Code, Codex, Cursor, …) is mid-task, and gets out of the way the moment that work finishes. ⚠️ Privileged sleep control. Overriding clamshell sleep requires root. Adrafinil isolates that in a tiny, audited helper that only exposes setSleepBlocked(Bool) — all policy lives in an unprivileged daemon. It holds a standard IOPMAssertion for idle sleep and uses pmset disablesleep for clamshell (lid-closed) sleep, after verifying on-device that the cleaner private IOPMrootDomain paths don't keep a displayless lid-closed Mac awake. See Docs/ARCHITECTURE.md §2. Features Agent-aware, not always-on. Sleep is blocked only while ≥1 agent session holds an assertion. Zero sessions → normal sleep, including lid-close. Hook integration for 9 agents. One-click installer wires Adrafinil into the hook systems of Claude Code, Codex, Cursor, Gemini CLI, Aider, Hermes, OpenCode, Cline, and Pi. Sub-50ms CLI. adrafinil acquire / release are called from agent hooks and round-trip to the daemon in under 50ms, so they never stall an agent's workflow. Reference-counted assertions. Overlapping sessions stack cleanly; sleep unblocks only when the last one releases. Thermal cutout. If skin/CPU temperature crosses threshold while the lid is closed, all assertions are force-released so a bag-bound Mac can't cook itself. Idle release. Assertions whose owning process has died or gone CPU-idle for N minutes are dropped automatically. Process sniffing (optional). The daemon can auto-acquire when it sees a known agent binary running, even without hooks installed. Lid-close audio + lid-open summary. A chime confirms an assertion is held when you close the lid (the screen is off, so no notification); reopening shows what ran while you were away, peak temperature, and whether the thermal cutout fired. Clean uninstall. Removes every hook entry it added across all agent configs. Requirements macOS Tahoe 26.4. That's what I build and test on; it likely runs on earlier 26.x, but I haven't tested it there. Xcode 26+ to build, with Swift 6 strict concurrency enabled. Admin rights for the standard install (the privileged helper installs via SMAppService ). A non-admin install path drops the CLI in ~/.local/bin instead of /usr/local/bin . Download Download Adrafinil — a signed, notarized disk image. Open it, drag Adrafinil to Applications, and launch. The first launch asks for admin rights once to register the privileged helper. Requires macOS 26.4 or later. Prefer to build it yourself? See Building . Building git clone https://github.com/kageroumado/adrafinil.git cd adrafinil open Adrafinil.xcodeproj In Xcode, select the Adrafinil scheme and Run. You'll need to set a development team for code signing — the daemon (LaunchAgent) and helper (LaunchDaemon) are embedded into the app bundle and registered with the system when the app launches. (No Team ID is baked into the source; the XPC caller check reads your own signing team at runtime, so a rebuild under any Developer ID authorizes its own components without code changes.) For a headless compile check without local signing identities: xcodebuild -project Adrafinil.xcodeproj -scheme Adrafinil -configuration Debug \ -destination ' generic/platform=macOS ' \ CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= ' ' build The shared logic builds and tests standalone as a Swift package: cd AdrafinilShared swift test How it works Agents don't talk to Adrafinil directly. Each agent's hook system calls the bundled CLI: adrafinil acquire < session-key > --tool claude-code --reason " long build " # when a turn starts adrafinil release < session-key > # when the agent goes idle Holds are activity-scoped , not session-scoped: Claude Code acquires on UserPromptSubmit and releases on Stop , so the Mac is only kept awake while the agent is actually working — an open-but-idle session at the prompt lets it sleep normally. The daemon refcounts by session key and asks the helper to block sleep while the count is non-zero. An agent can also keep the Mac awake for a background task that outlives its reply (a long build or deploy) with a time-boxed hold — either by calling adrafinil hold directly or, for MCP-capable agents, through the bundled MCP tool that adrafinil mcp serves: adrafinil hold --for 30m --reason " deploy " # keep awake up to 30 min, then auto-release adrafinil mcp # speak the Model Context Protocol on stdio (for agents) Other subcommands: status , install-hooks , uninstall-hooks , daemon-status , version . Architecture Four products across three privilege tiers (full detail, including the Xcode project layout, in Docs/ARCHITECTURE.md ): ┌──────────────────────────────────────────────────────────────┐ │ Adrafinil.app (menu bar app, user-facing) │ │ • Status item, settings, installer GUI, lid-open summary │ └─────────────────────────────┬────────────────────────────────┘ │ XPC ▼ ┌──────────────────────────────────────────────────────────────┐ │ AdrafinilDaemon (LaunchAgent, runs as user, always-on) │ │ • Reference-counted assertion registry │ │ • Process watchers (kqueue NOTE_EXIT + periodic sweep) │ │ • Thermal monitor (SMC) • Lid-state monitor (IORegistry) │ │ • Lid-close chime • CLI socket at …/Adrafinil/cli.sock │ └─────────────────────────────┬────────────────────────────────┘ │ XPC (privileged Mach service) ▼ ┌──────────────────────────────────────────────────────────────┐ │ AdrafinilHelper (SMAppService LaunchDaemon, root) │ │ • The ONLY component that touches sleep-blocking APIs │ │ • setSleepBlocked(Bool) + read-only state/version │ │ • Verifies caller's code-signing requirement │ └──────────────────────────────────────────────────────────────┘ adrafinil (CLI, ships inside the .app, symlinked onto PATH) • acquire / release / hold / mcp / status / install-hooks / uninstall-hooks • Connects to the daemon socket; <50ms round-trip AdrafinilShared — a Swift package shared across every target: data models ( AgentKind , Assertion ), the IPC wire formats, AssertionRegistry , CallerVerifier , the hook-install specs, and the CLI argument parser. This is where the unit tests live. Helper stays trivial to audit. It holds no policy — ref counting, thermal, idle, and lid logic all live in the daemon. The privileged surface is a single mutating endpoint plus read-only introspection. Daemon is the source of truth. The app is a pure view layer; it can quit and relaunch freely without affecting held assertions. Quirks worth knowing Public IOPM assertions don't beat clamshell sleep. IOPMAssertionCreateWithName with the public types (and therefore caffeinate ) will not keep a lid-closed Mac awake. Adrafinil's v1 uses pmset disablesleep 1 , which is blunt (it also disables idle sleep) and must be cleared on shutdown or it leaks — the helper resets to disablesleep 0 on resp