Loop 020

The Loop Harness verification loop

A scheduled loop-engineering workflow that runs a coding agent in an isolated worktree and requires a second agent to verify staged output before anything ships.

Ready-to-use prompt

Copy the loop

On the configured cadence, wake the due loop. Give a Claude session the task-specific skill and let it work in an isolated git worktree. Stage the resulting commits or output files without shipping them. Have a second Claude session verify the staged work against explicit acceptance criteria. If verification fails, ship nothing; preserve the findings and retry on the next cycle. If verification passes, ship the configured output—a pull request, review comments, or Slack message—and update the loop state. Finish with the source revision, staged artifacts, verifier result, delivery status, and next scheduled run.

Verify / stop

Only independently verified output ships.

A second-agent pass releases the configured output; a failed verification preserves evidence and produces no external change.

Context and guidance When to use it, steps, safety notes, and related loops
Published
Updated

Use this when

Use this when a recurring repository task should run unattended but one agent must not be allowed to generate and approve the same output.

How to run it

  1. Wake the due loop on its cadence and create an isolated worktree from the approved source revision.
  2. Give the primary Claude session its task-specific skill and let it stage one bounded output.
  3. Have a second Claude session inspect the staged work against explicit acceptance criteria.
  4. Ship on a pass; on a failure, preserve the findings, ship nothing, and retry according to the next-cycle policy.

Why it works

Worktree isolation limits interference, and the second-agent gate separates generation from approval. The result is a recurring loop that can wake, work, verify, and ship without relying on one session's confidence.

Implementation note

This pattern runs an unattended model with shell access. Start with read-only loops, smoke-test with run-once, cap runtime and retries, and grant only the tools each loop needs.