Logo
FrontierNews.ai

Loop Engineering Is Reshaping How Developers Use Claude Code: Here's What You Need to Know

Loop engineering represents a fundamental shift in how developers interact with AI coding tools: instead of prompting Claude directly, developers now write loops that prompt Claude and verify the results automatically. This approach separates the worker (the AI model writing code) from the judge (a separate model checking if the work is correct), eliminating a critical failure mode where AI agents ship bugs without noticing them.

What Exactly Is Loop Engineering?

Loop engineering breaks down into three distinct operations that most developers have been collapsing into one concept. Understanding the difference between each is where the real design power lives. The verb you choose determines which tool you reach for and what happens when the work is done.

  • Goal: Keep working until a specific outcome is achieved, then stop automatically. Claude Code sends the condition and transcript to a separate verification model (Haiku by default) that acts as a judge, returning yes or no with reasoning. The worker does not grade its own homework.
  • Loop: Keep repeating a task while you are actively watching. In Claude Code, this is the /loop command, which runs only during your open session and dies when you close it. It can run on a timer (5 minutes, 30 minutes, 2 hours) or self-pace based on output.
  • Routine: Keep working while you are gone. In Claude Code, this is /schedule, which runs on Anthropic's cloud infrastructure, survives your machine being closed, and can be triggered on a cron schedule, GitHub webhook, or API endpoint.

The distinction matters because conflating these three approaches leads to either leaving a hands-on loop running into an empty room or pointing an unsupervised routine at a task that needed human oversight.

Why Does Separating the Worker From the Judge Matter So Much?

The single most important idea in loop engineering is this: the worker does not grade its own homework. A separate model does. This is not a minor implementation detail; it is the core insight that prevents AI agents from confidently shipping broken code.

When you use /goal in Claude Code, the process works like this: Claude writes code and takes an action, then a separate, smaller, faster model (Haiku) evaluates whether the condition has been met. If the answer is no, Claude reads the judge's reasoning and takes another turn. If yes, the goal auto-clears and the run stops. This feedback loop continues until the judge confirms success, not until Claude thinks it is done.

"I don't prompt Claude anymore. I have loops running that prompt Claude and figuring out what to do. My job is to write loops," said Boris Cherny, who built Claude Code.

Boris Cherny, Creator of Claude Code

What Loop Patterns Are Developers Actually Running in Production?

The most common loop pattern combines a builder role and a checker role. The builder writes code and implements the next item on the task list, while the checker runs tests, type checking, and linting, then reports exactly what broke. They pass work back and forth until the build is green and the checker has nothing left to report.

A more advanced pattern, described by Addy Osmani, involves running the coding agent plus an advanced model plus a verifier, feeding it tasks, and removing bottlenecks as you go. The verifier is the part most developers skip, and without it you are just trusting the agent to be correct. This pattern is what Osmani calls "loop engineering," building on the principle that you should be designing loops that prompt your agents rather than prompting them yourself.

Peter Steinberger runs a version of this on a tight timer while he works. Every five minutes the agent does one small, verified piece of upkeep. Crucially, what to clean is the agent's call, not a hardcoded task list, which means the loop adapts to what actually needs attention.

How to Set Up Your First Loop in Claude Code

  • For a goal-based loop: Use /goal followed by a verifiable end state, such as "/goal all tests in test/auth pass and the lint step is clean." You can check status with a bare /goal and clear it with /goal clear. You can also bound it with a turn cap, for example "or stop after 20 turns."
  • For a hands-on loop: Use /loop with an interval like "/loop 5m check the deploy" to run every 5 minutes, or use /loop without an interval to let Claude self-pace the delays. Press Esc to cancel while it waits. A bare /loop with no prompt runs a built-in maintenance pass (git and PR triage plus cleanup).
  • For a scheduled routine: Use /schedule with a cron expression, such as "/schedule daily PR review at 9am." Routines run on Anthropic's cloud, clone a fresh copy of your repo each run, and work on claude/-prefixed branches. Manage them with /schedule list, /schedule update, and /schedule run.

One critical trap: there is no /routine command in Claude Code. The scheduler is /schedule. In OpenAI's Codex, the equivalent is Automations in the Codex app, which supports daily, weekly, or custom cron schedules with results landing in a Triage inbox.

What Are Claude Code Artifacts, and How Do They Fit Into This Workflow?

Claude Code artifacts are a separate but complementary feature launched in June 2026. An artifact is a live, interactive web page that Claude Code publishes from your session to a private URL on claude.ai. It updates in place as your session continues, and you share it from a button in the page header.

The key distinction is that artifacts are "a capture of work, not an application." They are one self-contained page with no backend, cannot store what you type into a form, cannot call an API when someone views them, and cannot serve more than one route. That constraint keeps artifacts cheap to produce and safe to share, and stops them from quietly becoming production apps nobody is maintaining.

Artifacts are currently in beta and available only on Team or Enterprise plans. They require signing in to claude.ai via /login, using Anthropic's API only (not Amazon Bedrock, Google Vertex AI, or Microsoft Foundry), and cannot be enabled if CMEK, HIPAA, or Zero Data Retention policies are active. They are accessible from the Claude Code CLI or desktop app (version 1.13576.0 and later).

Common use cases for artifacts include walking a reviewer through a pull request with diffs annotated inline and color-coded by severity, rendering a dashboard from data your session already pulled, laying out several options side by side (like layouts or API shapes), keeping an investigation timeline that fills itself in while a long task runs, and running a license or dependency audit as a browsable page instead of a JSON dump.

How Does Claude Code Integrate With Other AI Models and Services?

Claude Code is increasingly becoming a hub for connecting to other AI services and tools. Anthropic's Cowork, described as "Claude Code for everything else," works autonomously with your computer, local files, and applications to accomplish complex tasks. Through integrations like Composio Connect, Cowork can securely access external services like Mistral AI without sharing account credentials directly with the agent.

The Mistral AI integration via Composio provides 54 tools for actions including text generation and completion, summarization and paraphrasing, question answering and information extraction, content classification and sentiment analysis, and conversational AI and dialogue management. The integration uses the Model Context Protocol (MCP), which provides structured and secure access to your Mistral AI account so your agent can perform actions on your behalf.

Setting up these integrations is straightforward: in Claude Desktop, click Customize in the left sidebar, select Connectors, click the plus icon, add the custom connector URL, authorize in your browser, and then ask the agent to connect to the service or give it a task related to that service. The agent will prompt you to authenticate and authorize access.

What Are the Two Failure Modes That Turn a Clever Loop Into a Money Fire?

The guide on loop engineering identifies two critical failure modes that can cause loops to consume tokens and money without producing value. The first is leaving a hands-on loop running unattended, which happens when you set up a /loop command but forget it is session-scoped and dies when you close your session. The second is pointing a "while I sleep" routine at a task that needed you watching, which happens when you use /schedule for something that requires human judgment or intervention.

To avoid these failures, the guide recommends treating loop engineering as a working field guide and confirming exact command behavior in the official documentation before leaving anything running unattended. Loop features in Claude Code move fast, and the specific syntax and behavior can change.

The broader principle is that loop engineering is not about automating everything; it is about automating the right things with the right verification. As the guide puts it: "Stop being the thing in the loop. Write the goal, the loop, or the routine, give it a budget and a way to check itself, and go decide what to build next. That is loop engineering. Everything else is plumbing".