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 (4)

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?

Collapse
 
gautamtalksdev profile image
Gautam K •

"A prompt is a wish, not a boundary" is a great line. Making the forbidden thing impossible with a read-only token and one writable path is the only version that holds when the task feels more important than the rule.

Collapse
 
techblendconsult profile image
Dennis Weston •

Good framing. Prompt rules tell an agent what it shouldn't do, but the only thing it truly can't touch is what its credential can't reach. Two things that helped us: give each agent its own identity with a hard authority ceiling, and hand it short-lived tokens scoped to the one task, so a forgotten rule fails closed. Disclosure: I work on CoreLink, which handles agent identities and scoped tokens (usecorelink.com, free trial). Happy to compare notes on the deny-list side too.

Collapse
 
gautamtalksdev profile image
Gautam K •

Agreed that the credential is the real boundary. Per-agent identity with a hard ceiling plus short-lived, task-scoped tokens means a forgotten rule fails closed instead of open. Thanks for disclosing your affiliation too.