Send the prompt. Shut the lid.Walk away.
You shouldn't have to babysit an open laptop just so Claude, Cursor, or Codex can finish a 30-minute turn. NonSleep keeps your Mac working with the lid closed — and puts it to sleep the second your agent finishes.
Universal binary for M1–M4 Apple Silicon & Intel · Free & Open Source
Stays awake with lid closed
Lid closed · Battery 84% · Clamshell
Claude Code · my-app
pid 48291 · Holding until 18:15
[NonSleep] Clamshell closed! pmset disablesleep 1 active.
[NonSleep] Displays powered off. Session locked.
[12/20] Writing unit tests for token expiry...
[Test: OK] 18 tests passing in background
Step 19/20 compiling with lid shut...
Sound Familiar?
We built NonSleep because we were tired of losing hours of coding progress.
- 1You give Claude Code or Cursor a 30-minute refactoring prompt before going to bed.
- 2You shut the lid and head to sleep. macOS immediately puts the laptop to sleep.
- 3Your agent freezes after step 2. The other 18 steps never run.
- 4You wake up at 7 AM to find zero progress, wasted time, and broken deadlines.
- ✓You submit the prompt and shut the lid immediately.
- ✓NonSleep keeps the task cawing with the screen locked tight.
- ✓At step 20, Claude finishes. NonSleep detects the Stop event and puts the Mac to sleep safely.
- ✓You wake up to a cool laptop, full battery, and completed, tested code.
Why Traditional Tools Fail You
Apple designed caffeinate to stop your display from dimming while you stare at it. NonSleep is designed for when you close the lid and walk away.
True Clamshell Without a Monitor
Apple kills closed-lid tasks. NonSleep doesn't let it.
Standard tools only block idle sleep. The moment you close the lid without an external monitor, macOS forces sleep. NonSleep controls the only system switch that survives a shut lid: pmset disablesleep 1.
Agent-Aware: Sleep When Done
Never guess when a turn finishes.
Connects directly to Claude Code, Cursor, Codex, and omp hooks. While your agent thinks or executes commands, your Mac stays awake. The millisecond it finishes, NonSleep releases the flag so your Mac sleeps.
Won't Bake in Your Backpack
Automatic thermal & battery cut-outs.
Opening your backpack to find a scalding hot MacBook with 1% battery is a nightmare. NonSleep continuously watches temperature and battery sensors. If it gets hot or battery drops below 20%, it halts immediately.
Shut Lid = Instant Screen Lock
Keeps running, but locks down your screen.
Your code keeps compiling, but your session is safe. The moment the clamshell closes, NonSleep turns off the display, prompting macOS to lock the session immediately with Touch ID or password.
Crash-Proof Leases & Reaper
Never leaves your Mac permanently awake.
Ever run pmset manually and forgotten to turn it off? Your battery died overnight. NonSleep ties every request to a process lease. If your agent crashes or gets kill -9, our background reaper cleans it in 60s.
Bedtime Podcast & YouTube Timer
Fall asleep to audio with the lid closed.
Want to fall asleep listening to a YouTube video or podcast? Click Custom in the menu bar, type 45m, and shut the lid. Audio plays through speakers or AirPods; your Mac sleeps at 45 minutes.
Designed for Terminal & Automation
One engine shared between the Menu Bar app and the CLI. Predictable, scriptable, and transparent.
Native Hooks for Every Major Agent
Whether you code with Claude Code, Cursor, Codex, or omp, NonSleep attaches to the turn lifecycle seamlessly.
Ready-Made Prompt for Your AI Agent1-Click Prompt
Copy and paste this directly into Claude Code, Cursor, or Codex. Your agent will install and verify everything autonomously.
Claude Code
Anthropic CLI
Holds lease during UserPromptSubmit and PostToolUse; releases on Stop or Notification.
Monitored Events
Cursor
AI IDE
Listens to observe-only events (beforeSubmitPrompt, postToolUse, stop, sessionEnd).
Monitored Events
OpenAI Codex
OpenAI CLI
Captures prompt start, tool usage, and stop lifecycle to manage MacBook sleep seamlessly.
Monitored Events
omp (oh-my-pi)
Agent Harness
NonSleep automatically reads omp's 'omp agent session' power assertion via IOKit.
Monitored Events
Antigravity
Google Agent
Supports CLI, App, and IDE. Observes PreInvocation, PostToolUse, and fullyIdle Stop state.
Monitored Events
How NonSleep Compares
An objective architectural look across all keep-awake solutions for macOS.
| Capability | NonSleep (Ours) | Amphetamine | Caffeinate | Agent Caffeine | Amped |
|---|---|---|---|---|---|
Close lid without external monitor NonSleep uses pmset disablesleep 1, allowing true standalone clamshell mode. | Needs monitor/power | ||||
Auto-sleep when AI agent finishes NonSleep hooks into Claude, Cursor, Codex, and omp; auto-sleeps on turn completion. | |||||
Custom timer (e.g. 45m for YouTube) GUI allows typing custom duration like 45m or 2h with automatic sleep when done. | CLI only | ||||
Auto-lock screen on lid close Displays are turned off on clamshell close, enforcing macOS password/TouchID lock. | |||||
Thermal & Low Battery Cut-outs Protects against battery drain to 0% and backpack heat build-up. | Auto (<20% or Hot) | Battery % only | Battery only | ||
Zero Background Root Daemon NonSleep uses a tightly scoped sudoers rule for pmset only. No root daemon. | |||||
100% Offline (Zero Telemetry) NonSleep contains 0 network code, verified with lsof -i (completely empty). | Closed-source | ||||
Open Source & Verifiable (SLSA) Every release is cryptographically signed and verified via GitHub Artifact Attestations. | MIT + SLSA Provenance | Proprietary | Apple Built-in | Proprietary | GPL-3.0 |
Memory Footprint Pure Swift AppKit/SwiftUI native compilation. Zero Electron overhead. | ~25 MB RAM (3.9 MB CLI) | ~40 MB | < 5 MB | ~70 MB | ~30 MB |
Real Measurements on Apple Silicon
No Electron bloat. Starts in 30ms, takes ~25 MB RAM, and uses 0.0% CPU when idle.
Full macOS menu bar app + bundled CLI binary + Retina icons.
Pure native Swift executable compiled with zero external dependencies.
Registers Darwin kernel clamshell callbacks; zero CPU wakeups or busy loops.
Subcommands (status, reap, on, off) execute in ~30ms and immediately exit.
3.9 MB peak memory for CLI; ~25 MB resident private memory for menu bar app.
Tiny config (~300 B) + ephemeral leases (~150 B) auto-purged on task exit.
Interactive Sleep Timer Simulator
For YouTube, podcasts, audiobooks, or long compilation tasks.
100% Offline. We Don't Want Your Code.
Zero network code, zero third-party dependencies, and zero telemetry. Audited by security engineers.
100% Offline (Air-Gapped)
Zero network imports (URLSession, Network, sockets). Zero telemetry, tracking, or crash analytics. Verify yourself via `lsof -p $(pgrep NonSleepBar) -i` (returns empty).
Zero Third-Party Dependencies
Links exclusively against the Swift standard library and Apple system frameworks (AppKit, SwiftUI, IOKit). Eliminates supply-chain poisoning risks completely.
TOCTOU-Proof Sudoers Setup
Draft rules are staged directly into /etc/sudoers.d/ as 0440 root:wheel before visudo -c verification, preventing local processes from swapping files mid-check.
Cryptographic SLSA Build Provenance
All release binaries are compiled on public GitHub Actions with pinned commit SHAs and signed with GitHub Artifact Attestations (SLSA Level 3).
gh attestation verify NonSleep-0.3.0-macOS.zip --owner Tran-Duc-DuyFrequently Asked Questions
Everything you need to know about safety, permissions, and everyday workflows.