✓ Human-authored analysis; AI used for formatting and proofreading.
In June 2026, a tweet got 6.5 million views:
"You shouldn't be prompting coding agents anymore. You should be designing loops that prompt your agents."
Within a week, "loop engineering" had its own guides, its own conference talks, its own comparison tables, and its own thought leaders. A while statement with an LLM inside it became an engineering discipline.
A senior engineer said: instead of typing prompts one at a time, write a program that types prompts for you. That's a for-loop. The program runs the model, checks the output, and runs the model again if the output isn't good enough. That's a while-loop with a conditional break.
while not done:
output = model.generate(prompt)
if passes_check(output):
done = True
This is not a paradigm shift. This is a control flow mechanism that every first-year computer science student learns in week three. Calling it "engineering" is like civil engineers calling their use of hammers "hammer engineering". Elevating a tool to a discipline, confusing the mechanism with the architecture.
The loop is not the interesting part. What's inside the loop is the interesting part. And what's inside most loops in June 2026 is the same incomplete architecture the entire industry is building just running faster.
What the loop does
A "loop" in the loop engineering sense is:
- Prompt an agent with a task
- Agent generates code
- Run tests or have another model review the output
- If tests fail or review rejects → go to 1 with error context
- If tests pass → stop
That's generate → check → retry. The mechanism is a loop. The architecture is whatever is inside steps 2, 3, and 4. The loop itself contributes nothing architectural. It's the shell. The question is: what are you generating toward? What are you checking against? What happens when a failure class recurs?
The loop engineering conversation doesn't answer these questions. It answers: how often should the loop run? How many retries before stopping? Should you use cron or event triggers? How do you manage token budgets across iterations? These are operational questions about the shell. They're not architectural questions about what's inside it.
What's right — credit where it's due
"The verifier is the bottleneck, not the model." One guide states this directly and it's the most architecturally significant sentence in the entire loop engineering conversation. If the model generates faster than anyone can verify, the constraint is verification. That's the Non-Uniform Evolution diagnosis: the Tool (model) raced ahead, the Control Unit (verifier) didn't. If the loop engineering community followed this insight to its conclusion, they'd arrive at the independent verification gate. A deterministic checker, not another model forming an opinion.
"The writer and the checker should not be the same model." Independence. The Control Unit must be separate from the generator. They state it as a practical tip. The completeness law states it as an architectural requirement. Same insight, different weight.
Deterministic vs non-deterministic loops. The distinction between "tests pass / code compiles" (deterministic) and "reviewer agent grades output" (model opinion) is the right split. Deterministic loops are safe to leave unattended. Non-deterministic loops require human oversight. This is the hierarchy: use deterministic checks for questions with binary answers, use model judgment only for genuinely uncertain questions. The loop engineering guides almost name this principle. They don't elevate it to the primary design decision.
VISION.md as persistent intent. "A project-level file that states what you are building and why, so each loop tick does not re-derive intent from scratch." That's a proto-specification. Declared intent that persists across iterations. The right instinct, pointed in the right direction.
What's wrong, the same two elements, the same gap
1. VISION.md is a prompt, not a specification. "What you are building and why" is prose a model interprets. It guides generation — the model reads it and infers what to do. It doesn't gate output, nothing mechanically checks whether the output satisfies declared properties. A specification says: "the API must return valid JSON for every endpoint, no endpoint may accept unauthenticated requests, no response may contain PII." These are checkable. VISION.md says: "we're building a recipe assistant that helps users find meals." That's a direction. Not a verification target.
The loop generates toward whatever the model infers from VISION.md. If the model infers wrong, if it misunderstands the intent, if it focuses on the wrong aspect, if it produces output that satisfies the prose description but violates an unstated constraint. The loop runs toward the wrong target. And it runs toward the wrong target efficiently, with retries, at token cost, until MAX_ITER stops it.
2. The loop has no Engine. Nobody declared what properties the output must satisfy, independent of the tests and independent of the model's interpretation. The tests check what the developer happened to write tests for. The model checks what the model happens to think is good. Neither is a declared specification of what "correct" means.
A loop without a specification is a brute-force search. Generate broadly, check against whatever tests exist, retry on failure. A loop with a specification is a targeted search, generate toward declared properties, check mechanically, retry with a deterministic signal about what failed and why. The first burns tokens searching. The second spends tokens arriving. The cost difference is the Uber receipt: annual AI budget burned in four months.
3. The loop has no ratchet. When the loop encounters a failure class. The model generates code with a SQL injection, or produces an API response with PII, or writes a function that violates the project's architectural boundaries, the loop retries. Maybe it retries with error context. Maybe it retries with a different prompt. But the failure class isn't converted into a permanent rule that prevents recurrence.
Next loop run, the same failure class can recur. And the run after that. And the run after that. Each recurrence costs tokens, costs retries, costs time. A ratchet would convert the failure class into a declared property such as "no SQL concatenation," "no PII in API responses," "no imports across module boundaries" checked deterministically on every subsequent run. The class becomes impossible. The loop never encounters it again.
Without the ratchet, the loop runs forever at the same failure rate. With the ratchet, each cycle permanently reduces the next cycle's failure rate. The loop gets cheaper, faster, and more reliable every week, because the specification grew.
4. Skills are workarounds for the missing specification. "If you do something hard, turn it into a skill afterward so next time is free." A skill says "next time you encounter this task, here's how to do it well." A declared invariant says "the output must satisfy this property every time." The skill encodes expertise as a prompt. The invariant encodes a requirement as a machine-checkable rule. One guides the model's behavior. The other gates the model's output.
A loop with skills but no specification generates skillfully toward no declared target. A loop with a specification but no skills generates toward a declared target without shortcuts. The first is efficient waste. The second is inefficient correctness. Correctness wins and once the specification exists, skills become optimizations within a correct system rather than substitutes for the correctness the system doesn't have.
5. The cost crisis proves the specification is missing. "Uber capped engineers at $1,500 per person per tool per month after burning its annual AI budget in four months." The loop burns tokens because the agent generates without a specification targeting generation. Each tick generates broadly, checks against tests, and retries. The loop is a brute-force search wrapped in a cron job. Adding more ticks, more retries, more skills doesn't fix the economics. It runs the same untargeted generation faster.
A specification doesn't just verify output. It constrains generation. When the model knows the output must satisfy specific properties, it generates less because it generates toward a target instead of exploring the full space of possible outputs. Less generated means fewer tokens burned. Fewer tokens means the budget lasts the year instead of running out in Q1.
What civil engineers do
Civil engineers don't practice "hammer engineering." They don't brand the use of a concrete mixer as a discipline. They don't write guides about "rebar loops" or "crane engineering."
What civil engineers do:
- Declare what the structure must satisfy such as load capacity, seismic rating, fire resistance, material specifications. These are the specifications. They exist before construction starts.
- Build according to the specifications, using hammers, cranes, concrete, rebar. These are the tools. They serve the specification.
- Verify that the built structure satisfies the specifications such as load tests, inspections, material certifications. These are the verification gates. They're independent of the builder.
- Enforce that each failure discovered becomes a code update, building codes grow after every structural failure. That's the ratchet. The same failure class is permanently prevented.
The hammer is inside the loop. Nobody calls it hammer engineering. The engineering is in the specification, the verification, and the ratchet not in the tool or the loop that swings it.
A loop with a specification, a verification gate, and a ratchet is a viable system. A loop without them is a while statement with a language model inside it, running on cron, burning tokens, producing output nobody has declared is correct.
The term reveals the gap
"Loop engineering" exists as a term because the loop is the most visible new thing practitioners are building. The specification isn't visible because nobody builds it. The verification gate isn't visible because it's confused with "running tests." The ratchet isn't visible because nobody converts failures into permanent rules.
When the most visible thing is the control flow mechanism rather than the specification it should be serving, the naming tells you what's missing. Nobody calls traditional software development "for-loop engineering" — because the interesting parts (requirements, architecture, testing, deployment) are the engineering. The for-loop is just the mechanism.
The day "loop engineering" gets renamed to something that describes what the loop checks against such as what properties the output must satisfy, how violations are caught, and how each failure becomes permanent is the day the discipline matures from a control flow mechanism into an architecture.
Until then, it's a while statement.
The five-element framework: Altshuller's Law of System Completeness (TRIZ). Applied to AI-assisted development: every viable system needs a Tool (the model), an Engine (declared specification), a Transmission (delivery with middleware), a Control Unit (independent verification), and a Casing (enforced boundaries). Loop engineering provides the Transmission (delivery mechanism) and partial Casing (MAX_ITER, token budgets). The Engine (specification), Control Unit (independent verification gate), and ratchet (each failure becomes a permanent rule) are absent. See also Review is the Symptom. Specification is the Fix.
Top comments (0)