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 or judges it impossible),/loop(recurring local runs), the official Ralph plugin (iterate until a promise is kept), cloud scheduled tasks (formerly 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.312 (October 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 scheduled task (formerly a 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, or judges it impossible | 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 | Cloud scheduled tasks (formerly routines) | Cron, a one-off time, 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)
One local option sits between rings 3 and 5: Desktop scheduled tasks run on your machine without an open session, at intervals down to 1 minute when Claude sets them (1 hour in the forms), and the docs point to them “when you need access to local files and tools.”12
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 cloud scheduled task.
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 model checks whether the condition holds. If the model judges it not yet met, Claude starts another turn instead of returning control to you.”9 Under the hood, “/goal is a wrapper around a session-scoped prompt-based Stop hook,” so it is unavailable wherever hooks are off (disableAllHooks, or allowManagedHooksOnly in managed settings). The evaluator is your configured small fast model, and it returns one of three verdicts, each with a short reason:9
| Verdict | What happens |
|---|---|
| Not yet met | Claude keeps working and takes the reason as guidance for the next turn |
| Met | Claude Code clears the goal and records an achieved entry in the transcript |
| Impossible | The evaluator judged the condition can never be satisfied; Claude Code clears the goal and records a failed entry with the reason |
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 The docs state the limit outright: the evaluator “doesn’t run commands or read files independently, so write the condition as something Claude’s own output can demonstrate.”9 Put the stop rule inside the condition too: a clause such as or stop after 20 turns is judged like the rest of it, and a condition can be up to 4,000 characters. If Claude keeps answering the evaluator with no tool use for several turns in a row, Claude Code stops the loop and returns control to you with the goal still set.9
Failure handling, first hardened in v2.1.234,34 now covers every way a turn can fail:
| Failure | What the goal does |
|---|---|
| An error you have to fix: an authentication failure when Claude Code manages its own credentials, an exhausted credit balance, a context overflow that auto-compaction couldn’t clear, or a model that isn’t available | Clears, with a warning that starts Goal cleared after an unrecoverable error |
| A failure that tends to clear on its own, such as an overloaded server or a dropped connection (interactive, v2.1.269+) | Retries automatically; after three retries, it pauses |
| A failure a retry would only repeat: an API rate limit, a claude.ai usage limit, or a hook that ended the turn (interactive, v2.1.269+) | Pauses, and resumes at a usage-limit reset if the session is set to continue automatically |
When a host such as the desktop app or a cloud session manages credentials, an authentication failure leaves the goal active, because the host restores access itself. And when background work keeps a goal waiting, Claude checks in after 30 minutes, again 1 hour later, then every 2 hours, starting at most three idle check-ins between your prompts (CLAUDE_CODE_GOAL_CHECKIN_MINUTES sets the first interval; 0 turns off check-ins and automatic retries).9
/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, between one minute and one hour, 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 To replace the built-in maintenance prompt, write a loop.md (.claude/loop.md in the project, which takes precedence, or ~/.claude/loop.md); “Edits to loop.md take effect on the next iteration,” and content beyond 25,000 bytes is truncated.12
The limitation that matters: /loop lives in a running Claude Code process. “Tasks only fire while Claude Code is running and idle.” Exit and they stop firing; background the session and the loop keeps running without a terminal; resume with --resume or --continue and the tasks scheduled with CronCreate come back, but a self-paced /loop does not, so run it again.12 For work that must outlive the session, the docs compare three surfaces:12
| Cloud scheduled tasks (formerly routines) | Desktop scheduled tasks | /loop |
|
|---|---|---|---|
| Runs on | Cloud, Anthropic-managed by default | Your machine | Your machine |
| Requires machine on | No | Yes | Yes |
| Requires open session | No | No | Yes |
| Persistent across restarts | Yes | Yes | Restored on --resume, with exceptions |
| Minimum interval | 1 hour | 1 minute when Claude sets it, 1 hour in the forms | 1 minute |
Work that must run with your machine off is what cloud scheduled tasks are for.
The Ralph plugin — iterate until the promise is kept
Anthropic’s official ralph-loop plugin productizes the community’s favorite brute-force pattern. It has been ralph-loop in the anthropics/claude-plugins-official repository since January 6, 2026, when Anthropic renamed it from ralph-wiggum “per legal guidance.” On October 26, 2026, the claude-code repository deleted its own stale ralph-wiggum copy, and its marketplace now installs ralph-loop from the official repository, so “existing plugin ids keep working.”14 The mechanism: 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 One harness limit sits under every Stop-hook loop: “If the hook blocks eight stops in a row with no tool call between them, Claude Code overrides the next block and ends the turn” (CLAUDE_CODE_STOP_HOOK_BLOCK_CAP raises the cap).29 That ends a loop that has stopped making progress; it does not end a Ralph loop that keeps calling tools, so the iteration cap still matters.
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, say “use a workflow,” or include the keyword ultracode; Claude writes a JavaScript orchestration script, in which agent() spawns a subagent with optional JSON-schema outputs, pipeline() runs one per item in a list, parallel() runs a set at once, and plain await/loops/conditionals hold the control flow; a runtime executes it in the background. /effort ultracode goes further: Claude “plans a workflow for every substantive task in the session,” and such a session “reaches a session or weekly limit sooner than the same work with it off.”16 “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, per the docs:16
| Limit | Value |
|---|---|
| Concurrent agents | Up to 16 by default, fewer with fewer CPUs; CLAUDE_CODE_WORKFLOW_MAX_CONCURRENT_AGENTS sets 1 to 256 (v2.1.269+) |
| Agents per run | 1,000 (“Prevents runaway loops”) |
Items in one parallel() or pipeline() call |
4,096 |
| Mid-run user input | None |
Scripts saved to .claude/workflows/ become reusable slash commands. A run resumes from saved agent results when Claude relaunches it, but a failed agent “runs again, and so does every agent the script starts after it, even ones that completed,” and a run you background or exit mid-flight “doesn’t continue on its own.”16
The signature topology is fan-out / refute / converge: independent finders, then adversarial verifiers prompted to refute each finding, iterating until answers survive. Anthropic now ships an instance of it: the built-in /deep-research workflow “Fans out web searches on a question across several angles, fetches and cross-checks the sources it finds, votes on each claim, and returns a cited report with claims that didn’t survive cross-checking filtered out,” and when its verifiers can’t check a claim, “the report lists that claim as unverified instead of counting it as refuted.”16 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 (added as a research preview in v2.1.32, February 2026; the docs now say “Agent teams are experimental and disabled by default”): a team lead plus teammates who “work independently, each in its own context window, and communicate directly with each other.” That makes 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 put machine checks between a teammate and “done”: TaskCompleted exit code 2 blocks completion, and TeammateIdle exit code 2 keeps a teammate working.17 Two behaviors to know before switching it on: while agent teams are enabled, “a subagent that Claude names launches as a teammate, so teams can form even when you didn’t ask for one,” and “A teammate can’t approve a permission prompt or supply consent on your behalf.”17
Routines — loops that outlive your laptop
A cloud scheduled task (formerly a routine) is “a saved Claude Code configuration: a prompt, one or more repositories, and a set of connectors, packaged once and run automatically,” executing on Anthropic-managed cloud infrastructure or on your organization’s self-hosted environment.18 The old name survives where renaming would break things: the web address (claude.ai/code/routines), the /routines alias for /schedule, and the /fire API path. Three trigger types, combinable: a schedule (1-hour minimum for a recurring cadence, or a one-off run at a set time), API fire (POST .../routines/{id}/fire), and GitHub events. Created via /schedule, the Desktop app, or claude.ai/code/routines. A run’s session starts in auto mode unless auto mode is unavailable; a classifier allows or blocks each action, and the run stops to wait in cases such as an action that prompts even in auto mode (an ask rule) or repeated blocks. That is exactly why the docs’ caveat is load-bearing: a run’s outcome says “how the session ended, not whether Claude completed the work your prompt describes, so open the run and read its transcript to see what happened.”18 Two fixes since September show the gap is real: until v2.1.286, runs whose cloud session never started showed as Succeeded, and until v2.1.302, runs showed “as Completed after their cloud session stopped unexpectedly.”36 The same release stopped a run that failed partway from being rerun from the start, “which could repeat work such as posting the same report twice,” a reason to make fired work idempotent.36
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 From a session connected to Remote Control it also reaches your sessions on other machines (v2.1.225+) and in the cloud. For waits between loops, the notify_when_idle input (v2.1.236+)36 asks a session on this machine for one notice when it next goes idle or exits, and Claude Code subscribes “without starting a turn or spending tokens in the watched session.”19 Self-hosted runners (v2.1.224, Team/Enterprise) execute cloud sessions and cloud scheduled tasks (formerly 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; a teammate spawned while the lead is in plan mode sends its plan for approval, and Claude Code approves it automatically; the lead reviews it only if you switch a running in-process teammate into plan mode (
Shift+Tab); the graph is data, not code.17 One default changed under this pattern, first in v2.1.233:34 the task-tracking tools (TaskCreate,TaskGet,TaskUpdate,TaskList,TodoWrite) are now “available by default only on Opus 4.7, Sonnet 4.6, Haiku 4.5, and earlier models,” a default set that applies from v2.1.268.38 Agents without them “coordinate through messages instead of the shared task list,”17 so on a current model in an ordinary local session the task list isn’t there unless you opt in; background and cloud sessions get the tools on every model.38 Opt in withCLAUDE_CODE_ENABLE_TODO_TOOLS=1,--allowedTools TaskCreate, or a--toolslist that names them. An exported variable does not reach a split-pane teammate, so to give one the tools, start the lead withclaude --settings '{"env":{"CLAUDE_CODE_ENABLE_TODO_TOOLS":"1"}}'.38 - 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, starts from one tip: “Give Claude something it can run that comes back pass or fail. Once it has that, it can keep going on its own and you don’t have to watch.” The rungs then run from Claude deciding to the harness enforcing: a prompt line (run the auth tests after, and keep going until they pass) → a /goal condition that “a separate model checks against the conversation after every turn,” which “matters for long background runs, where Claude sometimes ends a turn with a progress summary while items are still open” → a Stop hook, “enforced by Claude Code (the harness), so the turn doesn’t end until the typecheck passes or the block limit is reached” → review “By someone who didn’t write the code,” where /code-review “reviews the diff in a fresh subagent that never saw your conversation. It isn’t swayed by the reasoning that produced the code.”29 The evidence norm attached: “ask Claude for evidence: the command it ran and its output, or the screenshot,” because “For a session you weren’t watching, it’s also the only evidence you have.”29 Adversarial refutation, the rung this ladder used to end on, now lives in the workflows docs, whose example prompt asks a workflow to “adversarially verify each finding before reporting it.”16
The same doc sorts every instruction into what Claude decides and what Claude Code enforces. Three of its rows are a loop’s stop, budget, and merge rules:29
| Non-deterministic (Claude decides) | Deterministic (Claude Code enforces) | |
|---|---|---|
| When it’s done | A request for evidence, /goal, /code-review |
Tests, typecheck, a Stop hook, CI |
| How much it spends | Effort level, Claude’s own pace | --max-turns or --max-budget-usd with -p, a spend limit you’ve set |
| Who has the last word | Claude’s summary of what it did | Branch protection, a person who approves the merge |
An unattended loop needs an entry from the right-hand column in every row; the left-hand column is all a loop has when nobody wrote one. The doc also retires a prompt habit: lines like “keep going, loop until done, don’t be lazy” are “more likely to cause over-work than fix a stall,” and “for runs nobody’s watching, /goal or a Stop hook enforces it.”29
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 One of those walls has since moved: as of v2.1.234, a session continues automatically when a claude.ai usage limit resets (the autoContinueAtUsageLimit setting; toggle off in /config → “Continue automatically at usage limit”).3437 The scope is narrow. “Automatic continue is on by default in interactive sessions signed in with a claude.ai subscription”; Claude Code does not start the wait on its own for “A reset more than 24 hours away,” such as a weekly limit; exiting Claude Code ends the wait; and Claude Code “doesn’t offer the wait at all” in “Background sessions and -p runs,” which covers headless Ralph and claude -p "/goal ...".37 Inside a qualifying session, loops follow it: a paused /goal resumes at the reset,9 and since v2.1.271 a workflow run waits out the limit instead of failing its agents, at most twice per run.16 An overnight loop that stays in an open interactive session can now outlast the cap; one that runs headless or in a background session still stops at it. That makes the budget controls below more important, not less. 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, the Stop-hook cap of 8 blocks with no tool call between them;29 cloud scheduled tasks (formerly routines): 100 scheduled runs per hour per account, 30 Run now or API runs per hour per task18 |
| Runaway spend | --max-budget-usd (halts background subagents at the cap, v2.1.217+; v2.1.299 fixed a mod keeping a headless run going past it),36 per-phase budgets; the Large workflow warning (over 25 agents or 1.5 million projected tokens) and workflowSizeGuideline, both advice rather than caps16 |
| Unattended permission creep | Auto mode’s classifier-gated permissions; cloud scheduled tasks’ connectors (every connected connector is included by default, so remove what a task doesn’t need);18 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. Cloud scheduled tasks ship this as the default: “Claude pushes its work to a branch prefixed with claude/ unless your prompt directs it to push to another branch,” and GitHub branch protection or rulesets decide where a run can push.18 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.
No loop input counts as consent. Four documented rules line up: a message from another session “never counts as your consent”;19 a teammate “can’t approve a permission prompt or supply consent on your behalf”;17 a cloud scheduled task’s fired prompt “can’t act as approval or consent for actions during the run,” and text sent with an API fire “arrives wrapped in a <routine-fire-payload> block that labels it as untrusted data”;18 and in auto mode, the prompt a workflow script passes to agent() “doesn’t count as a request from you” because “Claude Code marks it as text the script computed.”16 Copy the rule into your own loops: text a machine produced is data, and approval comes from a person.
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.
What a controlled study says about harness components
Most harness advice, this guide’s included, comes from practitioners changing one thing at a time in production. A September 2026 study from UMass Amherst, Emory, UNC Charlotte, and Zoom did it under control: a purpose-built harness “whose execution loop is fixed while three components are varied: planning, action space, and context management,” run across “176 matched settings spanning five context-management strategies, four context-window budgets, and targeted ablations of planning and action space” on SWE-Bench Verified and Terminal-Bench 2.1 with four open-weight models, three Nemotron-3 sizes and Mistral-Medium-3.5-128B.35 Its four findings, in the authors’ words:
- “Context management becomes increasingly valuable as the context-window budget tightens, with most of its benefit coming from preventing context-overflow failures.”
- “Staging rule-based elision before LLM-based summarization provides the strongest overall efficiency among the context-management strategies, whereas making elided content recoverable adds machinery that models rarely use and yields no accuracy gain.”
- “Planning shifts from an accuracy scaffold for weaker models to a cost saver for stronger models, with little change in accuracy.”
- “Predefined tools improve performance for models with weaker bash proficiency, whereas bash-capable models can operate effectively with a bash-only interface and achieve substantially lower cost, especially on command-line-centric tasks.”
On my reading, three of those land directly on loop engineering. Context management is overflow insurance: a long-running loop should budget its window and elide bulky tool output before it summarizes anything, and it can skip building recall machinery the model will not use. Planning is a cost dial for a capable model rather than an accuracy lever, which is worth knowing before adding a planning phase to a loop that runs a strong model. And the bash-only result is the exec/model split one level up: when the actor is capable, fewer and larger actions cost less. The caveats are the study’s own. Four models, two benchmarks, and a harness built for the experiment rather than any shipping agent, so the results transfer as directions, not as settings.35
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. Anthropic ships a small version of the idea: a
loop.mdfile replaces bare/loop’s built-in prompt, and edits to it take effect on the next iteration.12 - 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, or on Desktop scheduled tasks when the machine stays on; cloud fleets are cloud scheduled tasks (formerly routines). Session-bound loops (
/loop) are for work you are present for, or for a backgrounded session.12
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, cloud scheduled tasks (formerly 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-loop plugin (renamed from ralph-wiggum in January 2026) 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 a Claude Code session is running; /ralph-loop to iterate on one task until a completion promise; /schedule to create a cloud scheduled task 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 a local Claude Code session and stops firing when that process exits; a backgrounded session keeps it running. A cloud scheduled task (formerly 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-10-28 | Re-pinned v2.1.234 → v2.1.312; routines renamed, Ralph’s install source moved, verification ladder rewritten. Routines are now cloud scheduled tasks (“scheduled tasks, formerly routines,” in the docs’ words), with the old name kept where the URL, the /routines alias and the /fire API still use it; runs start in auto mode unless it is unavailable; the run-status quote, branch default, connector default, hourly caps and the fired-prompt consent rule come from the current docs. The Ralph plugin has been ralph-loop in anthropics/claude-plugins-official since January 6, 2026; since October 26, 2026 the claude-code marketplace installs it from there, and footnote 14 links the new README. /goal: three verdicts, four clearing errors, retries and pauses (v2.1.269), the capped check-in schedule, the evaluator-reads-only-the-conversation limit, the 4,000-character condition. /loop: background and resume rules, loop.md, the Cloud, Desktop and /loop comparison. Workflows: 16 concurrent is now a default (1 to 256), 4,096 items per call, ultracode, rerun-on-resume rules, /deep-research, usage-limit waits, the Large workflow warning. Agent teams are “experimental”; a teammate’s plan is approved automatically unless you switch a running in-process teammate into plan mode, and then the lead reviews it; TeammateIdle. Task tools rewritten from the tools reference: default only on Opus 4.7, Sonnet 4.6, Haiku 4.5 and earlier, on every model in background and cloud sessions. Auto-continue at a usage-limit reset scoped to interactive subscription sessions; background sessions and -p runs stop at the cap. The best-practices ladder, evidence norm and deterministic/non-deterministic table replace five quotes no longer on the page. Cross-session messaging reaches other machines and cloud sessions; notify_when_idle. Changelog-only, for operators: a resumed session restores an active goal, and goal turns run unattended in auto mode (in Manual mode, Claude still asks before tool calls that your settings don’t already allow); add --output-format stream-json --verbose to watch a headless goal’s progress; stop a fixed-interval /loop by asking Claude to cancel it (Esc stops only a self-paced one); a recurring task can start late by up to half the gap to its next run, 30 minutes at most; a cloud scheduled task without a GitHub connection skips runs for up to 72 hours, then turns off; ~/.claude/workflows/ holds workflows for every project; /verify has Claude build and run the app and look at the result. Verified unchanged: the /goal fresh-model quote, cron limits, Monitor, ScheduleWakeup {stop: true}, the 1,000-agent cap, /ralph-loop syntax and the “primary safety mechanism” quote. |
9, 12, 14, 16, 17, 18, 19, 29, 36, 37, 38 |
| 2026-09-21 | Added “What a controlled study says about harness components” to Cost and Safety Discipline: the Fan et al. component-level ablation (arXiv 2609.20804), its four findings quoted, mapped to overflow budgeting, planning as a cost dial, and the exec/model split, with the study’s caveats stated. | 35 |
| 2026-08-18 | Re-pinned v2.1.224 → v2.1.234, and three loop-relevant changes folded. v2.1.234: /goal self-clears with a notice on unrecoverable turn errors and checks in on background tasks that stall a goal 30+ minutes (CLAUDE_CODE_GOAL_CHECKIN_MINUTES, 0 opts out); sessions auto-continue when a claude.ai usage limit resets (/config toggle) — the overnight-loop-dies-at-the-cap failure mode this guide documented is now mitigated on subscription auth. v2.1.233: task tools off by default on current-gen models (CLAUDE_CODE_ENABLE_TODO_TOOLS=1 restores); agent-teams doc confirms task-tool-less agents “coordinate through messages instead of the shared task list” — caveat added to the agent-teams pattern. Changelog-only: v2.1.232 subagent forking default-on (subagent_type: "fork" inherits full conversation + prompt cache) and @-mention cross-session messaging. Verified unchanged: cron limits, Monitor/ScheduleWakeup semantics, --max-budget-usd, all earlier version anchors. |
34 |
| 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, fetched October 28, 2026: “After each turn, a model checks whether the condition holds”; “completion is decided by a fresh model rather than the one doing the work”; the wrapper-around-a-Stop-hook mechanics and the three verdicts (not yet met, met, impossible); the evaluator “doesn’t run commands or read files independently”; the 4,000-character condition and turn or time clauses; the four errors that clear a goal, retries and pauses (v2.1.269+), and the check-in schedule; 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, fetched October 28, 2026:
/loopmodes, the one-minute-to-one-hour self-paced range,loop.md,CronCreate/CronList/CronDeletelimits, the Monitor tool, self-paced termination viaScheduleWakeup {stop: true}, “Tasks only fire while Claude Code is running and idle,” the background and resume rules, and the Cloud, Desktop and/loopcomparison table. ↩↩↩↩↩↩↩↩ -
Boris Cherny, X post announcing
/loop, March 7, 2026. ↩ -
Anthropic, ralph-loop plugin README, fetched October 28, 2026: Stop-hook mechanics,
--max-iterationsas “your primary safety mechanism,” credit to Huntley, and scoping to verification-heavy tasks. The rename is claude-plugins-official commit 44328beed4, “Rename ralph-wiggum plugin to ralph-loop per legal guidance (#142)” (January 6, 2026). Theclaude-coderepository kept aralph-wiggumcopy until commit 10a5141d, “Install marketplace plugins from claude-plugins-official” (October 26, 2026): “ralph-wiggum is renamed to ralph-loop, its name in the official repository,” and the marketplace “now installs them from that repository, so existing plugin ids keep working.” The old README path inanthropics/claude-codenow returns 404. ↩↩↩ -
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, fetched October 28, 2026: “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”; the
agent()/pipeline()/parallel()API;ultracode; the limits table (16 concurrent agents by default, 4,096 items per call, 1,000 per run); saved workflows as slash commands; which agents rerun on resume; the bundled/deep-researchworkflow; usage-limit waits (v2.1.271+,autoContinueAtUsageLimit); theLarge workflowwarning and size guideline;agent()prompts as “text the script computed” in auto mode. ↩↩↩↩↩↩↩↩↩↩↩ -
Anthropic, Agent teams documentation, fetched October 28, 2026: “Agent teams are experimental and disabled by default”; peer communication; shared task list with dependencies and file claiming; plans approved automatically unless you switch a running in-process teammate into plan mode with
Shift+Tab, when the lead reviews them; theTaskCreated,TaskCompletedandTeammateIdlehooks; named subagents launching as teammates; teammate messages never counting as consent. The launch is the v2.1.32 changelog entry (February 5, 2026): “Added research preview agent teams feature for multi-agent collaboration.” ↩↩↩↩↩↩ -
Anthropic, “Automate work with scheduled tasks” (cloud scheduled tasks, formerly routines; the URL keeps the old name), fetched October 28, 2026: the definition, triggers including one-off runs, auto-mode runs and when they stop to wait, the
<routine-fire-payload>wrapper and the fired-prompt consent rule,claude/branches, connectors included by default, the hourly limits, where the old name still appears, and “These outcomes say how the session ended, not whether Claude completed the work your prompt describes, so open the run and read its transcript to see what happened.” ↩↩↩↩↩↩↩↩ -
Anthropic, Cross-session messaging documentation, v2.1.224, fetched October 28, 2026:
ListAgents/SendMessage, same-machine inbox sockets, sessions on other machines (v2.1.225+) and in the cloud through Remote Control,notify_when_idle, 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, fetched October 28, 2026: “Give Claude something it can run that comes back pass or fail”; the four-rung ladder (prompt,
/goal, Stop hook,/code-review); “ask Claude for evidence”; the deterministic and non-deterministic instructions table; the eight-block Stop-hook cap andCLAUDE_CODE_STOP_HOOK_BLOCK_CAP; the “keep going, loop until done” anti-pattern. ↩↩↩↩↩↩↩ -
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). ↩↩
-
Claude Code v2.1.233 (Aug 14) and v2.1.234 (Aug 17) release notes, plus the agent teams documentation. v2.1.234 verbatim: “
/goalnow clears itself with a notice when a turn dies on an unrecoverable error (e.g. revoked auth, an exhausted credit balance, or a context overflow) instead of staying armed”; “when background tasks keep a goal waiting for 30+ minutes, Claude now checks in on them instead of waiting indefinitely (setCLAUDE_CODE_GOAL_CHECKIN_MINUTES=0to opt out)”; “Claude Code now continues your session automatically when a claude.ai usage limit resets; turn it off in/config”. v2.1.233 verbatim: “Todo/task-tracking tools (TaskCreate/Get/Update/List, TodoWrite) are no longer available on Opus 4.8, Sonnet 5, Fable 5, Mythos 5, and newer models; setCLAUDE_CODE_ENABLE_TODO_TOOLS=1to bring them back”. Agent-teams doc verbatim: “Agents without the Task tools coordinate through messages instead of the shared task list.” All fetched 2026-08-18. The current/goalpage has since widened both/goalbehaviors (four clearing errors, a capped check-in schedule, and0now turning off check-ins and automatic retries; see 9), and the workflows page names the usage-limit settingautoContinueAtUsageLimit(see 16). ↩↩↩↩ -
Run-Ze Fan, Zihao Zhang, Simin Ma, Yebowen Hu, Shouju Wang, Kaiqiang Song, Fei Liu, Hamed Zamani, and Xiaoyang Wang, “An Empirical Study of Harness Design for Coding Agents”, arXiv:2609.20804, submitted September 17, 2026 (UMass Amherst, Emory University, UNC Charlotte; work completed during internships at Zoom Video Communications). Abstract quoted; strategies and settings from Sections 2.3 and 3.1. Models: Nemotron-3 30B, 120B, and 550B and Mistral-Medium-3.5-128B. Strategies: T0 (no context management), T1 (elision), T2 (elision and recall), T3 (summarization), T4 (all three), at 32k, 64k, 96k, and 128k budgets; planning and the action space ablated at 128k with T4; 22 settings per model and benchmark pair. Hacker News discussion at 224 points and 59 comments as of September 21, 2026. ↩↩↩
-
Anthropic, Claude Code CHANGELOG, fetched October 28, 2026. v2.1.286 (September 30): “Fixed routine runs whose cloud session never started showing as Succeeded in the Runs pane, the routine’s page and the sidebar; they now show as Failed.” v2.1.299 (October 14): “Fixed a mod that submits a prompt at the end of every turn keeping a headless run going past
--max-turns,--max-budget-usd, an interrupt, or the end of the host’s conversation.” v2.1.302 (October 16): “Fixed routine runs showing as Completed after their cloud session stopped unexpectedly, and as Cancelled when archived before they started, instead of failed” and “Fixed a scheduled routine run that failed partway being run again from the start an hour or more later, which could repeat work such as posting the same report twice.” Newest release at fetch: v2.1.312 (October 27, 2026). v2.1.236: “Addednotify_when_idleto cross-sessionSendMessage: ask another Claude Code session on this machine to send one notice when it next goes idle” (quoted to the clause before the entry’s dash). ↩↩↩↩↩ -
Anthropic, Interactive mode documentation, “Wait for a usage limit to reset”, fetched October 28, 2026: “Automatic continue is on by default in interactive sessions signed in with a claude.ai subscription. Requires Claude Code v2.1.234 or later.”; the wait ends when “You exit Claude Code”; it is not started on its own for “A reset more than 24 hours away”; it is not offered in “Background sessions and
-pruns”; and the/configtoggle, Continue automatically at usage limit, with theautoContinueAtUsageLimitsetting. ↩↩↩ -
Anthropic, Tools reference, “Task tool availability”, fetched October 28, 2026: the tools are “available by default only on Opus 4.7, Sonnet 4.6, Haiku 4.5, and earlier models”; the opt-in routes (
CLAUDE_CODE_ENABLE_TODO_TOOLS=1,--allowedTools,--tools); “In background sessions and in cloud sessions, Claude Code provides the same tools on every model, listed or not.”; “The default set described here applies in Claude Code v2.1.268 and later.”; and theclaude --settingsroute for split-pane teammates. ↩↩↩↩