Glowmoth coding agents: stay awake while agents work
Turn on Glowmoth's agent-aware mode: the 11 coding agents it detects, how Working and Waiting are decided, the cool-down, per-agent options and current limits.
Updated 7 min read
On this page
This page shows you how to make Glowmoth keep your Mac awake while a command-line coding agent such as Claude Code or Codex is working. When the agent goes quiet, Glowmoth lets the Mac sleep as usual after a short cool-down.
Before you start
- Glowmoth needs an active trial or MacSuite license. Without one it keeps nothing awake, and agent mode does nothing either.
- Agent mode doesn't ask for any macOS permission.
- Agent mode is off on a fresh install.
Turn on agent-aware mode
- Right-click the Glowmoth icon in the menu bar and choose Settings…, or press ⌘, (Command-Comma) while the panel is open.
- Open the Automation tab.
- Under Coding Agents, turn on Stay awake while coding agents work.
The caption under the switch reads "Spots tools like Claude Code, Codex and Aider by their activity. Nothing leaves your Mac."
You can also turn it on from the welcome window. The AI Agents card ("Awake while coding agents work, asleep when they're done.") does three things:
- It turns on agent mode.
- It sets left-click to open the panel.
- It turns off Keep the display on.
If you pick a different card later, agent mode goes back off only if the AI Agents card was what turned it on. To reopen the welcome window, go to Settings ▸ General ▸ Startup ▸ Welcome window and click Show Welcome.
Agents count only in Automatic mode. Check that Keep awake automatically is on in Settings ▸ Automation, or that the panel's Automatic | Manual control is set to Automatic. In Manual, agents are ignored.


Coding agents Glowmoth recognizes
Glowmoth detects these 11 command-line agents:
- Claude Code
- Codex
- Gemini CLI
- Aider
- Copilot CLI
- Cursor Agent
- OpenCode
- Amp
- Goose
- Qwen Code
- Crush
Glowmoth matches an agent by any of these:
- Its process name.
- Its
argv[0]. - Its script or package path, when it runs under node, bun, deno, python or ruby. This means an agent that runs as a node or python script is still found.
Wrappers and sub-agents fold into one session per agent. An agent that starts helper processes still appears as a single entry.
See what Glowmoth has detected
Settings ▸ Automation ▸ Coding Agents has a live list of detected sessions. Each row shows:


- The agent name
- The project folder it's working in
- Its state: Working, Waiting or Finished
- "· Track Only" if you set that agent to Track Only
When nothing is detected, the list says "No agents running".
While an agent holds the Mac awake, the panel lists it with a label such as "Claude Code working in glowmoth" (the agent name and the project folder). When only automatic reasons are holding the Mac, the menu bar icon shows the Automatic state, which has a ring-shaped bulb.
How Working and Waiting are decided
At every poll, Glowmoth looks at each agent's whole process tree. The session counts as Working if, since the previous poll, the tree did any of these:
- Used at least 3% of one CPU core
- Started or finished a child process
- Wrote to its terminal
If none of these happened, the session is Waiting, for example while the agent waits for your reply. When the agent's process exits, the session is Finished.
Glowmoth polls every 5 seconds while an agent is running and every 15 seconds otherwise. With agent mode off, it doesn't poll at all. A newly started agent can therefore take up to about 15 seconds to appear.
How long the Mac stays awake after an agent goes idle
The Mac stays awake until the cool-down has passed since the last poll where the agent was Working. Every time the agent is seen working again, the cool-down starts over.
To set the length, go to Settings ▸ Automation ▸ Coding Agents ▸ Allow sleep after. Its caption reads "How long an agent can sit idle before your Mac may sleep."
| Option | Pick it if |
|---|---|
| 2 min | You want the Mac to sleep soon after the agent stops to wait for you |
| 5 min (default) | The agent works in steady steps with short quiet gaps |
| 15 min | The agent often goes quiet for several minutes mid-run and your Mac has slept during those gaps |
Keep Awake, Track Only and Ignore
Open the Each Agent disclosure under Coding Agents to choose how each agent is handled:
| Choice | What it does |
|---|---|
| Keep Awake (default) | Detected, listed, and keeps the Mac awake while working and during the cool-down |
| Track Only | Detected and listed with "· Track Only", but never keeps the Mac awake |
| Ignore | Not detected at all |
Use Track Only to see an agent's state without it affecting sleep. Use Ignore for an agent you have installed but don't want Glowmoth to watch.
Agents don't keep the display on
Agent reasons block only idle system sleep. They never keep the display on, so the screen can turn off while the agent keeps working.
To keep the display on during a run, use either of these:
- Start your own session. In the right-click menu, choose Indefinitely (or a duration) under Keep This Mac Awake, and make sure Keep Display On is checked.
- Add a rule. Create a rule with a Process Running condition for the agent's executable, and turn on that rule's own Keep the display on switch.
Desktop agent apps are not counted
Agent mode detects only the command-line tools listed above. Desktop .app versions, such as Claude.app, are not counted.
To keep the Mac awake while a desktop app is open, add it in Settings ▸ Automation ▸ Apps and choose Running or In Front under While. The Mac then stays awake as long as the app is running or in front. Glowmoth doesn't check whether the app is actually busy.
Agents that aren't on the list
For a command-line tool Glowmoth doesn't recognize, you have two options:
- Settings ▸ Automation ▸ Processes: add the executable name. The Mac stays awake whenever a process with that name is running.
glowmoth run -- <command>: keeps the Mac awake for as long as the command runs, then returns the command's exit code. See the glowmoth command-line tool.
Neither option tells Working from Waiting. Both hold the Mac for as long as the process exists.
When an agent hits its usage limit
An agent hook can pass its usage-limit message to glowmoth agent, for example "…limit reached ∙ resets 5am (Europe/London)". Glowmoth then schedules a run that starts 2 minutes before the reset and lasts 30 minutes. A newer message replaces the previous run, and the feature needs a license.
Waking a Mac that is already asleep at that time normally isn't possible. Setup and limits are covered in Scheduled runs and agent limit resets.
What agent mode doesn't do yet
Detection is based on processes only. The following are not built:
- Connect buttons that add Glowmoth hooks to your Claude Code or Codex settings.
- A "needs you" state, or a notification when an agent is waiting for you. A waiting agent shows Waiting and nothing more.
- Handling of
glowmoth agentevents other than a usage-limit message. Glowmoth accepts these events and ignores them. - A notification before an agent's cool-down ends. The ending-soon and reminder notifications cover only your own session.
Privacy
Agent mode runs entirely on your Mac. To work out what's running and whether it's busy, Glowmoth reads:
- Process names and arguments
- CPU time
- Working directory
- The time of the last terminal write
It doesn't read your prompts or what the agent sends. Agent hook messages are parsed only for a reset time and aren't stored, apart from the scheduled run they create.
Settings in this section
| Setting | Where | Default |
|---|---|---|
| Stay awake while coding agents work | Settings ▸ Automation ▸ Coding Agents | Off |
| Allow sleep after | Same section | 5 min |
| Each Agent (per agent) | Same section | Keep Awake |
| Keep awake automatically | Settings ▸ Automation | On |
The agent mode switch, the cool-down and the per-agent choices are included when you export your settings (Settings ▸ Advanced ▸ Settings file ▸ Export…). Time kept awake by agents appears as "Agents" in Settings ▸ Activity.
If the Mac sleeps mid-run, or never sleeps
- The agent isn't in the live list. Check that the agent isn't set to Ignore under Each Agent. Make sure you're running the command-line tool, not a desktop app. Then wait up to 15 seconds for the next poll.
- The agent is listed but the Mac still slept. Check that the panel is set to Automatic, not Manual. If you clicked Stop Everything, automatic reasons stay suspended until you start a session again or relaunch Glowmoth.
- The agent is set to Track Only. Track Only agents are listed but never hold the Mac. Switch the agent to Keep Awake.
- The Mac slept during a long quiet stretch. The agent showed Waiting for longer than the cool-down. Raise Allow sleep after to 15 min.
- The Mac slept when you closed the lid. Glowmoth blocks only idle sleep, so closing a MacBook's lid still sleeps it. See Keep a MacBook awake with the lid closed.
- The panel says "Paused". A battery or heat limit paused every reason, including agents. See Battery and heat safety limits.
- The Mac stays awake after the agent is done. That's the cool-down. Lower Allow sleep after, or click the ✕ on the agent's row in the panel to end that reason now.
- The screen turned off mid-run. This is expected, because agent reasons never keep the display on. See "Agents don't keep the display on" above.