Loop Engineering
Loop Engineering
Loop Engineering is a new concept that rapidly spread in the AI programming community in June 2026, systematically organized by Google engineer Addy Osmani, and the same viewpoint was put forward publicly by Boris Cherny, head of Anthropic Claude Code, and developer Peter Steinberger.
This article will take you from scratch to understand what Loop Engineering is, the essential difference between it and Prompt Engineering, the six key elements that constitute a complete Agent Loop, and how to design your first runnable Loop.
Evolution of AI Engineering
Over the past two years, the focus of AI development has been constantly changing: from researching how to write good prompts (Prompt), gradually developing to organizing context (Context), orchestrating tools and workflows (Harness), and finally to building loop systems that can run autonomously and continuously deliver results (Loop).
Original prompt (Chinese, left untranslated)
Prompt:怎么问 AI
↓
Context:给 AI 什么信息
↓
Harness:如何组织 AI 的能力
↓
Loop:如何让 AI 持续创造结果

| Engineering Stages | Core Idea | Focus points | Input content | AI capabilities | Human role | Typical scenarios |
|---|---|---|---|---|---|---|
| Prompt Engineering | Obtaining better output through prompt design | How to ask questions | Prompt / Instruction | Single-turn generation | Proposer | Chat, writing, code generation |
| Context Engineering | Organize and provide complete background information | What information to give the AI | Knowledge base, history, constraints, context | Context Understanding | Information Organizer | RAG, AI Search, Code Assistant |
| Harness Engineering | Forming workflows by connecting models, tools, and data | How to invoke capabilities | Context + API + Toolchain | Executing tasks | System Designer | Agent, automated workflows, multi-tool collaboration |
| Loop Engineering | Building goal-driven autonomous closed-loop systems | How to continuously achieve goals | Goals, states, memory, verification mechanisms | Planning → Execution → Verification → Repair → Continuous Operation | Rule Maker | Claude Code, AI programming, automated operations, AI employees |
The origin of Loop Engineering
There was a clear timeline for the emergence of Loop Engineering: June 2026.
The trigger: two sentences, millions of shares
In early June 2026, the head of Anthropic Claude CodeBoris Chernysaid in a public speech:
"I don't prompt Claude anymore. I have loops running. They're the ones prompting Claude and figuring out what to do. My job is to write loops."
(I no longer prompt Claude directly. I have a set of Loops running that are responsible for prompting Claude and deciding what to do next. My job is to write the Loops.)
A few days later, on June 7, 2026, developerPeter Steinberger—creator of the open-source AI Agent project OpenClaw (the fastest new repository to gain stars in GitHub history)—posted a twelve-character tweet:
"You shouldn't be prompting coding agents anymore. You should be designing loops that prompt your agents."
(You shouldn't manually prompt AI coding assistants anymore. You should design Loops that prompt the Agent itself.)
- Prompt Engineeringis "teaching AI how to do things"
- Loop EngineeringIt is "designing a system that allows AI to continuously operate on its own."

These two sentences sparked huge discussions in the AI developer community because they precisely describe a trend that many have felt but have not yet named:The quality of the prompt is no longer the bottleneck; the bottleneck is the entire operational system you design for the Agent..
Subsequently, Addy Osmani published a long article on Substack, formally naming and systematizing this practice as Loop Engineering, making it an independent engineering discipline.
Background: The Three Generations of Evolution in AI Programming Tools
Loop Engineering did not come out of nowhere; it is a natural result of the evolution of AI programming tool capabilities.
| Stage | Representative tool | Working mode | Bottleneck |
|---|---|---|---|
| First generation: Autocompletion | Early versions of GitHub Copilot | Completes the current line or function, humans control all decisions | Can only assist, cannot act autonomously |
| Second Generation: Conversational | ChatGPT, Claude.ai | Asking one question and receiving one answer, with humans manually advancing each step | Humans become the bottleneck, speed is limited by typing speed |
| Third Generation: Agent Autonomous Loop | Claude Code, OpenAI Codex Agent | Agents autonomously plan, execute, and verify, looping until completion | How to design a system for reliable Loop operation |
The emergence of third-generation tools means that engineers' core competency is shifting from knowing how to write prompts to knowing how to design Loops.
What is Loop Engineering?
Loop Engineering is the engineering practice of designing, operating, and continuously improving feedback loops that enable AI programming Agents to autonomously plan, execute code modifications, observe results, and complete tasks through multiple iterations.
To summarize in one sentence:
Loop Engineering is the process of transforming you from a "prompting Agent" to an engineer who "designs the system for the Agent."
What is a Loop?
A Loop is a recursive goal system: you define an objective, and the Agent continuously iterates until the work is truly complete.
Every Agent has an "inner loop" built in when executing a task: Perceive $\rightarrow$ Reason $\rightarrow$ Act $\rightarrow$ Observe, and then loop again.
Loop Engineering works on this inner loopThe upper layer:
| Hierarchy | Who is driving | What is being done |
|---|---|---|
| Inner loop (Agent built-in) | The Agent itself | Read file → Modify code → Run test → Read error → Modify again |
| Outer loop (you design) | The system you design | Discover task according to plan → Dispatch Agent → Verify results → Record status → Start next round |
You are no longer sitting next to the Agent, issuing a command for every step. You are designing an external system that drives the inner loop for you, allowing you to focus on tasks with more judgment value.
The difference between Loop Engineering and Prompt Engineering
| Dimension | Prompt Engineering | Loop Engineering |
|---|---|---|
| Optimization target | A single instruction you manually write | A complete system that automatically decides "what to prompt, when to prompt, and whether the result is acceptable" |
| Unit of work | A turn of dialogue you manually input | A complete workflow that runs automatically across multiple turns |
| Successful measurement | Quality of the first response | Quality of the final output result |
| Failure mode | The model gave a poor answer | Poor system Loop design: loop stops too early, ignores error signals, cannot verify completion |
| Perspective of the Agent | Tools you hold | Long-running processes you schedule |

Prompt Engineering has not died out. A Loop is composed of multiple Prompts, and putting poorly written Prompts into a Loop will only produce bad work faster. Loop Engineering is a layer above Prompt Engineering, not a replacement for it.
The complete technology stack of three layers:
| Layer | What is optimized | Unit of work |
|---|---|---|
| Prompt Engineering | How to phrase an instruction | A conversation you manually input |
| Context Engineering | What content to put into the context window: documents, history, tool definitions | Environmental conditions around a single response |
| Loop Engineering | A self-running system that decides what to prompt, when to prompt, and whether the result is acceptable | An automated workflow spanning multiple inner loops |
The core loop of a Loop
The basic structure of an Agent Loop consists of five interconnected stages that iterate continuously.
| Stage | English Name | What it does | Typical signal sources |
|---|---|---|---|
| Intent | Intent | Define target outcome: what success looks like, what the constraints are | Developer or external system (Issue, CI report) |
| Context | Context | Collect relevant code, documentation, error logs, and conventions | Code repositories, test outputs, and historical conversations |
| Action | Action | Edit files, run commands, call tools, draft proposals | Agent autonomous execution |
| Observe | Observation | Obtain test results, compilation errors, runtime output, code Diff | Test framework, type checking, CI, manual review |
| Adjust | Adjustment | Update the plan based on observations, repeat the loop until the task is completed or blocked | Next iteration loop |
The power of a Loop is not in any single step, but inthe closed loop. A failed test is not just an error message; it is new context; a type error is not just a blocker; it is a signal about a faulty assumption; a Code Review comment is not just feedback; it is a new observation driving the next action.
Six constituent elements
A Loop that can truly run independently requires five core components, plus a memory system that runs throughout, all of which are essential.
Element one: Automations
Automations are the heartbeat of the Loop. Without automation, the Loop is just "an operation you performed," not a true cycle.
The trigger defines:When? What?
In Claude Code, use/loopthe command to create a scheduled Loop:
Instance
Runs every weekday at 9 AM: reads CI failures and Issues from the previous day,
writes findings to TODO.md, and drafts fixes for issues marked as quick-win
/
loop
Read yesterday's CI failures and open issues, write findings
to TODO.md, and draft fixes for anything labeled quick-win
\
--schedule
"0 9 * * 1-5"
/goal: Run until a verifiable condition is met
The following command will run continuously until all tests in the authentication module pass and lint is clean
/
goal
"All tests in test/auth pass and lint is clean"
In OpenAI Codex, Automations has a dedicated UI panel where you can set up projects, Prompts, cadence, and whether to run locally or in a background Worktree. Content found will enter the Triage inbox, and content not found will be automatically archived.
Token cost warning:Scheduled Loops with a validating Agent consume Tokens each time they trigger, and the consumption varies significantly depending on task complexity. It is recommended to start with a slower cadence (e.g., once a day), observe the costs for a few days, and then increase the frequency.
Element two: Parallel Isolation (Worktrees)
When you run multiple Agents simultaneously, file conflicts are the easiest place to run into problems. If two Agents write to the same file at the same time, it's like two engineers committing to the same line of code simultaneously, which is disastrous.
Git Worktree is the solution: provide an independent working directory for each Agent, operating on separate branches, sharing the same Git history, but with completely isolated file changes.
Example
Manually create worktree (Claude Code and Codex both support automatic management)
git
worktree add ..
/
agent-fix-auth feature
/
fix-auth-tests
git
worktree add ..
/
agent-upgrade-deps feature
/
upgrade-axios
Configure worktree isolation for sub-Agents in Claude Code
Add the following to the frontmatter of .claude/agents/reviewer.md:
isolation: worktree → Each Agent gets an independent checkout, which is automatically cleaned up upon completion.
Worktree eliminates mechanical file conflicts, but it cannot eliminatereview bottlenecks.The speed at which you handle and approve code changes is the real limit to how many Agents you can run in parallel, not how many Worktrees the tool can open.
Element three: Skill files (Skills)
Skills solve a recurring cost:Every new conversation, the Agent has to infer your project specifications from scratch..
Skill is a folder containingSKILL.mdfiles that specify project conventions, build steps, and knowledge such as "we don't do this because of that accident." The Agent loads the Skill at the start of each session instead of guessing every time.