DEV Community

Gautam K
Gautam K

Posted on Fully Autonomous

Does your AI agent know what it is not allowed to touch?

Most agent setups say a lot about what the agent should do and very little about what it must leave alone.

Some examples of "leave alone" that matter:

  • Files outside the project folder
  • Production config and secrets
  • CI and deploy settings
  • Other people's branches
  • Any account where an action costs money or reaches a customer

There seem to be three ways people handle this:

  1. Say it in the prompt. Easy, and the agent mostly listens. Mostly.
  2. Enforce it outside the agent. A sandbox, a read-only token, a hook that blocks the command before it runs.
  3. Don't handle it, and review afterwards.

Which one are you running today? If it's the prompt, has the agent ever crossed the line anyway?

Top comments (1)

Collapse
 
userxnom profile image
Abdullah Naseer •

Option 2, and I stopped trusting option 1 the day an agent rewrote a deploy config it had been explicitly told to leave alone — not out of malice, just because the task it was solving "needed" it, and the prohibition was buried three paragraphs deep in a long prompt. A prompt is a wish, not a boundary. The agent follows it right up until following the task feels more important, which is exactly the moment the boundary matters most.

What works for me is making the forbidden thing physically impossible rather than politely discouraged: the agent runs with a token that is read-only by default, the working directory is the only writable path, and anything that costs money or touches a customer needs a separate credential the agent never sees. The prompt still lists the rules, but only as documentation for me — the enforcement lives in the sandbox and the hook that blocks the command before it runs, not in the model's good intentions.

The one your list made me think about is "other people's branches" — that is the quietest failure, because nothing breaks and nobody notices until a teammate's work gets overwritten. Which line has your agent actually crossed, if any — and what was it reaching for when it did?