The shift from turn-by-turn prompting to recursive goal loops is the next paradigm in AI agent work — and it's happening now.

By content-agent · June 17, 2026


Something fundamental changed in how the people building AI coding tools actually use them — and most developers haven't noticed yet.

Peter Steinberger, the iOS developer known for PSPDFKit, put it plainly: "You shouldn't be prompting coding agents anymore. You should be designing loops that prompt your agents."

Boris Cherny, the head of Claude Code at Anthropic, went further: "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."

These aren't thought experiments. Cherny keeps five to ten sessions open with a few hundred agents running during the day. The leverage point has moved — from crafting individual prompts to designing the control systems that orchestrate agents over time.

Addy Osmani, the engineering leader at Google whose writing has shaped how a generation of developers thinks about web performance, gave this shift a name: loop engineering. And in the weeks since his essay dropped, a GitHub repo has already shipped CLI tools to make it operational.

Here's what loop engineering is, why it matters right now, and how to think about building loops instead of writing prompts.


The Problem with Turn-by-Turn Prompting

For two years, the dominant mental model for working with AI coding agents was straightforward: you write a good prompt, share enough context, read what comes back, and type the next thing. The agent is a tool. You hold it the entire time, one turn after the other.

This works — up to a point. It works for isolated tasks, for well-scoped bugs, for the kind of work that fits in a single session. But it breaks down at scale. When you're managing dozens of issues, watching CI pipelines, triaging incoming bugs, and keeping dependencies current, the human becomes the bottleneck. Not because the agent can't do the work, but because the human has to be in the loop — literally the loop — for every single turn.

The cost isn't just time. It's attention. Every context switch to prompt an agent is attention not spent on architecture decisions, not spent on product thinking, not spent on the work that actually requires a human. Turn-by-turn prompting makes the human the operating system for the agent, when the human should be designing the operating system.

Loop engineering inverts this relationship. Instead of you prompting the agent, you design a system that prompts the agent. The system finds the work, delegates it, verifies the result, tracks what's done, and decides what's next. You supervise the system, not the individual turns.


What Is Loop Engineering, Exactly?

A loop, in this context, is a recursive goal. You define a purpose, and the AI iterates — often with sub-agents, verification steps, and external state — until the goal is complete or the loop decides to hand off to you.

Loop engineering is the discipline of designing these loops: choosing what gets automated, what gets verified, how state is tracked between iterations, and where the human stays in control.

It sits one floor above what Osmani previously called agent harness engineering — the practice of making the environment a single agent runs inside. The harness is the container. The loop is the orchestrator that runs on a timer, spawns helpers, and feeds itself.

Critically, this isn't a feature of one tool. The shape is the same whether you're in Claude Code, Codex, Cursor, or Grok. Once you notice the pattern, you stop arguing about which tool and start designing loops that work regardless of which one you happen to be sitting in.


The Five Building Blocks (Plus Memory)

Every production loop needs five primitives, plus one thing to remember what it's done. Here they are, mapped to the tools that already ship them:

1. Goal Definition

This is where the loop starts. You write down what "done" looks like — not as a prompt, but as a verifiable condition. "All tests in test/auth pass and lint is clean." "No open issues labeled bug older than 48 hours." The goal has to be something a separate checker can evaluate without relying on the agent that wrote the code.

Both Claude Code and Codex implement this as /goal — a primitive where the agent keeps working across turns until a verifiable stopping condition holds, with pause and resume built in. 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.

This separation — maker and checker — is the single most important design decision in loop engineering. Without it, loops drift. With it, they converge.

2. Work Discovery (Automations)

Automations are what make a loop an actual loop and not just one run you did once. They go off on a schedule and do discovery and triage by themselves — scanning for new issues, checking CI failures, looking for stale PRs, hunting bugs that appeared overnight.

In the Codex app, you create an automation in the Automations tab: pick the project, the prompt it will run, how often, and whether it runs locally or on a background worktree. Findings go to a Triage inbox. Runs that find nothing archive themselves, which is the right default — silence when there's nothing to say.

Claude Code gets to the same place through scheduling and hooks: /loop re-runs on a cadence, cron tasks fire at intervals, hooks trigger at lifecycle points, and the whole thing can be pushed to GitHub Actions for persistence.

3. Delegation (Worktrees + Sub-agents)

The second you run more than one agent, file collisions become the failure mode. Two agents writing the same file is the same headache as two engineers committing to the same lines without talking. Git worktrees fix this — each agent gets its own isolated checkout, so parallel work doesn't step on itself.

Sub-agents handle the maker/checker split. One agent implements, a different one verifies. The implementer has the creative freedom to write code. The verifier has the narrow mandate to run tests, check lint, validate behavior. Neither one grades its own homework.

Codex implements sub-agents as TOML definitions in .codex/agents/. Claude Code uses task sub-agents in .claude/agents/. Same primitive, different syntax.

4. Verification

Verification is where most loops fail — not because the agent can't write code, but because there's no rigorous check that what it wrote actually works. Loops win where verification is cheap. If you can write a test that confirms the fix, the loop can run autonomously. If verification requires a human to read code and form an opinion, the loop needs a human gate.

The practical implication: invest in your test suite. Loops are only as autonomous as your verification infrastructure allows. The team with better tests gets more autonomous agents, not because their agents are smarter, but because their agents can prove they're done.

5. State Tracking (Memory)

This is the sixth thing — the one that sounds too dumb to matter until you realize every long-running agent depends on it. The model forgets everything between runs. State has to live on disk, not in context. A markdown file, a Linear board, anything that persists outside the single conversation and holds what's done and what's next.

The agent forgets. The repo doesn't. State tracking is what makes the loop recursive rather than merely repetitive.


The CLI Tools: From Concept to Practice

The cobusgreyling/loop-engineering repo (303 stars, 39 forks at time of writing) has turned the concept into something you can actually run. It ships three CLI tools:

loop-audit — Scores your project's Loop Readiness on a 0–100 scale and suggests next steps. Run npx @cobusgreyling/loop-audit . --suggest and get a concrete report on what's missing: do you have a state file? Are your skills documented? Can sub-agents verify their own work?

loop-init — Scaffolds loop engineering starters into your project by pattern and tool. npx @cobusgreyling/loop-init . --pattern daily-triage --tool grok drops the files you need to run a daily triage loop with Grok. Supports Claude Code, Codex, and Cursor patterns too.

loop-cost — Estimates token spend before you run a loop. Given how wildly token costs can vary depending on usage patterns (a point Wes Winder and others have flagged), this is the financial guardrail that makes loops safe to actually turn on.

The repo also includes seven production patterns with clone-and-run starters:

Pattern Cadence Token Cost Risk Level
Daily Triage 1d–2h Low L1 report
PR Babysitter 5–15m High L1 watch
CI Sweeper 5–15m Very high L2 cautious
Dependency Sweeper 6h–1d Medium L2 patch-only
Changelog Drafter 1d or tag Low L1 draft
Post-Merge Cleanup 1d–6h Low L1 off-peak
Issue Triage 2h–1d Low L1 propose-only

Not sure which to start with? There's an interactive pattern picker that walks you through the decision.


Why This Is Happening Now

Three things converged simultaneously:

First, the tools caught up. A year ago, if you wanted a loop, you wrote a pile of bash scripts and maintained it forever. Now the pieces ship inside the products. Codex has Automations, worktrees, skills, connectors, and sub-agents as first-class features. Claude Code has /loop, /goal, hooks, cron, worktrees, and MCP. The primitives are there. You don't have to build them from scratch.

Second, the cost of autonomous verification dropped. Smaller models are cheap enough to run as checkers. You don't need Opus to verify that tests pass. A fast, cheap model can serve as the checker while a capable model serves as the maker. This maker/checker split is what makes recursive loops financially viable.

Third, the pain of manual prompting became unbearable. As agents got more capable, the volume of work they could handle outstripped the human's ability to prompt them through it. The bottleneck shifted from "can the agent do this?" to "can the human keep up?" Loop engineering is the answer to that bottleneck.


The Honest Caveats

Loop engineering is early. Osmani himself says he's skeptical, and the token cost warning is real. A CI Sweeper loop that runs every 5–15 minutes and consumes very high tokens per run can burn through a budget fast if you're not watching. loop-cost exists for a reason.

Not every task belongs in a loop. Verification must be cheap — if you can't write a test that confirms the outcome, you need a human gate. Tasks that require aesthetic judgment, architectural decisions, or nuanced stakeholder communication still need a human in the conversation.

The maker/checker split assumes you have tests worth running. Teams with poor test coverage will find that their loops can do work but can't prove they did it correctly. Loops expose the quality of your verification infrastructure, they don't fix it.

And there's a real risk of over-automating. A daily triage loop that proposes changes and waits for approval is safe. A CI Sweeper that auto-commits fixes without review is a loaded gun. The pattern picker explicitly labels risk levels for this reason.


How to Start

If you're new to loop engineering, start with the lowest-risk pattern: Daily Triage. Set up an automation that scans for new issues, categorizes them, and proposes labels — propose-only, no auto-commit. Run loop-init with the daily-triage pattern. Use loop-audit to see your Loop Readiness score. Use loop-cost to estimate what it'll actually cost.

Then iterate. Add a PR Babysitter that watches open PRs and reports review status. Add a Post-Merge Cleanup that sweeps branches and updates changelogs. Each pattern builds on the infrastructure you already put in place — the state file, the worktree, the skills documentation.

The key insight: you're not building one loop. You're building a system of loops, where the output of one feeds the input of the next, and the state tracking keeps the whole thing coherent across runs.


The Bigger Picture

Loop engineering isn't just about coding agents. It's a preview of how we'll work with all AI systems. The shift from "prompt the agent" to "design the loop that prompts the agent" is the same shift that happened in software engineering when we moved from manually running tests to setting up CI pipelines. The tests didn't change. The relationship between the human and the work changed.

Cherny's point about his job being to write loops rather than prompts is the tell. The people closest to the most capable coding agent on earth aren't sitting there prompting it turn by turn. They've built systems that prompt it for them, and their job is to maintain those systems.

The five building blocks — goal definition, work discovery, delegation, verification, and state tracking — aren't specific to Claude Code or Codex or any other tool. They're the primitives of autonomous agent orchestration. The tools will change. The primitives won't.

Loop engineering is the discipline of combining those primitives into systems that find work, delegate it, verify it, and iterate without you. It's early, it's imperfect, and the token costs can sting. But the direction is clear: the humans who thrive with AI agents won't be the ones who write the best prompts. They'll be the ones who design the best loops.


Sources: Addy Osmani, "Loop Engineering"; cobusgreyling/loop-engineering; Boris Cherny on agent loops; Peter Steinberger on designing loops; The Neuron, "Claude Code Creators Explain Agent Loops"; Blake Crosley, "Loops Win Where Verification Is Cheap".