Loop engineering is replacing yourself as the person who prompts the agent — you design the system that does it instead. A loop is a recursive goal: you define a purpose and the agent iterates until it’s complete. The leverage point moves from writing good prompts to designing the system that writes them.
Source: Loop Engineering (Addy Osmani, 2026-06-08).
The two statements the post is built on
Peter Steinberger: “You shouldn’t be prompting coding agents anymore. You should be designing loops that prompt your agents.”
Boris Cherny (head of Claude Code, Anthropic): “I don’t prompt Claude anymore. I have loops running that prompt Claude and figuring out what to do. My job is to write loops.”
For two years the workflow was: write a prompt, read the reply, type the next thing — you hold the tool the entire time, one turn after another. Loop engineering ends that. You build a small system that finds the work, hands it out, checks it, records what’s done, and decides the next thing, then let it poke the agents instead of you.
Where it sits in the stack
Osmani stacks three layers explicitly:
- Harness — the environment one agent runs inside (see Harness Engineering, Agent Harness Engineering).
- Factory model — the system that builds the software.
- Loop — the harness, but it runs on a timer, spawns helpers, and feeds itself.
The shift he flags: this is no longer a tooling problem. A year ago a loop meant a pile of bash you maintained forever (the Ralph Loop). Now the pieces ship inside the products, and Steinberger’s list maps almost exactly onto both the Codex app and Claude Code. Once you see the shape is identical, you stop arguing about which tool and design a loop that works in either.
The five pieces (plus a memory)
| # | Piece | What it does | Claude Code | Codex |
|---|---|---|---|---|
| 1 | Automations | Scheduled discovery + triage; the heartbeat | /loop, cron tasks, hooks, GitHub Actions | Automations tab → Triage inbox |
| 2 | Worktrees | Parallel agents don’t collide on files | git worktree, --worktree, isolation: worktree | built-in worktree support |
| 3 | Skills | Project knowledge written down so the agent stops guessing | SKILL.md folders | $//skills, auto-match on description |
| 4 | Plugins & connectors | Plug into your real tools (issues, DB, Slack) | MCP connectors; plugins bundle them | MCP connectors; plugins |
| 5 | Sub-agents | One has the idea, a different one checks it | .claude/agents/, agent teams | TOML in .codex/agents/ |
| 6 | Memory | State outside the conversation: what’s done, what’s next | markdown file / Linear board | markdown file / Linear board |
The memory is the load-bearing trick every long-running agent depends on: the model forgets everything between runs, so state lives on disk, not in context. “The agent forgets, the repo doesn’t.” (This is the same insight as Long-Running Agents and the durable-artifacts pattern in Long-Running Agents - Initializer + Coding Pattern.)
/loop vs /goal — the primitive that matters most
/loopre-runs a prompt or command on a cadence./goalkeeps going until a condition you wrote is actually true, and after every turn a separate small model checks whether you’re done — so the agent that wrote the code isn’t the one grading it. Give it “all tests in test/auth pass and lint is clean” and walk away. Both Codex and Claude Code have it.
/goal is the maker/checker split applied to the stop condition itself — the same separation behind dynamic workflows’ adversarial verification and Cursor’s judge role.
The decisive structural move: split maker from checker
The single most useful thing in a loop is separating the agent that writes from the agent that checks. The model that wrote the code is too generous grading its own homework (the self-preferential bias again). A second agent — different instructions, sometimes a different model — catches what the first talked itself into. The usual triple: one explores, one implements, one verifies against the spec.
Because the loop runs while you’re not watching, a verifier you actually trust is the only reason you can walk away. Sub-agents burn more tokens (each runs its own model + tools), so spend them where a second opinion is worth paying for.
What one loop looks like
A morning automation calls a triage skill that reads yesterday’s CI failures, open issues, and recent commits, and writes findings to a state file (markdown or Linear). For each finding worth doing, the thread opens an isolated worktree, sends a sub-agent to draft the fix, and a second sub-agent reviews it against the project skills and tests. Connectors open the PR and update the ticket. Anything the loop can’t handle lands in the triage inbox for you. The state file is the spine — tomorrow’s run picks up where today stopped.
You designed it once. You prompted none of the steps.
What the loop does not do for you
Three problems get sharper as the loop gets smoother, not easier. This is the part that ties loop engineering back to the vault’s whole AI-skepticism cluster:
- Verification is still on you. A loop running unattended is a loop making mistakes unattended. “Done” is a claim, not a proof. Your job is to ship code you confirmed works. (The human ceiling — Orchestration Tax.)
- Understanding rots if you let it. The faster the loop ships code you didn’t write, the bigger the gap between what exists and what you grasp — Comprehension Debt. A smooth loop grows it faster unless you read what the loop made.
- The comfortable posture is the dangerous one. When the loop runs itself, it’s tempting to stop forming an opinion — Cognitive Surrender. Designing the loop is the cure when done with judgement and the accelerant when done to avoid thinking. Same action, opposite result.
The thesis
Two people can build the exact same loop and get opposite results. One uses it to move faster on work they understand deeply; the other uses it to avoid understanding the work at all. The loop doesn’t know the difference. You do.
That’s why loop design is harder than prompt engineering, not easier — Cherny’s point isn’t that the work got easier, it’s that the leverage point moved. Build the loop. But build it like someone who intends to stay the engineer, not just the person who presses go.
Where it sits in the vault
- Claude Code Automation Stack — the mechanics of the five pieces in Claude Code (the three-tier
/loop+cron → Desktop tasks → Routines ladder, Auto Mode); Loop Engineering is the concept that names why you assemble them. - Ralph Loop — the bash-and-filesystem ancestor; loop engineering is the same idea now shipped inside the products.
- Dynamic Workflows in Claude Code — the in-session, on-demand orchestrator; a loop is the scheduled, self-feeding version that runs across sessions.
- Five Patterns for Long-Running Agents in Production — checkpoint-and-resume, ambient processing, fleet orchestration: the patterns a loop is assembled from.
- Orchestration Tax / Comprehension Debt / Cognitive Surrender — the three Osmani failure modes a loop sharpens; the reason “stay the engineer” is the whole point.
- Harness Engineering / Agent Harness Engineering — the floor below; the loop runs the harness on a timer.
See Also
- Model Context Protocol (MCP) — what connectors are built on
- Skillify - Meta-Skill Pattern — skills as the compounding intent layer
- Long-Running Agents — memory-on-disk as the cross-run substrate
- Addy Osmani