Loop engineering for coding agents

Stop prompting. Start looping.

Instead of hand-prompting an AI coding agent turn by turn, wrap a code task in a loop that writes, runs, verifies, and retries until it actually passes or the loop decides to stop. Code that is verified, not just generated.

$ npx loopsmith
claude-code
> /verify-loop "add pagination to the users endpoint and make the tests pass" # maker writes the change # checker runs tests, lint, build on a clean context # failures feed back, it retries ✓ PASS verified in 2 iterations

The core idea

An agent that thinks it is done is not a change that has been verified.

loopsmith keeps a hard wall between the agent that makes the change and the agent that grades it. That independence removes the self-grading bias where an agent rubber-stamps its own work.

Without the wall

Self-grading bias

The same agent that wrote the change also decides whether it is correct. It has every reason to declare success. "Looks good to me" is not verification, it is a conflict of interest.

With loopsmith

Independent verification

A separate checker, with a clean context, runs the real tests, lint, and build, then reviews the diff against the original intent. It grades the work, not its own intentions.

The maker proposes. The checker disposes. Independence is the whole point.


Three skills

A Claude Code plugin, built from skills you can compose.

Run the full loop, or pull out just the checker, or price a loop before you spend a token on it.

/verify-loop

The full loop. A maker sub-agent writes the change. A separate checker sub-agent with a clean context runs tests, lint, and build, and reviews the diff against intent. Failures feed back and it retries until PASS or a stop condition fires.

maker + checker
/grade

The checker on its own. A one-shot, read-only verdict on a pending diff against its stated intent. Use it for a report-only review, or as the checker step inside verify-loop.

checker, read-only
/loop-cost

Estimate the token and iteration budget of a loop before you run it, so the loop has a ceiling to stop against. Know the bill before you sign it.

budget, pre-flight
How it works

One loop: capture, make, check, repeat.

verify-loop captures intent and detects the project's commands, then runs the maker and the checker on separate contexts until the verdict passes.

your task diff run + review FAIL: retry 02 · maker Write the change 03 · checker Run and review 04 · verdict Pass or fail? PASS: verified, exit
01 · setup

Capture intent

Read the task and auto-detect the project's test, lint, and build commands.

02 · maker

Write the change

The maker sub-agent implements the task and produces a diff. Nothing is trusted yet.

03 · checker

Run and review

A fresh checker runs the commands and reviews the diff against the original intent.

04 · verdict

Pass or feed back

PASS exits the loop. FAIL feeds the failure back to the maker for another pass.


The half that says no

A loop without a stop condition is a token furnace.

verify-loop is not just the half that retries. It is also the half that knows when to quit. It stops on any of these:

PASS

The checker's verdict passes. The change is verified and the loop exits cleanly.

Max iterations

A hard ceiling on retries, default 3, so it never spins forever.

No progress

The same failure twice in a row means retrying again will not help. Stop.

Budget exceeded

The loop runs against the ceiling from loop-cost and stops when the budget is spent.

Risk and ambiguity

It escalates to a human instead of forcing a destructive fix when the path is unclear.

Clean stop, every time

Whatever ends the loop, it ends on purpose. No runaway retries, no surprise bills.


Install

One line, into Claude Code.

loopsmith installs as three Claude Code skills. No build step, no config. Run it, start a new session, and the skills are ready.

terminal
# install globally, into ~/.claude/skills $ npx loopsmith # or into the current project, into ./.claude/skills $ npx loopsmith --project verify-loop, grade, loop-cost installed

Prefer the native plugin flow? Run /plugin marketplace add FahreddinHepdonduran/loopsmith, then /plugin install loopsmith. Either way, you are one command from a verified loop.