AI agents

A model can’t grade its own homework

What I learned building kmare-code, a coding-agent harness from scratch: the model is the brain, but the harness decides whether the work is actually done.

Mayank Raj·Oct 2026·2 min read

Every coding agent, whether Claude Code, Codex or the one I built, has two very different parts. The model is the brain: it reads code, plans and writes. On its own it can't touch a file, run a program or remember what happened five minutes ago. The harness is the body around it: what the model gets to see, which tools it can use, and how its work is checked.

Agent = model + harness. Swap the brain, keep the body.

I built kmare-code to understand the harness half properly. The most useful lesson was about checking.

The problem: the author is a bad reviewer

Ask a model to write code and then ask the same conversation whether the code is correct, and it will usually say yes. It has seen its own reasoning and is primed to agree with it. Early versions of my harness would cheerfully report "done" on code that didn't run.

Three roles instead of one

So kmare-code splits the work across three roles, each its own conversation:

Plannersteps, criteria Generatortools Evaluatorfresh context Done fail: here's why
A failed check goes back to the generator with the reason; the loop stops after a set number of rounds.

A failure goes back to the generator with the evaluator's reason, and the loop runs again, up to a fixed number of rounds so a stuck task gives up instead of spending forever.

Guides before, sensors after

A harness steers the model at two moments. Guides act before: the system prompt for each role and the project's own rules file. Sensors act after: they check whether something actually worked. The best sensor isn't another model's opinion; it's reality. Give kmare-code a test command such as pytest -q and the evaluator runs it. A failing exit code fails the round immediately, without spending a model call on judging it.

Tools are the only hands

The model never touches your machine directly. It asks for a tool (read, write, run), and the harness decides whether to allow it. Writes and commands ask for approval unless you opt out. That one boundary makes the agent both safer and easier to debug, because every effect it had is in the tool log.

Any provider, same harness

Because the roles talk to a small common model interface, the same harness runs on Anthropic, OpenAI, Gemini, Ollama and others, plus an offline mock for tests. You can even mix them: a cheap model to generate and a stronger one to evaluate.

The headline lesson carries beyond coding agents. Whenever a model's output matters, have something other than the author check it, ideally something that runs the code rather than reads it.

More writing

Durable reminders with TemporalHow a “tell me when the match starts” feature becomes one small, crash-proof workflow instead of a cron job, a table and a pile of retry code. Issuing a policy without losing a stepPayment succeeded, the insurer's API timed out. How a chain of small, idempotent queue steps keeps a purchase from getting stuck or happening twice.