Loops
A loop connects a sensor to the work: when the sensor is read, what counts as a failure, and what happens next.
Contents 30
- 1 A bug starts with a failing test
The agent turns a bug into a test that fails for the bug's reason, changes the code until it passes, and runs the whole suite.
- 2 A clean environment for each task
Each task gets a new environment of its own, which checks its own isolation before the agent starts and is thrown away at the end, so the sensors give the same result for the same code.
- 3 A correction becomes a rule
Every correction a person makes is logged at the phase that should have caught it, and the second of the same kind becomes a check, a reviewer's rule or a line in the agent's instructions.
- 4 A preview environment for each change
Every pull request is deployed to an environment of its own, at its own address, so the checks that need a running app test that change alone, before it is merged.
- 5 Architecture rules
Rules for the direction of imports between layers fail as soon as the agent adds an import that breaks them, and each message describes the layers, so the agent moves the code where it belongs.
- 6 Ask before the irreversible
Before an action that cannot be undone, the agent stops, and a person confirms or refuses it.
- 7 Confirm the release in production
After a release reaches production, a job judges a window of real traffic, and the change is confirmed only if production runs it, its own signal appeared often enough, and nothing is worse than under the previous version.
- 8 Evals on every prompt change
After each change to a prompt, a tool description or the model, the agent runs the feature on a suite of cases several times, and a drop in the pass rate fails the change.
- 9 Fix CI until it is green
The agent pushes, CI runs the checks on clean machines, and the agent fixes what fails until every required job passes for its latest commit.
- 10 Fix the errors users hit
The agent takes an issue from the top of the error tracker, reproduces it with a test that fails and fixes it, and the fix counts only once the issue's events stop under the release that carries it.
- 11 Fresh-context code review
Reviewer agents with a fresh context read the committed diff, and the coding agent fixes the confirmed findings for at most five rounds, each re-review checking only the open ones.
- 12 Keep the API compatible
When the agent changes a schema, a library's public types or data that released clients read, a check compares the change with what callers already have, and the agent restores compatibility.
- 13 Lint with fix instructions
Every lint violation reaches the agent with a text that says how to fix it, so it fixes the cause instead of silencing the rule.
- 14 Load test a preview
The agent runs a load scenario against the preview environment of its change, and when the response time or the error rate goes over its threshold, it finds the bottleneck in the traces and fixes it.
- 15 No known-vulnerable dependencies
A scanner checks the project's dependencies against vulnerability databases, and the agent moves each vulnerable package to a safe version before the change is merged.
- 16 Read the logs
After running a scenario, the agent queries the structured logs of its own run for errors, fixes the cause and runs the scenario again until the query comes back empty.
- 17 Read the traces
After running a scenario, the agent queries the traces of its own run for spans that failed or went over budget, and fixes the cause until the same queries return nothing.
- 18 Read third-party extensions before they run
On each pull request that adds or moves the pin of a third-party plugin, skill or MCP server, a reviewer reads every file it ships against a written policy, and a fail keeps the pin out; verdicts are cached per commit and policy.
- 19 Red, then green
A change in behaviour starts with a test that fails for the right reason, and ends when that test and the rest of the suite pass.
- 20 Repository health
Every day a job records the project's delivery metrics, an agent turns the worst trend into one proposed change, and a critic must approve it before it becomes a draft pull request a person reviews.
- 21 Run the tests first
Before changing anything, the agent runs the whole suite and keeps the result, so it never takes an old failure for its own regression.
- 22 Show the result
Once the automated checks pass, the agent shows a person the working feature, with screenshots, a recording or the real output of a command, and the person judges the behaviour, not the code.
- 23 Smoke test after a deploy
After each deploy to a preview environment or to staging, a job checks that the new version is ready and runs a few smoke checks against it, and a red result stops the release there.
- 24 Stall detector
A hook that watches every tool call tells the agent to step back when it repeats the same call or cycle five times, stops it for a person on a second stall, and keeps a subagent from starting agents of its own.
- 25 Triage what comes in
Each incoming error, alert, bot's pull request, user's message or ticket is merged with an open item on the same problem, or sorted as a fix, a new feature, maintenance or a question for a person, and a person decides what the judge cannot.
- 26 Try it by hand
The agent runs what it just wrote the way a user of that code would, and turns each defect it finds into a test that fails before the fix and passes after it.
- 27 Type check and build
After an edit, the agent runs the type checker and the build, and fixes each error at its file and line until both are clean.
- 28 Validate the configuration
A validator checks every configuration file and profile against its schema, a probe checks that each endpoint it names answers, and a smoke start runs the app with each profile.
- 29 Walk the feature in a browser
The agent starts the app and walks the feature through a real browser as a user would, which shows a feature broken end to end even when the unit tests pass.
- 30 When a dependency fails
A test makes a dependency slow, time out or go down through a fault proxy, and the agent fixes retries, timeouts and error handling until the code copes.