Live data from Hacker News

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

news.ycombinator.com

1–10 of 13 posts

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

#1
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?

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

#6

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

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

#8
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.

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

#10
It's often easier to catch and scold them than to prevent it. We have rule for example that agents (or anyone) can't touch autogenerated code. They still routinely do, but there is a CI job that re-generates everything and fails if there is a diff. Which the agents then see and fix. We have also use hooks for the same thing since they run locally and the feedback cycles are shorter.
Post reply on HN