A menu-bar app that keeps a MacBook awake with the lid closed so a Claude Code Remote Control session stays reachable — with guards so a laptop in a bag can't drain itself flat.

Close the MacBook lid and every Claude Code Remote Control session goes dead — the machine sleeps, the process freezes mid-execution, and the phone shows a session that can't answer. Midnight Oil keeps the Mac awake with the lid shut so those sessions stay reachable, and watches battery, heat and network so a laptop in a bag can't quietly drain itself flat.
It lives in the menu bar. One switch turns it on; everything else is a guard that turns it off again when staying awake stops being a good idea.
Guards that trip on a condition re-arm themselves once it clears — plug back in and the hold returns on its own. An explicit switch-off stays off.
caffeinate cannot do this. Power assertions don't defeat clamshell sleep. Proven on the machine rather than taken from documentation: an unrelated app held a sleep-prevention assertion for 12 hours 23 minutes, and the Mac still slept three times inside that window. Only the kernel flag works, which is why the app needs a narrow privilege grant — three literal pmset commands, no wildcards.
Releasing the hold doesn't sleep a closed Mac. Clamshell sleep is evaluated at the moment the lid closes, so clearing the flag afterwards only re-arms it for the next close. Measured: flag cleared, and the Mac was still awake eight minutes later with the lid shut. That single fact made every guard decorative — hit the battery floor in a bag, "release", and keep draining to zero. The guards now actively sleep the machine, but only when the lid is closed, so one tripping at your desk never sleeps a Mac you're using.
Built in a day, mostly as an exercise in not trusting inference. The design changed twice because a measurement contradicted something that seemed obviously true.