AI in practice from Performance Metrics

From the engine room #10: Fixed means enforced

Written by Thomas Petersen | Nov 23, 2026, 2:15:00 PM

The rule that has changed the way I work the most is in my own instruction file for the sessions I work with. When a fault is reported fixed, something must enforce the fix: a gate, a test, a sweep or a hook. A paragraph in a document or a line in a prompt is guidance, not a fix. And a session that "fixes" something with text must say so out loud.

It is the rule the other nine parts build on. This part is about the mechanisms that hold it, and ends with what you can take with you without building a runner.

Why the prompt is not enough

At the start I fixed things like most people do. A session did something wrong, and I added a line to the instructions: don't do that. The next session did not do it, and the one after did it again.

That is not because the model is stupid. A prompt is a pile of guidance that competes with all the other guidance in the same prompt, and it grows every time. Every session starts from scratch and reads all of it for the first time. A rule on line 400 weighs less than a rule on line 4, and nobody can see when it stopped working. Worst is the fix that only exists in a file that has not been committed. It reaches no other session.

So the fix is the check that fails next time.

The runner budget

AI code grows by itself. It is always easier to add a branch than to understand whether an existing one can be used. In September the runner grew by about 10,000 lines in 19 days, even though we had rules that temporary flags had to expire.

The budget is a file with three numbers: lines of code in the runner, number of command-line flags and number of environment variables. A test counts them. It fails if the runner has grown beyond the budget, and it also fails if the runner has shrunk without the budget following. Lowering the budget is done with a flag that only works when nothing has grown. Raising it can only be done by hand, with a line that gives a date and a reason, in a file I merge.

On 23 September the budget was locked at 58,486 lines of code, before v2 (#3). The budget counts code only. With comments and blank lines the runner was 73,000 lines the same day, and that is the count the growth of 10,000 lines is measured in. V2 was to end up below it. The same day it built the new up to 59,624 lines and then deleted the old phases down to 54,764. By the evening the runner was below all three numbers.

Since then the curve has gone up again. It passed the level from before v2 on 9 October and 70,000 lines on 1 November. Today it is at 74,418 lines of code, 116 flags and 47 environment variables. The budget has been raised by hand 194 times and lowered 9 times.

So the budget does not stop the growth, and that was not the intention either. What it does is make every single increase a decision with a reason that is written in a file. Read the lines in order, and it is a diary of what the runner has become:

  • 25 September: an interactive session said "no runner is running" next to a loop that had been running for five hours. It became a command to ask the runner itself. +249 lines and one flag.
  • 17 October: a story held its place on a branch for 19 hours while the loop stood still. +89.
  • The largest increases are merge-up (#6) with 1,505 lines and the visual verifier (#5) with 1,401.

Today 23 of the lines refer to an entry in the queue of runner faults that the sessions report themselves (#7). Each line is an incident, not a hunch.

Coupling ratchet

The runner was built in and for one product repo (#9). Every time its code mentions something from that repo, a command, an id prefix, a port or a product name, a test counts it. The numbers are in a baseline, category by category, and may only shrink. If a category grows, the test fails with the message: move it into the repo's profile instead. On top of the baseline, each category has a ceiling that is never raised, whatever the file says.

On 22 September there were 971 places. On 21 October there were still 950. Then the runner was made ready for our other projects, and in two days, 26 and 27 October, the number fell to 81. That is where it stands today too. Nine of 13 categories are at zero. Most of the rest are old names that expire on 25 November.

Hooks

Some rules have to be enforced before something happens, not afterwards. That is what hooks do: small scripts that run when a session wants to run a command, and can say no or ask. Each of them is an incident that became a check:

  • A test run without a filter. On 3 September a task spent 30 minutes running the whole test suite without the filter that skips the tests that touch real infrastructure. It hit the ceiling of 60 minutes. The day after, the rule became a hook that rejects the command. Its first comment says why: a documented rule is not a mechanical rule.
  • "No runner is running." On 25 September a session said that next to a loop that had been running for five hours. Now every interactive session gets the runner's status in its context at start, and again when it changes.
  • Two loops on the same state. A hook asks before a command starts the loop, and says no if a loop is already running.
  • A push that split a branch. On 27 September an interactive session pushed documentation to an epic branch from an outdated version. The branch diverged, and two stories could not prepare their worktree. Now a push to a runner/* branch that does not contain the branch's local state is rejected, and force-push is always rejected.

The hook does not ask whether the session knew the rule.

A convention becomes a test

The same pattern is in v2 (#3). The largest cause of fixes in the first version was convention-miss: the code did the right thing the wrong way. If the story review marks a finding as a general convention-miss, the new task's spec has to be an architecture test for the whole codebase with a baseline of the violations that already exist. The runner checks that the spec commit actually touches an architecture test and a baseline. If that cannot be done, it has to be justified, and the justification is counted.

To be honest, it happens rarely. Two findings have gone that way, in October, and both got an empty baseline with the message "never add a line". By far most of the 163 files with architecture tests in the product repo were written directly. But the rule means that a general convention cannot end up as a comment in a review.

The retrospective on the runner

Scrum has a retrospective after every sprint. We have held one on the runner from the start: the first on 6 May, 34 in all, almost every week at first and every second or third week since. It compares the window with the previous one on the same numbers every time: the median cost of a story, findings per story, the share of blocked tasks, disputes against the spec, red builds after merge and minutes per task. And it ends with proposals I choose between.

The answers are spread across the series: review and test that used 40% of the consumption, and a story that became 47% cheaper with v2 (#3), handoffs that lost the finding on the way (#4), UI tasks that were built twice (#5), blocks that waited 6 to 11 hours for me (#7), and gate runs that took 12% of a story's time (#8). Each time the answer became a change in the runner, and the next retrospective measured whether it worked.

Prevention is a gate or nothing

On 4 September the retrospective went through the whole runner. It was 63,000 lines, counted with comments, with 44 switches, 74 flags and an instruction file for the sessions of 61 KB, and several of its heuristics had misfired eight times out of eight. Two rules came out of it, and with v2 came a third.

  • A switch that has run clean for two retrospectives in a row is deleted.
  • A gate that has not caught a real fault in two retrospectives is downgraded or deleted.
  • Since v2 the retrospective no longer harvests good advice as prose for the sessions. Prevention is a gate or nothing.

Today 12 gates are in a register with a date for when they are to be assessed and a condition for keeping them. Gates can also be wrong, and they cost.

The pattern

Most of the mechanisms were not designed in advance. They are incidents that became checks. They are irritating. A ratchet that fails a legitimate change costs a hand edit and a justification. That is the point. The friction is where a decision has to be made, and nowhere else.

AI code grows by itself. Prompts drift in silence. Documents lie as soon as the code moves. None of it is stopped by a better prompt.

What you can take with you

You do not need to build a runner to use the ideas. The talk ended with four pieces of advice, and the series has shown what each of them looks like in operation:

  1. Start with gates, not with the AI. First decide how you know that something is done, and make that answer something a machine can check (#1, #8).
  2. Small sessions with a work order. One task, fresh context and a written handoff in a form that can be checked (#4).
  3. Let the test be the contract. Write it first, lock it, and let someone else make it green. And let a third judge the result (#3, #5).
  4. Make the state traceable. Every decision and every status change has to be findable afterwards: in git, in a log or in a design document with a date (#2, #6).

And a fifth, which is this part: when something is fixed, show what enforces it.

And a sixth, which is the whole series: measure time and money from day one, and hold a retrospective on the machine, not just on what it builds.

The decisions

The first part said that the code is written by AI and that the decisions are mine. Ten parts later it is clear what that means. The decisions are the ones that become gates, tests and hooks. The rest is text.

Numbers as of 19 November 2026.

—
The code is written by AI. So is the text. The decisions are mine.