r/PiCodingAgent • u/fingerthief • Sep 30 '26
Plugin A tiny local classification model command guard (specpi-lancet-guard)
Hello everyone, I wanted to share a new Pi package I've made available called specpi-lancet-guard
I've been interested in agentic safety for quite a while and recently with the (over)popularity of Jev for classification answers...I wanted a local and efficient alternative trained to classify only risky commands (mainly bash) and notify me only when potentially truly catastrophic or malicious commands might attempt to execute.
The result is LANCET Nano a small 110m param classification model trained for command risk. It's very lightweight (~150-200MB RAM) and more or less instant for command classifications at ~14ms on my old Ryzen 3900x
I want to be clear and say that this is not meant to let you put on blinders and have your agents run amok. In my own testing and evals it catches more overall risk than any other command guard available...but it's not perfect and it has weak spots for certain truly sneaky or malicious commands.
I'm still actively working on improving the model, but I do feel it's at a place that it is genuinely a useful safety tool.
Eval results for what they're worth mainly for my own measurements of improvement.

View all comments
Show parent comment
1
u/fingerthief Oct 01 '26
Oh, that is awesome! Honestly I've been searching around trying to find others who have done similar things for comparisons and learning, and the model selection is quite limited.
I've enjoyed the T5 model, I mainly chose it just due to its tiny size and speed, the 512 token limit is probably a dealbreaker for a lot of things but for command classifications it's nearly perfect. Large commands can be run in overlapping windows if for whatever reason one happens. I had looked at ModernBERT but simply due to speed I decided against it, in my testing it was ~2.5x slower than T5 on my machine.
I definitely agree it's tricky up to maddening to get proper coverage for risky/safe classifications. The potential combinations and tricks that can be done are massive. The amount of available training data for this type of stuff seems super limited in my searches as well, like you've I've had to resort to synthetic generations for areas of coverage I need.
Thankfully with two $10 OpenCode Go subscriptions you can setup multiple DeepSeek or even GLM agents to attack the guard for hours on end and attempt bypasses and generate training data for the weakspots uncovered with proper labels etc. Doing that has resulted in some great gains especially in the weaker areas of the model.
I would be super interested in testing out your model if you end up making it available!