Recipe
Keep an agent running with the lid closed
Closing the lid puts a Mac laptop to sleep. Kilobat has an opt-in helper that keeps a working agent run going with the lid closed.
In the app
Open Settings in Kilobat and find Awake & agents.
Turn on Allow running with the lid closed.
When macOS asks, approve Kilobat’s power helper in System Settings > General > Login Items.
Set Longest with the lid closed. The limit is 8 hours.
Set the battery level at which the Mac sleeps. The default is 20%.
Turn on Keep the Mac awake while AI agents work.
For an awake session, open the teacup menu and choose With the Lid Closed Too.
With the CLI
Make sure that the setting is on and see the current hold.
kilobat conditions --jsonOutput
lidClosedAllowedandlidHold, with the battery level and heat state underpower.Keep running with the lid closed for two hours.
kilobat awake --lid-closed --for 2hKeep running with the lid closed while one command runs. The hold ends with the command.
kilobat awake --lid-closed -- npm test
Through MCP
Connect the MCP server once with claude mcp add kilobat -- kilobat mcp. For other clients, see the docs. Then an agent can call these tools. Tools that change settings tell the agent to ask you first.
| Tool and arguments | What it does |
|---|---|
get_conditions | Shows lidClosedAllowed and lidHold. |
keep_awake | Keeps the Mac running with the lid closed. The tool tells the agent to get your confirmation each time. |
release_awake | Ends the hold. |
Good to know
- A closed Mac in a bag can become hot, and its battery can go flat. Connect the power adapter if you can.
- The helper lets the Mac sleep at your battery floor, when it is hot, after the time limit, and one minute after Kilobat quits.
- An agent that waits for you holds the lid for 30 minutes at most. This needs Keep awake while an agent waits for you.
- If the helper or the Mac restarts while it holds the lid, the helper puts the setting back first.
Questions
Can I do this without Kilobat?
macOS keeps a laptop awake with the lid closed in closed-display mode, with an external display and power. See Keep a Mac laptop working with the lid closed.
Does an agent need its hooks for this?
No. Kilobat sees agents by their traffic. Hooks tell it when a run waits or is done. See Tell Kilobat when an agent waits or is done.
Sources
- Kilobat docs: Running with the lid closed
- Kilobat skill: mac-agent-runs
- Kilobat llms.txt: CLI and MCP reference
Sources checked on 29 October 2026. Man pages are the ones installed with macOS; open one with man <name> in Terminal.