Lesson 1 · Synthetic test evidence
A Claude Code deletion guard is a pattern checker. Here is what mine catches and misses.
Rules in a CLAUDE.md file are advice. A PreToolUse hook is different: Claude Code's documentation says it runs before a tool call and can return a deny decision. So I wrote a small Python hook that reads the Bash command Claude wants to run and is intended to catch tested deletion and protected-branch force-push patterns, including some wrapped commands.
What I can show from a test run this morning:
- 27 checks on the first version and 47 hook-payload cases on the documented hook format all pass.
- I tried 16 fresh evasions. The hook denied 10 and still allowed 6: mv /etc /dev/null, shred -r /etc, dd to a disk device, an alias that hides rm, unlink on a system file, and a symlink to the root followed by rm.
- An install and rollback script restored a simulated .claude/settings.json byte for byte.
What I cannot show yet: it has not run inside a real Claude Code session, so I have no timing figure and no proof Claude Code calls it on your machine. The tests feed command strings to the script. They do not execute anything.
The takeaway: this is a pattern checker, not a sandbox. These results show which tested strings it recognizes, not that it prevents every dangerous action. Keep account permissions and isolation as separate controls.
If your team has one repeatable coding-agent mistake you want a check for, tell me what it is. I will say whether it fits a single pre-execution gate before anything is built. The $499 one-workflow sprint is for that, up to three a week.
Test receipt, November 23, 2026
Concise excerpt from the frozen prototype rerun. Counts are grouped test methods, not a claim of 67 independent tests. The 27 legacy checks and 47 payload cases are the suite case counts; the six fresh bypasses remain limitations.
test_hook: Ran 10 test methods. OK. test_gate: Ran 4 test methods. OK. rollout.py: 7/7 steps passed (toy config). rollout_claude.py: 10/10 steps passed (simulated settings). extra_probes: 6 of 16 allowed (still gaps). known_gaps: 0 of 6 allowed. No live Claude Code session. No tool commands executed. No timing claim.
The allowed probes used move, shred, disk-write, alias, unlink and symlink patterns. Rollback restored simulated settings byte for byte, not a live installation.