Designing AI Coding Loops That Actually Converge
Most AI coding workflows stall because developers give feedback like "make it better" and let the same model grade its own work. This method replaces that with a mechanical review loop that any team can script, cutting the iteration tax that makes autonomous coding feel like babysitting.
A login module build shows how to design a coding loop that avoids the three classic failure modes: false passes, endless refactoring, and structural drift. The core mechanism is three cards—pass criteria, feedback format, and stop conditions—each defined before generation begins. Pass criteria must be machine-verifiable (compilation, state observation, persistence tests), never adjectives like "good." Feedback must cite file, line, problem, and severity so the agent knows exactly what to fix. Stop conditions combine a quality gate, a convergence check, and a hard round limit so the loop always terminates. An independent review agent, not the generating agent, judges compliance to prevent self-grading blind spots. A tiered deliverable checklist locks core file structure while allowing justified additions, stopping the structural drift that makes each round a rewrite of the last.
The self-review blind spot is the same failure mode as letting a student grade their own exam; separating generation and review is the cheapest way to raise output quality without touching the model.
Structural drift—where each round rearranges the codebase—is a convergence killer that most loop designs ignore, but a simple file checklist stops it.
The calibration mindset flips the typical debugging instinct: when the loop fails, the design is wrong, not the AI. The criteria contain clauses the model cannot satisfy, and those clauses need rewriting.