Model choice and routing
Different steps in a loop need very different capabilities. Routing helps, but cheap per token is not cheap per task.
A loop isn't one kind of work. Planning a refactor, running a test, deciding whether a goal is met and noticing that nothing changed since the last heartbeat need very different amounts of intelligence. Running all of them on the strongest model is expensive and quota-bound; running all of them on the cheapest is a false economy.
A plausible routing table
| Loop component | What it needs |
|---|---|
| Planning, spec expansion | Strongest reasoning model |
| Task execution | Strong coding/reasoning model |
| Goal evaluation (judge) | Small, inexpensive model, or no model |
| Progress classification ("did anything change?") | Small model or deterministic logic |
| Independent review | Strong model with fresh context |
| Routine monitoring (heartbeats) | Small, fast model |
| Recovery from a complex failure | Strong model |
This mirrors what the tools do. Claude Code's /goal judge defaults to Haiku; Hermes lets you route goal_judge to a Flash-class model (docs); Anthropic recommends smaller, faster models for routine proactive loops and the strongest model for judgment calls (Getting started with loops).
The cheapest model call is the one you don't make
If the question is "did the tests pass?", read the exit code. Only escalate to a model when the answer genuinely needs judgment.
Open-weight models in loops
Cheap open-weight models are a natural fit for high-volume loop steps. Mid-2026 comparisons (OpenRouter, Developer's Digest, Creative Tim, Telnyx) suggest a split:
- Flash tier for routine steps. GLM-5.3-Flash and DeepSeek V4.1 Flash at around $0.15/M input tokens.
- Stronger open models for planning and long-horizon work. GLM-5.2 tops one open-weight index; Kimi is positioned for long sessions and sub-agent orchestration, but costs considerably more per task.
secondary reporting Prices and rankings change monthly, so check current rate cards.
Why cheap per token isn't cheap per task
- Retries. A model that needs 30 attempts can cost more than one that needs 3. Cost per task depends on how many attempts a model needs (Particula).
- Token appetite. Some cheap models are verbose, so budget above the raw rate (BetterClaw).
- Failure cost. A weaker model that confidently declares "done" creates review work for a human, which is the most expensive resource in the loop.
- Caching. In loops, cache-hit pricing can matter more than list price (Fastino).
Model upgrades change the harness
A good harness for one model generation can be overbuilt for the next. Anthropic simplified its planner/generator/evaluator harness when moving to a stronger model, dropping the per-sprint evaluator (Anthropic). The reverse also happens: fallbacks to an older model can bring back weaknesses. Notebookcheck reported that, per the Claude Fable 5.2 system card, requests handed to an older fallback model were more vulnerable to prompt injection (Notebookcheck). secondary reporting
Further reading
Context, state and memory
Long runs collect noise, compaction loses information, and work has to survive resets and crashes. These are related problems with different fixes.
Security of unattended loops
Loops remove the human who might notice a problem. Unattended runs plus tools, untrusted input and memory is the classic setup for prompt injection.