A watchdog that nudges instead of nagging
A silence ladder, batched delivery to busy panes, a host guard and a kill switch: the duty loop that keeps parallel coding-agent sessions moving.
When several coding agents work in parallel, one of them goes quiet sooner or later. It may wait for input, get stuck or crash. If I watch them myself, I lose the benefit of running them in parallel. So a small loop does the watching. Most of this post is about restraint: a watchdog should help without becoming the loudest part of the system.
What the loop does
The duty loop is a plain process in a pane, next to its own agent session. It ticks once a minute by default. Each tick does four jobs.
- It delivers queued messages to panes that went idle.
- It nudges lanes that have been silent.
- It escalates the stubborn ones to the lead.
- It marks a lane as lost when its pane has vanished.
The terminal runtime reports each pane as idle, working, blocked or done. The loop reads that state before it touches a pane. This one rule prevents most of the harm that a naive watchdog does.
The ladder
A ladder replaces a single threshold.
- After 10 minutes of silence, the loop sends a gentle nudge.
- After 20 minutes, it sends a second nudge.
- After 40 minutes, it escalates to the lead.
I send two nudges before I involve the lead. Most quiet agents are busy with a long build, a test run or a large file. A nudge costs one extra line of context. An escalation costs the attention of the lead, which is the scarcest resource in the setup. The ladder spends the cheap action first.
The loop never talks to me. Only the lead does. If every automated part could speak, my chat would fill with noise within a day.
Do not interrupt a busy pane
A message that lands in a working pane interrupts the agent in the middle of a thought. So the loop puts messages for a busy pane into an inbox. It delivers them as one batch when the pane next goes idle. The sender gets the same promise in both cases: the message arrives when the recipient can read it.
A host guard for launches
Parallel work can overload the machine. Before a new session starts, a host guard checks memory, disk and the number of panes. If one of them crosses its limit, new launches wait.
An hourly loop has its own budget. By default it keeps at most three lanes open and starts at most two in one run. It starts nothing while the host is loaded. It picks up only backlog items that need no decision. It asks each open question once.
Lost is a state
A pane can disappear. Someone may close it by mistake, it may crash, or the machine may kill it. The loop treats a pane that is gone before the lane reported ready as a named outcome, and it reports the lane as lost. Without that name, a dead lane looks the same as a thinking one, because both are silent. With the name, the lead learns about it within one tick.
The kill switch
The feature I trust most came last. I can stop the loop without killing it. When I stop it with a reason, every tick prints "duty stopped" and the reason, then does nothing else. It sends no messages, no nudges and no escalations. Queued messages wait in the inbox. A status command tells me whether the loop is stopped and why. A resume command starts it again.
I added the switch because I will want to silence a watchdog some day. If I cannot silence it, I will delete it. A deleted watchdog gives me nothing when I need it. A switch with a stated reason and a visible status is hard to forget.
State on disk
The loop keeps lanes, inboxes, briefs, receipts, the backlog and its own state as JSON files. After a restart it reads them back. I can inspect any decision with cat. The only runtime dependency is Bun. Apart from the agent sessions, the harness runs two long-lived processes: the duty loop and the hourly loop.
What I took from it
Cheap actions come first and human attention comes last. State comes before action, because a message to a busy agent is an interruption. A lost pane needs a name. An automated part needs an off switch with a reason. And one voice, the lead, speaks to me.