

laya-guard: a local guardrail that judges every tool call your coding agent makes
laya-guard: A local guardrail for coding agents that checks every tool call
I built laya-guard, a local guardrail that checks tool calls made by your coding agent and decides whether to allow, review, or block them.
It runs entirely locally, needs no API key, and takes around 90 ms per command on a CPU.
- Regex rules catch obvious risks like rm -rf /, curl ... | sh, and leaked API keys.
- Simple commands like ls and npm test skip the model entirely.
- Everything else is evaluated by Laya, a ~322M local model.
It supports Claude Code, Codex CLI, Cursor, Gemini CLI, Copilot CLI, and 6 other agents.
I also tested it on AgentDojo at the judge level: it blocked 25 of 27 attacks while allowing 92 of 97 benign tasks. These are my own measurements, and the README documents the current limitations.
It's free and MIT-licensed. Install it with pip install laya-guardrail.
I'd especially appreciate feedback on commands that slip through or cases where legitimate commands get blocked. Those are the areas I'd most like to improve.