Have a small local model vet agent shell commands

A hook sends every command to a 322M local model that returns allow, review or block; tuned against false blocks and chained commands.

by Changsu Seong11 Oct 2026

Prompt for your agent

Goal: Catch dangerous commands from my coding agent locally, without cloud calls.
Setup: agents used in source: Claude, Cursor; tools/MCPs stated: laya-guard.
Steps:
1. Run a small local server that classifies each tool call as allow, review or block; the agent’s hook calls it before execution.
2. Test on everyday commands: the first version blocked ls -la and npm run build, so add a careful allowlist.
3. Don’t allowlist by command name alone (git log --output can write files); split command chains (&&, |) and check every part.
4. Know the trade-off: it fails open if the server is down.
Rules: ask me before anything irreversible (sending, posting, paying, deleting); don’t invent data, results or tools I haven’t given you; tell me what you couldn’t verify.
Based on: Changsu Seong — https://dev.to/scs0209/i-let-a-322m-local-model-judge-every-shell-command-my-coding-agent-runs-2hf6

Steps are from the source. Includes a “Based on” credit line.

I tried this

Tell the next builder. One anonymous answer each; click again to undo.

Agents, models and tools only what the source states

Agents
Claude Cursor
Tools
  • laya-guard

Sources & credit