Loop Engineering: Claude Code Loops, Routines & Workflows
# The practitioner's reference for loop engineering: Claude Code loops, goals, Ralph loops, routines, and dynamic workflows — and the verification doctrine that decides whether they converge.
TL;DR: Loop engineering is the discipline of making agents repeat cycles of work until a stop condition is met — instead of prompting them one turn at a time. Anthropic’s Boris Cherny, creator of Claude Code, describes his own workflow bluntly: “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.”1 Claude Code now ships a full ladder of loop surfaces —
/goal(repeat until a separate model confirms a condition),/loop(recurring local runs), the official Ralph plugin (iterate until a promise is kept), routines (cloud cron), and dynamic workflows (Claude writes a JavaScript orchestration graph and runs up to 1,000 subagents against it). The load-bearing craft is none of those features: it is verification. A loop converges only when something outside the generator — a test, a grader model, a pixel diff, a machine check — decides “done.” Get that right and loops compound; get it wrong and you buy a very expensive random walk. This guide covers every loop surface with version anchors, the Ralph pattern and its failure modes, when loops need to become graphs, the verification ladder, cost and safety discipline, and how to run a standing fleet. Current as of Claude Code v2.1.224 (August 2026).
What Is Loop Engineering?
Two years ago, engineers wrote source code by hand. Then agents wrote the code from human prompts. The shift now underway is one level higher: agents prompt agents, and the human writes the system that decides what gets prompted. Cherny rates the step change directly: “As big as the step from source code to agents was, loops are just as important and as big a step.”2
His definition is refreshingly mundane: “Loop is essentially a cron job that’s running locally for Claude. Routine is the same thing, but it’s running in the cloud.”3 The exotic-sounding practice — “hundreds, sometimes thousands of agents running 5, 10, 20 hours” overnight,4 Claude Code “100% written by Claude Code for over six months”4 — reduces to a small set of primitives: a prompt that re-fires on a schedule or a condition, state that survives between iterations, and a check that ends the run.
Anthropic named the discipline in June 2026: loops are “agents repeating cycles of work until a stop condition is met,” and “the quality of a loop’s output depends on the system around it.”5 The system around it is what this guide is about.
A provenance note, because the discourse moved fast in mid-2026: the term “graph engineering” — often attributed to Cherny in viral posts — was coined by the community (Peter Steinberger’s July 18 “are we still talking loops or did we shift to graphs yet?”, amplified by Hamel Husain), not by Anthropic or Cherny.6 The widely shared “85% of our engineers… the way you do it is graph engineering” quote circulates only through third-party posts; in preparing this guide we could not locate it in any primary record of his talks (the YC Startup School conversation, Bloomberg’s Odd Lots, TechCrunch’s Meta @Scale report), so treat it as unverified attribution. His actual practice is graph-shaped (orchestrators spawning implementer/verifier/fixer subagents, nested to depth 5), but the verified vocabulary is loops, routines, and workflows — and that is the vocabulary this guide uses.
Five-Minute Golden Path
Three commands take you from prompting to looping:
# 1. A goal loop: Claude keeps working until a SEPARATE model confirms the condition
/goal all tests pass and coverage is above 80%
# 2. A recurring local loop: re-runs on a schedule while your session is open
/loop 30m check CI on my open PRs and fix any failures
# 3. A cloud routine: runs on Anthropic's infrastructure whether your laptop is open or not
/schedule every morning at 7am: triage new issues, reproduce what you can, draft fixes as PRs
The difference between these and a prompt is structural, not cosmetic: each has a re-fire rule (a condition, a clock, a cron) and each needs a stop rule. Everything else in this guide is about making those two rules trustworthy.
The Core Loop and the One Rule
Every agentic system runs the same inner cycle, which Anthropic’s Agent SDK documentation canonizes as gather context → take action → verify work → repeat.7 Claude Code’s own process is a loop: evaluate the prompt, call tools, read results, repeat until a response has no tool calls.8
Loop engineering wraps outer loops around that inner one — and inherits its one non-negotiable rule, stated across every serious source in the field:
The agent doing the work never grades it.
- Anthropic’s
/goaldocs: “completion is decided by a fresh model rather than the one doing the work.”9 - Anthropic’s harness-design essay: “Separating the agent doing the work from the agent judging it proves to be a strong lever to address this issue.”10
- Cherny, on what practitioners miss: “The verification is probably the single most important thing that people do not get right.”3 His worked example, instructing a two-week Electron-to-Swift rewrite: “run the Electron app in the Mac virtual machine, screenshot it, and then look pixel by pixel. Compare it to the Swift version. Don’t stop until you’re done.”3
The reason is mechanical, not moral: a model asked “are you done?” exhibits positive self-grading bias, and a confident transcript can talk a model-judged exit condition into premature “done.”11 External verification — a test suite, a compiler, a pixel diff, a fresh model with no stake in the answer — is the only signal that resists this.
The Autonomy Ladder
Loop surfaces in Claude Code form a ladder from “press enter again” to “runs without you.” Each ring trades more autonomy for more verification burden:
| Ring | Surface | Re-fire rule | Stop rule | Since |
|---|---|---|---|---|
| 0 | A normal turn | You press enter | Response ends | — |
| 1 | /goal |
Condition not yet met | Separate evaluator model says the condition holds | v2.1.139 |
| 2 | Stop hooks / Ralph plugin | Hook re-injects the prompt on exit | --completion-promise string or --max-iterations cap |
plugin (official) |
| 3 | /loop + cron tools |
Clock (fixed interval or self-paced) | You cancel, or the loop stops itself | v2.1.71 |
| 4 | Headless Ralph (claude -p in a shell loop) |
The shell’s while |
External check in the script | community pattern |
| 5 | Routines / scheduled cloud agents | Cron, API call, or GitHub event | Run completes; you read the transcript | research preview, ~April 2026 |
(The ring framing follows pardel.dev’s July 2026 taxonomy, the cleanest independent map of the space.11)
The ladder’s discipline: enter at the lowest ring that solves your problem, and climb only when a ring’s verification is proven. A /goal that can’t state its condition as something checkable is not ready to be a routine.
The Loop Surfaces, In Detail
(This guide covers the loop surfaces themselves. The Claude Code guide is the full CLI reference — configuration, permissions, hooks, MCP — and the Agent Architecture guide covers how harness components compose; loops are what you run on top of both.)
/goal — the evaluator-optimizer loop
/goal <condition> keeps Claude working until the condition holds: “After each turn, a small fast model checks whether the condition holds. If not, Claude starts another turn instead of returning control to you.”9 The evaluator (Haiku by default) returns yes/no plus a reason that Claude takes as next-turn guidance. It runs headless too: claude -p "/goal ..." executes the loop to completion.
Craft notes: make the condition observable (“tests pass,” “the endpoint returns 200,” “zero TypeScript errors”) rather than aspirational (“the code is clean”). A vague verifier gives the loop no direction — and a model-judged condition can be argued into agreement by a confident transcript, so pair /goal with a machine check whenever one exists.11
/loop — recurring local runs
/loop [interval] <prompt> re-runs a prompt on a schedule: fixed (/loop 5m check the deploy), self-paced (Claude picks the next delay from what it observed), or bare /loop for a built-in maintenance pass. Under the hood are CronCreate/CronList/CronDelete (5-field cron, 50 tasks per session, 7-day expiry) and the Monitor tool, which streams a background script’s output instead of polling.12 Cherny’s own launch example: “/loop babysit all my PRs. Auto-fix build issues and when comments come in, use a worktree agent to fix them.”13
The limitation that matters: /loop lives in your session. Close the terminal and the loop dies — that’s what routines are for.
The Ralph plugin — iterate until the promise is kept
Anthropic’s official ralph-wiggum plugin productizes the community’s favorite brute-force pattern: a Stop hook intercepts Claude’s attempt to end the session and re-injects the prompt, so the model iterates continuously in one session. /ralph-loop "<prompt>" --max-iterations <n> --completion-promise "<string>" starts it; /cancel-ralph aborts. The README is explicit that --max-iterations is “your primary safety mechanism” — exact-string completion matching can fail forever.14
Dynamic workflows — Claude writes the graph
Introduced with Claude Code v2.1.154 (May 2026) and detailed in Anthropic’s June 2, 2026 launch post, dynamic workflows are the biggest conceptual jump: “Claude can now write its own harness on the fly, custom-built for the task at hand.”15 You describe the task (or just say “use a workflow”); Claude writes a JavaScript orchestration script — agent() spawns a subagent with optional JSON-schema outputs, pipeline() runs items through stages, plain await/loops/conditionals hold the control flow — and a runtime executes it in the background. “A workflow moves the plan into code… A workflow script holds the loop, the branching, and the intermediate results itself, so Claude’s context holds only the final answer.”16
Limits and shape: 16 agents concurrent, 1,000 per run (“prevents runaway loops”), no mid-run user input; scripts saved to .claude/workflows/ become reusable slash commands; runs are resumable with cached agent results.16 The signature topology is fan-out / refute / converge: independent finders, then adversarial verifiers prompted to refute each finding, iterating until answers survive. The launch’s headline result: Bun’s port of its 535,496-line Zig codebase to Rust — yielding a Rust codebase past a million lines — in eleven days (May 3-14, 2026) by 64 parallel agents, per Jarred Sumner’s account.15
Agent teams — the peer graph
Behind CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 (research preview since v2.1.32, February 2026): a team lead plus teammates who “work independently, each in its own context window, and communicate directly with each other” — a peer graph rather than the subagent tree, coordinated through a shared task list with dependencies, file-lock claiming, and per-agent mailboxes. Hook-enforced quality gates (TaskCompleted exit-code-2 blocks) put machine checks between a teammate and “done.”17
Routines — loops that outlive your laptop
A routine is “a saved Claude Code configuration: a prompt, one or more repositories, and a set of connectors, packaged once and run automatically” on Anthropic-managed cloud or your own self-hosted runners.18 Three trigger types, combinable: cron schedule (1-hour minimum), API fire (POST .../routines/{id}/fire), and GitHub events. Created via /schedule or claude.ai/code/routines. Runs execute autonomously — no approval prompts — which is exactly why the docs’ caveat is load-bearing: a green run status “does not mean the task in your prompt succeeded. Open the run to read the transcript and confirm what Claude actually did.”18
Anthropic runs “every day maybe 20 or 30 of these routines” across its own codebases — dead-code cleanup, test coverage, shipping experiments.3
The supporting cast
Background subagents (default since v2.1.198) keep delegated work out of your context; the /agents panel monitors them. Cross-session messaging (v2.1.224) turns independent sessions into a message-passing graph via SendMessage, with security doctrine worth copying: a message from another session “never counts as your consent.”19 Self-hosted runners (v2.1.224, Team/Enterprise) execute cloud sessions and routines on your own machines — the substrate for org-scale fleets.20
The Ralph Pattern
The community got here first. In July 2025, Geoffrey Huntley published the essay that named the technique after The Simpsons character: Ralph is literally
while :; do cat PROMPT.md | claude-code ; done
— his one-liner exactly as published — one repo, one task per iteration, fresh context every pass, with specs and progress files on the filesystem carrying state between iterations, and tests/lints acting as “backpressure.”21 The modern headless form of the same shape is claude -p "$(cat PROMPT.md)" in a shell loop, which is essentially what Anthropic’s own C-compiler harness ran.23 His claimed results (a $50K contract’s MVP for $297 in tokens; six repos overnight at a hackathon) came with equally clear limits: greenfield only, placeholder and duplicate implementations as recurring failure modes, and “LLMs are mirrors of operator skill.”
Anthropic never uses the name in its engineering material, but the pattern is now official doctrine twice over: the November 2025 long-running-agents essay prescribes exactly this shape — an initializer agent creating feature lists and progress files, then fresh coding agents per context window that “start the session by reading the progress notes file and git commit logs”22 — and the February 2026 C-compiler project ran sixteen parallel Claude agents — “I built a harness that sticks Claude in a simple loop,” as Nicholas Carlini describes it — with file-based task locks and git as the sync layer, producing ~100K lines of Rust across ~2,000 sessions for about $20K.23 The essay’s verification line is the pattern’s whole theory: “it’s important that the task verifier is nearly perfect.”
Why fresh context beats one long session: effectiveness degrades as a session’s context fills — practitioner consensus puts the drift threshold around 100K tokens — and compaction summaries are lossy paraphrases that launder errors into confident prose.24 Ralph’s fresh-spawn-plus-files design sidesteps both. (The official plugin’s in-session looping trades some of this away for convenience; for long runs, the headless form with external state remains the stronger pattern.)
The pattern’s cautionary tale is also instructive: a practitioner ran the plugin with a vague prompt and max_iterations: 0 — which means infinite, not disabled — and Claude asked itself the same clarifying question 1,966 times, with the Stop hook hijacking every subsequent message.25 Iteration caps are not optional.
When Loops Become Graphs
A single loop assumes its iterations are independent or strictly sequential. The moment parallel work has dependencies — task B needs A’s output, two agents would edit the same file — freeform loops collide, and you need explicit structure: a task list with dependency arrays, file claiming, merge discipline. That is the honest content of the loops-versus-graphs debate: loops for one repo and one goal; graphs when parallel work needs ordering.26
The graph options, in ascending infrastructure:
- Dynamic workflows — dependencies expressed in JavaScript control flow; barriers only where a stage genuinely needs all prior results. The topologies Anthropic names: fan-out-and-synthesize, adversarial verification, generate-and-filter, tournament (“Spawn N agents that each attempt the same task using different approaches,” then judge pairwise), and loop-until-done.15
- Agent teams — a shared task list with dependency tracking and a lead who approves plans; the graph is data, not code.17
- External orchestrators — the community scale-out: Steve Yegge’s Gas Town runs 20–30 Claude Code instances against DAGs of git-backed “beads” (75K lines of Go in 17 days, by his own telling also “a cash guzzler” demanding high operator skill);27 claude-flow/Ruflo (~31K stars) wraps swarms in a queen/worker hierarchy; LangGraph-style engines put a typed state machine on top with Claude Code inside the nodes.
Cherny’s own formalization of the trajectory is the Steps of AI Adoption ladder, published via Anthropic in July 2026: Gated (0 agents) → Assisted (~1) → Parallel (~10) → Supervised autonomy (~100, where “most agents are kicked off by Claude, not humans”) → AI-native (1,000+). His advice with it: “at each step… you need to find and break down the next set of bottlenecks, and build up the next set of guardrails.”28
Verification Engineering
Everything above is plumbing. This section is the product.
Anthropic’s escalation ladder, from the current best-practices doc: give Claude something that produces a pass or fail and “the loop closes on its own” → a /goal condition re-checked by a separate evaluator → a Stop hook as “a deterministic gate” → “a verification subagent or a dynamic workflow that checks its own findings has a fresh model try to refute the result, so the agent doing the work isn’t the one grading it.”29 The evidence norm attached: “Have Claude show evidence rather than asserting success.”
The three feedback classes, from the Agent SDK essay: rules-based feedback (“clearly defined rules for an output, then explaining which rules failed and why” — the best form), visual feedback (screenshots, pixel diffs), and LLM-as-judge (fuzzy rubrics — in Anthropic’s words, “generally not a very robust method”).7 Prefer them in that order; a deterministic check that exists beats a judge that opines.
Convergence conditions. The sharpest critical treatment of loops — Yoko Li’s August 2026 analysis — reduces convergence to four requirements: a defined target state, an observable current state, precise local edits, and stopping rules outside the generator. Her instrumented experiment is the number to remember: 67% of the loop’s token spend produced zero improvement, because nothing told the loop that returns had gone logarithmic.30 Budget caps are not merely cost control; they are a stopping rule of last resort.
Test integrity. From Anthropic’s long-running-agents doctrine: “It is unacceptable to remove or edit tests because this could lead to missing or buggy functionality.”22 Loops game specifications — passing the visible tests while failing the hidden intent — so the verifier itself needs protection from the agent it judges.
Grade outcomes, not paths. From the evals essay: “Grade what the agent produced, not the path it took,” use code-based graders where objective and model-based graders for rubrics, and calibrate: “You won’t know if your graders are working well unless you read the transcripts and grades from many trials.”31
One more distinction most of the discourse misses: when every check in a loop is deterministic, no model belongs in the loop at all. A drift watcher that compares timestamps, a link checker, a build sentinel — these are shell scripts on a schedule: zero tokens, seconds per run, perfectly repeatable. Reserve model-driven loops for iterations that need judgment. The cheapest loop is the one that never calls a model.
Cost and Safety Discipline
The loudest community objection to loop engineering is cost, and the postmortem genre backs it up: a subagent-spawning bug burning 4M tokens in five minutes; overnight loops consuming thousands of dollars; usage limits hit “way faster than expected.”32 The discipline that emerged, each piece mapping to a shipped control:
| Risk | Control |
|---|---|
| Runaway iterations | --max-iterations (Ralph), 1,000-agent workflow cap, cron task limits |
| Runaway spend | --max-budget-usd (halts background subagents at the cap, v2.1.217+), per-phase budgets |
| Unattended permission creep | Auto mode’s classifier-gated permissions; routines’ scoped connectors; sandboxing |
| Silent failure | Report-per-run contracts; open the run and read the transcript18 |
| Blast radius | Worktrees and branches — never the main checkout; PR as the boundary |
That last row deserves its own paragraph, because it is how the most aggressive practitioners stay safe: make the pull request the blast radius. Cherny’s standing background agents — one continuously improving architecture, one hunting duplicated abstractions — submit PRs without human triggers;2 nothing merges without review. An always-on loop whose worst case is “an unmerged branch” can run hot; a loop that writes to main cannot. Promote loops gradually: start observe-only (reports, no writes), earn trust across boring runs, then graduate to proposing changes — with the ordering proof (“purge runs only after verification returns the new marker”) and an exhaustive blast-radius declaration written down before the schedule is installed. The economics of this promotion path are the subject of Loops Win Where Verification Is Cheap: verification cost, not loop construction, decides what can run unattended.
The deepest objection is not cost but review capacity — loops produce code faster than humans can meaningfully review it.33 There is no clever answer; there is only scoping honesty: unattended loops belong exactly where verification is machine-checkable, and nowhere else. “If you can’t verify it, don’t ship it.”29
Running a Fleet
The end state of loop engineering is not one loop; it is a standing fleet. What the practice looks like when it stabilizes:
- Specs as files. Each loop is a versioned spec — name, tier, schedule, goal, verifier, allowed tools, budget, timeout — living in the repo it serves. If you have typed the same manual check three times, it becomes a spec.
- Two tiers, earned promotion. Observe loops read anything, write only to their own report directory, and schedule immediately. Act loops touch the world and require the ordering proof, the blast-radius declaration, and a verifier that is not the maker — written before the schedule exists. Loops start life as observe and earn promotion.
- The exec/model split. Deterministic checks run as scripts (zero tokens, 1–2 seconds); model loops are reserved for judgment. A fleet’s daily heartbeat can cost nothing.
- Report contracts. One line per check,
PASS|FAIL <check>: <reason>, appended to a dated report file. If you cannot define the glanceable PASS line, the loop is not ready. A digest loop reads the fleet’s reports so the human reads one page, not thirty. - Self-maintaining baselines. The best drift watchers derive expectations from the artifact they guard — a guide’s own recorded timestamps, a lockfile’s own hashes — so updating the artifact updates the watcher, and there is no second source of truth to forget.
- Scheduling that survives. Local fleets run on the OS scheduler (launchd, cron, systemd timers) invoking a runner script; cloud fleets are routines. Session-bound loops (
/loop) are for work you are present for.
This is Cherny’s “my job is to write loops,” made concrete: the human’s work shifts to specifying checks, verifiers, and budgets — and reading the reports.
The First Two Loops Worth Building
If you are starting a fleet from zero, two loops pay for themselves immediately — both proven in this site’s own harness:
The gate loop — maker-checker for anything you publish. A fresh evaluator (no memory of prior rounds) scores the artifact against an explicit bar; you apply every named finding; a new evaluator re-scores; the loop stops at the bar or a hard round cap. Two field notes from running it across a fifteen-post sprint: repairs can introduce new defects (one round’s fix misattributed a figure that the next round’s evaluator caught), and evaluators err in both directions — one confidently “corrected” a true claim, so specific corrections get verified at the source before they are applied. The checker is not the authority; the source is.
The groundskeeper — the act-tier entry point. One small, objectively verifiable fix per run, on a branch, tests green before the PR opens, and the loop never merges. Two rules keep it safe: anything ambiguous gets flagged, not fixed (the first supervised run correctly declined a detector false positive), and a pre-existing failure on main is reported as such, never absorbed into the loop’s diff.
One fleet-operations detail worth stealing: give unattended model loops a session lease — defer any run while an interactive session is active in the same repo. Two writers with one checkout will eventually interleave commits; the lease makes the loop yield to the human by construction.
FAQ
What is loop engineering?
The practice of making AI agents repeat cycles of work until a stop condition is met, instead of prompting them turn by turn. The engineer’s job moves from writing prompts to designing the loop: its re-fire rule (a condition, a schedule, an event), its state between iterations, its verifier, and its budget. Anthropic named the discipline in June 2026; its Claude Code surfaces are /goal, /loop, the Ralph plugin, routines, and dynamic workflows.
What is a Ralph loop?
A brute-force autonomy pattern named by Geoffrey Huntley in July 2025: run Claude Code in a shell while loop, feeding it the same prompt with fresh context each iteration, with progress files and git carrying state between passes and tests acting as backpressure. Anthropic ships an official ralph-wiggum plugin that does the looping in-session via a Stop hook, with --max-iterations as the primary safety mechanism.
How do I run Claude Code in a loop?
Pick the lowest ring that fits: /goal <condition> to iterate until a separate evaluator confirms a condition; /loop <interval> <prompt> for recurring runs while your session is open; /ralph-loop to iterate on one task until a completion promise; /schedule to create a cloud routine that runs on cron without your machine. Headless, claude -p inside a shell loop with an external check is the classic form.
Do loops replace prompting?
The prompt does not disappear — it moves. You write it once, into the loop’s spec, and the loop re-fires it; increasingly (dynamic workflows, Cherny’s “it’s actually another Claude that does the prompting”) an orchestrating agent writes the per-task prompts. What replaces prompt-crafting as the human’s craft is verification design: stating conditions a machine or a fresh model can check.
What is the difference between a loop, a routine, and a workflow in Claude Code?
A loop (/loop) re-runs a prompt on a schedule inside your local session and dies with it. A routine is the same idea packaged to run on cloud infrastructure — cron, API, or GitHub-event triggered, no laptop required. A workflow is a single run’s orchestration graph: a JavaScript script Claude writes that spawns and coordinates up to 1,000 subagents with loops and branching held in code rather than context.
How much do agent loops cost?
The honest range is “zero to ruinous,” and the variable is design. Deterministic watchers cost nothing — they are scripts on a schedule. Model loops are metered by iteration: cap them (--max-iterations, --max-budget-usd), make returns observable so the loop can stop at diminishing returns, and treat every cap as a stopping rule, not an inconvenience. The failure postmortems — thousands of dollars overnight, 4M tokens in minutes — share one root cause: no external stop condition.
When should a loop become a graph?
When parallel work develops dependencies: one task needs another’s output, or two agents would touch the same files. Loops handle one repo and one goal; graphs (dynamic workflows, agent teams, external orchestrators) add dependency ordering, file claiming, and merge discipline. Enter graphs only when collisions actually appear — the added structure costs observability and setup.
Changelog
| Date | Change | Source |
|---|---|---|
| 2026-08-08 | Added “The First Two Loops Worth Building” (gate loop, groundskeeper) and the session-lease note to Running a Fleet — field practice from standing up this site’s own /gate skill and pr-groundskeeper act-tier loop (first proposal: PR #16). Focused review passed before ship. | — |
| 2026-08-07 | Guide created. Loop surfaces current to Claude Code v2.1.224 (routines research preview, dynamic workflows, agent teams, Ralph plugin, cross-session messaging, self-hosted runners); Cherny quotes verified against primary transcripts (Acquired, YC Startup School, Fortune, Platformer, Odd Lots, TechCrunch); “graph engineering” attribution corrected to community coinage; verification doctrine assembled from Anthropic engineering essays (Nov 2025 – Jun 2026) and Li’s convergence analysis (Aug 2026). | 1–33 |
-
Boris Cherny, conversation with the Acquired podcast (“Acquired Unplugged,” with WorkOS), early June 2026 — video; WorkOS’s official takeaways (June 2, 2026) render the passage as “Now he doesn’t even prompt Claude directly. He writes loops—automated workflows that prompt Claude and figure out what to build next.” The quotation used here is the wording carried by the widely-circulated clip and contemporaneous roundups (e.g., productmarketfit.tech, June 8, 2026) — treat it as a lightly condensed clip transcription rather than an official transcript. His CNBC variant of the same point, via Business Insider (June 20, 2026): “It’s an agent that prompts Claude. I don’t write the prompt anymore.” ↩↩
-
Russell Brandom, “The AI world is getting ‘loopy’”, TechCrunch, June 22, 2026 — Cherny at Meta @Scale: “Two years ago, we wrote source code by hand… And now we’re transitioning to the point where agents are prompting agents that then write the code”; “As big as the step from source code to agents was, loops are just as important and as big a step”; his two always-on background agents (architecture improvement, duplicate-abstraction hunting) submitting PRs without human triggers. ↩↩
-
Boris Cherny with Diana Hu, “Building Claude Code”, YC Startup School, published July 2026 (text via the full transcript mirror) — “Loop is essentially a cron job that’s running locally for Claude. Routine is the same thing, but it’s running in the cloud”; Anthropic’s “20 or 30 of these routines running across all of our code bases”; “The verification is probably the single most important thing that people do not get right”; the pixel-by-pixel Electron/Swift comparison instruction. ↩↩↩↩
-
Casey Newton, interview with Boris Cherny, Platformer, May 26, 2026 — “Every night I have hundreds, sometimes thousands of agents running 5, 10, 20 hours”; “Claude Code has been 100% written by Claude Code for over six months.” See also Bloomberg Odd Lots, July 20, 2026: “100% of my code has been written by Claude Code since November of last year.” ↩↩
-
Delba de Oliveira & Michael Segner, “Loop Engineering: Getting started with loops”, Anthropic, June 30, 2026 — the definition, the four loop types (turn-based, goal-based, time-based, proactive), “Loops that write code need loops that check it,” and “The quality of a loop’s output depends on the system around it.” ↩
-
Turing Post, “Is Graph Engineering Real?”, FOD#159, July 20, 2026 — traces the term “graph engineering” to Peter Steinberger’s July 18 post and Hamel Husain’s amplification, crediting neither to Cherny. The “85% of our engineers” attribution circulates via third-party X posts (late July 2026) with no linked primary source; the negative finding on it is this guide’s own verification (August 2026) against the YC Startup School conversation, Bloomberg Odd Lots, and TechCrunch’s Meta @Scale report. ↩
-
Anthropic, “Building agents with the Claude Agent SDK”, September 29, 2025 — the canonical loop (“gather context → take action → verify work → repeat”) and the three verification classes, with rules-based feedback called the best form. ↩↩
-
Anthropic, “How the agent loop works”, Agent SDK docs — turn mechanics, loop termination on a response with no tool calls,
maxTurns/maxBudgetUsd(“Setting a budget is a good default for production agents”). ↩ -
Anthropic,
/goaldocumentation — “After each turn, a small fast model checks whether the condition holds”; “completion is decided by a fresh model rather than the one doing the work”; headless viaclaude -p. ↩↩ -
Anthropic, “Harness design for long-running application development”, March 24, 2026 — the planner–generator–evaluator triad, context resets with structured handoffs, and “Every component in a harness encodes an assumption about what the model can’t do on its own, and those assumptions are worth stress testing.” ↩
-
pardel.dev, “Claude loops: from the inner while-loop to agents that run themselves”, July 11, 2026 — the Rings 0–5 taxonomy, four safeguards (verifiable exits, scoped permissions, idempotent iterations, cost metering), and the observation that
/goal’s model-judged condition can be “convinced” by a confident transcript. ↩↩↩ -
Anthropic, Scheduled tasks documentation —
/loopmodes,CronCreate/CronList/CronDeletelimits, the Monitor tool, self-paced termination viaScheduleWakeup {stop: true}. ↩ -
Boris Cherny, X post announcing
/loop, March 7, 2026. ↩ -
Anthropic, ralph-wiggum plugin README — Stop-hook mechanics,
--max-iterationsas “your primary safety mechanism,” credit to Huntley, and scoping to verification-heavy tasks. ↩ -
Thariq Shihipar & Sid Bidasaria, “A harness for every task: dynamic workflows in Claude Code”, Anthropic, June 2, 2026 — “Claude can now write its own harness on the fly”; split/synthesize, adversarial verification, tournaments. The launch post references the Bun rewrite and links Jarred Sumner’s X thread without figures; the figures here — 535,496 lines of Zig ported May 3-14, 2026 by 64 parallel agents, producing a Rust codebase of more than a million lines — are Sumner’s account as reported by The Register (May 14, 2026). Test-pass claims vary between accounts (99.8% to 100%), so this guide states none. ↩↩↩
-
Anthropic, Dynamic workflows documentation — “A workflow moves the plan into code”; “A workflow script holds the loop, the branching, and the intermediate results itself, so Claude’s context holds only the final answer”;
agent()/pipeline()API, 16-concurrent/1,000-per-run limits, saved workflows as slash commands, resumability. ↩↩ -
Anthropic, Agent teams documentation — research preview (Claude Code v2.1.32, February 2026), peer communication, shared task list with dependencies and file claiming, hook-enforced quality gates. ↩↩
-
Anthropic, Routines documentation — the definition, three trigger types, autonomous execution, and “does not mean the task in your prompt succeeded. Open the run to read the transcript and confirm what Claude actually did.” ↩↩↩
-
Anthropic, Cross-session messaging documentation, v2.1.224 —
ListAgents/SendMessage, same-machine inbox sockets, and the consent doctrine. ↩ -
Anthropic, Self-hosted environments quickstart, public beta —
claude self-hosted-runner, routine routing, orchestrator deployment model. ↩ -
Geoffrey Huntley, “Ralph Wiggum as a ‘software engineer’”, July 14, 2025, and “everything is a ralph loop”, January 17, 2026 — the pattern, the claims, and the stated limits (greenfield-only, operator skill as the mirror). ↩
-
Anthropic, “Effective harnesses for long-running agents”, November 26, 2025 — initializer + fresh coding agents over progress files (“compaction isn’t sufficient”), and the test-integrity rule. ↩↩
-
Nicholas Carlini, “Building a C compiler with a team of parallel Claudes”, Anthropic, February 5, 2026 — sixteen agents; “I built a harness that sticks Claude in a simple loop”; file-based task locks; the near-perfect-verifier requirement; ~100K lines / ~2,000 sessions / ~$20K. ↩↩
-
Eva Khmelinskaya, “Running Claude Code Autonomously Overnight”, May 18, 2026 — overnight failure modes (context exhaustion, compaction thrash, rule loss) and the fixes (output redirection, STATUS.md handoffs, phased fresh sessions with
/goaland per-phase budgets); Travis Sparks, “Everyone’s Using Ralph Loops Wrong”, February 4, 2026 — fresh-context doctrine vs in-session looping, drift past ~100K tokens. ↩ -
Sean K, “I accidentally made Claude ask itself the same question 1,966 times”, dev.to, January 3, 2026. ↩
-
xr0am, “What Ralph Wiggum loops are missing”, January 24, 2026 — dependency collisions as the graduation trigger; Yash Thakker, “Graphs vs. Loops”, explainx.ai, July 21, 2026 — the debate’s four conflated meanings and the settling consensus. ↩
-
Steve Yegge, “Welcome to Gas Town”, January 1, 2026 — the 20–30-instance control plane, DAGs of git-backed beads, claimed output, and the self-declared caveats. ↩
-
Boris Cherny, “Steps of AI Adoption”, published via Anthropic, July 16, 2026 — the five-step ladder and “at each step… find and break down the next set of bottlenecks, and build up the next set of guardrails.” ↩
-
Anthropic, Best practices for Claude Code — “Give Claude something that produces a pass or fail, and the loop closes on its own”; the escalation ladder ending in adversarial refutation; “Have Claude show evidence rather than asserting success”; “If you can’t verify it, don’t ship it.” ↩↩
-
Yoko Li, “Knowing When to Stop: the art of making a loop converge”, August 6, 2026 — the four convergence conditions, the 67%-wasted-tokens experiment, specification gaming, and cost blindness. ↩
-
Anthropic, “Demystifying evals for AI agents”, January 9, 2026 — grader selection, outcome-not-path grading, pass@k vs pass^k, and transcript-reading as calibration. ↩
-
techtrenches.dev, “The slot machine that codes” (4M tokens in five minutes); The Register, January 5, 2026, on usage limits; community postmortems collected across dev.to and HN, January 2026. ↩
-
Community reception synthesis: HN threads on Gas Town (item 46458936) and Ralph tooling (item 46750937) — the review-capacity and maintainability objections (“Mountains of code nobody understands”); Steinberger’s June 2026 “designing loops that prompt your agents” post (5.2M views, ~61% negative per explainx.ai’s reply analysis). ↩↩