Part 1 of 15 · The House That Diligence BuiltNext: Fix the Plan Before the Agent Writes the Code →

The House That Diligence Built

A field guide for AI engineers, told as a house: foundation, framing, plumbing, wiring, inspection, locks, roof and windows, built in order.

AdminPublished 6 min read

Most of the advice about coding agents arrives one tip at a time. Keep the context small. Write evals. Don't let the agent mark its own homework. Each tip is right, and a list of them is hard to act on, because nothing tells you which one comes first or how they hold each other up.

I started thinking about it as a house instead. A house has parts that depend on each other in a known order. You don't hang windows before there's framing to hold them, and you don't move in before the wiring has been inspected. The same is true of the environment an agent works in.

This series is that house, one part per article. Pick any part below to see what it means and where to read about it.

Pick any part of the house

Part 2 of 12

Foundation

How the codebase and the tools are shaped. Agents copy whatever they find, crooked or straight.

Building code, not signs

There's one idea under every part of the house.

A sign on the wall asks people to be careful. A breaker trips whether they read the sign or not. Most of what we tell agents is signs: a rules file, a line in the prompt, a comment that says "don't do this here." The agent follows a sign most of the time. A breaker it follows every time, and so does the next agent, and so do I.

So every time I correct an agent, I ask how that correction can become a breaker. Can the API make the mistake impossible? If not, can a lint rule fail the build and say what to do instead? Only when neither is possible does it go in the prose, and the prose should stay short.

A few swaps I've made, or am making:

The signThe breaker
A rules-file line: "never import server code into client components."A lint rule that fails the build and names the right module.
A content check that a comment can satisfy.Every check must fail when its pattern appears only in a comment or a string.
A report the tool wrote about itself, saying "passed."A report that carries the command, the exit code and a hash of the input, so a stale or forged one fails.
A prompt line: "don't send private data out."Once untrusted text is in the session, every outbound tool needs a person to approve it.
A skill file the agent reads in full before its first step.An index up front, and each step's instructions loaded when the agent reaches it.
Docs that name commands nobody re-checks.A test that every named command exists, with dated exceptions that expire.

The order of effort is an inverted pyramid. Most effort goes into the codebase itself. Next come static checks: lint, types, tests. Then verification, where the agent runs the thing and shows evidence. Prose sits at the narrow bottom, for real judgment calls only.

The parts, in build order

Blueprint. Agree on the plan before anyone pours concrete. A bad line of code is one bad line. A bad line in a plan becomes a hundred. I review a short structured plan before the agent builds, and I spend less time on the diff afterward.

Foundation. The codebase is the biggest input to every agent, and agents copy whatever they find. Your Codebase Is the Biggest Prompt covers turning corrections into checks. Deep Modules Are How Agents Find Their Way covers the shape of the code: few, deep modules with simple interfaces. Give Your Agent Fewer Tools covers the tool list, which is part of the foundation too.

Framing. The static layer that holds the shape. A green check proves what the tests cover, and when the agent wrote both the code and the tests, that can be very little. Framing only holds if each check can fail.

Plumbing. Context is what flows through the house. A session does its best work while its window is mostly empty, so the always-on prompt stays small, detail loads when a step needs it, and a fresh session takes over before the pipes back up.

Electrical. Evals are the wiring and the breakers. The best ones come from incidents you've already had, scored by a judge you've checked against people, and run in tiers so every change gets a quick check and every release gets the full one.

Inspection. An inspector who runs the house instead of reading about it. When agents write most of the code, review moves from the diff to the evidence: a recording, screenshots, the test that failed before the fix.

Front door. Who gets in and what can leave. An agent with private data, text an attacker can write, and a way to send data out is one prompt away from leaking. Cut one of the three, in code.

Roof. One hosted agent that covers everyone, so using it doesn't start with a setup document. Shared identity per environment, one install, and a cost and security sign-off before you open it up.

Windows. How people see in and work with the agent. The best interface leaves the person knowing more than before, not just less needed.

Rooms. I stopped building a new agent for every job. There's one general agent underneath, and the rooms are the skills I furnish it with.

Move-in. Getting real work through the door. The agents that hold up are mostly ordinary software, with the model called only where something needs judgment.

Build order. Automation multiplies whatever the house already does. If one session makes slop, a hundred unattended ones make a hundred times as much. Build the house, then move in.

How you know the house is sound

I don't trust a feeling here, so I watch a few numbers.

  • Repeat review comments go to zero. Any comment I've made twice is a missing breaker.
  • The prose gets shorter. When a check covers a rule, the rule comes out of the rules file. The note on the fridge should shrink over time.
  • Reverts stay flat as volume climbs. More pull requests with the same revert rate means the foundation is holding.
  • Tokens before the first step go down. A smaller always-on prompt, with quality holding, means the plumbing works.
  • Evals fail when they should. A suite that never goes red isn't measuring anything.
  • People who never open a terminal use the agent. That's when the roof and windows are done.

None of this is new engineering. Lint rules, tests, deep modules, least privilege, a plan before the build. What's new is that agents copy whatever they find at a speed no team ever wrote code before, so the diligence pays off faster, and skipping it costs more.

Next in The House That Diligence Built · Part 2 of 15Fix the Plan Before the Agent Writes the Code →