What Is Loop Engineering? The AI Coding Shift Everyone’s Talking About
In the first week of June 2026, a two-sentence post on X from Peter Steinberger, creator of OpenClaw and engineer at OpenAI, accumulated millions of views and split the developer community. The post urged engineers to stop prompting AI coding agents manually and start designing systems that prompt the agents on their behalf. Days later, Google Cloud engineer Addy Osmani published an essay giving the practice a formal name and a parts list. He called it loop engineering.
The timing was not random. Boris Cherny, head of Claude Code at Anthropic, had already told an audience at the WorkOS Acquired Unplugged event on June 2, 2026 that his daily workflow had changed at a fundamental level. He described running hundreds of agents that read his GitHub, Slack, and other signals to decide what to build next, with no manual prompting involved. Three engineers from three competing organizations reached the same conclusion within the same week, and the term entered mainstream developer vocabulary almost overnight.

What Is Loop Engineering
Loop engineering is the practice of designing automated systems that prompt AI coding agents, verify their output, and decide whether to continue or stop, all without a human entering each instruction manually. Instead of writing prompts one at a time and reading the results yourself, you write a program that handles the entire cycle.
A loop finds a task, gives the agent the relevant context, lets the agent execute, checks whether the result meets a defined standard, and either marks it complete or sends updated context for another attempt. The developer’s role shifts from being inside the process to designing the system that runs it.
Osmani framed it on O’Reilly Radar as replacing yourself as the person who prompts the agent and designing the system that does it instead. He added a less widely quoted caveat that he remains skeptical and that developers need to be careful about token costs, which can vary wildly depending on usage patterns.
From Ralph Loops to a Named Discipline
The practice predates the name by roughly a year. In July 2025, Australian developer Geoffrey Huntley published a technique he called the Ralph Wiggum loop, named after the Simpsons character known for relentless persistence despite limited awareness. The idea was a bash one-liner that wrapped Claude Code in an infinite loop, feeding the same prompt file to fresh sessions until the task was done. Each session read the codebase from disk, picked up where the last one left off, and ran until completion or failure.
The technique went viral in late 2025 after developers reported shipping entire features overnight. Anthropic noticed and formalized it. By December 2025, Cherny’s team had packaged it into an official ralph-wiggum plugin for Claude Code, and the company later shipped built-in /loop and /goal commands as supported equivalents.
Steinberger’s June 7 post crystallized the shift for a broader audience. Osmani’s essay the next day, later republished by O’Reilly Radar, provided the structure. What had been an informal hack used by power users now had a name, a parts list, and endorsements from engineers at OpenAI, Anthropic, and Google.
The Five Building Blocks
Osmani’s essay broke loop engineering into five components that both Claude Code and OpenAI’s Codex now support as shipping features.
- Automations schedule the loop to run on a cadence, turning a single run into a persistent system. Codex calls these Automations; Claude Code supports equivalent scheduling through scripting.
- Worktrees give each agent an isolated copy of the codebase, preventing parallel runs from overwriting each other’s changes.
- Skills are reusable files, often stored as CLAUDE.md or SKILL.md documents, that encode project knowledge so every future session inherits past decisions.
- Connectors integrate external tools through protocols like MCP (Model Context Protocol), linking agents to GitHub, Slack, databases, and CI systems.
- Subagents provide independent verification. One agent writes code while a separate agent reviews it, with no access to the writer’s reasoning.
A sixth element sits underneath all five. External state, typically stored as markdown files or a task board, allows progress to survive between sessions. Without persistent state, each iteration starts from scratch.


Loop Engineering vs Prompt Engineering and Context Engineering
Loop engineering does not replace the earlier layers. It sits on top of them. Prompt engineering shapes the individual instruction. Context engineering determines what information the model sees and when. Loop engineering determines what keeps running after the first call.
Each layer addresses a different failure mode. A bad output on a single call points to the prompt. A model that misses relevant information or hallucinates facts points to the context. A workflow that requires multiple iterations, verification gates, and autonomous decisions about what to do next points to the loop.
A newer concept, harness engineering, focuses on the scaffolding that contains the agent and enforces safety constraints. Some practitioners treat it as a subset of loop engineering. Others view it as a separate discipline concerned with boundaries rather than task orchestration.
The practical difference matters. A developer who improves a prompt is optimizing a single interaction. A developer who designs a loop is building a system that runs many interactions autonomously, each dependent on the outcome of the last.
Production Results and the Skeptic Response
The most cited production result comes from PostHog, the open-source analytics platform. At a team offsite in Lisbon, PostHog’s engineering team pointed an AI agent at their ClickHouse query engine, fed it slow production queries, and let it run overnight. By morning, the agent had found a bug that had existed for nearly three years, in which every query with a timestamp filter failed to use ClickHouse’s primary key correctly. The fix reduced the number of granules scanned by 62% on the benchmark query and delivered an 11% overall performance improvement, with no human intervention.
PostHog credited the technique to Andrej Karpathy’s autoresearch method, published in March 2026, which involves giving an agent a system, a benchmark, and a budget, then letting it loop through proposed changes while keeping what helps and discarding what does not.
The skeptic response has been equally grounded in data. Steinberger’s own API usage revealed $1.3 million in OpenAI token costs over 30 days, covering 603 billion tokens across 7.6 million requests generated by roughly 100 Codex instances running continuously. OpenAI covered the bill because Steinberger works there. The figure sparked a wider debate about what developers now call “tokenmaxxing,” where token throughput becomes a performance metric disconnected from shipped output.
Developer communities on Hacker News and Reddit have raised separate concerns about agent drift, in which unattended loops accumulate small errors that compound over time. Several practitioners reported reverting to human-in-the-loop workflows after finding that the verification cost of reviewing autonomous output exceeded the time saved by automating the prompting.
The gap between PostHog’s result and Steinberger’s bill points to what may be the most important and least discussed factor in loop engineering. The value of a loop depends almost entirely on the quality of its verification step. A loop with a strong exit condition, like a test suite that catches regressions, produces results like PostHog’s. A loop without one burns tokens and ships mistakes with equal confidence. The technique itself is neutral. The engineering discipline applied to the verification mechanism is what separates a useful system from an expensive one.
What Comes Next
Loop engineering arrived at a moment when AI coding agents are already reshaping how software teams operate. Whether it matures into a lasting discipline or gets absorbed into broader agent infrastructure depends on two unresolved factors.
The first is cost. Token pricing continues to fall, but loop-based workflows consume tokens at rates that can exceed standard chat usage by 4x for single agents and 15x for multi-agent setups, according to figures cited in community discussions after Steinberger’s disclosure. Teams paying their own API bills face fundamentally different economics than engineers working inside the labs that sell the tokens.
The second is tooling. Claude Code’s /goal and /loop commands, Codex’s Automations tab, and third-party orchestration layers are all early implementations. If designing a reliable loop becomes significantly easier than it is today, broad adoption will likely follow. If loops remain fragile and expensive to debug, the practice may stay confined to teams with large token budgets and high risk tolerance.
The underlying shift is already visible regardless of what happens to the vocabulary. Developers are spending less time typing prompts and more time designing systems that run autonomously. Whether the industry settles on loop engineering, agent orchestration, or another label, the workflow has moved.
FAQs
What is loop engineering in AI?
Loop engineering is the practice of building automated systems that prompt AI coding agents, verify their output, and iterate until a task meets defined criteria. The developer designs the system rather than entering each prompt manually. The term was formally introduced by Addy Osmani in June 2026.
How is loop engineering different from prompt engineering?
Prompt engineering focuses on crafting a single instruction to get a better AI response. Loop engineering focuses on designing a system that sends many prompts automatically, checks results against tests or benchmarks, and decides whether to continue or stop. Loop engineering builds on prompt engineering rather than replacing it.
Is loop engineering just a renamed cron job?
The comparison is common in developer discussions but incomplete. A cron job runs a task on a schedule. A loop in the loop engineering sense includes verification, context management, and autonomous decision-making about what the agent should do next based on its own output.
What are the risks of loop engineering?
The primary risks are token cost, agent drift, and unverified output. Unattended loops can consume large volumes of API tokens quickly. Without strong verification steps, loops can accumulate errors that compound across iterations. The quality of the exit condition determines whether a loop produces reliable results or expensive mistakes.
