Each rule on this page is what was left after something broke. This page lists the incidents, and sorts the resulting rules by a question I now ask of every rule: if an agent ignores it, what stops the action?
The record

Four strengths of rule
| Strength | How it works | Holds when the agent forgets? |
|---|---|---|
| Hook | a script inspects the tool call and refuses it | yes |
| Test fixture | the environment the code runs in is changed before the code runs | yes |
| Script | the correct sequence is one command, so the wrong one is more work | mostly |
| Protocol | a written rule with its reason and date | no |
Three of the seven rules are still protocol only. That is not always wrong: a hook is worth writing when the mistake repeats and the action can be recognised from a tool call. “Keep important files under version control” cannot be recognised from a single call. It is still worth knowing which rules depend on being remembered.
The test that sent a real message
In October 2026 an application test in one product sent a real one-time-password SMS to my phone. Nothing was wrong with the test. The application loaded a shared development environment file at import time, that file held live credentials for the SMS provider, and the test exercised the sign-up path without a mock. An audit of the neighbouring product the same day found the same shape: its development environment file held a live payment key, a live mail key and several others, and any test that reached those paths unmocked would have charged a card or sent mail.
The fix does not depend on tests being written correctly. A fixture at the root of the repository runs before every test.
@pytest.fixture(autouse=True)
def _no_live_external_calls(monkeypatch):
for key in LIVE_EXTERNAL_KEYS:
monkeypatch.delenv(key, raising=False)
monkeypatch.setenv("SIGNUP_MAILER", "console")
# the settings object is cached lazily, so clear it around every test
_reset_trail_config()
yield
_reset_trail_config()
LIVE_EXTERNAL_KEYS is a list of every environment variable that can reach a paid or outward-facing service: provider keys, payment keys, mail keys, and the flags that switch on paid generation steps. Each test starts with all of them removed and the mailer set to print to the console. A test that needs a key sets a fake one explicitly. When a new integration is added, its variables are added to the list in the same change.
A wrapper script adds a second layer for running tests by hand. It exports the same keys as empty values before the test runner starts, turns off the sending and billing flags, and then refuses to run at all if any of three critical keys is still set. Exporting empty values is deliberate: the environment loader does not override a variable that already exists, so an empty one cannot be filled in from the file.
An agent that writes a new test without thinking about any of this still cannot send a message.
The script that was not in git
In November 2026 a daily publishing step failed without an error anyone saw. The script that posts to a social network had been written during a session, kept in that session’s scratch folder, and used from there on following days. Scratch folders are cleaned up. One day the script was gone, the step that called it found nothing to run, and nothing was published.
The rule that resulted is short: a tool that is used more than once lives in a tracked folder. The publishers now sit in a skill folder under version control, and the instructions for the publishing flow name that path and say not to keep them in a session folder.
A second rule came with it. When the outcome of a publish is unclear, look up what was actually posted before running the step again. Posting is not reversible, and a retry after a silent success posts twice.
A month earlier the same lesson had arrived in a larger form. A vendored folder of third-party skills was listed in the ignore file, so it had no history. When the folder disappeared, there was nothing to restore it from, and forty-odd symlinks pointed at nothing. The record of that loss is kept in the repository’s guide, with the list of what was lost and the recipe for reinstalling it.
The worktree that restarted the server
In July 2026 a worktree was created inside a product repository, in a hidden folder. The API server was running in development mode and watching the repository for file changes. Several thousand new files appeared under its root, the server reloaded, and the long content pipelines running inside it were killed mid-job.
The rule is that worktrees for product repositories live in a sibling folder. It is enforced by the script that creates them, described in worktrees and progress documents. An agent that creates a worktree by hand in the old place would still cause the reload, which is why this rule is “mostly” enforced and not fully.
The question dialog
An eighth case, outside the table, is about agents asking instead of deciding. In May 2026 a lead agent, in the middle of a billing task that the protocol said it should resolve itself, opened a dialog with four tabs of questions. The protocol already said not to. The tool was then named in the protocol and removed from the agents’ permissions, so the rule no longer depends on being remembered.
Reading the pattern
| Incident | First response | What finally held |
|---|---|---|
| Edits in the main tree | a sentence in the worker’s brief | a hook |
| Staging symlinks | a sentence in the worker’s brief | a hook |
| A live key in a test | “remember to mock” | a fixture that removes the keys |
| Asking instead of deciding | a paragraph in the protocol | removing the tool |
| Worktree location | a paragraph in the protocol | a script that creates it correctly |
In each row the first response was to write the rule more clearly. It helped and was not enough. What held was changing what the agent is able to do, or what the environment contains when it acts.
Limits I know about
Each mechanism covers one known failure. The list of live keys is maintained by hand, and a new integration whose variables are not added to it is unprotected until someone notices. The fixture guards tests and the wrapper guards the test runner. Neither guards an agent that runs application code directly from a shell with the development environment loaded.
These guards work by removing keys at the moment of use. The cleaner design is a development environment that holds no live key at all, with separate, deliberate access for the few tasks that need one.
