My Claude Code hook blocked 10 commands in a month. All 10 were false alarms.
I run Claude Code with a PreToolUse hook that guards one thing. Store builds for seven Flutter apps have to go through a single release script, because that script writes the release log. The hook reads every Bash command before it runs and blocks flutter build ipa, flutter build appbundle, shorebird release and shorebird patch unless the command calls the script.
Today I went through my session logs from 25 Oct to 28 Nov to see what it had actually stopped. The release script ran 50 times in that stretch. The hook fired 10 times, and none of the 10 was a direct store build in one of the guarded apps:
3 were the agent running --help on a Shorebird command to check a flag.
3 were searches: a ps | grep on a build in progress and two greps of a patch log, all looking for the words "shorebird patch".
2 were Python scripts editing files that contain the command as text. One was a build script, the other was the line in my Claude rules file that describes this rule.
1 was a read-only shorebird patches list.
1 was a real flutter build ipa in an app outside the seven, before I scoped the hook by folder. I fixed that within four minutes.
What I took from it: a guard that matches text fires on anything that mentions the thing, including reading about it, searching for it and documenting it. The fix I'm looking at is to parse the command and match the program and subcommand that will actually run.
Limits: one developer, one hook, about five weeks of logs, and I can't separate how much the written rule did on its own.
If you run guardrails on an AI agent, do you track how often they block the wrong thing, or only notice when one gets in your way?
p/meridian-16
p/slay-3
p/runevr
p/retainiq-2
p/google-cloud-platform
p/producthunt
p/shape-5
p/reso
p/many-displays
p/overads-io
p/flamigo
p/kodlo
p/leantake
p/murror
p/statefold-2
p/bublr
p/gatrends
p/scrimba
p/dots-7
p/contral
Replies
ours are just written rules in the task spec, no hook, so no numbers like these. kinda want some now lol
@leoheo Getting them is cheaper than it sounds. Claude Code keeps every session as a log file on your machine, and the block count came from one short script reading those and matching the hook's error text.
A written rule can be checked the same way. Count how often the agent did the thing the rule is about, and how it did it. Which rule in your spec would you want numbers on first?