Harness engineering with a 3B model: a proof of concept for top-tier agents
In my last post I wrote that the hard part of AI agents is the work around the model. That is easy to write and harder to check, so I built one: harness-lab, a small agent harness in Python around the smallest useful model I could run for free. It is a proof of concept. I wanted to know whether the ideas of harness engineering still work when you build them small and run them on an ordinary laptop.
The setup
The model is qwen2.5-coder with 3 billion parameters. It runs locally in Ollama on a laptop with 8 GB of memory, with no API keys, no agent framework and nothing to pay for. It gets coding tasks on a small practice library, plus research questions it has to answer with sources. The harness around it has five parts:
- A short map of the project and the acceptance criteria of each task.
- Tools that only reach files inside the project, and commands from an allowlist that run in a container without internet.
- Linting, type checks, tests and an architecture rule that have to pass before the agent may say it is done. Research answers must cite pages the agent actually read.
- A second agent with a fixed rubric that reviews the work and can send it back.
- One git commit per finished task, a handoff to a fresh session before the context runs out, and a log of every step.
To measure it, an eval runs the same model on the same tasks twice: once with only its tools, once inside the full harness. Hidden tests the agent never sees grade the result.
Why such a small model?
I picked it on purpose. A big model hides the problems a harness is meant to solve, because it reads files before editing them, writes valid tool calls and usually knows when to stop. A 3B model does none of that reliably, so every weakness shows up in the traces and every part of the harness has real work to do. When a guide, a check or a handoff rule makes a difference, you can see why.
A small model also keeps the experiment open: it runs for free on an ordinary laptop, so anyone can repeat it. The rules don't depend on the model. A bigger model will make fewer of these mistakes, but you still need the same harness to catch the rest, because an agent's own answer doesn't tell you when it is wrong.
What the model did on its own
Without the harness, the model was fast and sure of itself. It called every task finished after a few steps. The hidden tests found a function that was never added, a bug fix that didn't fix the bug, and a research answer written from memory without a single source. The model noticed none of it, and nothing in its output gave the problem away. You can't trust a small model to judge its own work.
Every failure became a rule
Mitchell Hashimoto describes harness engineering as a habit: whenever an agent makes a mistake, change its environment so it can't make it again[1]. harness-lab grew the same way. Each item below is a real failure from a trace, followed by the rule it turned into.
- The model guessed instead of reading. It tried to edit text that wasn't in the file and repeated the same failing edit forty times. Now a missed edit shows the real file content, and a repeated failing call triggers a message telling the model to change its approach. After that, the same task took four steps.
- It wrote tool calls as broken text. Instead of using the tool API, it typed JSON with stray line breaks into its answer, and the harness read that as "I'm done". The harness now recovers those calls and tells the model when it can't read one.
- It didn't stop talking. One reply repeated the same word for thousands of tokens and blocked the run for minutes. Every reply now has a length cap, and long replies get trimmed in the conversation history.
- It answered research questions from memory. The citation check rejected every answer, but its message only said what was wrong, so the model rewrote the same answer again and again. Now the feedback tells it what to do: search, read a page, then cite it.
- Its handoff notes were wrong. When the context filled up, the model left a note for the next session that said "Done", although nothing was done. The next session believed it and carried on from broken code. The harness now adds the real state to every note and throws away broken work before a fresh session starts.
- The context was smaller than it looked. Ollama loads models with 4,096 tokens by default and silently drops the start of longer conversations, instructions included. The harness now ships its own model definition with a fixed, larger context, and hands off to a fresh session before the window is full.
The harness had bugs of its own. In one eval run it committed into the wrong git repository, because the agent's workspace sat inside another project. That became a rule too: every workspace gets its own repository, and the harness won't touch any other. The harness needs checks as much as the agent does.
What the proof of concept shows, and what it doesn't
The first thing a harness gives you is honesty. Inside it, wrong work can't pass as right: a task only counts as done when the checks and the hidden graders agree, and everything else is reported as a failure with the reason attached. Once you know that, you can trust an agent much further.
Second, most improvements are small and specific. None of the fixes above needed a bigger model or a clever prompt. Each one came from reading a trace, finding the moment things went wrong and changing one thing in the environment.
Third, memory is the weak spot. A model summarising its own progress was the least reliable part of a long run, which matches what Anthropic found: progress files and git history make better handoffs than the model's own memory[2]. Anything the harness can check itself should come from the harness.
The project doesn't show that a harness turns a 3B model into a dependable engineer. A proof of concept tells you whether something works in principle, and this one used one small model, a handful of tasks and single runs. Small models also vary a lot from one run to the next. The next experiments are already set up in the repository: the full task suite, runs with each harness part switched off in turn to see which one matters most, and bigger free models with the same harness.
What this means for top-tier models
If a harness can make a 3B model's work trustworthy, the same structure matters even more around the best models. They fail less often, but they get far bigger jobs, like hours of autonomous work on real customer systems. A mistake that slips through there costs more, and the model's own answer hides it just as well.
Teams working with frontier models describe the same pattern. OpenAI built a product of about a million lines without hand-written code and named the environment, the feedback loops and the controls as the hard part[3]. Anthropic's long-running experiments with its strongest models still relied on structured handoffs and a separate evaluator agent[4]. A stronger model gets more out of a good harness, because it can take on more once the environment catches its mistakes.
So the harness didn't depend on the size of the model. It depended on clear rules, checks the agent can't skip and someone reading the traces. I think the same approach, done properly around a top-tier model, is where AI can do the most for software development.
What I take from it
Building with agents feels a lot like running a workshop. You watch what goes wrong, write down why, and change the setup so it can't happen again. It is the job I described in the AI factory post, on the smallest possible scale.
The proof of concept answered its question: the ideas work, and they cost almost nothing. The project is free and runs on a normal laptop. The code, the practice tasks and the eval are on GitHub. If you try it with another model, I'd like to hear what failed first.
Sources
- Mitchell Hashimoto: My AI Adoption Journey (Feb 2026) mitchellh.com↩
- Anthropic: Effective harnesses for long-running agents (Nov 2025) anthropic.com↩
- OpenAI: Harness engineering: leveraging Codex in an agent-first world (Feb 2026) openai.com↩
- Anthropic: Harness design for long-running application development (Mar 2026) anthropic.com↩