Founder pricing: Pro at $9.99/mo forever for the first 50 members. 18 of 50 left Claim yours →
All posts

How to give AI coding agents autonomy without the damage

The SanuDesk team 5 min read
guardrails ai agents workflow

Everyone turns off the confirmation prompts eventually.

Week one, you read every command before approving it. By week two you're hitting allow on autopilot, because ninety-five of the last hundred prompts were an agent asking permission to list a directory.

Then comes the afternoon it resets a working tree with two hours of uncommitted work in it, or runs a migration against a database you'd rather it hadn't touched.

The fix isn't going back to reading every prompt. You won't. The fix is making the mistakes cheap.

Approval prompts aren't a safety system

They're a speed bump that measures your patience, not the risk. The dialog for ls looks exactly like the dialog for rm -rf. You see dozens a session, attention decays, and the one that actually matters arrives at minute ninety, right when you've stopped reading them.

Any control that depends on you being alert late in a long session will fail late in a long session. So stop asking "should I allow this command?" and start asking "what happens if it's wrong?"

Sort by blast radius, not by danger

Three questions cover almost every action an agent can take:

Is it reversible? A bad edit is reversible. A dropped table isn't.

Is it contained? Does it stay inside this repo, or does it reach production, a shared environment, or someone else's inbox?

Is it visible? Will it show up in a diff you'll read, or does it disappear into a log nobody opens?

Anything that's reversible, contained and visible (file edits, reads, test runs, type checks, linters, local commits) should just run. Approving those is theatre. Anything that fails one of the three (deploys, force-pushes, package publishes, destructive database commands, writes to live services) belongs on a short list you genuinely review.

Most setups have it backwards. They gate everything, produce fatigue, and the fatigue is what waves through the one command that mattered.

Git is the guardrail you already have

Almost every "the agent destroyed my work" story is really an uncommitted-work story. Four habits remove most of the risk:

  • Commit before you hand over. A clean tree turns disaster into git checkout .
  • Agents work on a branch, never straight on main.
  • Commit often while it works. Small commits are an undo history with timestamps, and keeping each one revertable on its own is what makes that history worth reading at 23:47.
  • One agent per checkout. Two agents sharing a working tree means one's half-finished refactor becomes the other's test run: the exact problem git worktrees exist to solve.

Once the worst realistic outcome is "throw away a branch," you can let it run.

Quarantine the things that have no undo

Some actions have no recovery path, and no amount of careful prompting changes that. Put them out of reach instead of trusting the agent to be careful:

  • Production credentials. Point the agent at a local database with seeded data. Its migration should be able to fail.
  • Deploys and publishes. Human-triggered, every time.
  • Anything that messages real people: email sends, webhooks to live endpoints.
  • Secrets. Agents read files. A key that's readable can end up in a prompt, a log, or a commit, not maliciously, just incidentally.

The honest version: an agent that has been told not to do something is not prevented from doing it. A line in a config file is a preference. Not having the credential is a control. Use instructions for taste and structure for consequences.

Decide that boundary before the session starts, not while arguing with the agent mid-run: that is what sandboxing buys you, a reach that is settled by the environment instead of negotiated one command at a time.

That gap matters most once the agent starts reading text other people wrote, where the persuasion can arrive from outside your session entirely: prompt injection is the same argument with an attacker holding the pen.

Give it a way to catch itself

Autonomy is only safe when the agent can discover it's wrong before you do. That means fast, local feedback it can run unprompted: a test suite, a type checker, a linter.

This is why test-driven development works so well with agents. A failing test is a guardrail that reports in seconds, and unlike a permission prompt, it doesn't need you awake to work.

Review the diff, not the transcript

The chat log tells you what the agent believes it did. The diff tells you what happened. Those two documents disagree more often than anyone expects, and only one of them ships.

So read git diff before you merge, and read it for blast radius first: files it had no business touching, deleted tests, new dependencies, changed config, loosened checks. The details of the logic can wait: reviewing AI-generated code is much faster when you triage by risk instead of reading top to bottom.

A workspace built around cheap mistakes

This is the shape SanuDesk is built for. It's a desktop app where your Claude Code, Codex and Gemini sessions tile into one grid, each workspace pointed at a single project folder, so an agent's blast radius is a workspace, not your whole machine.

Beside every session there's a git pane with the history graph and live diffs, so what an agent actually changed is on screen while it's changing it, not reconstructed afterwards from a transcript. Work arrives from a Kanban board: deploy a card and it opens a fresh session briefed with it, then the result comes back with a what-changed note: a review step that exists by default rather than one you have to remember. Loops handle the recurring passes you'd otherwise babysit, like a nightly run over the test suite.

It drives the agent subscriptions you already pay for, so nothing here is metered by us, and the free tier is a real one.

Start by making the undo cheap

You don't need a policy document. Commit before you hand over, put the agent on a branch, take production credentials off the table, and let everything reversible run without asking.

Do that and you can stop supervising keystrokes, which is the only way running several agents at once was ever going to work.

Download SanuDesk free, or see how the grid, the git pane and the board fit together on the features page.

Run your own fleet of agents

SanuDesk is a free desktop app that tiles your Claude Code and Codex sessions and gives every project a Kanban board your agents work from.