The “loop” is the part everyone gets wrong.
Get it right, and the rest is engineering all the way down.
Developers hear “loop” and think of the loops they write: for, while. So they hear “loop engineering” as loop programming: an agent in a while that keeps trying.
It isn't. Loop engineering is building a feedback loop out of three parts: an implementer, an implementation, and an evaluator that measures the implementation and signals the implementer. Nobody writes the loop. It exists because of how the parts are connected, and engineering that system is loop engineering.
We know the heading is click-bait. It's also true: almost everyone starts with the wrong loop in their head, and the wrong loop builds the wrong system.
Illustrative. Connect the parts in any order and run it to see what each wiring does.
In TDD, the developer is the implementer, the code is the implementation, and the test run is the evaluator, feeding back to the implementer. Red means “keep going”. Green means “stop”. A thermostat is the same shape: the heater doesn't decide when the room is warm enough; a thermometer does.
Agentic loop engineering keeps the shape and puts an agent in the implementer's seat. Then the engineering is in the parts and the wiring:
| Part | Thermostat | TDD | Agentic |
|---|---|---|---|
| Implementer | The heater | The developer | The agent |
| Implementation | The room | The code | The code |
| Evaluator | The thermometer | The test run | The test run, and every other check |
| Target | The setting | The tests | The spec, as tests |
| Signal | Too cold / warm enough | Red / green | Red with the failures / green |
You have a test. You write code and run the test. If the test fails, you change the code and run it again. When it passes, you're done.
That's the whole loop: the developer implements, the test run evaluates, and the result feeds back. Put an agent in the implementer's seat, and the agent does the going round.
Each time round, the agent gets a clear signal: still failing, and why. It fixes, re-runs and gets closer. It climbs to correctness.
This doesn't mean you have to write the tests. It means you must have correctness conditions the agent can run to make sure its code doesn't ruin the codebase:
Putting the correctness conditions in the local loop means the agent can iterate on its own machine, fast and cheap. Once they pass, the work moves out to CI, a longer loop with further guards. After it merges, integration and acceptance testing run. Users are the last loop of all, and the telemetry they generate can feed agents directly (Point them at a number).
Say a defect slips through the local loop, CI, and integration and acceptance testing, and turns up in a user's bug report.
Of course you fix the defect. But an engineer also examines the engineering of the loops: how could we detect this class of bug as early as possible, in the tightest loop?
Could this class of defect be made impossible by changing the type system? This is the fun part. It's engineering.
Loop engineering is designing these loops so they give you confidence in the implementation.
A failing check feeds back into the same loop: change the code, run it again. Agents do this, many times a minute.
Escaped defects, slow runs and wasted resources feed back into the design of the loops. Engineers do this: better types, better checks, a better place for each check.
Pick a pile of escaped defects and I'll analyse where they got through.
Putting feedback loops in place is where loop engineering starts, not where it ends. Loops that nobody measures drift. The agents ship more, the system grows, and more defects reach users.
The agents write the code. We engineer the loops that determine the quality of the code. Obsessively, and continuously.
So measure them. For every defect, record which loop caught it: local, CI, integration, or a user. Watch how that changes over time. The share that reaches users is the defect escape rate, and it's the score. The game is to keep engineering the loops so it goes down.
You could try, but you'll hit diminishing returns. If the inner loop catches everything but is slow and expensive to run, and 20% of it catches 80% of the issues, maybe the other 80% belongs later, in exchange for velocity.
Illustrative numbers. The checks in purple still run, just later (in CI or after merge), where an escape costs more to fix.
Faster loops that use fewer resources mean more of them can run at once, and each one finishes sooner. With many agents working in parallel, that multiplies.
Teams have switched to faster-compiling languages to speed up the inner loop, and to languages with more expressive type systems to get stronger guarantees.
Test impact analysis runs the tests whose imports reach the changed file. It can only be as narrow as the import graph. A barrel file, an index that re-exports a whole folder, connects every module in that folder to every test that imports any of them.
In one project, editing a single store selected 966 of about 1,380 test files, because every test reached every store through the barrel. With each store imported from its own module, the same edit selects 64. Removing the services barrel takes an edit to one service from 944 test files to 199.
Cutting imports can change the order modules load in. The project’s first attempt failed on start; that crash became a lint rule (chapter 11, Rules that enforce themselves).
Measured with Jest --findRelatedTests in that project. One square is about ten test files.
Designing the conditions. Placing each check in the right loop. Pushing detection inward. Measuring where every defect is caught, and tuning the loops until fewer escape. Making loops faster and cheaper, down to the shape of the import graph. Trading time and resources for confidence. Agents go round the loops; engineers design them.