VocalFuse is a Fuse Intelligence product.

LOOP ENGINEERING

Loop Engineering: Stop Prompting, Start Designing Loops

Loop engineering is the 2026 discipline of building the system that runs your AI coding agent for you — the trigger that starts it, the verification that checks it, the budget that bounds it, and the rule that stops it. The creator of Claude Code put it bluntly in June 2026: "I don't prompt Claude anymore. I have loops that are running." Learn the loop specification, the four loop types, and the stop-condition law, then run your loops in VibeFuse — the free widget-based harness on Windows.

What is loop engineering?

Loop engineering is designing the outer loop around an AI agent — its trigger, its goal, its verification, its budget, and its memory — so the agent finds the work, does it, checks its own result, and knows when to stop or call for help without a human prompting each step. Prompt engineering shapes one answer. Context engineering shapes what the model sees. Loop engineering shapes whole runs of autonomous work.

The term crystallized in a single week of June 2026. On June 2, Boris Cherny, the creator of Claude Code, said: "I don't prompt Claude anymore. I have loops that are running. They're the ones that are prompting Claude and kind of figuring out what to do. My job is to write loops." On June 7, Peter Steinberger posted: "you shouldn't be prompting coding agents anymore. You should be designing loops that prompt your agents" — a post that reached more than eight million views by mid-July. Addy Osmani named the practice the next day: "replacing yourself as the person who prompts the agent. You design the system that does it instead."

Academic work landed within weeks. The arXiv paper "Stop Hand-Holding Your Coding Agent" (June 2026) names the object of the practice the loop specification — and a follow-up mining study ("Loop Engineering: Building Blocks, Adoption, and Impact") examined 36,710 real software repositories to trace how the pattern is actually used.

Where loop engineering sits in the stack

Each layer wraps the previous one — nothing gets discarded. A loop is not a replacement for a good harness; it is the control system you build on top of one.

Layer The question it answers Scope
Prompt engineeringHow do I word this instruction?One request
Context engineeringWhat does the model see on every call?One session
Harness engineeringWhat environment, tools, and limits does the agent have?One agent run
Loop engineeringWhat system starts, verifies, bounds, and escalates the runs?Many runs over time

The paper's phrasing is worth stealing: "The harness supplies the engine; loop engineering writes the pilot." Where a harness equips a single agent run, a loop governs many runs over time — it decides what starts each one, how results are verified and persisted, and when a human gets pulled in. This is the operational layer of what Karpathy's agentic engineering rebrand describes: agents write the code, you orchestrate the system that runs them.

The loop specification: five parts

A loop specification is an external, bounded, reusable artifact you hand to a harness such as Claude Code or Codex. Five components — and most homemade loops are missing at least two of them.

1. A trigger

An interval, a schedule, an event, or an unmet goal — defined precisely. "Whenever needed" is not a trigger; it's a human with a to-do list. Examples: every 10 minutes, every weekday at 9am, on every opened pull request, until the test suite passes.

2. A goal

The work to pursue, stated as an outcome rather than a task list. The model decides how to reach it — that's its job. Everything else on this list decides whether it keeps going.

3. A verification step

An objective check the loop runs outside the model: a test suite exit code, a compiler, a schema validator, a measurable threshold. The single most important part — see the stop-condition law below.

4. A stopping rule

Two budgets, always: a maximum iteration count and a token (or dollar) cap. A loop without budgets isn't autonomous — it's unsupervised. Budgets convert "what's the worst that can happen?" from an unknown into a number you chose.

5. A memory

Durable state that lives outside the model's context — a file, a database row, a ticket label — recording what the loop has already seen and done. A heartbeat agent that can't remember what it handled will handle it again, every ten minutes, forever. Add an escalation path: when budgets are exhausted without success, the loop stops, preserves the evidence, and notifies a human with enough context to act. Loops that retry silently until someone notices the bill are the genre's horror stories.

# loop.spec — the minimal loop specification (paste into your agent's instructions)
trigger:  every 15 minutes              # interval, schedule, event, or unmet goal
goal:     every open PR in this repo is reviewed and either approved or commented
verify:   gh pr list --state open  ==  empty        # objective check, not model opinion
budget:   max 12 iterations · max $2.00 tokens     # hard ceilings
memory:   .loop-state.json  (processed PR ids, last run time)
escalate: on budget exhaustion, write .loop-failed.md and stop — never silently retry

Source trail: Boris Cherny (creator of Claude Code), June 2, 2026; Peter Steinberger, June 7, 2026 (8M+ views by mid-July); Addy Osmani, "loop engineering" naming, June 8, 2026; arXiv 2607.00038, "Stop Hand-Holding Your Coding Agent: Engineering the Loops that Replace Step-by-Step Prompting"; arXiv 2608.21884, "Loop Engineering: Building Blocks, Adoption, and Impact" (mining 36,710 repositories).

The four loop types (and the Claude Code command for each)

Every autonomous agent setup in the wild is one of these four — or a composition of them. Claude Code ships a native surface for each, which is a large part of why the discipline stuck once the tools caught up.

Loop type Trigger Example Native surface
Heartbeat Short constant interval Every 10 min: check the support inbox, triage anything new /loop 10m (session-scoped)
Cron / time Fixed schedule Every weekday 9am: pull yesterday's analytics, write the anomalies report /schedule routines (cloud or desktop), cron tools
Hook / event Something happened On every PR: review the diff, comment on real issues, approve if clean Hooks + Channels (CI pushes events into the session)
Goal Success condition not yet met Keep going until every test passes and the linter is clean — or 15 attempts /goal

Real systems compose them: a hook loop watches CI, and when a build fails it hands the failure to a goal loop that fixes it — bounded by a budget, escalating to a human only on defeat.

The /loop bundled skill runs a prompt on repeat while the session stays open: /loop 5m check my PR, address review comments, and fix failing CI. Fixed intervals convert to cron expressions; omit the interval and Claude picks a dynamic delay (one minute to one hour) based on what it observed. Loops auto-expire after seven days, stop with Esc, and you can replace the built-in default prompt with a loop.md file. For work that must survive the session, move up a surface: /schedule routines run in the cloud (no machine needed, one-hour minimum) or as desktop scheduled tasks (local files, one-minute minimum) — and GitHub Actions with the official Claude Code action covers CI-native scheduling.

One honest caveat from the docs: /loop is session-scoped — it fires only while Claude Code is running and idle, and there is no catch-up for fires missed during a long request. Anything that must run unattended belongs in routines, desktop tasks, or CI, not in a terminal you close at 6pm.

The stop-condition law (and the two failure modes)

If loop engineering has one law, it's this: never let the model grade its own homework. Models are systematically overconfident about their own output — ask an agent "is this done?" and the answer skews yes, because the transcript it is reading is a story of itself succeeding. A loop whose only exit is the model's self-assessment will exit early on hard tasks and, worse, exit wrong.

Stop condition Quality Example
Objective checkBestTest suite exit code, compiler, schema validator, a number crossing a threshold
Independent judgeGoodA second model call with fresh context whose only job is to find fault
Human checkpointRight for risky actionsThe loop drafts; a person approves outward-facing or irreversible actions
Self-assessmentNever"I believe the task is complete" — not on the list

If a task has no checkable success condition at all, that's the signal it isn't ready for a loop — run it interactively instead. The second failure mode is non-convergence: loops that oscillate (fix A breaks B, fix B breaks A) or plateau (each attempt slightly rephrases the last failure). Budgets are what make both failures cheap.

One prompt detail worth stealing into every goal loop: "never fix the tests unless they are objectively wrong." Goal loops optimize whatever you actually measure — an agent told to "make the tests pass" will eventually discover that deleting the tests makes them pass.

Loop engineering in VibeFuse: the harness runs the loop

A loop needs a runtime — somewhere for the agent runs, the verifier, and the state to live. VibeFuse is the first ever free widget-based AI harness, and it gives every loop its infrastructure on one canvas: each agent CLI (Claude Code, Codex, Gemini, Cursor Agent, Qwen) runs as its own widget, so a verifier subagent can watch a worker without sharing its context; named sessions persist per repo, which is exactly the durable loop memory the specification calls for; and terminals on the same canvas are where objective checks — test suites, exit codes, linters — actually execute.

Going deeper: read context engineering for what the agent sees inside each run, harness engineering for the runtime the loop lives in, and Claude Code tutorial for the commands. Compare harnesses in best vibe coding tools or see VibeFuse as a Claude Code GUI.

  • ✓ One widget per agent
  • ✓ Named per-repo sessions
  • ✓ MCP + Skill Seekers
  • ✓ 80% creator payouts

Explore VibeFuse & harness guides

Loop engineering FAQ

What is loop engineering?

Loop engineering is designing the system that runs your AI coding agent for you — the trigger that starts each run, the goal it pursues, the verification that checks its work, the budget that bounds it, and the memory that persists between runs — so the agent works without a human prompting each step. Boris Cherny, creator of Claude Code, described the shift in June 2026: "I don't prompt Claude anymore. I have loops that are running. My job is to write loops."

How is loop engineering different from prompt, context, and harness engineering?

They are layers, not competitors. Prompt engineering shapes how you word one request. Context engineering shapes what the model sees on every call. Harness engineering shapes the environment, tools, and limits of a single agent run. Loop engineering sits one level up: it governs many runs over time — what starts each run, how results are verified and persisted, and when to escalate to a human. As the arXiv paper puts it: the harness supplies the engine; loop engineering writes the pilot.

What are the four types of agent loops?

Heartbeat loops run on a short constant interval (an always-on assistant checking its inbox every ten minutes). Cron loops run on a fixed schedule (a report agent every weekday at 9am). Hook loops fire on events (review every pull request when it opens). Goal loops iterate until an externally-checked success condition is met (keep fixing until the tests pass), with budgets as the safety net. Real systems compose them — a hook loop watches CI and hands failures to a goal loop that fixes them.

What are the five parts of a loop specification?

Per the June 2026 arXiv paper "Stop Hand-Holding Your Coding Agent": a trigger (interval, schedule, event, or unmet goal), a goal, a verification step (an objective check run outside the model), a stopping rule (a maximum iteration count plus a token or dollar cap), and a memory (durable state outside the model's context recording what was already handled), plus a designed escalation path for when budgets run out.

How do you stop an AI agent loop from running forever?

Layer three mechanisms, because each fails differently: an objective stop condition checked outside the model (test suite exit code, compiler, schema validator — never the agent's own claim of success), hard budgets (a maximum iteration count and a token or dollar ceiling so a non-converging loop costs a bounded amount), and an escalation path (stop and report to a human rather than silently retrying). The pattern to avoid is any loop whose only exit is the model deciding it is done.

What is Claude Code's /loop command?

/loop is a bundled skill that re-runs a prompt on an interval while the session stays open: "/loop 5m check my PR, address review comments, and fix failing CI". Fixed intervals convert to cron expressions; with no interval, Claude picks a dynamic delay between one minute and one hour based on what it observed. Loops are session-scoped (they stop when the session exits), auto-expire after seven days, and stop with Esc. For work that must run unattended, Claude Code offers /schedule routines (cloud or desktop scheduled tasks) and /goal for condition-driven runs.

Is loop engineering a real discipline or just hype?

The name is new (June 2026); the problem is older. The value of an agent scales with how long it can run correctly without you, and that duration is determined almost entirely by loop design — stop conditions, verification, budgets, recovery. Two 2026 arXiv papers have formalized the loop specification and mined 36,710 repositories for real adoption patterns, which is more rigor than most named practices get in their first months.