When I wired a PreToolUse counter on Edit and Write to stop Claude Code from patching the same file five times in a row, the agent routed around it through Bash heredocs and Python .write_text() calls.
To see how often that actually happens in real work, I parsed all 153 local Claude Code ( ~/.claude/projects ) and Codex CLI ( ~/.codex/sessions ) JSONL transcripts on my machine ( 2,581 deduplicated tool calls ).
1. Why Edit -only circuit breakers miss 39.2% of file rewrites
Across those 153 sessions, agents performed 199 total source-file mutations :
121 mutations ( 60.8% ) went through structured Edit , MultiEdit , Write , or apply_patch tool calls.
78 mutations ( 39.2% ) went through Bash or codex:exec shell commands ( cat <<'EOF' > , sed , tee , .write_text( , open(..., "w") ).
In session 01a12a24.jsonl , Codex rewrote brain.py 4 times in a single session purely through shell commands ( LPB001 + LPB004 ). Any hook that only watches Edit and Write never fires on those rewrites.…