# An agent loop for Claude Code where "done" means proven Claude does the work

> Source: <https://github.com/localixai/localix-loop>
> Published: 2026-12-01 13:10:24+00:00

**Key takeaway:** localix-loop gates each Claude Code change on an external, model-free hook that keeps it only if the scorekeeper's score rises and rolls it back otherwise, so "done" is declared by the score reaching its target rather than by the model.

**An agent loop for Claude Code where "done" means proven**

  Claude does the work. The loop checks every step itself and keeps only what holds up.

[Install](#install) •
  [Docs](https://loop.localix.ai/docs) •
  [Website](https://loop.localix.ai) •
  [Quality bench](https://github.com/localixai/localix-loop/blob/main/bench/README.md) •
  [Changelog](https://github.com/localixai/localix-loop/blob/main/CHANGELOG.md)

**"Done" is a claim until something checks it.** An agent that says it is done may be right. Often
you find out later: you try the result, something is off, you explain it, you wait for the fix,
you check the fix broke nothing else. That round trip is the expensive part. localix-loop spends
its effort before the "done" instead: every step is checked against tests Claude can't change.

**① The loop runs the checks, not Claude.** After every change, a hook with no model in it runs
your scorekeeper (a test suite, a build, a benchmark), keeps the change only if the score went up
and rolls back the rest. The loop ends when the score reaches the target, not when Claude says so.

**② The tests aren't the agent's to write or bend.** In a project with no tests, a separate
`examiner` subagent writes them from your goal or spec before any code exists. Claude can't edit
them, and hidden checks it never sees catch code fitted to the visible ones.

**③ What worked keeps working.** Your next goal in the same project, a feature or a bug you found,
extends the tests instead of replacing them, so a new change can't quietly break an old one.

```
claude plugin marketplace add localixai/localix-loop
claude plugin install localix-loop@localix-loop
```

Restart Claude Code, then in a git repository (an empty folder needs only `git init`):

```
/localix-loop:start make the login test suite pass
```

Claude finds a scorekeeper or has the examiner write one, shows you the baseline, and starts once
you agree. When it ends, `git diff` shows the whole change and `REPORT.md` what was checked; you
commit it yourself. It needs Node.js 20 or newer.

The [quality bench](https://github.com/localixai/localix-loop/blob/main/bench/README.md) doesn't time runs or count tokens. It builds one project from
an empty folder and changes it five times, the way a person works with an agent. After every round
its own acceptance test, which no approach sees, checks every feature so far, and what fails is
told back to the agent as a person would. Sonnet 5.5, one chain each:

| Approach | Right the first time | Rounds of corrections | Regressions | "Done" that wasn't | 
|---|---|---|---|---|
| one plain prompt | 6 of 6 | 0 | 0 | 0 | 
| Claude Code's `/goal` | 5 of 6 | 1 | 0 | 0 | 
| localix-loop | 5 of 6 | 1 | 0 | 0 | 
| the `ralph-loop` plugin | 3 of 6 (3 never accepted) | 6 | 0 | 9 | 

On this project the model was right on its own: one plain prompt passed every step the first time.
localix-loop matched `/goal` and never said done while the acceptance failed. Its weak point is its
examiner's tests: in each of three runs, a wrong test (a date in the wrong time zone, a page test
that raced the page) made a loop stop with a right app instead of saying done. A wrong test stops a
loop; it never passes bad work. So on a well-specified project of this size the loop adds checking,
not correctness, and it takes far longer. Building the bench found over a dozen defects in
localix-loop itself, from hidden checks that never ran to a judge that failed in a project that
ignores `.claude/`; each is fixed and in the [changelog](https://github.com/localixai/localix-loop/blob/main/CHANGELOG.md).

One chain shows what one model got wrong on one project. To see what the loop does with each kind
of mistake, `npm run sim` runs the same seeded agent, making the same mistakes in the same order,
with the real judge and without it. There is no model in it, and the same seeds give the same
numbers. Accepted / "done" that wasn't, 40 runs each:

| The agent | Without a loop | With localix-loop | 
|---|---|---|
| never wrong | 100% / 0% | 100% / 0% | 
| wrong a third of the time, runs its tests | 100% / 0% | 100% / 0% | 
| breaks what worked, runs its tests half the time | 68% / 33% | 100% / 0% | 
| fits the visible test | 10% / 90% | 80% / 0% | 
| edits a test it keeps failing | 53% / 48% | 98% / 0% | 
| says done while it sees failures | 5% / 95% | 100% / 0% | 
| all of these, milder | 10% / 90% | 73% / 0% | 

Where the agent's own tests would catch the mistake, the loop changes nothing. Where they
wouldn't, runs without it said done with defects left; with it, no run did. Each one either passed
or stopped saying the goal was not reached, at the cost of up to four more turns. The rates are
assumptions, one kind of mistake at a time, not measurements of a model:
[the method and the full table](https://github.com/localixai/localix-loop/blob/main/bench/README.md#the-simulation).

| Command | What it does | 
|---|---|
| `/localix-loop:start [goal]` | Sets up the goal, the scorekeeper, the protected paths and a budget, then starts | 
| `/localix-loop:status` | The goal, the score, iterations kept and rolled back | 
| `/localix-loop:stop` | Stops; the working tree keeps the best version | 
| `/localix-loop:resume [answer] [--more N]` | Goes on after a pause or a stop | 
| `/localix-loop` | Opens the panel | 

It never commits: kept versions are git snapshots under `refs/localix-loop/`, so signing and
pre-commit hooks never stop an unattended run.

**[loop.localix.ai/docs](https://loop.localix.ai/docs)** has the rest:
[the definition file](https://loop.localix.ai/docs/definition) and every field,
[how it works](https://loop.localix.ai/docs/how-it-works) (the judge, the guard, hidden checks, the brief, the
subagents, long runs), [the commands](https://loop.localix.ai/docs/commands), [quality](https://loop.localix.ai/docs/quality) and
[the limits](https://loop.localix.ai/docs/limits). To work on localix-loop itself, see [AGENTS.md](https://github.com/localixai/localix-loop/blob/main/AGENTS.md).

localix-loop is free and made by a small lab without investors. If it saves you time, you can [buy us a coffee](https://buymeacoffee.com/localix).

MIT
