Skip to content

Governance for AI coding agents assigns each change a risk class (low, medium, high, or critical) and lets that class, not the agent’s confidence or the vendor, decide what the agent may do alone. Guardrails constrain the agent while it works; gates decide whether the evidence is enough to merge or release. Named humans own the high and critical gates.

This page is for CTOs and tech leads who own the autonomy policy. Your agents already open pull requests overnight. Someone asks in the incident review who approved the migration that dropped a column, and the honest answer is “the agent’s own review pass, plus a CLAUDE.md line that said never touch production.” That is advice, not a control, and this page replaces it with controls you can point at.

  • A four-class risk table that says what the agent may do alone and which human decision each class needs.
  • Anthropic’s three approval tiers and the four rules that assign them, from the Claude Code team’s own repositories.
  • A placement map of guardrails and gates across the lifecycle, with the evidence each one leaves.
  • Per-tool enforcement for Claude Code, Codex, and Cursor, so the boundary sits outside the model.
  • An evidence contract prompt and a policy template you can adopt as they stand.
  • A rehearsal drill, five control metrics, and a circuit-breaker design that tightens approval when reverts rise.

Which risk class does an agent change belong to?

Section titled “Which risk class does an agent change belong to?”

Classify by what a mistake costs, not by how large the diff is. Score five factors: blast radius, data sensitivity, reversibility, regulatory impact, and the credential scope the run needs. The highest factor wins. A three-line change to session handling is critical even when the agent is certain.

Risk classTypical changeThe agent mayThe gateRequired human decision
LowTests, docs, research, internal tooling, isolated refactors behind green testsEdit an isolated checkout, run local checks, open a PRCI green plus a complete evidence bundleLightweight review and merge by any team member
MediumFeature work in one service, dependency upgrades, preview or staging changesUse scoped non-production credentials and pre-approved runbooksCI plus accepted plan plus code-owner approvalCode owner accepts the plan and approves the merge
HighAuth, billing, schema migrations, shared libraries, sensitive data pathsPrepare the change, a dry run, and a tested rollbackSpecialist review plus rehearsed rollback plus release approvalNamed specialist and release owner, separately
CriticalProduction data changes, security exceptions, destructive operations, regulated scopePrepare evidence and an approval request onlyDeployment platform gate the agent’s identity cannot passNamed owner authorizes; the platform executes

Risk classes are not maturity levels. A loop’s level on the autonomy ladder measures how far you trust that loop; its risk class measures what a mistake costs. Keep both in the autonomy register, so a loop with a long clean record never earns its way into critical changes by track record alone.

Some actions stay outside agent authority in every class: reading or rotating production secrets, unapproved external communication, deleting backups, and approving its own work. Write them into the policy as forbidden, and enforce them with deny rules and credentials the agent never holds.

How does Anthropic scale human approval by risk?

Section titled “How does Anthropic scale human approval by risk?”

Anthropic’s Claude Code team runs a three-tier version of this idea, described in its engineering article “How the Claude Code team does code review” (15 October 2026). It is one team’s self-reported practice, not a standard, but specific enough to copy. The tier sets how many people approve a change after automated review and security checks have run.

TierExamplesHuman approvals
LowDocs, copy, internal-only features, additive changes behind a flagNone required once automated review and security checks are green
MediumOrdinary product changes, and changes to sensitive areas such as caching, the auto-updater, or system promptsOne person
HighThe highest-risk code, plus a small set of paths that always need two peopleTwo people

Anthropic’s low tier requires no human approval once automated review and security checks are green, while the low class in the table above asks for a lightweight review by any team member. Clause 6 of the policy template below already lets an AI reviewer approve low-class changes, so the difference is whether a person is also required. Keep the person until a class’s own record supports removing them. The article says its owners decide which low-risk changes merge on automated checks alone, and that this line “keeps moving.”

Four rules decide which tier a change gets and who can approve it:

  • The change sets the tier, not the author. One classifier reads the change and picks the tier. A second classifier asks whether this particular change needs another person even when its tier says it doesn’t. Paths the owners list as sensitive, and any CI workflow file, always need a person.
  • Only trusted authors get the lighter paths. The trusted list belongs to the repository and is mostly the team that owns it. Everyone else needs a second person to approve. An agent’s approval never counts as a person’s: automated review can clear a low-risk change, but it can’t fill a slot that calls for a human.
  • The person directing the agent is a required reviewer. On an agent-written pull request they count as one of the required reviewers, the same as if they had typed the code. On this guide’s reading, a Medium change can then be approved by the person who directed the agent, while a High change still needs a second person besides them.
  • An approval covers one specific commit. New commits the system can’t vouch for, such as an agent’s push or a merge someone resolved by hand, need the approval given again.

The article’s adoption checklist turns those rules into three settings for your forge:

  • Write the tiers down, set them from the change rather than the author, and start strict and loosen with evidence, one class at a time. Keep the lighter paths for authors you trust, and for nobody else.
  • Route auth, billing, CI and release workflows, and installers through CODEOWNERS with branch protection that requires code-owner review, so these paths always need a person. The CODEOWNERS block on human in the loop is a starting point.
  • Never let a bot’s approval replace a required human’s, and dismiss approvals on new commits. GitHub’s branch protection has a setting for the second part, Dismiss stale pull request approvals when new commits are pushed. It is less precise than Anthropic’s rule, which asks for a fresh approval only on commits the system can’t vouch for.

Guardrails or gates: which control goes where?

Section titled “Guardrails or gates: which control goes where?”

A guardrail shapes or constrains the agent before and during work: a sandbox, a scoped token, a hook that blocks a command. A gate decides whether the evidence is sufficient to advance: a required check, a code-owner approval, a deployment approval. You need both, because a guardrail cannot judge product intent and a gate cannot stop a command that already ran. Running agents across the whole lifecycle under human-owned gates is agentic software development.

MomentControlExampleEvidence it leaves
Before workBoundaryAccepted intent, allowed paths, data class, budgetReviewed intent.md and plan.md
During workGuardrailSandbox, scoped credentials, hook, protected pathPolicy log and a blocked-action test
Before mergeGateTypes, tests, security scan, specification reviewCI results and the review record
Before productionAuthority gateNamed approver, change window, rollback readinessApproval and release record
After releaseFeedbackCanary, telemetry, incident triggerObservation window and the promote-or-roll-back decision

Repository instructions (CLAUDE.md, AGENTS.md, Cursor rules, and skills) improve behavior, but they are instructions the model can misread. Match each need to the layer that actually enforces it:

NeedCorrect controlWrong control
Explain architecture and conventionsCLAUDE.md, AGENTS.md, Cursor rulesA hook
Reuse a multi-step workflowSkillA long prompt pasted by hand
Block or log a deterministic tool actionHook or execution policyA sentence in CLAUDE.md
Limit files, commands, and networkSandbox plus scoped identity“Do not deploy” in the prompt
Require review before mergeBranch protection and code ownersAn AI reviewer’s approval
Require authorization before productionDeployment environment or change-management gateThe authoring agent’s summary
Recover safelyRehearsed rollback with a named ownerA runbook nobody has run
Prove what happenedImmutable CI, PR, deployment, and incident logsThe agent’s transcript alone

Separate agent identity from human authority

Section titled “Separate agent identity from human authority”
  1. Give every non-interactive agent its own service identity. Never reuse a developer’s broad token; the details are in agent identity, credentials, and secrets.

  2. Grant the smallest repository, network, cloud, and data scope the run’s risk class needs. A worktree or container does not narrow a cloud token.

  3. Keep production secrets out of every agent run, whatever its class. In critical changes the deployment platform holds them, never the agent. A prompt that says “do not deploy” is not an access boundary.

  4. Require branch protection and code-owner approval for merge. The agent’s identity must not be a code owner.

  5. Require a separate deployment-environment approval for high and critical changes. Neither the authoring agent nor a reviewing agent can satisfy it.

  6. Log the initiating human, agent identity, tool and model version, artifact versions, commands, findings, approval, deployment, and rollback outcome.

The pattern is identical in all three tools: guidance in instruction files, hard limits in managed settings or admin policy, and merge and production gates on the forge and the deployment platform. The settings differ. For a side-by-side of every managed key, see enforcing one policy across every coding agent.

Put hard limits in managed settings (managed-settings.json, MDM, or server-managed settings on Team and Enterprise), which user and project settings cannot override. Keys checked against Claude Code 2.1.283:

{
"permissions": {
"disableBypassPermissionsMode": "disable",
"deny": [
"Bash(terraform apply:*)",
"Bash(kubectl delete:*)"
]
},
"allowManagedPermissionRulesOnly": true,
"allowManagedHooksOnly": true
}

A Bash deny rule matches the command text Claude writes, not the program, so sh -c or a script gets past it (Claude Code docs, checked against v2.1.283). The real boundary for terraform and kubectl is that the agent identity holds no production cloud or cluster credentials; treat the deny rule as a typo-catcher on top.

allowManagedPermissionRulesOnly ignores permission rules from user, project, and local settings; allowManagedHooksOnly does the same for hooks. From v2.1.283 (both release channels on 2026-10-12), auto mode is the starting mode for interactive terminal and VS Code sessions on supported models, and a classifier reviews each action. Treat that classifier as a guardrail, not a gate. To turn it off for regulated repositories, add "disableAutoMode": "disable" inside permissions. In CI, claude -p starts in Manual mode (auto mode on third-party providers or with telemetry off, from v2.1.285, where a classifier decides), so pass --permission-mode dontAsk, which denies anything that would prompt on every provider.

Claude Code’s managed Code Review posts findings, but “a review never approves or blocks your pull request, and the check run never concludes as a failure” (Claude Code docs, checked 2026-10-16). If its findings must gate a merge, parse them in your own required CI check, or require conversation resolution in branch protection. A review that failed, timed out or was superseded leaves no verdict line in its check run (Claude Code docs, checked 2026-10-16), so your CI check must fail when the result is missing.

Write an evidence contract for every agent run

Section titled “Write an evidence contract for every agent run”

Every background or autonomous run states its contract before it starts. The next gate reads the output, so a run with no contract has nothing for a gate to check.

  • Input: the exact commit, artifacts, ticket, telemetry window, and allowed external sources.
  • Scope: directories, tools, network destinations, credential class, and a time or cost budget.
  • Proof: commands with expected exit status, schemas, screenshots, or eval thresholds.
  • Output: the file, pull request, comment, or structured record the next gate reads.
  • Failure: non-zero exit, timeout, missing dependency, or low confidence, plus the escalation owner.
  • Authority: the actions allowed without approval and the first action that always stops for a human.

Replace the commit, paths, commands, and owner with your own. The fixed clauses (fail closed, never edit the oracle, never approve your own work) are the part to keep verbatim; protecting the test oracle explains why the second one matters most.

Paste this into your engineering handbook, fill in the owners, and link it from every repository’s instruction file. Each clause names what enforces it; a clause that says “trust” is a known gap.

AGENT AUTONOMY POLICY — v1.0 — owner: CTO — review: quarterly
1. Classification. Every agent change gets a risk class (low, medium, high, critical),
computed in CI from touched paths, migrations, and requested credentials.
Highest factor wins. Enforced by: required CI check that writes the PR label.
2. Forbidden in every class: production secrets, destructive production commands,
deleting backups, external communication, approving own work.
Enforced by: managed deny rules + credentials the agent identity never holds.
3. Identity. One service identity per agent loop, least privilege, short-lived tokens.
Enforced by: identity provider + CI OIDC. Owner: platform team.
4. Merge gate. Low: CI + evidence bundle + any reviewer. Medium: + code owner.
High: + specialist review + rehearsed rollback. Enforced by: branch protection.
5. Production gate. High and critical: named release owner approves in the
deployment environment. Agent identities cannot approve. Enforced by: deploy platform.
6. AI reviewers and auto-approval tools may approve low-class changes only.
Criteria owner: release owner. Enforced by: routing rules + branch protection.
7. Overrides. Every bypass is attributed, expires in 7 days, and is reviewed.
Enforced by: override log in the change record.
8. Evidence. Every control has an owner, trigger, failure behavior, exception path,
and audit record. Controls fail closed.
9. Proof. Controls are rehearsed quarterly; metrics are reported by risk class.
10. Circuit breaker. When a class's revert share or escaped defects pass the agreed
ceiling for two periods running, or any incident is traced to a change that took
a lighter path, changes in that class take the next class's merge gate (clause 4)
until the owner links the fix and a clean period. Tightening is automatic;
loosening is a reviewed change. Enforced by: scheduled job that raises the class
floor read by the CI classification check.

The seven-day override expiry and quarterly cadence are this guide’s working defaults, not a published standard. So are the circuit breaker’s two-period trigger and next-gate step: Anthropic’s article says its own team has no such control yet. Set all of them to your own risk appetite.

Prompts for designing and auditing controls

Section titled “Prompts for designing and auditing controls”

Run these in Claude Code, Codex, or Cursor with read access to the repository and its CI configuration. They produce reports; they change nothing.

Prove each control by making it fail on purpose, then measure the controls by risk class. Nobody has to read every diff for either step.

  1. Ask a low-class agent run to write outside its allowed workspace. The sandbox must block it, and the block must appear in the policy log.

  2. Ask it to skip a failing required test. The workflow must fail.

  3. Attempt a merge without code-owner approval. Branch protection must block it.

  4. Attempt a production release with the agent’s identity and without the named approval. The deployment platform must block it.

  5. Make the review service unavailable. The merge must stay blocked; a missing reviewer never counts as an approval.

  6. Trigger a rollback in a non-production environment and record the time to restore.

  7. Change a rule, skill, or hook and run the harness evals before rollout.

  8. Feed the circuit breaker a revert share above its ceiling in a test repository. Changes in the class must take the next class’s merge gate, and lifting that must need a reviewed change.

A step that passes when it should fail is an incident in the control, not a flaky test. Record it the way you would record an incident an agent caused.

MetricDefinitionWhat a bad trend means
False-block rateBlocked changes later merged unchanged ÷ all blocked changesThe gate costs trust and invites bypasses
Override rateMerges or releases with an attributed bypass ÷ all merges in the classThe control is wrong or the class is too strict
Escaped defectsIncidents traced to a change that passed every gateThe gate checks the wrong thing
Revert shareChanges in the class reverted within 30 days ÷ all changes merged in the classThe lighter paths let defects through; tighten the class
Review waitMedian hours from “ready for review” to decisionHuman gates became the bottleneck; move checks to automation

Report these per class. A healthy low class shows short waits and few overrides; a healthy critical class can show long waits and still be correct. The canonical metric definitions live in metrics frameworks.

How do you tighten approval when the numbers move?

Section titled “How do you tighten approval when the numbers move?”

Anthropic’s article is candid about a gap. Noticing a bad merge still depends on the author, the on-call engineer and the revert and incident dashboards, and the team doesn’t yet have “circuit breakers that tighten approval when those numbers move; engineers here want them before more code moves to zero-human merges.” Its goal is most pull requests merging with at most one human in the loop, “with no increase in reverts or incidents”: “if they rise, we haven’t saved human time, we’ve only moved it.”

Design this control before you loosen any class. The article describes no design, so the one below is this guide’s own:

  1. Pick the inputs per class. Use the revert share and the escaped defects from the table above. Anthropic measures human time as human approvals per pull request (median and 95th percentile), human comments, and how long a pull request waits on a person. Record those too, so you can see what the lighter path saves.

  2. Set a trigger. A class’s revert share or escaped defects above the agreed ceiling for two periods running, or any incident traced to a change that took a lighter path.

  3. Tighten without a meeting. When the trigger fires, a scheduled job raises that class’s floor in the configuration your CI classifier reads, so the next pull request in the class takes the next class’s merge gate (clause 4 of the template). A High class has no next merge gate, so there the trigger escalates to the policy owner.

  4. Loosen only with evidence. Lifting the floor takes a reviewed change that links the fix and a clean period, signed by the policy owner.

Who signs off: the release owner signs off the production gate for high and critical changes, the code owner signs off medium merges, and the CTO signs off changes to the policy itself, including the circuit breaker’s ceilings, with the rehearsal results and the metrics attached.

An author agent and a reviewer agent improve detection, but they can share credentials, configuration, model blind spots, and the organization that set them up. Two agents are not separation of duties. The OWASP GenAI LLM Top 10 2026 (published 2026-08-04) lists Excessive Agency as LLM03 and advises: “Use human-in-the-loop control to require a human to approve high-impact actions before they are taken.”

A real gate uses an identity the authoring run cannot act as, or a platform policy it cannot change, plus the accountable human where the risk class demands one. The approval tiers above carry the same rule. Use AI review to decide where human attention goes, not to replace it on high and critical changes. For evidence that auditors accept, see agentic engineering in regulated industries.

What breaks in agent governance, and how do you recover?

Section titled “What breaks in agent governance, and how do you recover?”

Advisory text is treated as enforcement. A CLAUDE.md line says “never run migrations,” and one day the agent runs one. Recover: run the “separate advice from enforcement” prompt, then move each advisory-only invariant into an enforced control. For destructive actions, prefer removing the credentials from the agent identity or a platform permission; a managed deny rule, a hook, or CI catches the common spelling on top.

One token reaches every environment. The agent’s CI token can also deploy. Recover: revoke it first, then split identities per loop and environment, and rotate. Treat the exposure as an incident until the logs show what the token touched.

The agent labels its own risk. Every change arrives as “low.” Recover: compute the class in CI from paths and migrations, and alert when an agent-proposed label is lower than the computed one.

A human gate has no decision criteria. Approvers click through because nothing tells them what to check. Recover: attach the evidence bundle and a one-line risk statement to every request, and set the criteria, owner, timeout, and escalation path before automating the request.

Overrides never expire. A one-off bypass for an outage becomes permanent. Recover: give every override an expiry and an owner, and report the open ones in the quarterly review.

A control fails open. The review service times out and the merge proceeds. Recover: make the check required and fail on a missing result, then add the outage case to the rehearsal.

Rollback exists only in a document. Recover: rehearse it in a representative non-production environment and measure the time to restore. Pair high-class releases with progressive delivery so the rollback is a flag, not a redeploy.

A loosened tier has no way back. The checks are green, the lighter path becomes permanent, and nothing tightens it when reverts rise. Recover: add the circuit breaker, and loosen a class again only with a clean period on record.

An approval outlives the code it covered. An agent’s late push or a hand-resolved merge rides in on an earlier approval. Recover: dismiss approvals on new commits.

False certainty. Someone calls the instructions “unbreakable guardrails” or retires human review because the checks are green. Models misread instructions, hooks can be misconfigured, and deterministic checks cannot judge product intent. Recover: test the full control path, write down the residual risk, and keep human authority at the consequential gates.

Before this page, read the operating model for who owns the autonomy register. Next, apply the policy to the threats and credentials it has to hold against.

For the stage procedures these gates sit inside, see Deploy and Maintain.

Did this guide help you?

One tap, no sign-in.

not at all a lot

Frequently asked questions

How should an organization decide how much autonomy a coding agent gets?

Assign autonomy by the risk class and blast radius of the target system—such as local sandbox, internal service, or production auth and billing—rather than by how confident the model sounds.

What is the difference between a guardrail and a gate?

A guardrail constrains what the agent can do during execution (such as sandboxes, hooks, and deny rules), while a gate is a mandatory verification check or human sign-off required before merge or deployment.