← Back to Blog

Loop Engineering Is Missing a Layer

Everyone's talking about loop engineering.

Andrew Ng mapped 3 loops: the agentic coding loop (minutes), the developer feedback loop (hours), and the external feedback loop (days). Boris Cherny built Claude Code around it. Peter Steinberger made OpenClaw iterate autonomously.

The loops are real. The progress is real.

But here's what nobody in that conversation is designing: the control layer.

One comment on Ng's post nailed it: "We are not short of loops. We are short of control."

Three Problems Nobody Is Solving

1. Correlated Failure

If the same model writes the code AND tests the code, the reviewer has the same blind spots as the generator. The loop closes. It looks green. The tests pass. The bug ships.

This isn't a theoretical risk. It's the default behaviour of every agentic coding loop that doesn't use diverse evaluation.

2. Token Cost Compounding

Every loop iteration re-reads context. One developer measured his agent's token bill: 79% was context being re-read, not new generation. Faster loops don't mean cheaper loops — they mean the bill scales with the iteration count.

This isn't token minimisation. It's token management — knowing when the cost of another iteration exceeds the value of the improvement.

3. No Stop Condition

A loop without an exit condition isn't engineering. It's expense. The agent doesn't know when "better" has become "different." It just keeps iterating, optimising for "looks done" instead of "is correct."

The Answer: Intelligent Gates

I've been building a framework for this. Four layers, each adding a different type of control to the loop:

Layer 1 — Deterministic Gates. Policy-as-code. The stop conditions and bounded failure modes that the loop needs before it starts. Linting, tests, DLP, compliance checks. Pass/fail. No opinions. Runs in seconds.

Layer 2 — Diverse Evaluation. If AI reviews AI, use different models, different prompts, different evaluation criteria. Break the correlation. The reviewer must not share the generator's blind spots.

Layer 3 — Scoped Human Judgment. Not "human reviews everything." Human reviews the things the loops can't evaluate — architectural decisions, product bets, ethical calls. The human's job shifts from "check every line" to "own the decisions that have consequences."

Layer 4 — Production Feedback + Cost Governance. Observability, token budgets, drift detection, rollback. The loop that monitors all the other loops — including what they cost. Because agreement is not truth; only production is reality.

The Hard Part

Loop engineering is the right idea. But a loop without control is just recursion with a dashboard.

The hard part isn't making agents iterate longer. It's deciding what the loop is controlling, how error is detected, and who owns the outcome when it converges beautifully to the wrong answer.

If you're building agentic systems and thinking about this problem, the Intelligent Gates playbook is a one-page checklist you can score your pipeline against this week.

References

  • Andrew Ng — "Loop Engineering" (LinkedIn, July 2026)
  • Boris Cherny — Claude Code: agentic iteration in practice
  • Peter Steinberger — OpenClaw: autonomous agent-driven development
  • Philip Ward — Token cost analysis of agentic coding workflows