# Example impulse: keep a coding session driving toward a daily goal
<!--
ref: @protocol/example-impulse
tags: [impulse, example, shell-dispatch, recurring, escalation, agent-supervision]
version: 1
updated_at: 2026-11-16T23:47:06.786Z
-->

A sanitized copy of a real recurring impulse. The operator's intent was one sentence: *"keep that session working until it hits N completed tasks a day; it keeps finding reasons to pause."* The impulse below turns that sentence into a checked behavior that runs every 30 minutes. A supervising agent ("the driver") does not do the work itself. Its only job is to keep a separate coding session moving.

## The row

```yaml
title: Session driver: N completed tasks/day; push the worker session when idle
type: tick-task
status: ready
frequency: recurring
cadence: every 30m
dispatch: shell                  # a cheap shell check runs first; the agent wakes only on a signal
shell_cmd: driver.sh check
shell_trigger: exit_code != 0    # exit 0 = nothing to do, no tokens spent
timeout_sec: 90
priority: P1
no_auto_park: true               # never quietly shelve this row
```

## How it fires

Every 30 minutes the dispatcher runs `driver.sh check`. It **exits 0** (nothing to do, the agent is never woken) when any of these is true:

- it is outside working hours;
- today's count already meets N;
- the worker session is busy;
- the operator is typing in it;
- there is nothing left to work on and that has already been reported today.

Any other exit code wakes the driver with the check's one-line output. The count comes from the system of record, never from the worker's own claims.

| Exit | Meaning | Driver action |
|---|---|---|
| 11 | Idle, under N, work available | Push the session |
| 14 | Supply short | Tell the operator once per day; do not push |
| 10 | Session dead | Resume it, then push if work is available |
| 12 | Session shows a menu or permission prompt | Report what it asks; never answer on the operator's behalf |
| 2 | Count unreadable | Log it; never push blind |

## Per-fire procedure

1. Read the check's output line: count, state, exit code.
2. **Push** (exit 11): send one short standing instruction (≤1000 bytes) carrying a unique marker. Then confirm delivery by finding the marker in the session's transcript, not by looking at the screen. If it did not land, re-send once.
3. The push already carries answers to the usual reasons the worker stops, such as "tool wedged: restart it" or "form needs a human: park it, take the next task". Most pauses never reach the operator.
4. Never kill a session. Never answer a prompt that is the operator's to answer.

## Escalation: hard stops vs soft pauses

The worker ends turns early for reasons that sound reasonable. The impulse names the few that need a human, and treats everything else as a pause to push through.

**Hard stops** get ONE line to the operator per blocker per day, never one per fire:

- a login, 2FA or captcha that needs the operator's own browser;
- an attestation the operator must make personally;
- anything that spends money;
- an ambiguous result where the operator must check by hand.

**Soft pauses** get pushed, not escalated:

- "say the word if you want me to continue";
- "left for next session";
- stopping after a batch to report;
- stopping at an old, lower target;
- waiting on answers to open questions.

Open questions are batched into one list per day. Work continues on other tasks while the list waits.

## Logging

Each fire appends one log row to the impulse:

```json
{"count": 23, "pane": "idle", "action": "pushed", "landed": "<marker>"}
```

`action` is one of `none`, `pushed`, `resumed`, `reported-menu`, or `raised:<blocker>`. The log shows the operator what the driver did on every fire. When the goal is missed, it shows why: the worker stalled, the supply ran out, or a hard stop was raised.

## Why it is shaped this way

- **Shell check first.** Most fires are no-ops, so they cost no model tokens.
- **The count comes from the record.** A worker's "done" is a claim. The system of record is the evidence.
- **Hard and soft are named lists.** Without them, every polite deferral becomes a stall that waits for a human.
- **The first version never ran.** It was a thread-dispatched daily row with an empty log. Rebuilding it as a shell-dispatched driver every 30 minutes is what made it run.

---

*Related: `@protocol/protocol-api-write-traps` · `@protocol/stuck` · `@protocol/capture` · `@protocol/ask-lifecycle` · `@protocol/code-health`*

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*