pi-rm-guard
pi doesn’t ship much in the way of permissions out of the box. It does block rm -rf and forces you to stop and assess what the agent is doing (unless you’re yolo-ing it i guess). I’ve been experimenting with longer runs and app verification which requires routine cleanup, and those runs would stall out when I wasn’t looking.
I asked an agent to build an auto-approver for rm -rf commands. I wanted something simple: when the agent tries to run a flagged rm -rf call, it sends the command to a decision model. The model looks at the command and the context, then tells the agent whether to proceed, ask me, or deny it. Boom, done. Most things are fine and safe and within the scope of the task at hand.
That isn’t what happened.
Instead, the agent started building a static safety policy. It spent several review cycles trying to write a perfect set of heuristics. It built a deny tier of hardcoded paths like /, $HOME, and /tmp. It added quote-aware command segmentation so it wouldn’t trigger on a mentioned string. It even implemented physical path resolution to stop symlink escapes and special cases for git rm --cached.
Each rule was reasonable on its own. But the review rounds kept finding holes, and the agent patched each hole with another rule.
Naturally, because it’s an agent and not a human it just kept firing away at the problem. It was trapped in review hell and didn’t even know it.
Layers upon layers of logic was added, but it never converged.
I eventually got fed up and had the whole thing rebuilt.
I deleted the shell-policy parser entirely. Now, the extension just routes possible rm commands to the model with the raw evidence and lets it decide. (… like I originally intended).
A week later, I narrowed the trigger so it only activates on recursive-force rm commands. (Again, like I originally intended).
The bitter lesson
It reminded me of the bitter lesson. Rich Sutton wrote about how general methods that leverage computation eventually beat human-encoded knowledge.
Turns out that even applies to agent-encoded knowledge lol.
The detector I kept uses lexical flag matching. It does no interpretation at all. It just makes sure it doesn’t miss a recursive-force flag. Everything that requires actual understanding of what might be deleted is the model’s job. I expect to see this same trap everywhere agents touch real work. People (and especially agents!) have an instinct to enumerate cases instead of routing the decision to something that can actually reason about it.
I built pi-rm-guard as an open-source extension for pi, MIT licensed: github.com/sdougbrown/pi-rm-guard. It’s an autonomy aid, not a sandbox. It doesn’t interpret shell programs or provide isolation; isolation is the OS’s job. (Or you could use paddock - more on that later).
The model I used for this is gemma4-26b running locally (via exl3 and tabbyAPI), with a 1500ms timeout on the model call.
I could use jev of course, and it would probably even work better. Part of the fun for me is using stuff I can fully control though. You can and should totally use jev with this if you install the extension!