r/PiCodingAgent • u/deepu105 • Oct 08 '26
Plugin pi-automode-classifier: an auto mode plugin for Pi that uses Jev or Kev/Laya (running locally) to classify commands
Just published pi-automode-classifier, an auto mode plugin for the Pi coding agent that uses Jev or Kev/Laya (running locally) to classify commands.
Pi runs every tool call without asking for approval. This plugin checks each shell command before it runs:
- Built-in rules decide most commands. For example
ls, builds and tests run,rm -rf ~is blocked, andgit pushandsudoneed my approval. - Commands the rules do not know are sent to the model. It returns the probability that the command is risky.
- If the probability is above a threshold, I get a confirm prompt. The model never blocks a command by itself.
The models I tested:
- Jev 1.13 (hosted, from TypeSafe) through OpenRouter: about 270 ms per check and about 1.5 cents per 1,000 checks. The commands are sent to OpenRouter and TypeSafe.
- Kev-0.8B on CPU with llama.cpp: about 170 ms per check and 1.1 GB of RAM. This is what I use. Nothing leaves the machine.
- Laya typed-decisions on CPU with llama.cpp: about 100 ms per check and about 550 MB of RAM.
In my test with 50 commands (25 safe, 25 risky), all safe commands ran without a prompt and no risky command did. I wrote the test commands myself, so this is only a rough check. The plugin is not a sandbox.
pi install npm:pi-automode-classifierCode and docs: https://github.com/deepu105/pi-automode-classifier
Let me know if it allows or blocks something it should not.
5
u/HockeyDadNinja Oct 08 '26 edited Oct 08 '26
I'm the author of pi-permission-classifer. The current release uses an LLM judge through pi-permission-system. I have a pending release that adds a system one judge in front of that.
I've found that the system one models don't really do a good job and too many should be allowed commands get through (as in defer, not high enough percent sure). I've been testing on jev and kev locally through llama.cpp as well. My thresholds are high, around 0.85 give or take depending on the decision and I'm using a dataset of > 1500 commands taken from interactive coding sessions.
Have you encountered the same problem? I'm thinking we need a security trained model or lora.
5
u/Vistyy Oct 08 '26
Isn't this unnecessary with the built-in codemode Pi provides?
1
u/Mdbook 23d ago
Laya is absolutely NOT a good enough model to act as a command classifier. I've ran multiple tests with it including runs with over 30,000 commands and it performs miserably. I'd suggest using a fine-tuned 4b model like H2O-Lightning-4B. I don't have any experience with Kev, but I'd suggest being very cautious about letting it be your auto mode classifier as well.
1
u/tys203831 Oct 08 '26
Still prefer manual rule based permission control like https://github.com/Dicklesworthstone/destructive_command_guard unless there are some breakthrough in future for the accuracy of these classifier model in cybersecurity field
1
u/Magnus114 Oct 09 '26
Would love a tweak. Instead of looking at what’s dangerous, look if it much my request. E.g. a "is it possible to ..."-question should not lead to file edits.
3
u/fingerthief Oct 08 '26 edited Oct 08 '26
I’ve done a good chunk of testing with Jev and more or less every other similar classifier available for command guards.
I would not recommend Laya or any of the others over Jev. Jev itself is not super amazing either with its false positive rate.
I’d recommend a tiny fine tuned classifier trained specifically for command risk. I have a version that does that.
https://tannermidd.github.io/LANCET-model/
Evals readily available and whatnot to review.
This is a cool space to play around in, there aren’t many proper commands classifiers out there for agents.
0
u/YogurtExternal7923 Oct 08 '26
Did layla/kev hold the risky ones or nah?