Your agent didn't fail. You closed the lid
Description and use
SleepSwitch lets developers run long AI agent tasks on macOS without interruption, even with the lid closed, and auto‑disables when battery drops.
Problem
Macs sleep when the lid is closed, causing long-running AI agent tasks to terminate mid‑run.
Outcome
SleepSwitch enables developers to run long AI agent tasks without interruption, even when the laptop lid is closed, and includes a battery guard to prevent overheating.
Workflow
- 1. Install SleepSwitch via .pkg or source.
- 2. Launch SleepSwitch; icon shows current state (🌙 normal, ☕️ mode on, ⚠️ partial).
- 3. Click the icon to toggle mode on (prevents all sleep).
- 4. Close the laptop lid; the Mac stays awake and the agent continues.
- 5. When finished, click again to turn mode off or let the battery guard auto‑disable at 20%.
Evidence
SleepSwitch is a macOS menu bar toggle that stops your Mac from sleeping — lid closed included.
The standard answer is caffeinate -dimsu. It works — right up until you close the lid, at which point the Mac sleeps anyway.
Mode switches itself off once the battery drops to a threshold you pick — 20% out of the box — and, optionally, the instant the power adapter is unplugged.
- Record date: 2026-09-06T00:22:31.853Z