# Run Coding Agents Overnight on a Mac With Edith

> Leave a task list running when you close the laptop, without coming back to a dead battery, a capped limit or an agent stuck on a question.

- Canonical URL: https://getedith.pro/use-cases/run-coding-agents-overnight
- Published: 2026-11-15
- Updated: 2026-11-15

## The problem

Coding agents are good at long, boring work: migrating a codebase, fixing a backlog of failing tests, writing docs for every module. The natural time for that is overnight. Three things usually go wrong. The MacBook sleeps when you close the lid and every agent stops. An agent asks a question at 1am and waits until morning. Or the agents burn through the 5-hour window by 2am and sit idle for the rest of the night.

This setup chains five Edith extensions so the Mac stays up safely, the agents keep moving, and you can see in the morning exactly what happened and what it used.

## The setup

1. 1
   ### Start the agents on one board
   Open [Agents](https://getedith.pro/extensions/coding-agents) and press New Agent for each task: pick Claude Code, Codex or another agent, the machine and the space. Give each one its own git worktree so their edits cannot collide. Blocked agents sort to the top of the board.
   `ed herdr ls`
2. 2
   ### Queue tomorrow's follow-up
   An agent that finishes at midnight should not sit idle. Pick its pane id from `ed herdr ls` and queue its next instruction now. Edith types it in once that agent finishes its current turn, even with the Edith window closed. Queue one message per agent.
   `ed herdr send w1:p2 "now run the full test suite and fix what fails" --when-finished`
3. 3
   ### Check your limits before you leave
   [Usage](https://getedith.pro/extensions/claude-code-usage) shows the 5-hour and weekly windows for Claude, Codex and Cursor. If the weekly window is already high, start fewer agents. Turn on limit alerts so the notifications are waiting for you in the morning.
   `ed usage limits --refresh`
4. 4
   ### Keep the Mac awake with the lid closed
   [Lid Awake](https://getedith.pro/extensions/lid-awake) stops lid-close sleep for a session you choose and pauses itself below a battery floor. Approve its helper in Login Items the first time, before you leave, not at the door.
   `ed lid-awake on --yes`
5. 5
   ### Keep the screen on while you are still around
   While the lid is still open and you are watching the first few turns, [Keep Awake](https://getedith.pro/extensions/keep-awake) stops the Mac and its display from idling to sleep. Turn it on from its Home card or the notch.
6. 6
   ### Bring other machines in
   Agents running on a desktop or a Linux box you added in [Machines](https://getedith.pro/extensions/ssh-machines) show up on the same board. Ask a remote machine not to sleep, and count its agents in Usage.
   `ed machines control caffeinate box on`

## The whole thing as one script

Every step above has an `ed` command, so the evening routine fits in a few lines. Commands that change the Mac preview until they get `--yes`.

```
 ed usage limits --refresh
 ed herdr ls
 ed herdr send w1:p2 "now run the full test suite and fix what fails" --when-finished
 ed herdr send w1:p3 "write docs for every module you touched" --when-finished
 ed lid-awake battery 30
 ed lid-awake on --yes
 ed machines control caffeinate box on
 ed usage machines enable box
```

And in the morning:

```
 ed lid-awake off
 ed usage refresh
 ed usage summary --range today
 ed usage projects
 ed herdr hooks ls
```

`ed usage summary --range today` shows tokens and cost per agent, `ed usage projects` shows which repositories they went to, and `ed herdr hooks ls` shows which queued messages were sent and which are still waiting.

## Pitfalls

- **Permission prompts stall agents.** An agent that stops to ask whether it may run a command waits all night. Decide before you leave which commands the agent may run without asking, in the agent's own permission settings, and keep the work inside a worktree.
- **The battery floor ends the night.** When the battery drops below the floor, Lid Awake pauses and the Mac sleeps, which pauses the agents. Plug in for anything longer than a couple of hours.
- **Battery saver turns it off.** By default, when Edith's battery saver is on, for example in Low Power Mode, and the Mac is on battery, Lid Awake stays off until you plug in or battery saver ends.
- **Keep Awake does not cover a closed lid.** It handles idle sleep only. Closing the lid still sleeps the Mac unless Lid Awake is on.
- **Remote machines need their own Herdr.** The board finds agents on SSH machines only where Herdr is installed.
- **Heat.** Leave the closed MacBook on a desk or a stand, not in a bag.

See it in the notch

Agents and Usage can both show live activity in the notch when you turn it on, so a glance at the top of the screen tells you whether any agent is blocked and how close the current window is to its cap.

## Go deeper

Each step has its own guide: [keeping a MacBook awake with the lid closed](https://getedith.pro/guides/keep-macbook-awake-lid-closed), [running multiple Claude Code agents](https://getedith.pro/guides/run-multiple-claude-code-agents-mac), and [checking Claude Code usage limits](https://getedith.pro/guides/check-claude-code-usage-limits).

## Edith extensions used

- [Run Multiple Claude Code and Codex Agents on Mac](https://getedith.pro/extensions/coding-agents): See every coding agent on your Macs in one board, and step in when one needs you.
- [Claude Code Usage Tracker for Mac: Codex, Cursor](https://getedith.pro/extensions/claude-code-usage): See what your coding agents cost and how close you are to their limits.
- [Keep MacBook Awake With the Lid Closed](https://getedith.pro/extensions/lid-awake): Keep your Mac running with the lid closed.
- [Keep Mac Awake: Stop Sleep While You Work](https://getedith.pro/extensions/keep-awake): Stop your Mac and display from going to sleep while you work.
- [SSH Server Manager for Mac With Docker and Files](https://getedith.pro/extensions/ssh-machines): Watch, browse and run your servers and containers from one place.
