Building a harness

A harness is a system built around an AI model that gives it access to tools and resources, allowing the model to actually do something. Most people build one by copying a feature list. They look at Claude Code or Codex, write down what it has, and build the same features, maybe with their own tweaks: memory, compaction, sub-agents, MCP.
Devi is the harness we built at realfast. It is a red-team sidecar: it runs beside our coding agents and checks each change they make for security bugs, along with how to fix them. Devi started the same way. A couple of weeks in, it had many features. Then we chose to delete all of it in one commit.
The features worked. But they were built around a core that did not. The model still could not finish a real task on its own.
That left us with one question: how do you build a harness right?
Our answer is to derive and build it from first principles. Start from what a model can and cannot do. Build only what follows from that. Add a feature only when a real task shows you need it.
What a model can do
So we start with the model. A model does one thing. It reads text and writes text.
It cannot open a file. It cannot run a command. It does not remember the last call. Each time, you send it all the text again, and it writes a reply.
Give it a task, like “review this change for security bugs.” The best it can do is write the next step: “show me the file Login.kt.” It cannot open that file itself.

The core
So something else has to act on that step. That is the harness.
A harness gives the model tools and resources. A tool is a small program the harness runs for the model, like “read a file” or “search the text in a file”. A resource is what a tool works on, like the files in your code. Devi has six tools. None of them can change a file.
Each reply from the model is one of two things: a tool request, or the final output.
If the reply is a tool request, the harness runs that tool. It adds the tool’s result to the text and sends all the text back to the model. The model replies again. This repeats until the reply is the final output.
That is the core of a harness. Nothing else is needed for the model to finish a task. Everything else is a feature.
Devi’s rebuild started here, one piece at a time: a single call to the model, then text that grows with each call, then one tool, then the repeat.

What real tasks expose
In theory, the core can now finish a task. But real tasks are harder. They need many tool requests. They run for minutes, hours or even days, based on their complexity and ambition. And the text sent to the model grows with every tool result. That text is called the context. Every model has a limit on how much context it can read.
So once the core runs real tasks, problems show up. Some you can guess. Many you cannot. We added a feature only when a real run showed a problem, never because another harness had it.
Measure before you build
Building from first principles means you measure before you build. The data decides what goes into the harness, not what you think it needs. That way every feature fixes a real pain point. We do this in three steps, in a cycle.
Find a real problem. Real problems only show up in real runs, so devi had real users early. Internal adoption was key: our own projects used devi and reported what broke. We made each fix reach them in under 15 seconds, with no new release and no one to install it. The faster a fix arrives, the sooner the next real problem shows up.
Build only what fixes it. Before anyone writes code, they name what breaks today without it. If the honest answer is nothing, it is not written.
Delete what is stale. Code goes stale when the problem it fixed is gone. To find it, delete a piece of code and run every check. If every check still passes, the code was stale, so it stays deleted. Git keeps the history, so nothing is lost.

Keeping the rules from drifting
A cycle like this only works if it runs every time. Most of devi is written by AI coding tools, Claude Code and Codex, with us directing them. So the cycle is written down as rules those tools read before they work: a CLAUDE.md file, rule files, skills, and checks that run on every change.
One rule often ends up in several of these files. When one file changes and the others do not, the tools get two different instructions. Nothing fails. The rules drift apart, and the tools start skipping steps.
So we built a tool to stop the drift, called principles, and open-sourced it. (Here “principles” means the rules the coding tools follow, not first principles.) It keeps a map of every file that carries each rule. When one of those files changes, it asks the coding tool to read them together and fix what disagrees. Devi maps six of its rules this way. One of them is “run every check before every change”, which the stale-code step depends on.
Let real tasks write the feature list
Devi started with a feature list, and we deleted it. Today every feature in it has a real task behind it, or is being measured against one. It reviews each code change for security bugs for a few cents.
You can check your own harness the same way. Write down every feature it has, or every feature you plan to build. Next to each, write the real run that needed it. If there is nothing to write, remove the feature, or wait until a run needs it.
Then start from the core: a model, its tools and resources, and the repeat until the final output. Put real tasks through it early. Keep the rules that hold the cycle in one place, or map them with principles.
Do not copy the feature list. Let real tasks write it.