// 00 Loop engineering · the masterclass, made interactive

Act evaluate improve, live.

Most people use AI one prompt at a time. Loop engineering builds the jobs you do in your head—evaluation, memory, guardrails, and stopping conditions—into a system that can tell whether its own work is improving.

Source · Babete · loop engineering researchTheme engine · tokens swap, not markup9 parts · 4 architectures · 5 failure modes
ACTTake one narrow action with current context and memory.
⟲ Repeat■ Stop↑ Escalate
// 01The problemWhy one prompt stops working

One prompt eventually stops working.

A strong prompt can impress once. Real work has a quality bar, happens at volume, and must stay consistent long after attention starts to drift.

Job / 01

Evaluation

You judged the output, noticed failure, and named it.

Job / 02

Memory

You carried what failed into the next attempt.

Job / 03

Guardrails

You enforced boundaries: no invented dates and no broken tone.

Job / 04

Stopping

You decided when an answer was ready. The model never could.

→ Without naming it, you were running a loop manually, inside your head.

Prompt

Drafts one reply. Nothing happens if it is weak unless a person notices.

Workflow

Runs a designed sequence: retrieve, check, draft, route.

Agent

Receives an objective and tools; inspects sources and asks when they conflict.

Loop

Evaluates work against a defined standard; failures inform another attempt, passing checks stop, and conflict escalates.

Treat a loop like a new employee with infinite patience and no earned judgment.It evaluates the fiftieth item with the same energy as the first, but cannot decide which failure matters.
// 02AnatomySpec inspector

The nine parts of a reliable loop.

The model handles generation and reasoning. The system around it supplies the controls. Select any part to see it resolved and the matching architecture lines light up.

01 · A measurable state, not an activity

Goal

Reviewing a pull request is an activity. A reliable goal defines completion: inspect every changed file, run the required tests, link failures to evidence, flag security-sensitive changes, then recommend approve, request changes, or escalate.

If the goal is an activity, the loop has no definition of done.
loop.pyAct → observe → evaluate → update → decide
while target_not_reached:
    result     = take_action(context, memory)
    evaluation = evaluate(result, rubric)
    log(result, evaluation)
    if evaluation.passes:
        stop_with_success(result)
    if human_decision_required(evaluation):
        escalate(result, evaluation)
    if budget_exhausted() or progress_stalled():
        stop_without_success()
    memory = update_memory(result, evaluation)
// 03Live runSelf-improving champion loop

The champion defends its title.

The active prompt is the champion. A challenger takes the title only by beating it on a holdout it never studied.

Idle · awaiting run
Champion
—/12Rounds used
0 · 0Promotion · reject
0 minUnattended
$0.00Cost
StandbyPropose → test → compare → promote or reject → log → repeat.
    // 04PatternsArchitectures worth stealing

    Four loop architectures worth stealing.

    The same building blocks support several distinct patterns. Choose the architecture that matches the task and the evidence you can collect.

    The Champion Loop

    Self-improving

    The active version keeps its title until a challenger beats it on a holdout it never studied.

    Sequence
    Propose → test → compare → promote or reject → log → repeat.
    Stop
    Target reached · budget spent · three rounds without promotion.

    The Saturation Loop

    Research

    Process interviews, tickets, or surveys in batches; attach original quotes and sources to every evolving cluster.

    Sequence
    After each batch: new cluster, changed cluster, or merely added weight?
    Stop
    Two consecutive batches teach nothing new · hard cap of ten.

    The Builder-Critic Loop

    Adversarial

    One model builds a document. Another attacks assumptions, edge cases, metrics, costs, and irreversible decisions without rewriting it.

    Sequence
    Each objection ends Fixed or Accepted, with the reason recorded.
    Stop
    No high-impact objections remain · critic repeats resolved objections.

    The Product Experience Loop

    Experiential

    A fresh browser session attempts a real product task and scores the full journey instead of one component.

    Sequence
    Pick the weakest screen · change one thing · restart fresh · run the task again.
    Stop
    Journey reaches target · two passes without improvement.
    // 05Failure modesFive ways loops fail

    A loop can complete every round without crashing—and still become less useful.

    Expand each failure. Every one is a specification problem, not a model problem.

    A score can rise while useful work rots. Restate the real objective, use a multidimensional rubric, and inspect behavior direction as well as a number.

    // 06EscalationLet the loop earn autonomy

    Autonomy is granted on observable evidence—never on stated confidence.

    Stage 01

    Shadow

    The loop runs on real work but cannot affect anything. Compare what it would have done with the human decision and turn each mismatch into a rule.

    Boundary at this stageRead-only. No sends, writes, or merges; output is a logged shadow decision.
    Evidence checklist✓ Required tests passed✓ Sources retrieved✓ Claims match approved records✓ Known category✓ No escalation trigger
    Q1

    Can the result be checked?

    Clarify what good work looks like before automating it.

    Q2

    What happens if it is wrong?

    Automate what is checkable. Escalate what is consequential.

    Q3

    Can you define the stop before starting?

    An unattended system needs an operating policy before it runs.

    // 07ManifestoSix rules for reliable loops

    Six rules for reliable loops.

    01

    Spec before code

    If a specification field is blank, that is design work—not an invitation to hide uncertainty inside a longer prompt.

    02

    One change per round

    One change preserves causality; bundled changes make it impossible to know what helped.

    03

    The holdout is truth

    An improvement-set win is only a rumor until it survives unfamiliar work.

    04

    The champion defends its title

    A tie goes to the active version. Every challenger needs recorded evidence.

    05

    Automate the checkable

    Customers, money, legal commitments, private data, and irreversible changes need a human gate.

    06

    Autonomy is earned

    Shadow, suggest, approve, bounded autonomy—grant it on observable evidence and keep sampling.

    // 08The contractOne-page loop specification

    The one-page loop specification.

    Choose one narrow job you have performed at least three times. Fill this in before building—the preview updates live.

    Input · fill every field or admit the blank

    Launch stage