Hacker News new | ask | show | jobs
Show HN: Interlock, an open shell command safety classifier (gauss.motor.dev)
7 points by ncd 1 day ago
Hey all, we built this shell command classifier for our internal experimentation with custom harnesses and local LLMs, but I thought others might be able to get some use from it as well. The `interlock` binary clocks in at ~22 MiB, and runs checks in ~8-16 ms on my M2 Ultra cheese grater tower.

In "auto" mode, the big players all ask a black box classifier model if commands being run by the agent should be allowed. It's super handy to have this capability for local work as well, and I also used building it as an excuse to get some experience training a small (but effective) encoder model on a domain with a limited vocabulary, and have the whole shebang run by Neon with my guidance (it's a great model, but can still spin out in strange ways).

The first version was trained from scratch using a corpus generated by Neon with a "shell simulation environment" I asked for inspired by fuzzing techniques. It worked well on the held-out set from the corpus, but then didn't generalize well to similar but different commands it hadn't ever seen.

The second version used https://huggingface.co/jhu-clsp/ettin-encoder-17m as a base, and then ran the generated corpus as a fine-tuning pass, which got much better results (and added some awareness of non-shell code which helps spots dangerous things in executed Python or JS scripts).

All of the pipeline for generating data, training, and fine-tuning is included in the repo.

It tries to be clever about doing things like expanding variables, taking ambient shell context into account, looking into scripts that are being executed, seeing if something is obfuscated using things like base64, etc. It also supports a large group of shell syntaxes (parses and converts them to a common IR before processing further).

However (and hopefully this is somewhat obvious), there's only so much a tool like this can do to detect unsafe behavior (what if the script being executed downloads new code to execute?) so be safe and run your stuff in a sandbox (there are a million providers out there at this point) when unsure about safety.

Have fun!

2 comments

Very cool!

It’s great to see real technical implementations like this tiny embedded model. I feel like the norm these days is, “here’s how I built a text classifier with a local 27B model at the Pareto Frontier of CLI safety.”

Can we see the code before installing some random binary on some random domain?

From what I can tell, this is some bespoke forge / scm meant as yet another replacement for git, but I cannot figure out how to find any public repos or where the code is actually hosted. The first step is "give this markdown to your agent ... and access to github at the same time too"

Makes it seem sketch

https://simonwillison.net/2025/Jun/16/the-lethal-trifecta/

We don't have a web UI for the code, since the entire thing is meant to be used by agents only, but there's definitely a chicken and egg problem here... you have to download `amp` to clone Amp repo code, which is a problem as we try to get folks to check it out.

Maybe we could cut the knot by adding a way to download an archive of the repo from the public repo page? I'll add that.

yeah, trying to do something besides git is going to be a very hard uphill battle, see jj as an example. Without git support, tools like Go are going to struggle with fetching dependencies (it uses git under the hood in fallback / source iirc)

humans need to see the code - need to be involved - eyes (vs hands) free coding is a fools errand (imo)

Definitely not an easy task we've set for ourselves! I just added a tab at the top of the repo page so you can download an archive of the code in the format of your choosing. You can do the same for `amp` itself here: https://gauss.motor.dev/motor/amp.

Also, I appreciate the feedback—I'm not sure how good a fit we'll be for folks who are still reading lots of code, but I definitely recognize we're in a transition period and we're actively looking for ways to make what we're building accessible for everyone.

Re Go: it should just work, as I added support for the Go module protocol a while back and the `go install` snippet you see on the `motor/interlock` repo is tested.