Rules My Agent Actually Follows (and How a Violation Log Taught Me to Write Them)
I keep a violation log for my agent, and the log does something I did not expect: it grades my rules.
Every rule that gets breached twice is not a rule the agent keeps breaking. It is a rule built for a human reader, in a shape an agent cannot execute. The rewrites that survived follow three laws, and each law was paid for with a log entry.
Law One: Deterministic Beats Aspirational
"Be efficient with tests" is not a rule. It is a mood, and the agent will optimize it into whatever behavior looks efficient from the inside, which is how you end up watching it re-run entire suites to feel safe while the actual instruction was to run one failing test.
The rewrite: "Run only the failing test." A vibe can be optimized around. An exact instruction can be checked after the fact, by a human, in five seconds.
The test for law one: could two different people read your rule and disagree about whether a specific action complied? If yes, it is aspirational, and it will be interpreted in the direction of whatever the agent was already doing.
Law Two: Enforceable Beats Advisory
"If possible, avoid rewriting shared git history" is a polite wish. "Never force-push to a shared branch" is a rule, and the difference is not tone, it is enforcement.
Advisory rules rely on the agent's judgment at the exact moment its judgment is worst: mid-task, under pressure, confident. Enforceable rules move the decision out of the moment entirely, into a gate that checks before the command runs, or a harness setting that denies the capability outright.
I learned this one from a leaked credential incident. The soft version of the rule existed. The agent's protective instinct, rewrite history to scrub the key, looked like compliance from the inside. The rewrite was mechanical: the specific action is now denied by the harness, not requested in prose. The agent cannot optimize around a denial. It can only escalate, which is exactly what you want it doing with dangerous operations.
tip: Write rules in the passive voice of the system, not the active voice of the agent. "Force-push is denied" beats "do not force-push," because the first one is a fact about the world the agent lives in, and the second is a suggestion the agent gets to grade itself on.
Law Three: Looped Beats Floating
A rule nobody revisits after a violation is a rule that gets violated again. The loop is what turns prose into policy.
My loop is a violation log, one file, dated entries, written by the agent itself whenever it breaches a rule. Three effects, all of them worth the overhead.
The entry forces an admission. A rule breach that gets written down in the agent's own words is a different object from one that gets quietly undone, and the writing itself changes future behavior, because the agent reads the file before each session.
The log converts anecdotes into a dataset. Ten entries in, I was no longer arguing about whether the agent "tends to overstep." I could count the oversteps, group them, and rewrite the rules that kept getting hit.
And the log exposes the rules that never work. A rule that shows up in the log three times is not a rule the agent keeps breaking. It is a rule written in a shape that cannot be followed, and it needs law one or law two applied, not more emphasis.
The Before and After Pairs
Real rewrites, the pattern in miniature:
"Aspirational: Be efficient with tests."
"Deterministic: Run only the failing test. Full suite only at the milestone gate."
"Advisory: Try not to overwrite hand-maintained files."
"Enforceable: No automation writes the field-test report. Automation that targets it is denied."
"Floating: Don't rewrite shared history if you can avoid it."
"Looped: Never force-push a shared branch. Any history-rewriting operation gets logged as a breach."
Each rewrite costs one line and prevents one category of the entries that used to fill my log. The rules did not get longer. They got harder to misread.
Where the Analogy With Human Management Breaks
The tempting frame is that agent rules are like managing a junior engineer, and the frame holds for about one law. Then it breaks in a way that is actually useful.
Humans grow. Coaching an engineer pays off for years, so you invest in the person. Agents do not grow. Coaching an agent is a fixed cost paid every session, forever, and the investment that compounds is the system: the rules, the gates, the log. Spend the coaching energy on the artifact, not the instance.
The inversion is also true and less comfortable. When an agent executes a bad instruction literally and instantly, it surfaces how vague the instruction was. Humans silently round your vague rules into something sensible and you never learn the instruction was broken. The agent is an instruction-quality test that runs every day, for free.
Start With the Rule That Keeps Breaking
You do not need a framework. You need one rule that keeps getting violated, rewritten according to the three laws, and a file where the breaches get logged.
If no rule comes to mind, you have not been reading your agent's failures closely enough, and that is the first finding.
So here is the question, and it is the loop's entry point: what rule did you add only after something broke, and what did it replace?
The before-and-after pairs in the comments are worth more than this piece, because everyone's broken rule is different and the shape of the fix is always the same: deterministic, enforceable, looped.
Top comments (1)
The 'breached twice means the rule is built for a human reader' line is the sharpest bit — most agent-rule advice stops at 'write better prompts' without asking whether the rule is even checkable. Law two is the one I'd push further: denying the capability in the harness is the only version that survives a confident agent mid-task. Do you rewrite the rule yourself after a breach, or does the agent propose the rewrite?