Every system has a few numbers people care about: a stock level, a price, a
status, a balance. Many parts of the system read them. So I started asking
the opposite question. Who writes them?
Does it work? Every time. I have run that question as a small audit on 4
systems, never more than an afternoon each. It found a real problem on all 4!
On one, 45 scripts read the stock level and one more quietly wrote it.
Nothing in the system could tell.
4 of 4 systems where the audit found a problem1 afternoon, at most, per system45 scripts that read one stock level. One more also wrote it.From my own audits.
Stock has exactly one place it should come from: the inventory. Everything
after it only reads. So why did that one script write it? Easy. It worked
with stock, it already had the product in hand, and changing the number was
one line away.
Count the writers
Forty five readers are fine. The second writer is the bug.
The whole audit is 4 steps. Boring on purpose.
List the values that matter. Stock, price, status, balance: anything a
person would notice being wrong. Usually fewer than 15.
For each one, search for every write. Not reads. Writes. Every place in
the code that can change it. Be complete and boring about it.
Count the writers. One is correct. Two is a bug you have not noticed
yet. Three or more? Nobody owns it, and the value is whatever ran last.
Write the owner down next to the value, in the code, where the next
person will be standing.
Count the writers. The answer should be one.
Make it impossible, not forbidden
Script number 47 never reads the warning. The lock still holds.
My first repair was the obvious one. Remove the extra write. Add a loud
warning in the file. Done.
Did the warning work? On whoever reads the file, yes. Not on script number 47,
written in a hurry, with the product in hand and a need for one line.
So the real fix went into the structure. Those scripts can no longer change
the stock level at all. Not "please don't". Can't! Make the wrong thing
impossible, not forbidden, and you stop needing people to read your warnings.
Why this matters more with AI
The helpful extra write only stands out if the value has an owner.
I work with AI agents every day now, and this is where it gets interesting.
An agent reads your rules at the start of a session. Then it spends an hour
working toward a solution that happens to need one small write.
Will it be careless about it? No. It will be helpful about it. And
that is much harder to catch, because helpful code looks like it belongs.
The reviewer sees a sensible change doing a sensible thing. Nobody sees that
it is the second writer of the value. Unless someone already wrote down that
the value has an owner.
That is what the audit really gives you. Not documentation. A map of who owns
what, so the next review, by a person or by an agent, can actually see the
problem. The more hands touch a system, the more it needs a few simple facts
that nobody can argue with.
Things I did not expect
On a busy day nobody asks who owns the number.
The scariest problem had no error message. No red line. No crash. No alert at
night. Every script did exactly what it was told, the system looked healthy,
and the number was simply not what everyone thought it was. Two writers with
different ideas of what a number means: no single part can see that failure.
Since then, a quiet system does not calm me the way it used to.
The growth was faster than anyone noticed. 17 of those 46 scripts arrived on
one single day! On a day like that, nobody stops to ask who owns
the stock level. Everyone is busy shipping, and the number is one line away.
That is not carelessness. That is just a busy day.
Funny thing is, the boring work was the valuable work. Searching
for every single write, value by value, is dull. It is also the only part that
found anything, on all 4 systems.
How many writers does the most important number in your system have? Count
them. If the answer is one, go home early!
Every one comes from a real mistake. The best 100 are open on /rules, or download them as AGENTS.md, no email. All 527 come by email, as one file you can drop straight into your repo as AGENTS.md or CLAUDE.md, so your agents follow them from the next session. Plus the occasional email when I learn a new one.