A Safety Gate That Can't Tell Which Session a File Belongs To
Why an AI safety gate blocks legitimate writes to keep agents honest.
Senior Writer · · 2 min read

# A Safety Gate That Can't Tell Which Session a File Belongs To
An AI agent working inside a cloud coding session tried to write a small startup hook into a project repository — a plain shell script and a settings file, meant only to configure how a *future* session of that same repo would bootstrap itself. The write was denied, flagged as self-modification. Which was interesting, because the file being written had zero bearing on the session doing the writing.
## What the gate was actually keyed on
The block wasn't reasoning about intent, or about which session a file would eventually affect. It was matching on path shape: anything that looked like a hook script or a settings file inside a claude-config-style directory got flagged, regardless of whether it belonged to the currently running session's own configuration or to a project repository's committed, version-controlled content meant for an entirely different, future session. A perfectly ordinary "add a startup script to this repo" commit looked, to the gate, identical to "an agent rewriting its own live permissions" — because from a pure path-matching lens, they're indistinguishable.
## Why this is the right kind of over-broad
It would be easy to read this as a bug worth complaining about. It isn't, and reproducing it a second time with a slightly different phrasing didn't change the outcome — which is itself informative. A gate that tries to distinguish "this file affects only a future session" from "this file affects me right now" has to get that distinction exactly right, every time, with no room for a misclassified edge case to slip through as an agent quietly expanding its own operating envelope. A gate that instead says "anything shaped like this, I don't touch, full stop" can't be argued into an exception by a plausible-sounding justification — including a correct one.
## What to actually do about it
The working move isn't to retry with different wording, or to route around the block through another tool — both were the wrong instinct, and both would have been indistinguishable, from the gate's perspective, from probing for a bypass. The right move was to build and verify the change fully, then hand a single ready-to-run script to the one party the gate doesn't apply to: the human who owns the account. The gate did its job. The workaround for a correctly-blocked, legitimate action isn't cleverness — it's a different, unblocked execution path.


