Essay
Building an agent harness: fix the repo before you tune the prompts
An agent harness is guardrails plus orchestration around coding agents. What I learned leading an agentic SDLC, and why the codebase matters more than the model.
Essay
An agent harness is guardrails plus orchestration around coding agents. What I learned leading an agentic SDLC, and why the codebase matters more than the model.
I led SpotDraft’s agentic software development lifecycle. If another engineering leader asked me whether to build something similar, my first answer would be: fix the repository before you tune a single prompt.
Agents fail in the same places new engineers fail. They cannot find the module. They put business logic in the wrong layer. They ignore the shared test setup. They open one pull request that should have been three. A better model reduces some of that. A codebase that teaches its own conventions removes most of it.
That is the half of the work nobody demos. It is also the half that decides whether agents become part of how a team ships, or stay a private habit in a few editors.
“Harness” gets used loosely. I use it to mean two things around the model: guardrails and orchestration.
Guardrails are the rules and checks that keep agent output inside the team’s standards. They cover conventions, layer boundaries, test expectations, PR size, and what a reviewer will reject.
Orchestration is the workflow that routes work through the lifecycle with a check at each step:
requirement and acceptance criteria → planning → task breakdown → implementation → small pull requests → review → automated testing → validation → merge-ready PR.
The target is explicit. “Generate a PR” is too low a bar. The target is a pull request a human can stand behind and merge.
Without the harness you get what most teams already have. Engineers use coding agents in private, with a ticket in one window and an agent in another. The pull request still needs the review comments the team has left for years. Usage goes up. The development system does not improve.
We treated “agent-ready” as a property of the repository. The model was the smaller variable.
Root instructions became an index, not a documentation dump. Detailed context moved into scoped files next to the modules that actually change. Engineering conventions (architecture, testing, PR size, data rules) lived in one central place. Business flows lived with the domain they describe. An agent should navigate from the index to the right context. It should not reread the same framework lecture in every folder.
The rules came from review comments, not from a style guide someone wished the team followed. I took recent review feedback and turned the repeated points into rules. Then we ran real implementation tasks against those rules and reviewed the agent output ourselves. Every miss went back into the rules.
That loop is the whole method. If the same review comment appears twice, the rule is incomplete.
The workflow has to be the default path. An engineer should be able to write a normal engineering prompt and land in the lifecycle without remembering commands or picking the right skill.
If people have to select the right skill, you do not have a lifecycle. You have a menu.
This mattered more for adoption than anything else we built. Two things drove wider use. The first was that normal prompts routed in, so engineers did not have to learn a new interface to get the benefit. The second was a clear leadership expectation that new tickets go through the harness. The expectation alone would have produced compliance theater. The routing alone would have produced a nice option few people chose. Together, they made the harness the normal way to work.
The first complaints were specific, which is a good sign. The harness was slower than a raw coding-agent session, and the orchestrator could be better. Those are production-system complaints. You only get them once people actually use the thing.
Slow is not automatically a problem. A flow that asks follow-up questions, writes a plan, and looks for edge cases does work that a fast autocomplete skips. If the extra time is thinking, keep it. If it goes to context thrash or a single long session that cannot isolate steps, fix the system.
Since then the harness has become faster for three reasons:
Review also got better. Pull requests arrive closer to review-ready. Part of that is the rule loop: conventions that used to show up as review comments now apply before the code is written.
Once agents are in the loop, they need tools: the ticketing system, the documentation system, and the product itself. The obvious move is to let each team wire up its own. That works until several products and agents depend on the same tools, and every new tool risks breaking someone.
The pattern I would keep is one shared gateway for agent tools. Standing it up is easy. Letting a team register a tool without breaking every consumer is the hard part. Three rules help:
Part of my job is also to say when this layer is the wrong abstraction. An agent that needs a tool catalog is a different problem from a deterministic script with an owner. Glue enough tool servers together and nobody can explain a failure. Skip the layer entirely and the harness cannot reach the systems where the work already lives.
If implementation drafts get cheaper, specification quality gets more expensive. If tests can be generated, deciding what to trust gets more expensive. If pull requests arrive faster, review design gets more expensive.
I have moved my own review time toward architecture, contracts, risks, and high-context decisions. Implementation quality moves through peer and tech-lead review. A harness makes that split mandatory. A manager who still inspects every diff will drown. A manager who never looks at the new workflow will ship confident nonsense.
People development does not go away. Engineers still grow through the same progression: task ownership, project ownership, technical judgment, organizational ownership. An agent can draft the spec. It cannot own the decision. If the important call still routes through me by default, the engineer does not own the work yet, however the PR was generated.
I like building reusable things. Internal platforms, developer portals, public API docs, and now an agent harness come from one instinct: stop paying the same tax in twelve places. A harness applies that instinct to how engineering happens. If it only lives in one champion’s editor, it disappears when the champion changes teams.