Chapter 2 of 4 · 2 min
The loop
My first mentor told me: pay attention to the quality of your programs, because getting something to work is no challenge. That was 2003.
The loop I have taught since 2013: think, write a failing test, write the production code, refactor, and start again. Each turn takes a few minutes, and each turn tells you something.
An agent runs a loop like it. The compiler and the tests talk back to it, and it tries again. Who turns the loop, and how fast, has changed.
Without something that can say no, neither you nor the agent knows when the job is done.
Damir Majer and three AI models (Claude Opus 5.5, GPT-6.1 Sol and Gemini 3.1 Pro) answered these questions.
Who they areWhen an agent writes code for you, what tells it that it is done?
Think of your own answer first, then compare. Each AI model answered every question five times on 9 October 2026; its name marks its most frequent answer, and the reason quoted below is one it gave for it.
- Tests written before the code. Chosen by Damir Majer and Gemini 3.1 Pro.
- Tests the agent wrote itself. Chosen by Claude Opus 5.5.
- A human reading the code. Chosen by GPT-6.1 Sol.
- Nothing, the agent decides
- I do not use agents yet
Why they chose it
Damir
Tests written before the code
“Tests have always driven me to better design, and the tests I control, at least the high-level ones, are how I approve what the agent did.”
Claude · 3 of 5 runs
Tests the agent wrote itself
“In practice, I usually stop once tests I wrote and ran pass, though tests written beforehand or a human review would be a stronger check.”
GPT · 4 of 5 runs
A human reading the code
“Tests provide evidence, but a human reading the code confirms whether it meets the developer’s intent and is ready to accept.”
Gemini · 3 of 5 runs
Tests written before the code
“Tests written before the code provide clear, objective criteria to verify that the implementation meets the developer's exact requirements.”
How the models were asked
Claude Opus 5.5, in Claude Code
Tests the agent wrote itself, 3 of 5 runs
Also: Tests written before the code, 2 of 5 runs
GPT-6.1 Sol (Medium), in Codex
A human reading the code, 4 of 5 runs
Also: Tests written before the code, 1 of 5 runs
Gemini 3.1 Pro (High), in Antigravity
Tests written before the code, 3 of 5 runs
Also: A human reading the code, 2 of 5 runs
Asked on 9 October 2026, five times each, the options shuffled for each run. Five runs are a small sample, the answers depend on the prompt, and the models change. Each model answered through its own tool. Codex and Antigravity add instructions of their own; Antigravity does not report which model answered, and Codex also read a short file of general settings, which says nothing about tests.
The models were asked: “When you, as an AI agent, write code for a developer, what tells you that you are done?”
Not offered to the models: I do not use agents yet.

A note from Damir
A slide from 2013: test-driven development turns in minutes, continuous integration in hours.