Running loops with oversight
A loop that grinds through many items unattended is only as safe as three things: a
ledger you can read at a glance, an explicit bound it can't run past, and a verify
pass that isn't the same agent that did the work. Set those up before the loop starts.
Oversight is not watching the agent — it's making the loop's state legible in an artifact and
inserting checkpoints the loop cannot skip.
Before you launch — five gates
Don't start the loop until each is a concrete artifact, not an intention.
- Ledger. One canonical file the loop reads and writes every turn — a status table (item /
expected behaviour / status / findings / evidence). Reuse
.claude/current_plan.md so the
plan-reminder and big-change-reminder hooks already track it. Template:
templates/loop-ledger.md. Oversight = reading this
one file.
- Unit of work + done-condition. Define the smallest atomic item and its checkable exit
("test green", "row marked done with a linked commit") — never "be thorough".
- Bound. Every loop gets an explicit ceiling: max iterations, a token budget, or
until-N-consecutive-empty (a plain counter misses the tail). No unbounded loops.
- Independent verify pass. The agent that produces an item does not get to mark it done. A
separate pass confirms it — an adversarial subagent prompted to refute, or
/code-review.
Mirrors review-reminder's "review → fix → re-review until clean".
- Integration cadence. Commit per unit (atomic — keeps
git log the audit trail and never
trips big-change-reminder). An unattended loop opens one PR per unit and never
auto-merges — the [[commit-digest]] pattern.
The per-turn contract
Paste this into the loop prompt so every iteration is self-checking:
read ledger → pick next un-done item → do it → verify (separate pass) → update the ledger
row with evidence → commit.
Stop when the bound is hit, or the ledger has no un-done item two turns running.
Substrate — match it to how much you can watch
| You are… |
Use |
Bound + oversight |
| At the keyboard |
/loop (interval or self-paced) |
Ctrl-C; Stop hooks (verify-work, review-reminder) gate each turn |
| Present, want structure |
Workflow tool |
budget.remaining() ceiling; verify stage baked into the pipeline |
| Away / recurring |
/schedule cron routine |
PR-per-unit, no auto-merge, a digest you read later |
Detail and the budget/until-dry patterns: substrate-selection.md.
Ready generate + verify prompts, plus a poll-until-true scaffold for "wait for a condition, then
take one action" (merge once CI/main settles, confirm a deploy went live):
prompt-scaffolds.md.
Completion criteria
- All five gates existed as artifacts before the loop ran (ledger file, defined unit,
written bound, verify pass, commit/PR cadence).
- Every ledger row reaches a terminal state with linked evidence (commit / PR / test
output), or is explicitly parked with a reason — no silent skips.
- The loop stopped at its bound, not by running out of context or being interrupted.
Red flags — stop and add a gate
- No ledger file, or the loop isn't updating it each turn → oversight is invisible.
- "I'll just let it run and check the result" with no iteration/budget ceiling → unbounded.
- The same agent writes an item and marks it done → no independent verify.
- An unattended loop merging to
main → review can never happen.
Notes
- The bound lives where you write it. A Stop hook can't hard-cap a
/loop (it can only nudge
the next turn) and can't see token counts. The real ceiling is max iterations /
until-N-empty in the prompt, or budget.remaining() in the Workflow tool.
- For a batch sweep across many targets, the
dev-env-setup fleet mode (canary first → one
isolated agent per target → verify each) is the supervised template — reuse that shape.
- Related: [[multi-session-plans]] owns the
.claude/current_plan.md phased checkpoint this
skill uses as a ledger; [[repo-review]] and ad-hoc work surface the items a loop then works.
1---2name: loop-oversight3description: Use before launching a loop that runs many iterations — a `/loop`, a `/schedule` routine, or a Workflow fan-out — or when a running loop is drifting, unbounded, or leaving no reviewable trail. Triggers on "loop over every X", "go through all the Y and track status", "automate this repetitive sweep", "run this on a schedule", or an Osman-style "make a canonical tracker and work through every item". Sets up the ledger, the bound, and the independent verify pass a loop needs to stay reviewable. NOT for a one-off task (just do it) or one-shot parallel fan-out with no iteration (that's dispatching-parallel-agents).4---56# Running loops with oversight78A loop that grinds through many items unattended is only as safe as three things: a9**ledger** you can read at a glance, an explicit **bound** it can't run past, and a **verify10pass** that isn't the same agent that did the work. Set those up *before* the loop starts.11Oversight is not watching the agent — it's making the loop's state legible in an artifact and12inserting checkpoints the loop cannot skip.1314## Before you launch — five gates1516Don't start the loop until each is a concrete artifact, not an intention.17181. **Ledger.** One canonical file the loop reads and writes every turn — a status table (item /19 expected behaviour / status / findings / evidence). Reuse `.claude/current_plan.md` so the20 `plan-reminder` and `big-change-reminder` hooks already track it. Template:21 [templates/loop-ledger.md](references/templates/loop-ledger.md). *Oversight = reading this22 one file.*232. **Unit of work + done-condition.** Define the smallest atomic item and its **checkable** exit24 ("test green", "row marked done with a linked commit") — never "be thorough".253. **Bound.** Every loop gets an explicit ceiling: max iterations, a token budget, or26 **until-N-consecutive-empty** (a plain counter misses the tail). No unbounded loops.274. **Independent verify pass.** The agent that produces an item does not get to mark it done. A28 separate pass confirms it — an adversarial subagent prompted to *refute*, or `/code-review`.29 Mirrors `review-reminder`'s "review → fix → re-review until clean".305. **Integration cadence.** Commit per unit (atomic — keeps `git log` the audit trail and never31 trips `big-change-reminder`). An **unattended** loop opens one PR per unit and **never32 auto-merges** — the [[commit-digest]] pattern.3334## The per-turn contract3536Paste this into the loop prompt so every iteration is self-checking:3738> read ledger → pick next un-done item → do it → **verify (separate pass)** → update the ledger39> row with evidence → commit.4041Stop when the bound is hit, or the ledger has no un-done item two turns running.4243## Substrate — match it to how much you can watch4445| You are… | Use | Bound + oversight |46|---|---|---|47| At the keyboard | `/loop` (interval or self-paced) | Ctrl-C; Stop hooks (`verify-work`, `review-reminder`) gate each turn |48| Present, want structure | Workflow tool | `budget.remaining()` ceiling; verify stage baked into the pipeline |49| Away / recurring | `/schedule` cron routine | PR-per-unit, no auto-merge, a digest you read later |5051Detail and the budget/until-dry patterns: [substrate-selection.md](references/substrate-selection.md).52Ready generate + verify prompts, plus a poll-until-true scaffold for "wait for a condition, then53take one action" (merge once CI/main settles, confirm a deploy went live):54[prompt-scaffolds.md](references/prompt-scaffolds.md).5556## Completion criteria5758- All five gates existed as artifacts **before** the loop ran (ledger file, defined unit,59 written bound, verify pass, commit/PR cadence).60- Every ledger row reaches a terminal state with **linked evidence** (commit / PR / test61 output), or is explicitly parked with a reason — no silent skips.62- The loop stopped at its bound, not by running out of context or being interrupted.6364## Red flags — stop and add a gate6566- No ledger file, or the loop isn't updating it each turn → oversight is invisible.67- "I'll just let it run and check the result" with no iteration/budget ceiling → unbounded.68- The same agent writes an item and marks it done → no independent verify.69- An unattended loop merging to `main` → review can never happen.7071## Notes7273- **The bound lives where you write it.** A Stop hook can't hard-cap a `/loop` (it can only nudge74 the next turn) and can't see token counts. The real ceiling is `max iterations` /75 `until-N-empty` in the prompt, or `budget.remaining()` in the Workflow tool.76- For a batch sweep across many targets, the `dev-env-setup` **fleet mode** (canary first → one77 isolated agent per target → verify each) is the supervised template — reuse that shape.78- Related: [[multi-session-plans]] owns the `.claude/current_plan.md` phased checkpoint this79 skill uses as a ledger; [[repo-review]] and ad-hoc work surface the items a loop then works.