Keep your Mac awake for AI agents, not all night

by Xun

You start a long Claude Code task, walk away, and come back to a Mac that fell asleep twenty minutes in. Or you turn on a keep-awake app, forget about it, and the screen glows all night.

Neither is what you wanted. You wanted the Mac awake while the agent works, and asleep after. That’s what AgentCat does.

Tie sleep to the task, not a timer

Classic keep-awake apps give you a duration: 1 hour, 4 hours, forever. Agents don’t run on a schedule. A refactor might take six minutes or ninety.

So AgentCat takes a signal from the agent itself. Any tool that can run a shell command can tell it when work starts and ends:

open -g "agentcat://activate"   # task started
open -g "agentcat://done"       # task finished
open -g "agentcat://attention"  # waiting for you

-g keeps AgentCat in the background, so your terminal or editor keeps focus. Each activate opens a session and each done closes one. With two agents running, the Mac stays up until both finish. When the last one reports done, AgentCat lets go and the Mac sleeps on its normal schedule.

In Claude Code, that’s a hook on prompt submit and on stop. In Cursor, AgentCat writes the beforeSubmitPrompt and stop hooks into hooks.json for you, merged with whatever hooks you already have.

Screen off, agent on

Keeping a Mac awake usually means keeping the display awake too. That’s the part you don’t want overnight.

AgentCat holds a system sleep assertion, not a display one, so your screen still dims, turns off, and locks on its usual timer while the Mac, the agent, and its network connections stay up. Your Mac isn’t sitting there unlocked at 3am with a terminal open.

When an agent never says done

Hooks fail. An agent crashes, a terminal closes, a done never arrives. Without a fallback, that’s the same “awake all night” problem again.

So every hook session has a watchdog, two hours by default, adjustable. If no activate or done arrives before it fires, AgentCat assumes the task stalled, releases the Mac, and sends you a notification saying so.

Always-on gateways

Some agents aren’t tasks, they’re services: a Hermes or OpenClaw gateway on a Mac mini answering messages all day. For those, AgentCat can watch for the process instead. While a matching process is running, the Mac stays awake. Stop the gateway and the Mac can sleep again. The matching happens on your Mac; nothing leaves it.

Takeaway

Sleep should follow the work. A timer only guesses how long a task will take; a hook knows when it’s actually done.

AgentCat is a $0.99 menu bar app for Mac. If your agent setup needs a hook it doesn’t support yet, I’d like to hear about it.