concept · created Jul 12, 2026 · updated Jul 12, 2026

loop-engineering

#agent-engineering#claude-code#agent-loop#autonomy

Loop engineering — designing agent loops instead of prompting individual turns. The term circulated on X with no agreed meaning; the Claude Code team’s definition, from 2026-07-12-loop-engineering-getting-started: loops are agents repeating cycles of work until a stop condition is met, classified by trigger, stop criteria, driving primitive, and task fit.

The four-type taxonomy

LoopTriggered byStops whenYou hand offPrimitive
Turn-basedUser promptClaude judges done / needs contextThe checkVerification skills
Goal-basedManual promptGoal met OR turn capThe stop condition/goal + evaluator model
Time-basedTime intervalCancelled, or work completesThe trigger/loop (local), /schedule (cloud)
ProactiveEvent/schedule, no human livePer-task goal; routine runs until offThe promptAll of the above + dynamic workflows + auto mode

The rows form a hand-off ladder: each type delegates one more piece of what the human was doing — first the verification check, then the decision that it’s done, then the decision to start, and finally the prompt itself. Not every task needs a complex loop; start with the simplest pattern that fits (2026-07-12-loop-engineering-getting-started).

Relation to the wiki’s existing loop pages

  • agent-loop — the base cycle (gather context → act → verify → repeat) is what the turn-based row names; the taxonomy is about who supplies the loop’s trigger and terminator, not the loop body. The “five control patterns” on that page are orthogonal composition shapes; /goal’s evaluator-model cycle is the Evaluator-Optimizer pattern productized.
  • verifier-loop — the whole ladder rests on verification: turn-based loops improve by encoding manual checks as skills; goal-based loops need deterministic exit criteria (“number of tests passed”, “score ≥ 90”) precisely so the evaluator isn’t judging “good enough” by taste. Same rule as that page’s diagnostic: if you can’t articulate done, the task isn’t loop-ready.
  • ralph-wiggum-loop — the source’s “use a second agent with fresh context for code review” advice is this pattern’s core insight (a reviewer not influenced by the main agent’s reasoning), stopping one step short of the full loop-until-all-reviewers-satisfied shape.
  • long-running-agents — proactive loops are the productized form of what that page builds by hand (Initializer/Coding-Agent splits, externalized state, released-in-order autonomy). /schedule + /goal + auto mode is the vendor packaging of trigger + acceptance + permission.
  • harness — a loop is only safe to leave running when the harness rows are filled: acceptance (goal criteria), boundary (auto mode’s permission scope), signal (verification skills), fallback (turn caps, /workflows stop).

Operating discipline

Two sections of the source read as the loop-engineering counterpart of harness discipline:

  • Quality is a property of the system, not the run. Keep the codebase clean (the agent follows existing patterns), make docs reachable, give the agent quantitative self-verification, review with a fresh-context second agent — and when a result misses the bar, encode the fix into the system (skill, rule, verifier) for all future iterations rather than patching the instance.
  • Token budgets are loop design inputs. Right-size primitive and model per task (model-and-effort-selection — “among the biggest levers on what a loop costs”); set explicit success/stop criteria; pilot before large runs (dynamic workflows can spawn hundreds of agents); replace deterministic reasoning with scripts; match polling intervals to the watched system’s rate of change; inspect with /usage, bare /goal, /workflows.
  • claude-code — the loop primitives are product surface on the entity page.
  • multi-agent-orchestration — dynamic workflows (orchestrating triage/fix/review agents per report) are the productized orchestrator-workers pattern.
  • agent-evaluation — the evaluator model grading a stop condition is a runtime grader; deterministic criteria are the fix-the-eval-first instinct applied to loops.

Referenced by 10

2026-07-12-claude-model-effort-level 2026-07-12-loop-engineering-getting-started harness-why-it-matters-now agent-loop claude-skills model-and-effort-selection ralph-wiggum-loop verifier-loop anthropic claude-code
esc