Keep your Mac awake while Claude Code, Codex, Claude Desktop, or Claude Cowork is doing work.
Sentinel is a macOS menu bar app and CLI helper. It prevents system sleep while supported coding agents are active, including lid-closed sessions, then restores normal sleep behavior when the work is finished.
- Claude Code CLI through Claude Code hooks.
- Codex CLI through Codex hooks.
- Claude Desktop and Claude Cowork through process monitoring.
- Lid-closed keep-awake behavior through
pmset disablesleep. - Optional privacy lock for CLI sessions using the real macOS lock screen.
- Claude Desktop/Cowork stays awake without privacy-locking by default, so Chrome/computer-use tasks have the best chance to keep using the graphical session.
The target state is awake, not asleep.
- If the Mac is awake and Sentinel is running, active agents can continue.
- If the Mac is locked but awake, CLI agents and many background tasks can continue.
- If the Mac is actually asleep, local Claude/Codex/Cowork work stops.
- If Claude Desktop/Cowork needs Chrome UI control, avoid auto-locking Claude Desktop. This is the default.
- Download the latest DMG from the releases page: Sentinel latest release
- Open the DMG.
- Drag
Sentinel.appinto/Applications. - Launch
Sentinel.app. - Approve the setup prompt. Administrator permission is required to configure
pmset. - Restart Claude Code, Codex, or Claude Desktop.
brew tap CharlonTank/tap
brew install sentinel
sentinel installgit clone https://github.com/Aravindargutus/sentinel.git
cd sentinel
git checkout main
cargo build --release
./target/release/sentinel installAfter installation, launch the app:
open /Applications/Sentinel.appSentinel may ask for these permissions depending on enabled features:
- Administrator permission: required to configure passwordless
pmsetaccess. - Input Monitoring: used for idle detection and dictation shortcuts.
- Accessibility: used for dictation text injection and related automation helpers.
- Microphone: used only by the dictation feature.
For keep-awake behavior, the most important setup step is sentinel install, which configures pmset access and agent hooks.
sentinel install adds lifecycle hooks:
- When an agent starts work, hooks call
sentinel start. - Sentinel records the active agent PID.
- The menu bar app/background agent disables sleep while any active PID exists.
- When the agent finishes, hooks call
sentinel stop. - Sleep is re-enabled only when no protected work remains.
Claude Desktop does not use the same hook lifecycle as Claude Code. Sentinel monitors the main Claude.app process instead.
- When Claude Desktop is running, Sentinel treats it as protected activity.
- Sleep stays disabled while Claude Desktop is open.
- When Claude Desktop quits, Sentinel restores normal sleep if no CLI agent sessions are active.
Privacy lock uses the real macOS lock screen:
CGSession -suspend
Defaults:
- CLI agent sessions: privacy lock enabled.
- Claude Desktop/Cowork: privacy lock disabled.
- Idle delay: 60 seconds.
This default avoids interrupting Claude Desktop tasks that need an unlocked graphical session, such as Chrome/computer-use workflows.
Run the menu bar app:
open /Applications/Sentinel.appCheck current state:
sentinel statusList active sessions as JSON:
sentinel listClean up stale interrupted sessions:
sentinel cleanupForce reset sleep prevention:
sentinel resetUninstall:
sentinel uninstallKeep Whisper/dictation model data during uninstall:
sentinel uninstall --keep-modelOpen settings from the menu bar app or run:
sentinel settingsAvailable settings include:
- Enable or disable sleep prevention.
- Enable or disable Claude Desktop monitoring.
- Enable or disable privacy lock.
- Choose whether privacy lock applies to CLI agents.
- Choose whether privacy lock applies to Claude Desktop.
- Set the privacy-lock idle delay.
- Configure speech-to-text language and vocabulary.
Settings are stored in:
~/Library/Application Support/Sentinel/settings.json
This repository uses the main branch.
Run tests:
cargo test --workspaceFormat code:
cargo fmtBuild release binary:
cargo build --releaseBuild a local DMG:
cargo xtask build-dmg --skip-notarizeClean the local installed app/test state:
cargo xtask clean --keep-modelFull local test package flow:
cargo xtask complete-test --skip-notarize --keep-modelSentinel can prevent sleep, but it cannot override every macOS, hardware, power, or security policy.
It cannot guarantee work continues if:
- The Mac is already asleep before Sentinel is active.
- Battery dies or power is lost.
- macOS thermal protection forces sleep or throttling.
- Enterprise/security policy blocks
pmset disablesleep. - Claude Desktop is closed.
- A Chrome/computer-use task requires a visible unlocked display and macOS does not provide one while the lid is closed.
The intended reliable state is:
Agents active + Sentinel running + Mac awake = work can continue
MIT. See LICENSE.