From Prompt Engineer to Loop Engineer: How Anthropic’s New Workflow Operates

The article explains how Anthropic’s engineers have replaced manual prompt writing with automated "loop" workflows using Claude Code and Codex, detailing the required conditions, core modules, practical examples, and common pitfalls for building effective AI‑driven code loops.

AI Engineering
AI Engineering
AI Engineering
From Prompt Engineer to Loop Engineer: How Anthropic’s New Workflow Operates

From Prompt Engineer to Loop Engineer

Claude Code author Boris states that Anthropic now processes 100% of its pull requests and 80‑90% of code reviews with Claude Code, using the /loops feature instead of manually writing prompts.

What Loop Engineering Is

Loop engineering automates the repetitive cycle “write prompt → wait → edit prompt → wait” by creating a self‑running system. The leverage shifts from who writes the best prompt to who designs the most effective autonomous workflow.

The loop assigns work to an AI agent, checks the result, records the state, and decides the next step. Both Claude Code and Codex support this pattern with minimal differences.

After adopting loops, Anthropic engineers claim a merge volume eight times higher than in 2024; the company acknowledges the numbers may be overstated but confirms a genuine shift in leverage.

Four‑Condition Test Before Building a Loop

Task repeats at least weekly – the loop’s setup cost must be amortized over multiple runs.

Results can be automatically verified – test suites, type checks, or build tools are required to detect failures without manual diffing.

Token budget can absorb waste – loops repeatedly read context, retry, and explore, burning tokens even if no usable code is produced.

Agent has advanced engineering tools – it must be able to read logs and execute code in a reproducible environment.

Who Benefits and Who Should Stay Away

Teams with large amounts of repeatable, machine‑checkable work and ample budget.

Codebases that already have comprehensive test suites.

Teams accustomed to asynchronous collaboration and multi‑agent workflows.

Solo developers on free‑tier plans.

Projects lacking automated verification.

Teams whose bottleneck is review capacity rather than typing speed.

Five Core Modules of a Loop

Automation Trigger – the heartbeat

Define a timed or event‑driven start. In Claude Code use /loop for scheduling and /goal for termination; Codex offers similar settings in its automation panel.

> /loop 30m /goal All tests in test/auth pass and lint is clean.
  Scan src/auth for new failures, propose fixes in claude/auth-fixes,
  open draft PR when goal condition holds.

▲ Claude
CronCreate(*/30 * * * * : auth quality loop)
Stop condition: tests pass + lint clean (verified by checker)
✓ Scheduled. Will continue past intermediate completions until /goal condition is met by independent checker.

Worktree – avoid file‑level conflicts

When multiple agents run concurrently, they can clash on the same file. Using Git worktrees gives each agent an isolated directory while sharing repository history. Claude Code exposes a worktree interface; Codex has it built‑in.

Skills – persistent project knowledge

Store project conventions, build steps, and prohibitions in a SKILL.md file so every loop run can read them automatically.

name: ci-triage
description: Classify CI failures by root cause (env, flake, real bug,
  dependency, infra), draft fixes for the easy ones, escalate the rest.
---
# CI triage skill

## Classification rules
- env: missing secret, wrong env var, infra not provisioned.
- flake: passes on retry without code change.
- bug: deterministic failure tied to recent commit.
- dependency: failure tied to a version bump.
- infra: timeout, OOM, runner issue.

## Fix patterns
- Auth tests → check src/auth/middleware first
- Database tests → verify migration applied in CI env
- E2E tests → check selectors against the latest UI snapshot

## Never do
- Disable failing tests — always file as escalation instead
- Modify CI config without human approval
- Touch src/payments/ or src/billing/ (in claude/permissions.md)

## State
Update STATE.md after each run: file paths checked, classifications,
PRs opened, items escalated.

Connectors – bridge to real tools

Using the MCP protocol, connectors let the loop interact with issue trackers, databases, test APIs, and Slack. Both Claude Code and Codex support MCP, so a single connector works for both platforms. The most valuable connectors are GitHub, Linear/Jira, Slack, and Sentry.

Sub‑Agents – separate writing and checking

Split responsibilities: one agent generates code, another validates it. This mirrors Anthropic’s 2024 “evaluator‑optimizer” pattern. Both Claude Code and Codex allow custom sub‑agents, typically an explorer, an implementer, and a verifier.

Avoiding Token Black Holes

Common failure modes include unchecked token burn, missing verification gates, and premature exits (the “Ralph Wiggum” loop). Mitigate by enforcing objective stop conditions such as passing tests, successful builds, or clean lint results.

State File – the loop’s backbone

A persistent state file records completed actions, in‑progress work, and next steps, preventing the AI from forgetting between runs.

# Loop state · ci-triage

## Last run
2026-06-09 03:30 UTC · 7 failures classified, 3 fixes drafted, 4 escalated

## In progress
- claude/fix-auth-token-refresh — tests passing locally, awaiting CI
- claude/fix-flaky-payment-webhook — retry pattern applied, monitoring

## Completed today
- claude/bump-axios-1.7.4 → merged (CI green, deps loop verified)
- claude/lint-fix-pass-june-9 → merged

## Escalated to humans
- src/billing/refund.ts — tests failing in 3 ways, root cause unclear
- ci/staging-runner — infra timeouts, not a code issue

## Lessons learned (write here, not in chat)
- 2026-06-08: PowerShell hits TLS 1.2 issue on this Windows runner. Use bash.
- 2026-06-07: tests/e2e/checkout requires Stripe webhook secret in env. Skip if missing.

## Stop conditions met since last review
- /goal "all tests pass + lint clean" achieved on commit 3a7b8c1 at 02:14 UTC

Build a Minimal Viable Loop First

Start with four pieces: an automation trigger, a Skill, a state file, and a verification gate. Run the loop manually, then encapsulate each part, finally schedule it. Skipping any step leads to failure.

The key metric is the cost per usable change, not raw token consumption. If the pass‑rate falls below 50 %, the loop likely hurts productivity.

Final Thoughts

Leverage in AI‑assisted coding has moved from prompt craftsmanship to system design. Loops are powerful but only for teams that meet the four preconditions; otherwise, the cost outweighs the benefit. Begin with a small loop, iterate, and retain human oversight to avoid hidden technical debt and security risks.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

prompt engineeringsoftware developmentAI automationClaude Codeloop engineeringagent loops
AI Engineering
Written by

AI Engineering

Focused on cutting‑edge product and technology information and practical experience sharing in the AI field (large models, MLOps/LLMOps, AI application development, AI infrastructure).

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.