lid
It keeps a Mac awake while a coding agent is working, including with the lid shut. Close the laptop, put it in a bag, and the turn that was running is still running.
Lid open, the agent is working.
Almost all of it is invisible. The tool succeeds by nothing happening, so there is no screen to design and no moment to make satisfying. There is one line in the menu bar, and behind it this.
It used to have one more row. Deleting it caught the app lying.
The row sat under the headline and printed the battery level. macOS already shows the battery two icons away, so it was spending the one line people actually read on something they could already see. I cut it.
What it had been covering only showed up once it was gone. With a limit refusing to hold, the panel said Sleeping normally and nothing else. True, and useless. Someone who asked for a hold and did not get one decides the tool is broken. So it names the limit that is refusing.
What counts as working
Keeping a Mac awake is one line of code. Knowing when to stop is the product.
Tools that watch for a running process keep the machine awake for as long as your terminal is open, which is most of the day. An agent sits idle far longer than it works. So this watches the turn instead, using the lifecycle hooks Claude Code and Codex already fire.
A turn ends three ways. Only one of them is the one everybody handles.
| how the turn ends | what fires | a tool watching Stop | lid |
|---|---|---|---|
| it finishes | Stop | releases | releases |
| an API error kills it | StopFailure | never releases | releases |
| you close the terminal | SessionEnd | never releases | releases |
Why caffeinate cannot do this
There is more than one road to sleep, and the well known tool parks a barrier on the wrong one.
The only thing that closes the lower road is a machine wide setting that needs root, so it cannot simply be left on.
The proof
What has to be proved here is an absence, which is harder to show than a feature.
Five commands, and the one I did not build
session, open, stop, status, setting. Named after what you want, not after how it works.
There is no doctor. Nobody runs a diagnostic they have to think of first, and this tool fails silently by design, so the health check lives inside status, which is where people already go when something feels wrong.
Six words in the menu bar
0 and lid off sit next to each other and mean opposite things. One is running and holding nothing. The other is not running at all. A blank title would have merged them, and this is not a tool that can afford to look the same when it is dead.
Asking a stranger for sudo
The install writes a sudoers rule, which is a lot to ask of someone who found the repo an hour ago. It covers exactly two commands, it is checked with visudo before it goes in, and it is staged as a script you read before you run it. Nothing pipes a URL into a shell.
What I do not know
Verified on one machine. Apple M3 Pro, macOS 26.6, internal display, on battery. Intel, older macOS, and clamshell with an external display are all untested, and the lid is the entire product, so those are gaps rather than caveats.
A failure report is worth more to me than a success one.
MIT · 69 tests, no third party dependencies · github.com/kuanrur/holdlid