HartreeWorks

Dont Sleep — AI skill for Claude Code

AI community

Keep your Mac awake while your AI agents are working — even on battery with the lid closed.

How to install Dont Sleep

This entry records only its repository, not the path inside it, so there is no exact command to give. Open HartreeWorks/dont-sleep and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Dont Sleep does

Keep your Mac awake while your AI agents are working — even on battery with the lid closed.

Alternatives in AI

README

dont-sleep

Keep your MacBook awake while Claude Code or Codex is working—even on battery with the lid closed—and let it sleep when the agent stops.

[!WARNING] **Beta software. Use at your own risk.** `dont-sleep` changes system sleep behaviour and has been physically tested on just one Apple Silicon MacBook M4 running macOS Sequoia 15.7.

Quickstart

Install `dont-sleep` as a root LaunchDaemon so it starts automatically after every reboot:

mkdir -p "$HOME/code"
git clone https://github.com/HartreeWorks/dont-sleep.git "$HOME/code/dont-sleep"
cd "$HOME/code/dont-sleep"

sudo mkdir -p /usr/local/libexec
sudo install -o root -g wheel -m 755 dont-sleep.sh /usr/local/libexec/dont-sleep.sh

sed \
  -e 's|/ABSOLUTE/PATH/TO/dont-sleep.sh|/usr/local/libexec/dont-sleep.sh|' \
  -e "s|YOUR_USERNAME|$USER|g" \
  dont-sleep.plist > /tmp/com.example.dont-sleep.plist

sudo install -o root -g wheel -m 644 \
  /tmp/com.example.dont-sleep.plist \
  /Library/LaunchDaemons/com.example.dont-sleep.plist
sudo launchctl bootstrap system /Library/LaunchDaemons/com.example.dont-sleep.plist

Check that it is running:

sudo launchctl print system/com.example.dont-sleep
tail -f "$HOME/Library/Logs/dont-sleep.log"

The default battery threshold is 50%. To change it, edit the `50` in `ProgramArguments` in the installed plist, then reload the daemon.

What it does

Every 15 seconds, `dont-sleep` checks agent activity, battery level, lid state and thermal pressure:

  • It enables pmset disablesleep while a Claude Code or Codex agent is active and the battery is at least 50%.
  • It recognises long, quiet shell commands and subagents as active work for up to one hour. Normally fast tools such as reads and edits expire after 10 minutes. Tools waiting for human input do not count after the 10-minute activity grace.
  • When the agent stops or the battery falls below 50%, it releases the override. If the lid is shut on battery, it forces sleep because macOS does not r