Loop Engineering: Why Top Engineers Stopped Prompting Their AI
guideUpdated 8 min read
Loop engineering means building the system that prompts your AI agents. Learn what works in production today, what doesn't, and when to skip it.

Last verified: 2026-06-17. Statements attributed to Peter Steinberger, Boris Cherny and Addy Osmani come from their public posts and essays as of this date. The field moves fast, so check the linked sources for their current positions.
By Frankie C. · Senior Market Researcher, Mindber. Tracks 500+ AI/SaaS tools across SEA markets via the Mindber Innovation Index methodology.
If you run the same prompt against your coding agent every few hours, paste in the latest error and check the diff yourself, you already have a loop. You are the part that keeps it going. Loop engineering is the practice of building a system to do that job for you. The system wakes the agent, hands it a goal, checks the result and decides whether to go again. It stops when the goal is met or when it needs a human.
The name took hold in June 2026. On 7 June, developer Peter Steinberger posted two sentences that drew millions of views and reopened an argument the AI-coding world thought was settled. His point: stop typing prompts into your coding agent and build the system that prompts it for you. Days earlier, Boris Cherny, who runs Claude Code at Anthropic, had said the same from the inside. He doesn't prompt the model anymore. He writes loops, and the loops do the prompting.
We read their posts and Addy Osmani's essay on the subject, and Mindber's view is narrower than most of the coverage. Build a loop only for work that repeats and ends in a check a machine can run, such as a test suite passing. For a one-off job, write the prompt yourself. For a vague goal, no loop helps until people pin the goal down. The reason is cost. A loop spends tokens on every cycle, and without a pass or fail signal it can't tell progress from motion.

The post that reopened the debate: Peter Steinberger on building the loop instead of typing the prompts. Source: Peter Steinberger on X, June 2026.
Should you build a loop?
Sort the job before you write any automation. Three boxes cover it.
Should you build a loop?
Build the loop
- Dependency bumps and codemods
- Flaky test detection and fix cycles
- Scheduled content or data pipelines
- Code review automation on PRs
- Regression testing across deploys
Just write the prompt
- Single-use analysis or investigation
- One-time migration or data move
- First-pass exploration of a codebase
- Ad hoc research with no repeat pattern
Do not hand it to a loop
- 'Come up with a better product strategy'
- Open-ended creative direction
- Decisions requiring business context a loop can't hold
- Work with no measurable success signal
If your job sits in the green box, start with its smallest version. Steinberger suggests a dependency bump, a codemod or a flaky-test fix. Each one is narrow, repeats on a schedule and ends in a CI run that is either green or red.
Then set three limits before the first unattended run:
-
Cap the token budget for each run, in code. A limit written in a config comment doesn't count. Treat the budget as the loop's credit limit: if code doesn't enforce it, it doesn't exist. To choose the number, price a typical run in our LLM cost calculator, which turns request counts and token prices into daily and monthly totals.
-
Run one narrow, verifiable task before you chain several. Complexity compounds fast. Earn trust in the simple version, then add stages.
-
Stop on repeats. If the same error, an empty diff or the same failing test comes back N times running, the loop halts and tells a person. Without that rule, a loop stuck on one error keeps paying for the same failed attempt.
Four layers, and where the loop sits
Osmani is the Google engineer whose essay on loop engineering became the reference text. He describes a loop as a recursive goal: define the purpose, then iterate until done. His essay puts Loop Engineering on top of three earlier layers, and each layer answers a different question. Steinberger, who created the open-source agent project OpenClaw and now works at OpenAI, calls the top layer's job designing "loops that prompt your agents."
The four layers of AI engineering, each built on the last
- 1
Prompt Engineering
The early stageThe question: how do I phrase one request? You control the wording of a single input. The lever is precise human expression, so the model grasps that one prompt better. - 2
Context / Workflow Engineering
The intermediate stageThe question: how do I chain steps and feed in background? You control what the agent sees and in what order. Deterministic logic chains and fuller project context help the model with a large, multi-step task. - 3
Harness Engineering
The runtime layerThe question: how do I equip one agent run? You control tools, permissions and signals the agent can verify, such as running the code and reading the error. - 4
Loop Engineering
The current frontierThe question: how do I keep the agent running and improving on its own? You control the system that triggers, assigns, verifies, persists state and decides what's next. The agent corrects itself instead of waiting for a human to check.
The layers stack rather than replace each other. A loop calls the agent many times. Every call runs inside the runtime layer, on prompts and context that someone still has to write.
Most debate about "prompting vs. engineering" treats the stack as one thing, and that sends people to the wrong fix. Suppose a team's agent keeps shipping code that fails a test nobody re-runs. Rewording the prompt won't help. The gap is at the top of the stack: nothing checks the result and sends the agent back for another pass.
The two steps most loops skip
Most people picture an agent as Goal → Plan → Execute → Output. They stop there, and that is why their "loop" runs once and quits. A real loop adds two mandatory steps after the output.
The six-step loop: what separates a loop from a one-shot run
- 1
Set a goal
Define the target with a measurable acceptance criterion. 'Improve the dashboard' fails this test. 'Cut initial load time by 30% without breaking the filter component' passes it. Without a concrete stop condition, the loop either runs forever or quits at a random point, and both count as failures. - 2
Make a plan
The agent breaks the goal into discrete, executable steps, each with an output it can verify. The plan isn't fixed. It changes when Observe and Reflect bring new information back. - 3
Execute
The agent acts: it writes code, calls APIs, edits files, runs tests and reads error messages. The runtime layer decides what it can reach. Most developer time goes into this step, but it is one of six. - 4
Output
The agent produces a result: a diff, a report or a test outcome. Most DIY loops stop here. In a real loop the output becomes the input to the next two steps. - 5
Observe
Look at the result and at the steps that produced it, beyond the final answer. A common production pattern uses a second, independent model, the checker, to review the work against the original spec. The checker's only job is to find what the maker missed. - 6
Reflect
Decide what to change: adjust the goal, update the plan and go again. The checker pushes the maker to keep iterating instead of declaring victory early. Without this step you have a pipeline, not a loop.
Observe is where the design effort goes, because a checker can only be as strict as the spec it reads. Write "make the test pass" and a maker can satisfy it by deleting the test. A better spec names the outcome and the things that must not change: the test passes, no other test changes state, and the public API stays the same.
Reflect is cheaper to build than it sounds. It can be as simple as feeding the checker's objection back to the maker as the next instruction. What matters is that the loop decides whether to go again, so no person has to read every result to keep it moving.
What a production loop needs
A loop that holds up on real work has six components. When a loop fails, one of them is usually missing.

The same six parts mapped onto a full agent OS. Tools and orchestration feed the agents, while human gates (Co-Plan / Co-Execute / Co-Comply) and memory close the loop. Mindber original diagram.
| Component | What it does | Without it |
|---|---|---|
| Automation | The heartbeat. A schedule, a webhook or a file-change event wakes the loop. | A chat session, not a loop. A human has to start every run. |
| Workspace isolation | Parallel agents get separate working copies (git worktrees, scoped permissions) so they don't overwrite each other's changes. | Agents collide mid-run and leave corrupted or rolled-back work. |
| Skills | Written-down experience: reusable prompt templates, standard verification steps and domain knowledge files. | Each run works out the same steps again, at full token cost. |
| Connectors | APIs and tools that let the agent act in the world: git, email, calendar, payments and MCP tool servers. | The agent can reason but can't act. A loop that can only write can't ship. |
| Sub-agents (maker + checker) | One agent, the maker, works fast. A second, independent agent, the checker, reviews the work against the spec. Neither has the final word alone. | There is no internal quality gate, so the loop ships whatever the first pass produces. |
| Memory | The loop writes progress, errors and lessons to a persistent store, so each run builds on the last. | Every cycle starts from zero, and the system never gets smarter. |
In our view, connectors carry most of the risk, because they turn reasoning into actions with side effects: a commit, an email, a payment. MCP tool servers, listed in the table, are one way to give an agent those actions. Our guide to MCP servers explains how hosts, clients and transports fit together, which matters once a loop holds credentials.
Components make a loop run. Guardrails make it safe to walk away. They are the difference between an autonomous system and an expensive mistake you find on the next credit card bill.
| Guardrail | What it prevents | How to implement |
|---|---|---|
| Acceptance criteria | Infinite loops, or quitting at a random point mid-task | Define 'done' in binary terms before the loop starts, and make it measurable, verifiable and automated. If you can't describe done in code, don't start the loop. |
| Permission boundaries | Agents overstepping scope: deleting files they shouldn't touch, merging without review, triggering payments | Use least privilege. Decide what the agent may change, delete, merge or pay for before it runs. You make the scope decision, and the boundary enforces it. |
| Human gate | Irreversible mistakes executed at machine speed | For sensitive or irreversible calls (money out, production merges, schema changes), the loop pauses and hands the decision to a human. For high-stakes operations this is mandatory. |
| Observability | Silent failure, untraceable errors, runaway cost | Every step must be auditable. You tune a loop by watching where it breaks, not by guessing. Logs, step traces and budget meters are required. |
One loop worked through: nightly flaky-test fixes
The parts are easier to judge on one job. What follows is a hypothetical setup assembled from the patterns above, not a system Mindber built or ran.
A team has a handful of flaky tests, and someone fixes one by hand every few days. The job repeats and CI already gives a verdict, so it belongs in the green box.
A scheduled job wakes the loop each night and hands it one flaky test. The goal is written as a check: the test passes on repeated CI runs, and no other test changes state. "Make the test stable" would fail the acceptance-criteria row in the guardrails table.
The agent works in its own git worktree. A second agent bumping dependencies the same night can't overwrite its branch.
The maker reads the failure log, looks for the timing or ordering problem and proposes a fix. The checker then reads the diff against the spec. Its main question is whether the fix removed the cause or only hid it, for example with a longer timeout or an automatic retry. A rejected fix goes back to the maker with the checker's reason. That hand-back is the Reflect step.
The token budget is capped in code. The stop rule fires if the same test fails the same way three times in a row. The loop then opens an issue for a person instead of trying a fourth fix.
The loop can open a pull request. It can't merge one. A developer reviews at merge, and any change to CI configuration or shared fixtures goes to a person before it runs.
After each night the loop appends what it learned to a notes file: which test depended on wall-clock time, which fix the checker rejected and why. The verification steps become a skill that the next run loads instead of working them out again. Every step also writes to a log with its token count, so a jump in the budget meter points to the step that spent it.
What works in production today, and what doesn't
The people closest to this work are also the most cautious about it. Osmani openly calls himself skeptical and stresses that it's early. Token costs, he notes, swing wildly depending on whether you're "token rich or token poor." An unbounded loop can quietly burn a fortune while it looks like it's making progress.
Steinberger draws a clear line between what works now and what doesn't.
Works today, proven in production:
- Several agents working on separate issues in parallel, with a human reviewing at merge
- Narrow, verifiable pipelines: dependency bumps, codemods, flaky-test fixes
- Tasks where "done" has a binary, automated signal (tests pass, the diff is clean, the endpoint returns 200)
Doesn't work yet, by his own admission:
- "Idea in, product out" with no human holding the vision
- Pre-committing to a fixed end state and fully automating the path to it, which is waterfall with extra steps
His reason for the second point is that good software still gets discovered through iteration, not declared up front. In practice that means checkpoints. Have a person approve the plan before a long run, review at merge and keep a human gate on anything irreversible. The loop does the iterating in between.
Analyst data points the same way. Gartner's Hype Cycle for Artificial Intelligence has agentic AI at the top of its curve, the peak of inflated expectations. About 17% of organisations have deployed agents in production. Source: Gartner Hype Cycle for Artificial Intelligence, 2026, Jun 17, 2026 The peak doesn't mean the technology is fake. It means the demos are well ahead of the deployments.
Roughly 83% of organisations haven't deployed agents at all. The gap between conference demos and production systems is wide. In our reading, it is closing more slowly than the hype suggests.
Which tools support loop engineering, and what it costs
Claude Code, OpenAI's Codex, Cursor and OpenClaw each build in a different amount of loop infrastructure. The loop logic sits around the agent, though, so you build much of it yourself whichever tool you pick. When you compare them, look for scheduled execution, sub-agent delegation, built-in state persistence and stop conditions or budget caps you can configure.
The Mindber Innovation Index tracks which tools in the AI coding agents category ship that infrastructure natively and which leave you to build it from scratch. The Mindber Functionality Score measures how much scaffolding each tool provides out of the box, including how it handles budget guardrails and fails gracefully. That difference matters most for small teams that can't afford to build the same plumbing twice.
Cost discipline matters more than ambition for solo builders, and more so across Southeast Asia, where "token rich" builders are rare. The Mindber Innovation Index tracks cost efficiency directly: how well each tool copes with tight resources without giving up output quality. Our report on the true cost of AI tools works through the token math behind Osmani's rich and poor split.
On a personal plan rather than the API, usage limits are the first wall a loop hits. Claude Code comes with Claude Pro and Codex with ChatGPT Plus, and our Claude Pro vs ChatGPT Plus comparison sets out how each plan meters long coding sessions.
More from Mindber: our methodology explains how the Innovation Index and Functionality Score are built, and Compare puts agent tools side by side on architecture and pricing. Manus vs Claude Cowork shows how hosted and desktop agent architectures differ in practice. Before you pay for another seat, our AI shelfware report counts how many paid AI seats sit unused.
Frequently asked questions
Is prompt engineering dead because of loop engineering?
No. Prompts still run inside every loop, and their quality still sets the quality of each cycle's output. What changed is who calls them: a scheduler and a set of rules instead of a developer at the keyboard. A loop also multiplies the cost of a weak prompt, because the same flaw repeats on every run. Our prompt engineering guide shows how to give a model examples and a format, habits that carry straight into a loop's prompt templates.
What's the difference between Harness Engineering and loop engineering?
Scope: one run versus many. Harness Engineering equips a single agent run with tools, permissions and feedback signals. Loop engineering keeps the agent going across many runs, spawning sub-agents, verifying results, persisting state and deciding what comes next. Build the runtime layer first. A loop can only observe through the signals that layer provides, so an agent that can't run its own tests gives the loop nothing to check.
How is loop engineering different from traditional automation?
Traditional automation runs fixed scripts against deterministic systems. A loop puts an AI agent in the middle, so the path adapts, natural language directs the actions and the system can handle cases its builder didn't anticipate. The loop structure (goal, act, observe, reflect, repeat) comes from classical control theory, but the agent inside it is non-deterministic and can generalise. The trade-off is a system that is more capable, harder to predict and more expensive to run. A middle option is AI workflow automation, where a fixed workflow calls a model only for the steps that need judgement.
Is loop engineering the same as agentic AI?
No. Agentic AI is the category: systems that plan, act through tools and adjust to results with limited human direction. Loop engineering is one practice inside it, the work of building the system that keeps such an agent running, checks its output and decides when to stop. A coding agent used turn by turn in a chat is agentic AI with a human acting as the loop.
How long should a loop run before you give it more work?
Weeks, not days. Let the simple version run reliably in production for a few weeks before it takes on a second kind of task. The pattern carries over to harder work, but trust has to be earned one step at a time. The logs from those weeks show where the loop breaks while mistakes are still cheap.
Is loop engineering only for coding?
Not in principle, but every case on Steinberger's works-today list is a coding job. Tests, diffs and status codes give a loop the pass or fail signal it needs. A scheduled content or data pipeline qualifies when its output can be checked the same way, such as a schema validation. Work judged by taste, like product strategy, has no such signal yet.
Sources and editorial methodology
Mindber read the public statements, published essays and analyst research cited inline, as of 17 June 2026, and labels established facts apart from speculative or early-stage claims. Mindber did not evaluate any specific loop implementation directly. The flaky-test walkthrough is a hypothetical assembled from those sources. This is editorial analysis of public information, not hands-on testing.
- [1]Peter Steinberger's public framing of loop engineering and designing systems that prompt agentsPublic post, June 2026 · 2026-06-07
- [2]Boris Cherny on writing loops instead of prompting models directlyAnthropic / Claude Code: public statements · 2026-06-07
- [3]Addy Osmani's reference essay defining the layers of loop engineering and expressing scepticism about early-stage claimsAddy Osmani: public writing · 2026-06-17
- [4]Gartner placement of agentic AI at peak of inflated expectations, and about 17% of organisations with agents deployedGartner Hype Cycle for Artificial Intelligence, 2026 · 2026-06-17
Go deeper on agent architecture
Manus vs Claude Cowork (2026): Cloud vs Desktop Agent
Architecture, pricing and compliance compared, for builders choosing between hosted and local-first AI agents.
The True Cost of AI Tools in 2026
Token pricing, hidden costs, and the token-rich vs token-poor divide that determines which loop patterns are financially viable for your team.
Learn the basics on Mindber
Background for this article, from the free Mindber learning hub.
Topic guides
AI Basics lessons
Share this article
Legal notice
This publication constitutes editorial commentary on publicly available information and does not constitute financial, legal, investment, or professional advice. Product names, trademarks, and registered trademarks referenced herein are the property of their respective owners; their appearance does not imply endorsement or affiliation. Mindber's analysis reflects editorial judgment based on public signals and is subject to change without notice. Scores are not buy, sell, or hold recommendations. No commercial relationship exists between Mindber and the vendors evaluated unless separately disclosed in writing. This publication is governed by the laws of Malaysia. Any dispute arising from or in connection with this publication shall be submitted to the exclusive jurisdiction of the courts of Malaysia.