ai-coding-minesIndexGitHub

The safeguard blocks the thing it was protecting (the general case)

Git and automation

Same shape three times in one day.

SafeguardMeant to blockActually blocked
pgrep guardDuplicate runsItself — immediate exit every time
Lock fileOverlapEvery later run — permanent block after a crash
Ever-growing seen setReprocessingAll candidates — the filter exhausted them and the system went silent

Whenever you write a safeguard, ask: "Can this block the body, not just the target?"

About the seen set

A deduplication list that grows without bound eventually drives candidates to zero. Give it a TTL, or count it against the population and watch for exhaustion. Zero candidates may not mean "none"; it may mean "all filtered out."

The other direction — the safeguard lets the target through

The three above are safeguards that blocked the body. It also runs the other way.

SafeguardMeant to catchActually did
Regex detecting bad tracking numbersAn order number typed into the tracking-number fieldPut ^\d{10,14}$ on the allow-list — the exact shape of the incident

Back-test a detection rule against past incidents. If it doesn't fire on them, the rule doesn't exist. Details in chapter 02, "The validator had the very shape it was meant to catch on its allow-list."