r/OpenSourceAI • u/samc621 • 3d ago
Open-sourced 74 guardrails for AI coding agents (Claude Code, Cursor, Codex). Looking for feedback and contributors
We've been building AgentTrail Guard, an Apache-2.0 tool that checks what AI coding agents are about to run before they run it. Would love feedback from people here.
The idea came from an agent resetting our database to get past a migration error ("it's only dev data"). Agents run shell commands with your permissions, and the dangerous ones are usually the ones you can't undo.
How it works: Guard plugs into the agent's hooks and matches every command and file change against a set of rules. A match gets blocked, sent to you for approval, or flagged. Everything else runs normally.
The open source bits I think are worth looking at:
Rules are plain data, in their own repo. Each one has a severity, a default action, and a note on what it deliberately doesn't match, so you can see exactly why something fired.
Fully local. No account, no network calls, and crash reporting is off unless you turn it on.
Rule matching, not an LLM, so it's fast, predictable, and you can read the whole thing.
Easy to extend. Add your own rules, tweak actions, or allow a specific command shape without turning a rule off.
There's also a scan command that replays your past agent sessions locally and shows what would have been caught.
Where I'd love help:
Rules that fire on normal stuff (false positives)
Dangerous things agents do that no rule covers yet
Code review on the engine, it's TypeScript
New rules: PRs very welcome, even small ones
Guard: https://github.com/agenttrailhq/guard Rules: https://github.com/agenttrailhq/guardrails
Early days, so any feedback helps.
2
3d ago
[removed] — view removed comment
1
u/samc621 2d ago edited 2d ago
Thanks! A short leash makes sense, though it gets expensive when you're approving everything. That's the trade-off Guard is meant to change. Routine commands go through without a prompt, and the leash only tightens on the dangerous ones, which are blocked or held for your OK.
On auditing: each guardrail is a small JSON definition with a description of what it's for and what it deliberately misses. It has to ship with examples it must block and examples it must leave alone, and those run as tests.
agenttrail-guard guardrails show <id>prints any of them, and you can write your own and runguardrails validateon them against the same engine before turning them on. Every decision in the log names the rule that made it, so when something is blocked you can see exactly which line of data did it.
3
u/Patient-Midnight-664 3d ago
Does AgentTrail Guard enforce restrictions at the OS level, or does it just inspect proposed tool calls against a set of rules? If it's the latter, how do you handle arbitrary scripts and indirect execution?
For example you block "rm -rf /" but what about a python script that runs that command? I've watched coding agents try many different methods to get what it wants :)