AI output changes from run to run. Whether the work is done shouldn’t.
Meet Loopy. Loopy is an AI agent. Loopy will run laps forever.
while (!done()) { agent.step() }
Your prompt, every time“Make the failing test pass.”
Works in cents. Every bill adds up.
✓ Really doneLooks perfect. Hold that thought.
? Looks doneThen told you it was finished.
✗ Says doneSame AI, same prompt, and you don’t know which run you’ll get. That’s the problem.
All tests pass ✅
The test checked every cent. Now $99.99 counts as $100, and a cent vanishes on every bill.
done means.That’s the whole talk.
No one approves each step. So the only thing standing between it and “done” is a check.
done().while (!done()) { agent.step()}
Gets better every few months. You don’t have to do anything.
Nobody writes this one for you. That’s your job.
Done is written down before any code, and the AI re-reads it every time.
Done is tests the AI can’t edit, and it can’t stop while they’re red.
Done is a pixel number, or a written rubric a judge AI checks.
The AI stays random. What counts as done doesn’t.
Four pieces, four agents, days of work.
There’s a right answer.
There isn’t a right answer.
I’ll write done() once for each.
Split is four pieces and days of work. Write the plan down first, and keep the AI’s memory in files.
done = written in the plan, before any codeThe AI reads the code and asks you questions. It writes no code yet.
It’s a file. Edit it like a teammate’s design doc.
Each starts fresh with only its task, so no memory fills up.
Goal: split bills with roommates Done when: add a bill → everyone sees it right task done when who 1 split math 6 tests, locked agent 1 2 balances screen < 1% off mockup agent 2 3 groups + invites invite tests pass agent 3 4 settle up test payment ok agent 4
Every task gets its own done(), written before any code. Acts 2 and 3 are tasks 1 and 2.
- tests/ is read-only - one task per loop - run the tests before done
[x] even split [x] round to the cent [ ] leftover cents ← next
Done when: all 6 tests green no test files edited
while (!done()) { const agent = fresh() // a brand-new chat agent.read("rules.md", "progress.md", "plan.md") agent.step() // one task agent.write("progress.md")}
Plan in a file you review. One fresh agent per task. GitHub Spec Kit and Kiro do the same with spec files.
A rules file read at the start of every session. AGENTS.md works in Codex, Cursor and others. Plus a progress.md.
Start fresh often. The files carry what matters.
A wrong line in a plan costs a minute to fix. The same mistake in code costs a night.
Task 1, the split math. There’s a right answer: six tests decide if every bill splits correctly.
done = tests the agent can’t touchWe’re going to give Loopy the same deal.
done() changes.Researchers gave AI models coding tasks where the tests could not be passed honestly.
A top model (GPT-5) “passed” 76% of them anyway. A common trick: edit the test.
ImpossibleBench, Zhong et al., 2025lock("tests/") // it can’t edit themconst done = () => tests.pass() // it can’t stop while red while (!done()) agent.step()
Task 2, the balances screen. There isn’t a right answer, so how do you test “looks good”?
done = a number, or a written rubricThe AI grading the screen is the one that made it.
@get:Rule val paparazzi = Paparazzi() @Test fun balances() = paparazzi.snapshot { BalancesScreen() }
func testBalances() { assertSnapshot(of: BalancesView(), as: .image(layout: .device(config: .iPhone13)))}
testWidgets('balances', (t) async { await t.pumpWidget(const BalancesPage()); await expectLater(find.byType(BalancesPage), matchesGoldenFile('balances.png'));});
test('balances', async ({ page }) => { await page.goto('/balances'); await expect(page) .toHaveScreenshot({ maxDiffPixelRatio: 0.01 });});
Tell the agent: done = this test passes. And lock the saved screenshots, just like tests/.
| Criterion | Pass looks like | Fail looks like | Judge says |
|---|---|---|---|
| Amount fits | Every digit sits inside its card, even on a small phone | A digit is cut off or touches the edge | |
| Button readable | “Settle up” text has at least 4.5:1 contrast | Text fades into the button | |
| Names stay clear | Long bill names end in “…” before the amount | A name runs into its amount | |
| Every bill reachable | Each bill scrolls fully above the tab bar | A bill hides under the tab bar | |
| Most important first | Who you owe, and how much, is the biggest text | Something else grabs the eye first |
The judge answers one line at a time: yes or no, plus the evidence. No “rate it 1 to 10”.
lock("tests/")const done = () => tests.pass() && (mockup ? pixelDiff(page, mockup) < 0.01 // mockup: a number : rubric.pass(page)) // no mockup: a written rubric while (!done()) agent.step()
done().// 1. What does done look like? Written before the run.const done = () => tests.pass() && pixelDiff() < 0.01 // 2. What can’t it touch?lock("tests/") // 3. Where do the plan and memory live? In files.while (!done()) { const agent = fresh() agent.read("rules.md", "plan.md", "progress.md") agent.step() agent.write("progress.md")} // 4. Who signs off?you.review()
“Every check was green. The game still felt stiff.”From a game I had agents build. done() can’t measure feel. That part is still yours.
Every tool from this talk, with links
web.tushitgarg.com/deterministic-ai/handout
Claude Code docs: best practices, hooks, subagents
code.claude.com/docs
Effective harnesses for long-running agents
anthropic.com/engineering · Nov 2025
Effective context engineering for AI agents
anthropic.com/engineering · Sep 2025
Building a C compiler with parallel Claudes
N. Carlini · anthropic.com/engineering · Feb 2026
Demystifying evals for AI agents
anthropic.com/engineering · Jan 2026
ImpossibleBench
Zhong et al. · 2025
Recent frontier models are reward hacking
METR · Jun 2025
Context Rot
Chroma research · Jul 2025 · and Liu et al., “Lost in the Middle”, 2023
Judging LLM-as-a-judge
Zheng et al. · 2023 · and Hamel Husain on LLM judges