Every engineering manager I respect has the same instinct on a new hire's first day. You do not hand them production credentials and the keys to the billing account. You give them a laptop, read access to the code, a starter ticket, and a person to ask. Access grows as trust grows, and each step is a decision someone made on purpose.
Most teams I talk to skip that instinct entirely with AI coding agents. The agent arrives with whatever its tool allows by default, which is often "anything the developer's terminal can do." Then the team spends weeks reacting: a surprising force-push here, a migration that ran against the wrong database there, a pull request merged by the same agent that wrote it. Nobody can say what the agent is actually allowed to do today.
I have led engineering teams and AI adoption programs, and I now work with coding agents every day. The approach I have settled on is boring on purpose: treat an agent like a capable new hire with no context. Start at no. Grant yes in writing, one scope at a time, with an expiry. The rest of this post is how to do that without slowing everything down.
Start at no, and write it where the agent reads it
A default of no only works if the agent actually encounters it. A toggle someone flipped once in a settings screen is not a policy, it is a rumour. The agent cannot cite it, a reviewer cannot audit it, and the next person to set up a machine will not know it exists.
Put the default in plain text, in the instructions the agent loads at the start of every session. "Do not commit, push, merge or deploy unless the repository has an explicit grant below" is one sentence, and it changes the agent's starting posture from "act, then explain" to "check, then act." Agents follow written instructions remarkably well. They are much worse at inferring unwritten norms, which is exactly the failure mode of a confident new hire who was never told that the staging database is shared with the sales demo.
The tool-level controls still matter. Permission prompts, sandboxing and restricted tokens are the locks on the door. The written default is the employee handbook that explains why the doors are locked. You want both, because the lock without the handbook produces an agent that keeps trying the handle, and the handbook without the lock relies on an instruction surviving every prompt the agent reads that day.
One grant per repo, and say what a push fires
Once the default is no, the exceptions become the interesting part. The mistake I see most often is a grant that says what the agent may do ("may push to main") without saying what that push causes.
Imagine a repo where a push to main silently triggers a production deploy, and a version tag uploads a mobile build to external testers and also runs database migrations. An agent with "may push and tag" is now authorized to do three very different things, two of which reach real people. A human engineer on that team learns this from a teammate in their first week. The agent learns it only if someone writes it down.
So every grant gets one extra column: what this action triggers. "Push to main: deploys the public site." "Tag v*: publishes the package and runs the production migration, two releases, not one." In my experience that single column does more for safety than an extra approval step. An approval step asks "are you sure?" The trigger column answers "sure of what?", and that is the question the agent and the reviewer both actually need answered.
It also forces you to read your own CI configuration, which is a useful exercise on its own. A team I worked with discovered, while writing these rows, that a workflow they thought only ran tests was also publishing a package on every merge. Nobody had looked at that file in a year.
Grants expire, on a date and on an event
Broad autonomy is genuinely useful. There are stretches of a project, usually early, when the blast radius is small and speed matters more than ceremony. Letting an agent merge and deploy its own changes in that window can be the right call.
The problem is that broad grants never get revoked by accident. They outlive the conditions that justified them. The internal prototype gets its first external user, a second team starts depending on the service, and the agent is still merging to production unreviewed because nobody remembered that permission was meant to be temporary.
Give every broad grant two ways to end: a calendar date, and an event. "Until the end of the quarter, or until the service takes external traffic, whichever comes first." The date is the backstop. The event is the important part, because it ends the grant at the moment the risk actually changes, not at an arbitrary point that happened to look reasonable when you wrote it.
When a grant expires, the default should snap back to no, and the agent should say so instead of carrying on. That turns renewal into a real decision. Renewing out of inertia is the same as never having set an expiry at all. The useful question at renewal time is narrow: which parts of this grant earned their keep, and which parts did I keep only because nothing went wrong yet? Those are different things, and the expiry date is what makes you honest about the difference.
Keep the irreversible behind a confirmation, always
Even inside a generous grant, some operations stay behind a human confirmation. My test is simple: can this be undone by another commit?
A bad merge can be reverted. A bad deploy can be rolled back. A deleted volume, a dropped table, a rotated secret that other systems still depend on, a changed access policy, a removed DNS record: those either cannot be undone or cannot be undone quickly, and the cost of a wrong guess is measured in hours of recovery or lost data.
Name these operations explicitly in the policy. "Deletions, changes to secrets or access, and schema migrations that touch authorization or core tables require a confirmation, regardless of any other grant." Listing them matters, because "be careful with destructive things" means something different to every reader, human or model. A concrete list does not.
The usual counterargument is that confirmations create fatigue and people start clicking yes without reading. That is real, and it is the reason the list should be short. If everything needs a confirmation, nothing does. Keep the free lane wide and the confirmed lane narrow, and a confirmation becomes a rare event that people actually stop and read.
The same principle applies to where that confirmation comes from. An approval should arrive through a channel the agent's inputs cannot impersonate. If the agent reads issues, emails or web pages, any of those can contain text that claims to be the approval. Treat untrusted input as a reason to require a confirmation, never as a source of one.
Verify at the source, not in the pipeline
Agents are excellent at reporting that a step succeeded. CI is excellent at turning green. Neither is the same as the outcome you wanted.
Upload steps can exit successfully while the build never shows up for testers. A deploy job can finish while the old container keeps serving traffic. A migration step can report done against a connection string that pointed somewhere else. Every one of these is a green check sitting on top of a missing result.
So define success at the place the outcome lives. If the goal is a build in testers' hands, ask the store whether the build exists and is ready. If the goal is a deployed fix, request the live endpoint and check the version it reports. If the goal is a migrated schema, query the schema. Tell the agent that this verification is part of the task, not an optional extra, and it will do it.
There is a second benefit. "Deployed must equal committed" becomes something you can test. If the thing running in production cannot be traced to a commit, you have a configuration that nobody can rebuild, and that is a problem whether a person or an agent created it.
Keep the policy in one place
The last rule is the one teams resist most, because it feels like bureaucracy: the permission policy lives in exactly one place, and everything else links to it.
Here is why it matters with agents specifically. Agents believe what they read. If a repo's README says "this project is not allowed to deploy automatically" and the central policy granted it last month, the agent working in that repo will find the README first and act on it, or worse, find both and pick one. Imagine a repo where the docs said one thing and the policy said another for months, and every agent session that touched it made a slightly different call. Nobody notices the drift until something surprising happens.
Duplicated policy always diverges. Write the grants once, in the instructions the agent loads, and let repo documentation point there with a single line. When the policy changes, there is one edit to make, and no stale copy left behind to contradict it.
The tradeoff, stated plainly
This approach costs something. Writing grants takes an afternoon. Reading your CI files to fill in the trigger column takes longer than you expect. Expiry dates mean you will occasionally be interrupted to renew something you would rather not think about. And a default of no means the first week with a new agent feels slower than the demos promised.
I think that cost is cheap compared with the alternative, which is discovering your agent's real permissions through incidents. It is also exactly the cost we already accept for people. Nobody argues that onboarding a senior engineer should skip access reviews because they are talented. Talent is not the same as context, and an agent has plenty of the first and none of the second until you write it down.
If you want a place to start this week, do three things. Write the default of no into your agent's instructions. Add one grant for the repo where agents already do the most work, with the trigger column filled in. Give that grant an end date and an ending event. Everything else in this post can follow once those three exist, and you will learn more from writing the first row than from reading any more about it.