For five months I ran a development loop where AI agents handled everything: reading the issue, designing, implementing, reviewing, merging, and shipping to production. One human was involved: to choose which issue to start and to approve a few pre-agreed points. No human wrote the code, and no human reviewed it line by line.
This is a record of one problem in that loop: rules that were written down and then not followed. It is not a success story. It took several failed attempts before the rule was enforced anywhere.
The setup, in numbers
Five months, one human, and agents doing the work: 1,065 issues, 982 merge requests, 4,057 commits. Alongside the code there were 2,851 lines of rules across several files, plus 32 automated tests whose only job is to check that the rule machinery itself still works.
The rule that follows is one of those rules.
The rule was written, read, and ignored
I added one line to the file the agent reads at the start of every session: after merging, write a retrospective on that issue. The agent read the file, replied that it understood, and merged work.
The next week I opened about 20 merged merge requests. Several had no retrospective.
I tried the usual fixes. Move the line to the top of the file. Make it bold. Add the word "must". Each time, retrospectives appeared for a while, then stopped.
Other rules failed the same way:
| Written in the rule file | What the agent did |
|---|---|
| Paste the review results into the merge request | Forgot to paste them |
| Post the pre-work survey on the issue before writing code | Skipped the survey and started implementing |
| Read open issues that touch the same file before editing rules | Started editing without reading them |
The reason this is hard to notice is that nothing fails. No retrospective, no failing test, no red CI, no blocked merge. You only find out by opening merged requests later and counting.
Each session, the agent decides again whether this time the rule applies. When it is in a hurry, when the context is long, when its attention is on another problem, the same instruction produces a different result. Instructions are a request. A request can be declined silently.
Stop the commit instead of rewording the rule
The change that worked was not a better sentence in the rule file. It was a git commit hook that rejects commits that do not satisfy the rule.
A hook is a script git runs automatically at a fixed point. If it exits non-zero, the commit is not created. Nothing is left for the agent to decide: either the condition holds, or the commit fails.
So the rule became: if the issue has no retrospective, git commit fails.
Choose where you can block, then design the flow
The important part is the order of the work.
First decide at which point you can block a commit. Then design the flow so the check can run there.
If you design the flow first and ask later "how do I enforce this rule?", you end up with rules that have no enforcement point. Those rules stay in the file, unenforced, and slowly become noise that trains the agent to ignore the file.
The practical consequence: a rule that cannot be checked at a blocking point is not adopted at all. If I cannot find a place to verify it, the rule does not go in.
Put the hook where it cannot be skipped
Git's pre-commit and commit-msg hooks do not run when the commit is made with --no-verify. An agent in a hurry can add that flag and every check disappears.
prepare-commit-msg still runs with --no-verify, and a non-zero exit from it fails the commit. So I moved the entry point of the checks there.
The lesson is not "watch for the flag". It is "put the check in the place that runs anyway".
The single most effective check
When a commit touches the rules files, the hook asks the issue tracker for open issues that modify the same files. It then checks whether the commit message contains at least one of those issue numbers. If not, the commit is rejected.
The original rule was "read the related issue before editing the rules". It was ignored because whether the agent read something cannot be verified.
"Write the issue number in the commit message" can be verified. And to know the number, the agent has to look at the issue list. Faking it is no longer free.
If you cannot verify that something was done, require an artifact that cannot be produced without doing it.
What this cost, and what it did not fix
Cost: one small script per rule, plus the friction of a rejected commit when the agent forgets. That friction is the point.
Not fixed: hooks cover the paths that go through git. Anything the agent does outside a commit — writing to the tracker, editing a document — still relies on instructions. The coverage is only as wide as the blocking points I could find.
The rule file did not get shorter. It got honest: it now describes what the checks enforce, instead of promising behaviour.
If you are running agents on your code
Three things I would do in the same order again:
- Pick one rule you have already seen ignored twice.
- Find the earliest point where a failure can block the work (a commit, a push, a required CI check).
- Express the rule as a verifiable condition there, and delete the sentence from the rule file if it adds nothing.
Rules that cannot be verified are not rules. They are wishes with a markdown heading.
Top comments (0)