{"id":81742,"date":"2026-06-22T13:27:08","date_gmt":"2026-06-22T13:27:08","guid":{"rendered":"https:\/\/www.europesays.com\/ai\/81742\/"},"modified":"2026-06-22T13:27:08","modified_gmt":"2026-06-22T13:27:08","slug":"claude-code-loop-engineering-stop-prompting-start-designing-autonomous-agent-workflows","status":"publish","type":"post","link":"https:\/\/www.europesays.com\/ai\/81742\/","title":{"rendered":"Claude Code Loop Engineering: Stop Prompting, Start Designing Autonomous Agent Workflows"},"content":{"rendered":"<p>Anthropic&#8217;s Boris Cherny has stopped writing prompts. The creator and head of Claude Code \u2014 Anthropic&#8217;s terminal-based agentic coding tool \u2014 told interviewers in June 2026 that his job had changed: &#8220;I don&#8217;t prompt Claude anymore. I have loops running that prompt Claude and figuring out what to do. My job is to write loops.&#8221; That statement, echoed almost simultaneously by OpenAI engineer Peter Steinberger and then named and structured by Google engineer Addy Osmani in a <a href=\"https:\/\/addyosmani.com\/blog\/loop-engineering\/\" rel=\"nofollow noopener\" target=\"_blank\">widely shared essay<\/a>, crystallized a paradigm shift that developers had been building toward for the better part of two years. The shift has a name \u2014 loop engineering \u2014 and it comes with a warning its most enthusiastic proponents have been careful to include: token costs in autonomous agent loops compound faster than almost any developer expects, and an unattended loop without a verifier is a machine that ships bugs with high confidence.<\/p>\n<p>Understanding why this shift happened requires understanding something architectural about every large language model that does not show up in product announcements: LLMs are stateless. They forget everything between sessions. The agent you prompt today has no memory of the task you prompted yesterday. Every persistent piece of context \u2014 every project rule, every prior decision, every mid-task intermediate result \u2014 must live outside the model, in a file on disk, in a git repository, or in a structured memory document. That constraint is not unique to Claude Code. It is a property of every transformer-based model from every lab. Loop engineering is the systems design response to that constraint: instead of holding the context in your head and manually re-prompting the agent each turn, you build a small system that holds the context externally, decides what to prompt, dispatches the agent, and checks whether the work is done. The leverage shifts from the quality of a single prompt to the design of the system that generates and checks prompts.<\/p>\n<p>Why Prompting One Turn at a Time No Longer Scales<\/p>\n<p>For the first two years of AI coding agents, the standard interaction model was simple: write a prompt, add context, read the output, write the next prompt. The developer held the tool the entire time, one turn after another. That model has an upper bound. For a one-shot task \u2014 write a function, fix a specific bug \u2014 it works well enough. For anything that requires more than a few steps, adapts to feedback, or benefits from running while the engineer is doing something else, the manual turn-by-turn model collapses under its own overhead.<\/p>\n<p><a href=\"https:\/\/thenewstack.io\/loop-engineering\/\" rel=\"nofollow noopener\" target=\"_blank\">The New Stack&#8217;s June 2026 coverage<\/a> of the loop engineering discussion described the progression in developer tooling over the preceding 18 months: prompt engineering gave way to context engineering (ensuring the right information reached the model), which gave way to harness engineering (designing the environment a single agent runs inside), which gave way to loop engineering \u2014 the harness, running on a timer, spawning helpers, and feeding itself. The critical technical distinction that separates a harness from a loop: a cron job runs a fixed script. An agent loop runs a model that reads current state and decides its own next action.<\/p>\n<p>How the Agentic Loop Works: Five Stages and a Sixth That Changes Everything<\/p>\n<p>The architecture underlying every agentic loop traces back to the ReAct framework, introduced by researchers at Princeton and Google in 2022. ReAct interleaved reasoning and action in a repeating cycle: the model thinks about what it needs, takes an action, observes the result, and thinks again. That cycle \u2014 demonstrated to outperform single-pass models on standard task benchmarks \u2014 became the foundation for every modern AI coding agent. <a href=\"https:\/\/arxiv.org\/abs\/2210.03629\" rel=\"nofollow noopener\" target=\"_blank\">The paper<\/a> established the pattern that Claude Code, OpenAI Codex, and every serious agentic tool now implements.<\/p>\n<p>In Claude Code, the cycle runs as follows. The agent receives a prompt with the conversation history and available tool definitions. It evaluates the current state and decides what to do next. If that decision requires a tool call \u2014 reading a file, running a test, editing code \u2014 it issues the call. The result comes back into the context, and the cycle begins again. This continues until the model determines the task is complete.<\/p>\n<p>The six building blocks Addy Osmani identified in his June 7, 2026 &#8220;Loop Engineering&#8221; essay \u2014 which map almost exactly onto Claude Code&#8217;s current command set \u2014 are:<\/p>\n<p>Automations: scheduled triggers that start the loop on their own \u2014 on a timer, a git event, or a continuous integration signal \u2014 so the developer is not the one pushing the button. In Claude Code, \/schedule and \/loop handle this. \/loop runs on a specified interval; without an interval, it self-paces based on output.<\/p>\n<p>Worktrees: isolation so parallel agents do not overwrite each other&#8217;s work. Two agents editing the same file produces the same collision as two engineers committing to the same lines without talking. Claude Code&#8217;s &#8211;worktree flag and isolation: worktree subagent setting each spawn a fresh git checkout that cleans itself up when the agent finishes.<\/p>\n<p>Skills: saved instruction sets that freeze project knowledge so the agent does not re-learn the same context every session. Written as a folder with a SKILL.md file, skills are reusable across sessions and across team members \u2014 institutional memory that does not depend on a single developer&#8217;s prompt habits.<\/p>\n<p>Connectors: Model Context Protocol-based plugins that give the loop access to real tools: GitHub, Slack, Linear, external application programming interfaces. Without connectors, the loop sees only what is in the local filesystem.<\/p>\n<p>Sub-agents: the maker-checker separation. One sub-agent writes the code. A separate sub-agent runs the tests, reads the lint output, and reports what failed. The agent that wrote the code is not the one grading its own work.<\/p>\n<p>Memory: external state that persists across sessions. The most common implementation is CLAUDE.md, a project-level markdown file that Claude Code reads automatically at the start of every session. When an agent makes a repeated mistake, the correct response \u2014 as Cherny described \u2014 is to have the agent write the lesson into CLAUDE.md so the correction propagates to every future session rather than staying private to one chat.<\/p>\n<p>The \/goal Command: What a Separate Verifier Model Does<\/p>\n<p>The specific mechanism that separates a goal-conditioned loop from a simple repeating prompt is the \/goal command, which <a href=\"https:\/\/code.claude.com\/docs\/en\/whats-new\" rel=\"nofollow noopener\" target=\"_blank\">Claude Code added in version 2.1.139 during the week of May 11, 2026<\/a>. When a developer sets a goal \u2014 &#8220;all tests in test\/auth pass and lint is clean&#8221; \u2014 Claude Code does not ask the same model that wrote the code to decide whether that condition is met. It uses a separate, faster model specifically tasked with checking the completion condition after each turn. The agent that built the work and the agent evaluating whether the work is done are different model instances.<\/p>\n<p>Addy Osmani&#8217;s essay was explicit about why this matters: point a loop at something open-ended and it either produces something valuable or it quietly becomes a very expensive machine for generating bad code at high speed. The generator \u2014 the model writing code \u2014 has become extremely capable. The verifier \u2014 the part that decides whether the output meets a real standard \u2014 is where almost every poorly designed loop fails. A verifier that accepts vague success criteria does not fail loudly; it confidently ships work that the next developer has to untangle.<\/p>\n<p>What Claude Code Dynamic Workflows Add to the Architecture<\/p>\n<p>On May 28, 2026, Anthropic launched Dynamic Workflows in research preview alongside Claude Opus 4.8. The architectural change Dynamic Workflows makes is not adding more agents \u2014 it moves the orchestration plan out of the model&#8217;s context window entirely. In previous multi-agent patterns, subagents were dispatched by Claude turn by turn, with every intermediate result accumulating in the shared context window. That accumulation was the binding constraint on autonomous long-running tasks: the context window has a fixed size, and a migration across hundreds of thousands of lines of code could not fit.<\/p>\n<p>In Dynamic Workflows, Claude writes a JavaScript orchestration script for the task at hand. A background runtime executes that script. The orchestration logic \u2014 loops, branching, agent-count decisions, verification passes \u2014 lives in script variables rather than in the model&#8217;s working memory. Each subagent gets a clean, focused context window. According to the official Claude Code documentation, a workflow run can include up to 1,000 total agents with 16 running concurrently. Salesforce has reported completing a migration that previously would have taken 231 days in 13 days using the feature.<\/p>\n<p>The Token Cost of Autonomous Loops: What the Discourse Underweights<\/p>\n<p>Here is what the viral loop engineering discussion largely left out: agent loops do not cost the same as prompts. Every tool call in an agentic loop adds context that is re-sent to the model on every subsequent call. By iteration 20 in a loop with file reads, the cumulative input can exceed 50,000 tokens per call. At Claude Opus 4.8&#8217;s current pricing of $5 per million input tokens, a single late-loop step costs roughly $0.25. A loop running 200 iterations on an open-ended task can cost $80 or more \u2014 compared to a well-scoped single-prompt version of the same task costing under a dollar. <a href=\"https:\/\/leanopstech.com\/blog\/agentic-ai-cost-runaway-token-budget-2026\/\" rel=\"nofollow noopener\" target=\"_blank\">An analysis of 30 production engineering teams<\/a> found that one developer hit $4,200 in API fees over a single weekend during an autonomous refactoring run.<\/p>\n<p>The enterprise evidence is unambiguous. Uber reportedly burned through its entire 2026 AI budget for Claude Code in four months, with per-engineer API costs ranging between $500 and $2,000 monthly and usage rates reaching 95% by April. Microsoft&#8217;s Experiences and Devices division \u2014 responsible for Windows, Microsoft 365, and Surface \u2014 ended most Claude Code licenses in June 2026, with token-based billing consuming the annual AI budget ahead of schedule. <a href=\"https:\/\/www.morphllm.com\/ai-coding-costs\" rel=\"nofollow noopener\" target=\"_blank\">Anthropic&#8217;s own published enterprise figures<\/a> place average costs at $150 to $250 per developer per month at scale, before any optimization.<\/p>\n<p>Addy Osmani was measured in his original essay: &#8220;It&#8217;s still early. I&#8217;m skeptical, and you absolutely have to be careful about token costs.&#8221; The three failure modes he and practitioners flag consistently are: a weak verifier that ships low-quality work with confidence; comprehension debt, where code ships faster than the team can understand it; and cognitive surrender \u2014 accepting whatever the loop returns without judgment. A well-designed loop multiplies a good engineer. It multiplies a bad decision at the same speed, with less of the engineer watching.<\/p>\n<p>Starting June 15, 2026, Anthropic formalized the economics: automated workloads through the Agent SDK, claude -p scripts, and Claude Code in GitHub Actions now bill against a separate monthly credit pool \u2014 $20 for Pro subscribers, up to $200 for Max \u2014 rather than drawing from the same subscription pool as interactive use. When that credit runs out, automated requests stop.<\/p>\n<p>Building a Production-Safe Loop: Four Decisions Before the First Iteration<\/p>\n<p>The difference between a loop that compounds value and one that compounds a billing problem comes down to four decisions made before the first iteration runs.<\/p>\n<p>Define a verifiable success condition. Not &#8220;fix the bugs&#8221; \u2014 &#8220;all tests in \/tests\/unit\/ pass with exit code 0 and no new files created outside \/src\/.&#8221; If the condition cannot be expressed in a way a separate evaluator model can check mechanically, the task is not ready for autonomous execution. The \/goal command requires this: the completion check runs after every turn on a fast, independent model.<\/p>\n<p>Set a budget before starting. The &#8211;max-turns flag caps iterations. Without a cap, a loop running on a vague goal will continue until it hits API hard limits or the monthly credit pool runs out. The Claude Code documentation recommends setting a budget as a production default for any open-ended task.<\/p>\n<p>Separate the maker from the checker. Assign one sub-agent to generate the code and a separate sub-agent to evaluate it against tests, lint output, and specifications. A model that wrote the code and is also asked whether the code is correct consistently over-reports success. The evaluator model in \/goal does this automatically; in custom workflows, it requires explicit design.<\/p>\n<p>Use worktrees for parallel work. When multiple sub-agents touch the same repository, file collisions are inevitable without isolation. Claude Code&#8217;s isolation: worktree setting spawns a fresh git checkout for each sub-agent that cleans itself up after the run. Omitting this in parallel workflows does not just cause merge conflicts \u2014 it introduces unpredictable state where agents overwrite each other&#8217;s changes mid-execution.<\/p>\n<p>Where Loop Engineering Stands in June 2026<\/p>\n<p>The June 7, 2026 discussion that crystallized the term \u2014 Peter Steinberger&#8217;s viral post, Boris Cherny&#8217;s widely circulated quote, Addy Osmani&#8217;s structuring essay \u2014 produced a vocabulary and a set of primitives that now exist as shipping features in both Claude Code and OpenAI Codex. Anthropic&#8217;s Claude Code documentation ships first-party \/loop, \/goal, \/schedule, and \/workflows commands. The pieces that a year ago required writing and maintaining bash scripts indefinitely now ship inside the products.<\/p>\n<p>What has not changed is that loop engineering is a systems engineering discipline, not an AI skill. The model&#8217;s statelessness does not go away with better prompting. Persistent state must live outside the model \u2014 in files, in git, in the CLAUDE.md that teaches today&#8217;s loop what yesterday&#8217;s loop learned. The engineer who moves fastest with loops is not the one who writes the fewest prompts. It is the one who designs the most precise verifier and sets the most specific completion conditions. The leverage moved. The craft did not get easier.<\/p>\n<p>Frequently Asked Questions<\/p>\n<p>What is the difference between \/loop and \/goal in Claude Code?<\/p>\n<p>\/loop runs a prompt on a recurring schedule \u2014 every five minutes, every hour, or self-paced based on output \u2014 and is useful for recurring maintenance tasks like pull request triage or continuous integration monitoring. \/goal is different: it keeps Claude working across turns until a specific completion condition you write becomes true. After each turn, a separate fast evaluator model checks whether the condition holds \u2014 the agent that wrote the code is not the one deciding whether it is done. For tasks where you need autonomous execution toward a specific outcome rather than recurring scheduled work, \/goal is the correct primitive.<\/p>\n<p>Why do agent loops cost so much more than single prompts?<\/p>\n<p>Every tool call in an agentic loop adds context that gets re-sent to the model on every subsequent call. By the 20th iteration of a loop reading files, the cumulative input per call can exceed 50,000 tokens. At Opus 4.8&#8217;s $5 per million input tokens, a single late-loop step costs roughly $0.25 \u2014 and a 200-iteration autonomous session on an open-ended task can cost $80 or more. The June 15, 2026 Agent SDK billing change separated automated workloads onto their own credit pool specifically because flat-rate subscriptions were never designed to sustain agent-level compute consumption.<\/p>\n<p>What is the verifier model in \/goal, and why does it matter?<\/p>\n<p>When a developer sets a goal in Claude Code, the system uses a separate, faster model to check whether the completion condition is satisfied after each turn. The model that generated the code and the model evaluating whether the work is done are different instances. This separation is architecturally important because a model evaluating its own output consistently over-reports success. The verifier encodes the developer&#8217;s standard for &#8220;done&#8221; \u2014 something the code generator cannot reliably supply for itself. Without an independent verifier, a loop can run for many turns producing work that satisfies none of the actual requirements.<\/p>\n<p>Does loop engineering work with tools other than Claude Code?<\/p>\n<p>Yes. The pattern maps almost identically onto OpenAI Codex&#8217;s Automations, \/goal command (added in Codex command-line interface version 0.128.0), worktrees, and skills features. Addy Osmani noted that once you recognize the shape is identical across tools, you stop debating which agent to use and start designing a loop that works regardless of which one you happen to be running. The primitive names differ by tool; the architectural requirements do not.<\/p>\n","protected":false},"excerpt":{"rendered":"Anthropic&#8217;s Boris Cherny has stopped writing prompts. The creator and head of Claude Code \u2014 Anthropic&#8217;s terminal-based agentic&hellip;\n","protected":false},"author":2,"featured_media":81743,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[44026,11386,405,25609,53,3154,182,2798,37389,39928],"class_list":["post-81742","post","type-post","status-publish","format-standard","has-post-thumbnail","category-anthropic","tag-agentic-loop","tag-agentic-workflows","tag-ai-agents","tag-ai-coding-agents","tag-anthropic","tag-anthropic-claude","tag-claude","tag-claude-code","tag-loop-engineering","tag-token-costs"],"_links":{"self":[{"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/posts\/81742","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/comments?post=81742"}],"version-history":[{"count":0,"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/posts\/81742\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/media\/81743"}],"wp:attachment":[{"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/media?parent=81742"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/categories?post=81742"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.europesays.com\/ai\/wp-json\/wp\/v2\/tags?post=81742"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}