📄 Engineering Fundamentals for Agent Programming - Reader

For a bit more than a year, I’ve written almost everything with agents. I’ve been referencing AI-written code for over two years, but around 15 to 17 months ago agents got powerful enough that I stopped writing code myself. Now I describe what I want and iterate.

Here is what I think matters when you work this way. Each layer is something I set up once and keep maintaining. The more of it I have in place, the less I need to review at the end.

A clean codebase

This is the cheapest foundation and the one that matters most. By clean, I mean easy to follow, for agents and for humans. There is one clear pattern, and it’s used everywhere. When a new requirement comes in, the agent can extend the codebase by following that pattern.

Modules should also be orthogonal, with no real dependencies between them. Then it’s obvious which module to use, and when a utility function needs to change, it’s clear what to update.

This doesn’t stay true by itself. Agents write most of the code now, and entropy tends to increase, so we need to keep refactoring. I think the human’s job is to keep the codebase’s entropy from exploding.

Static analysis

A formatter, a linter, and a type checker help. They aren’t critical, since agents already do well without them, but setting them up is low-hanging fruit.

Verification that crosses modules

Agents are very good at writing tons of unit tests. Many of them aren’t very useful, and they may still miss the edge cases that matter.

So I set up a verification layer on purpose: tests that run across modules, maybe one or two end-to-end cases, plus a dataset I maintain that really represents production data. That is what really matters.

Write down the domain knowledge

I put domain knowledge in writing: an AGENTS.md and a glossary.

The glossary matters a lot to me. Every time we introduce a new concept, I end up using two, three, or four different names for it. My colleague might use another one. An agent will definitely get confused. So I settle the terminology and write it down.

I also describe the codebase’s layers explicitly: which layer does what, which module owns which part, and the conventions for how things are structured. This helped me most once the codebase got large. A clean codebase guides the agent indirectly, but there is still some misalignment. Writing the structure down closes that gap.

Review less, and auto-merge what earns it

Human review comes last. If I’ve spent enough time on the layers above, there is less left to review.

Recently, every PR gets classified by a Claude Code hook: how confident the agent is, and how critical the change is for production. I was hesitant about auto-merge at first, so I started by only recording the agent’s classification as GitHub labels.

About a month later, I analyzed them. Whenever the agent’s confidence was high and the risk was low, I never added another commit. That convinced me I could just merge those. The verification layer already tells me the change doesn’t break the pipeline, so if the confidence is high, auto-merge is fine. That rule is a heuristic, not a proof, but it took me one more step toward being really productive.

For the PRs I still review, I go in this order:

  • Confidence. This is mostly an early filter. A very confident PR would usually have been merged already.
  • Risk. What could go wrong, and does that assessment make sense?
  • Reversibility. If it goes wrong, can I undo it? That is a big part of the risk.
  • Evaluation history. I ask the agent to write down how the PR was evaluated. If it was fully evaluated, it’s mostly good to go.
  • The core of the diff. I ask the agent to write out the essential part of the change, and I check whether it feels right.

Move fast, simplify once a week

With a well-structured codebase and guide docs for agents (AGENTS.md, the layer and structure guide, the glossary), I don’t worry much about code slop anymore. The docs already direct the agent, and PR review and simplification steps already run, which slows the growth of entropy.

So I keep moving fast. Once a week, I spend two or three hours looking back at what could be simplified or refined. That’s my preferred workflow these days.

Keep reading

More in Engineering

  1. AI Coding: Programming by Coincidence at Scale

    · 1 min read

    AI lets us pile up code we don't understand faster than ever. Working code is not correct code.

  2. What’s inside that token? JWT explained with a boarding pass

    · 7 min read

    AI-researched

    I built an OAuth 2.0 server with Keycloak for our MCP setup. Here is what a JWT actually carries — issuer, audience, roles — and how we pack our own facts into it: environment, customer, and...

  3. Job Applications with AI: My Cover Letter Generation Agent

    · 1 min read

    The ProblemWriting cover letters sucks. Each one took me 45+ minutes of:

  4. Keycloak Components: Roles, Scopes, Client Scopes, and Audience

    · 7 min read

    AI-researched

    A simple explanation of how Keycloak controls access from an app to an SSH MCP server.

📂 All 14 posts in Engineering