Skip to content

gergomiklos/nosleepagent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NoSleepAgent

Keeps your Mac awake while your agents are working — close the lid and the job keeps running. Once they are idle, normal sleep comes back.

Works with Claude Code and Codex.

How it works

Claude Code / Codex hooks stamp a "last activity" time on every prompt and tool call. A root daemon checks it every 30s:

  • active in the last 10 min → pmset disablesleep 1 (stay awake, lid open or closed)
  • idle → pmset disablesleep 0 (sleep normally)

A timestamp drives everything — no state machine.

Menu bar

An icon shows the live state so you can check before closing the lid:

  • ⚡️ Awake — safe to close the lid, the job keeps running
  • 🌙 Will sleep — closing the lid now sleeps the Mac

Click it to pause/resume keep-awake or quit.

Install

git clone https://github.com/gergomiklos/nosleepagent.git
cd nosleepagent
./install.sh

Wires up the hooks for both Claude Code (~/.claude/settings.json) and Codex (~/.codex/hooks.json), backing up each first, installs the daemon, and adds a /nosleep command. Needs sudo (flipping disablesleep is root-only). Works on any Mac.

Afterward: restart open Claude Code sessions; in Codex, run /hooks and trust the new hooks.

Use

Nothing — it just runs. To turn it off: ./ctl.sh off (on / status), or /nosleep off inside Claude Code.

Uninstall

./uninstall.sh

Removes the daemon and re-enables normal sleep.

License

MIT — see LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors