Before this one I wrote six technical articles for this blog and verified every claim in them by execution. I compiled PostgreSQL 18 from source, built an API with planted defects, measured collisions over two hundred thousand values, attacked an audit log from the inside.

In that process four errors got past me. I found all four myself, when reverifying, and three of the four got past for exactly the same reason.

That pattern is the article. Because it is not about agents: it is about why correct reasoning produces a false claim, and about the only thing that catches it. Agents merely make it happen faster and in more places at once.

The four failures

One: the FastAPI version. I claimed the change to app.routes landed in 0.141. It landed in 0.137. I only verified it when somebody asked whether the article might mislead anyone. Four versions apart, and a reader on 0.139 would have concluded they were safe when they were not.

Two: RLS failing closed. I wrote that a policy without nullif returns zero rows when the tenant setting is undefined, reasoning from the documentation. The reasoning was impeccable for a freshly opened connection. On execution I found that a setting assigned with set_config(..., true) does not revert to undefined when the transaction ends: it reverts to the empty string. And casting an empty string, ''::uuid, is not NULL — it is a syntax error. Correct for the case I had in mind, false for the one that matters.

Three: the tldr that vanished. I rewrote the content validation schema and left a field out. Zod silently strips what it does not declare, so the summary block disappeared from all six articles and the build stayed green.

Four: a replacement with no assertion. I made four text substitutions in a script. Three carried an assert that the target string existed; one did not. The one without it failed, and it failed silently: the script exited zero having left the file half-edited.

The pattern: in one, three and four there was nothing capable of failing. The reasoning was not bad — the failure is that no assertion existed to contradict it. In two the reasoning genuinely was wrong, and what caught it was standing up a database, not thinking harder.

Why this becomes urgent with an agent

Here is where the subject arrives, and I want to state it without the usual enthusiasm.

All four failures are mine and no agent caused any of them. What changes when the code is generated by something that does not understand why a constraint exists is the scale and the appearance of the failure:

  • A person forgets once; an agent propagates the forgetting across forty files in perfectly consistent style, and the result reads like code somebody already reviewed.
  • The agent optimises for what it can verify. If your suite passes, it is done. And it is right by the criterion you gave it: the problem is that the criterion was incomplete.
  • The diff grows. An eight-hundred-line change of coherent code does not get reviewed; it gets approved. That is the actual mechanism by which most of what should not land, lands.

Which is why the conclusion I found hardest to accept is this: agents do not lower the value of knowing architecture, they raise it. Not because they write worse, but because the bottleneck moved. Writing code stopped being the scarce thing. The scarce thing is deciding what is impossible to violate and expressing it so that a machine can check.

Checkable requirement versus description

The practical difference, with examples from this project:

Not a requirement A requirement
“queries should be efficient” “the subject lookup uses idx_subject; a plan with Seq Scan fails the test”
“handle errors properly” “an unset tenant returns zero rows and raises no exception”
“the code should be clean” (delete it: not verifiable, so it does not belong in a spec)

The test for whether something is a requirement: can you write the test that fails when it is violated? If not, you have specified nothing; you have expressed a wish. And this matters more with an agent than with a person, because a person interprets a wish using their own judgment, whereas an agent interprets it strictly from the text you gave it.

The minimum structure: capability, requirement, scenario

No methodology needed. Three things are: an identifier, a falsifiable condition, and the scenario that falsifies it.

## TI-4 — RLS fails closed on a pooled connection

The policy must survive a connection whose custom setting reverted to the empty string
after a previous transaction committed.

**Scenario:** commit a transaction that set the tenant, then query again on the same
connection without setting it → zero rows, no exception.

That TI-4 identifier is what makes everything else possible. Tests reference it:

def test_rls_fails_closed_on_a_pooled_connection():
    """Covers: TI-4"""

And with that the relationship becomes machine-checkable, which is this article’s artifact.

check_specs.py

A script that walks specs/ for requirement identifiers and tests/ for Covers: references, and fails the build if any are missing. The artifact ships with all four requirements covered; remove the TI-4 test, as its README explains, and you get this:

4 requirements · 3 covered
  [ok  ] TI-1 — No route reaches tenant data without tenant context
  [ok  ] TI-2 — No route returns, deletes or modifies another tenant's rows
  [ok  ] TI-3 — The route enumeration itself is verified
  [MISS] TI-4 — RLS fails closed on a pooled connection

requirements with no test:
  TI-4 — RLS fails closed on a pooled connection
exit code: 1

And it checks the other direction too, which is the one almost nobody implements. I added a test covering a non-existent TI-9:

tests covering requirements that no longer exist:
  TI-9 (referenced by test_isolation.py)
exit code: 1

Both directions matter for different reasons. A requirement with no test is a promise nobody checks. A test covering a deleted requirement is a test whose reason for existing is gone, and that is how a suite accumulates assertions nobody dares remove because nobody remembers what they protected.

With both gaps closed, exit code 0. Sixty-five lines of Python with no dependencies, forty of them code.

4failures that got past me in the six articles I wrote before this one (my own tally)
3 of 4got past, by my own classification, because no assertion existed, not from bad reasoning
2directions the checker verifies: requirement without test, test without requirement

The verification loop, and the part that does not automate

The loop I use, in order and unadorned:

ruff format . && ruff check .
mypy .
python check_specs.py        # every requirement has a test
pytest -q                   # includes the isolation sweep

Each step catches a different class of defect, and the order matters because the cheap ones go first. What is interesting is what none of them catches: whether the change is correct. That is answered by reading the diff, and there is no way to delegate it.

Hence the limit I hold myself to: if a change exceeds roughly four hundred lines, split it. Not for the agent: for the reviewer. An eight-hundred-line diff of coherent code does not get reviewed, it gets approved, regardless of who wrote it.

Context hygiene: past a point, less is more

This runs against instinct, and I have seen it enough times to state it: past a certain amount, more context makes the result worse.

With the whole repository in front of it, what gets diluted is the signal. The agent finds forty similar patterns and takes the most frequent one, which in real code is rarely the best: it is usually the most copied. And if the most copied pattern is the one you are trying to fix, you have just multiplied it.

What works: the task, the relevant invariants and the files involved. Nothing else. And the relevant invariants are three or four, not the whole list — a forty-point rules file is read by nobody — human or model — and its real function ends up being to protect you from criticism rather than to protect the codebase.

What never to delegate

With the reason for each, because a list without reasons does not get respected:

Trust boundaries. Every point where data enters the domain. Not because the agent does it badly, but because the error is undetectable from the inside: the code works, the tests pass, and the failure is only visible if you know where the data came from.

Schema and migrations. An error here does not revert with a commit. And an almost-correct generated migration is worse than a badly generated one, because it ships.

Anything touching a key, a tenant_id, or the audit log. All three share the property that their failure has no repair path.

Adding a dependency. It is the decision that commits the most future with the least discussion.

When not to

If you are exploring — a prototype, a proof of concept, a script that runs once — all this ceremony is a tax on something you are about to delete. Specify when the code will outlive the session that wrote it.

And if your project is one person with fifteen files, the rules file and the requirement-to-test mapping are bureaucracy: you remember everything. They start paying off when you stop remembering, or when somebody else joins — and an agent counts as somebody else, with the twist that it accumulates no context between sessions.

Closing

The frame I started with when working with agents was “how do I get it to write better code”. That turned out to be the wrong question, and the four failures in this article are why: none of them was a generation problem. Three got past because no assertion existed, and one because I reasoned from documentation instead of executing.

I committed all four. And that is precisely what convinces me: if the same pattern shows up four times across six carefully written articles by somebody keeping count, the conclusion is not that more care is needed. It is that care does not scale and assertions do.

The question I now use to review a task before delegating it is not whether the agent can do it. It is:

If it does this wrong, what will tell me, and is that mechanism written before it starts?

If the answer is “I will spot it in review”, the task is not ready to delegate. Not to an agent, not to a person, and not to myself in three months.