Authoring a loop you can trust

A .loop.yaml that parses isn't necessarily one worth running. This guide covers how to author a spec that's runnable and trustworthy — one whose checks actually test the requirement and start RED before the agent begins. (If you use Claude Code, the in-repo author-loop skill runs these steps for you.)

Want to train the judgment first? The workshop's evaluator-design module ends with a "trustworthy or fake-able?" judging game on real check shapes: Module 6 · Designing Evaluators.

loopgen generate already turns flags into a valid skeleton. What it can't supply is the judgment: reading the actual target repo to pick the right checks, writing concrete requirements, choosing the trust policy, and proving the spec before any agent budget is spent.

The one rule that matters most

Every check must (a) test the requirement and (b) be RED before the agent starts. A loop is only as good as its evaluators — "all checks passed" means nothing if the checks don't exercise the new behavior or were already green on the untouched workspace. Step 5 confirms exactly that.

When a loop fits (and when it doesn't)

A loop is only as good as the checks you hand it. loop-generator shines where success is mechanically checkable and misleads where it isn't, so it's worth knowing which side of that line a task falls on before you spend agent budget.

Works best when

Poor fit

Tasks where the framework mostly ends up telling you the checks were the wrong contract:

What it can't solve

These are fundamental to the agentic-loop approach, not gaps to be closed. The trust guards make them visible; they don't eliminate them:

If you can't write a check that's RED before the work and turns GREEN only when the requirement is met, the task isn't ready for a loop. The steps below are how you get it ready — and prove it.

The skill pipeline: let an agent run this workflow

The engine audits the run; these skills produce checks worth auditing. The repo ships Claude Code skills (.claude/skills/) that load automatically when you open it in Claude Code — three of them form the authoring pipeline, from a whole app spec down to a runnable loop:

frame-app ─────► frame-checks ────► author-loop ──► loopgen run
whole app into    one request into    one verified     (debug-loop when a
RED-able slices   falsifiable         .loop.yaml,      run goes sideways)
(a .batch.yaml)   acceptance checks   proven RED

No Claude Code? The pipeline is just this page plus debugging — the skills automate the workflow, they don't replace it.

1. Pin down the goal

Write the goal as something a command can verify. Push vague asks until they're testable:

You also need three more things:

If the goal is too vague to write a check for, resolve that now. A loop with no real check is the most common way these waste hours.

2. Inspect the target repo — don't trust the defaults

This is the step generation can't do for you. Open the workspace and find ground truth:

3. Decide the spec (with reasons)

4. Generate the skeleton, then edit

Generate a guaranteed-valid skeleton, then fix the fields the defaults got wrong. Editing a generated file beats hand-writing YAML — the skeleton always parses, so you only change values.

loopgen generate \
  -n "add-retry-to-fetchUser" \
  -t function -l typescript -f express \
  -d claude-agent-sdk \
  -r "Add exponential backoff (max 3 retries) to fetchUser(); keep the signature." \
  -m 6 -o ./loops/add-retry.loop.yaml

(From the repo without a build, prefix with npm run loopgen --, e.g. npm run loopgen -- generate ….) -d opencode seeds dangerouslySkipPermissions: true; interactive (-i) also asks for a provider/model id (e.g. lmstudio/…).

Then edit the file to: swap in the real test/build commands, set workspace.dir to the target repo, set limits.baseline: strict, tighten requirements, and adjust success if needed. Keep the spec outside the target repo and point workspace.dir at it.

5. Prove it — the part that earns trust

Two gates, neither of which spends agent budget.

a. Lint clean

loopgen lint ./loops/add-retry.loop.yaml --strict

Resolve every error and warning. Don't hand off a spec with open errors. Each rule and its fix is documented in the lint reference.

b. The checks start RED for the right reason

There is no agent-free "baseline only" run mode, so verify directly: run each evaluator's command yourself in the target workspace and confirm it fails because the requirement isn't met yet — not because a binary is missing, the working directory is wrong, or the command is bogus.

# in the target repo, on an untouched checkout:
npm test              # should FAIL (the new behavior isn't implemented yet)
npx tsc --noEmit      # should pass or fail per the real baseline

If a check passes on the untouched workspace, it doesn't test the requirement — fix the check before continuing. This is the same contract limits.baseline: strict enforces at runtime; you're confirming it up front so a run doesn't waste budget discovering it.

6. Run it

Once lint is clean and the checks start RED, you're ready:

loopgen run ./loops/add-retry.loop.yaml --strict-baseline --report run.json

A real run spends agent budget and needs the driver's credentials (ANTHROPIC_API_KEY for claude-agent-sdk, XAI_API_KEY for grok, and so on). The --report run.json file is the richest input to the debugging workflow if the run doesn't go green.

Guardrails

Reference

For exact field names, defaults, the per-language default commands, evaluator options, success-criteria forms, and the full lint-rule → fix table, see the in-repo author-loop skill's reference.md (.claude/skills/author-loop/reference.md) and the spec section. The source of truth is the code: src/core/spec.ts (schema), src/tasks/ (task types and default commands), and src/lint/rules.ts (lint rules).