I Was Observing When My Agent Built Its Own Harness

Over Christmas I had an agent build me a game from scratch.

My constraints

  • Make it look like code I would write
  • Don't look at any of the code
  • Judge quality from the outside

If I can't look at the code, how do I know it's working?

If I need observability...

so does the agent.

It's writing visual code. Shaders, lighting, physics.

It can't just print() its way through this.

"How do I design the codebase so the agent can succeed?"

What I gave it

  • Clear directory layout
  • Specs that describe what, not how
  • Places to put things: debug-temp/, scripts/

So we had a back-and-forth:

  • "The rendering looks wrong. How would you debug this?"
  • "I could add a screenshot command..."
  • "Do it. What else do you need?"
  • "Frame stepping, input simulation, state dumps..."

The agent designed its own debugging system.

Then documented it in AGENTS.md for next time.

Make room for solutions you didn't anticipate.

The agent needed visual feedback. I didn't build that.

But the codebase had:

  • An extensible build system
  • Command-line args it could hook into
  • A folder for debug artifacts
  • Multimodal vision

So it built:

--debug-script "frames 3; screenshot test.png; quit"

# Test jump pad mechanics
map assets/maps/fjord_jump.map
god on
frames 5

# Teleport near the jump pad
teleport 13.0 7.0
screenshot debug-temp/near_pad.png

# Walk onto pad, wait for jump
input +right
frames 20
input stop
frames 80
screenshot debug-temp/landed.png

quit

It's tempting to write instructions like:

"When debugging visual code, use the screenshot command like this: [exact steps]"

You don't know what solution the model will naturally gravitate toward.

The model has been RL'd on... something.

  • We don't have the training data
  • We don't know what it's optimized for

When you over-prescribe

  • You fight the model's grain
  • You close off better solutions
  • The agent follows suboptimal instructions anyway
  • You become the bottleneck

When you under-prescribe

  • The agent finds solutions that fit its capabilities
  • Sometimes surprising, sometimes obvious
  • Solutions it can actually execute

I didn't say "build a debug script system."

I said:

"Visual changes need validation. Figure it out."

The agent built a 1200-line debug scripting system:

  • Frame control
  • Input simulation
  • State dumps
  • Screenshot capture
  • Named pipe for live injection

Would I have designed it that way?

Maybe not.

Does it work?

Absolutely.

The agent builds tools.

Sometimes it doesn't use them.

When a session fails, feed it back:

"Here's a transcript where you tried to debug X but didn't use the screenshot tool you built. What went wrong? How should the tooling evolve?"
  • Agent sees its own failure patterns
  • Proposes tool improvements
  • Updates AGENTS.md with better guidance
  • The tooling evolves

When the agent isn't using its tools:

  • Prescribe harder — fights the grain
  • Fix it yourself — you become the bottleneck
  • Feed it back — the agent evolves its tools

Only one of those scales.

  • Design agent-first codebases
    Structure for discovery, not prescription
  • Stop over-prescribing
    Describe the problem, set constraints, let it find the approach
  • Feed failures back
    Let the agent evolve its own tools

The tank game was built with pi — a minimal, hackable coding agent.

My advice:

  • Start with the simplest agent loop that works
  • Extend it for your project's needs
  • Let the agent shape its own tooling

github.com/badlogicgames/pi-mono

Thanks

Postscriptum

Code is free now. This changes everything.

This presentation was made fully by an agent — directly to HTML.
The presentation software was built from scratch by an agent.

github.com/mitsuhiko/mini-presenter

Rethink everything.