p.enthalabs

Ask HN: How do you guys stop coding agents from acting out of line?

news.ycombinator.com · Read Story HN original

I’ve been pretty annoyed recently with my coding agents doing stupid things that are anti-protocol. I can encode rules like “agents shouldn’t write to the README” pretty easily, but things like “database migrations must be autogenerated and not handwritten” are much harder to enforce. Anyone have any tools they use for this or tips for how to deal with issues like that?

Comments

Have you consider asking your agent to set up basic permission deny rules to block dangerous commands? Just ask it and request that it shows you the config before applying it.
I can add some basic configs, but it seems kinda provider dependent, so I'm gonna need to do this differently for Claude, Cursor, and Codex. It will also require a custom pre-tool use plugin to allow something like "AI can generate DB migrations via CLI but cannot handwrite them", which is pretty annoying when I need a separate one per model
Telling llms what not to do actually makes things worse. Frame things in positive language where possible, if not possible I don't mention it at all. The biggest fix for me is using better models. You can't rely on guardrails to make dumber models act smarter.