Skip to main content
A policy file, .claude/approvals.yml, tells Claude Approvals who has to approve a pull request and when Claude may approve it. Look up its keys here, how its rules combine, and how approvals are counted.
To set up Approvals and require the Claude Approvals check, see Set up Claude Approvals. To find out what a check’s title means, see Work with Claude Approvals on a pull request. For a file that the check refuses, see Fix a policy file that Approvals refuses. To define a repo/<name> classifier, see Claude Approvals classifiers.

How a policy file works

A policy file is a list of rules. Each rule names the files that it’s about, in paths, and says what a pull request that changes them needs:
  • seats: how many people have to approve
  • claude: whether Claude approves, comments, or blocks
  • override: another verdict, which replaces the rule’s own while its if is true
This policy file is the one that Set up Claude Approvals starts from. It asks for two people to approve a change, or one person when Claude’s review passes. In both cases, the pull request’s author can count as one person:
Each line of that file does one job: A file under .claude/ matches both rules. Approvals takes the strictest of the verdicts that apply, so once you enforce the policy, a change to that file needs two people, because the second rule has no override.

Where to put a policy file

Save the policy file as .claude/approvals.yml in your repository’s root, and merge it into the default branch. Approvals reads policy files from the default branch, so the file’s rules apply once it’s merged. You can also name the file .claude/approvals.yaml, which Approvals reads where the .yml file is absent. To give a directory rules of its own, add a policy file there.

When a change to a policy file takes effect

While a change to a policy file is in an open pull request, Approvals can check the changed file for errors, and applies none of its rules. The rules on the default branch decide for that pull request. Once the change merges, new pull requests get the new rules, and open ones get them from their next evaluation. Approvals can read the earlier copy for a few minutes more. To evaluate an open pull request now, comment @claude approvals rerun.

Policy files in subdirectories

To give a directory its own rules beside the root policy file, add a .claude/approvals.yml inside it, such as services/billing/.claude/approvals.yml. For each changed file, Approvals walks up from that file’s directory. The first enforcing policy file that covers the changed file, and in which a rule with a verdict applies, decides for it. A nested: inherit rule in a policy file higher up counts as one of the deciding policy file’s rules.
  • The nearest policy file decides: it can ask for less than the root policy file. Above it, only rules marked nested: inherit still count.
  • paths start at the directory: in services/billing/.claude/approvals.yml, write api/** to match the files under services/billing/api/
  • locals reach down: in a policy file, you can use the locals of the policy files above it
  • Each policy file has its own mode: while the root policy file observes, none of its rules count under a directory’s enforcing policy file, the nested: inherit rules included
  • Some custom classifiers go only under advisory: that’s a classifier whose tools list reviewers or labels, or that has an input with no merge. List it in an enforced rule with no if. If a rule reads its result, the check on pull requests under a directory’s policy file can read Cannot evaluate: classifier outside advisory

Top-level keys

Approvals refuses a file that has an unknown key. Write keys, and fixed words such as observe and approves, in lower case. Put double quotes around every purpose, pattern, condition, and "!" item. Keep the file to one YAML document, quote each ! item, and indent with spaces, or Approvals refuses the file. Anchors, aliases, and !! tags draw a warning. Write these keys at the top level of the file:

Rule keys

Give each rule a purpose, paths, and at least one of verdict, advisory, findings, and reuse. If reuse is the only one of the four that a rule has, the value of reuse has to be false or name a classifier. A rule with no verdict asks nobody and covers no file. You can write these keys on a rule:

paths

Write each pattern as a path from the directory that holds the .claude folder. A moved file counts at its old path and its new one.

if

Write a condition as true, false, or one double-quoted string with a fact’s or a classifier’s name on the left, such as "pr/files_changed > 50". When you give a rule an if, keep another rule with no if on the same paths. While the if is false, the rule that has it doesn’t apply. Where rules cover a file and none applies, the Claude Approvals check fails.
  • Operators: =, !=, <, <=, >, >=
  • Joining: AND and OR in capitals. Use parentheses to mix the two.
  • Lists: write ANY or ALL before pr/authors and pr/approved_by. Where the condition leads to a lighter verdict, use ALL: with ANY, one listed author relaxes the rule for everyone else’s commits. Where it leads to a stricter one, use ANY: with ALL, one unlisted author switches it off.
  • Quotes: single quotes around a login or a branch pattern, and none around a team, a bot: name, or a fact, as in "ALL pr/authors = ['ana-acme', acme/payments]"
  • Classifiers: claude/code_review = pass, repo/change_risk <= medium, and the other forms under Read a classifier’s answer from a rule
A fact comes from the pull request itself:

verdict

A verdict says what Claude does and who has to approve. In a rule’s verdict, write claude, and write seats unless claude is blocks. Give each set in seats a count, from 1 to 16, and a from, which is a people list. Every set has to be filled, and one person can fill a seat in several sets.

People lists

A people list names accounts. Write one as a set’s from under seats, or under findings, as one item or as a list in brackets. Only accounts with write access to the repository count. If a set’s from admits Claude, for example through bots, everyone, or bot:claude, and every rule that applies says approves, Approvals counts a seat in that set as filled before Claude approves. The Claude Approvals check can then pass with no person’s approval.

override

An override changes its rule’s verdict while the override’s own if is true. Approvals reads the override list from the top, and the first true override applies. When an override’s if reads a classifier, the Claude Approvals check waits for the classifier’s run:
  • The run is still going: the check stays in progress. It can finish early when the approvals already meet every verdict that the rule could still pick, unless the classifier’s tools list reviewers. With a policy file in a subdirectory, list such a classifier only under advisory
  • The run ended with no answer: reading stops at that override, and the rule’s own verdict applies. Put the strict verdict on the rule for this reason.
  • You want to catch a missing answer: put an override on = error or = incomplete above the ones that read the answer
In a rule’s own if, a comparison with no answer fails the check, whoever approves, unless another part of the condition settles it.

advisory

Under advisory, list classifier names or calls, such as [claude/code_review, repo/change_risk]. A repo/ classifier listed here can run, and each run is billed. List it in a rule that has a verdict. To keep Code Review’s automatic reviews, list claude/code_review here, or read it in an if, in a rule that has a verdict and matches the files you want reviewed.

reuse

reuse says which earlier approvals and classifier answers continue to count after a push that changes the diff, under a condition that usually reads claude/diff. When claude/diff’s answer is at most same_intent and Claude’s review of the new commit passes, this example can keep people’s approvals:
Write reuse in one of these forms: Before you rely on reuse, check these cases:
  • Every rule that matches the files: write reuse on each of them
  • When claude/diff gives no answer: a condition that reads it keeps nothing
  • After a dismissal or a force-push: the example keeps no approval that GitHub dismissed, and normally none given before a force-push. reuse can keep them under a seats condition that reads claude/diff and no other classifier, such as "claude/diff <= same_intent".
  • Earlier authors count too: where reuse keeps seats, people who held the author’s seat at an earlier commit can continue to count. Two of them can fill seats: 2 with nobody approving. To prevent that, exclude authors from the set with "!pr/authors".
  • Files that a push left alone: in a policy file that writes reuse, an approval can outlast a push to other files only. Those can be files that no rule covers, or whose rules couldn’t count that person. An approval that GitHub dismissed normally doesn’t

findings

A classifier can report findings as review threads, and a condition can read their severity as .severity. Use findings to say who may close a finding, by resolving its thread or with @claude approvals resolve. Until a rule’s findings lists who may close findings, a person’s resolve alone doesn’t lower .severity. A classifier needs no list to close its own finding, as Code Review can when a later review finds it fixed. This example lets the acme/leads team, less the pull request’s authors, close Code Review’s findings:
Under findings, write resolution with one of these values: To let people close findings, put a list on a rule that has no if and covers the finding’s file. Put that rule in the policy file that decides for the file. For a resolve alone to count, every list that applies to that file has to admit the person who resolves. A failed claude/code_review is one answer for the whole pull request. Check every changed file under a rule that compares that answer, as in claude/code_review = pass:
  • Every file’s lists admit the person who resolves: once every Important finding of the review is closed, it can read pass, with no new review
  • One file’s lists don’t admit the person who resolves, or that file has nobody or no list: that person’s resolve leaves the review fail. Write a list for that file that admits the person.
Closing a finding changes no code, so people can lower .severity and pass a failed review with nothing fixed. Keep the lists short.

locals and use

To reuse a value, name it under locals at the top of the policy file. Then write "@name" where the value belongs, or copy a whole map into a rule with use. In this example, payments_owner names one set of people, and strict names a whole verdict that the first rule copies with use:
Check what a local can hold and where you can use it:
  • What a local holds: text, a number, true or false, a list, or one map
  • Where "@name" can stand: for the whole of paths, a people list, seats, verdict, or override, and for one item of paths, a people list, or seats. Inside a condition it takes no quotes of its own, as in "pr/files_changed > @many".
  • What use copies: verdict, override, if, paths, reuse, advisory, and findings. What the rule writes itself wins: key by key inside verdict, findings, and a reuse map, and whole for any other key.

How rules combine into one verdict

Approvals takes the strictest of the verdicts that apply: blocks outranks comments, which outranks approves, and every rule’s seats have to be filled. Which verdicts apply turns on whether a rule matches, applies to, or covers a changed file:
  • Matches: a rule matches a changed file when its paths include the file and no "!" item takes it out
  • Applies: a rule applies to a changed file when it matches, its mode is enforce, and its if is true or absent
  • Covers: a rule covers a changed file when it matches, its mode is enforce, and it has a verdict, whatever its if says
Approvals picks a policy file, then rules, then verdicts:
  1. The policy file: for each changed file, the nearest enforcing one that covers it and in which a rule with a verdict applies. nested: inherit rules in policy files higher up count as its rules.
  2. The rules: the ones that apply to each changed file.
  3. Each rule’s verdict: its own, or its first true override.
  4. One verdict for the pull request: the strictest across all changed files. One person can fill a seat in several rules, and the shortest max_age applies.
Under an enforced policy, these cases end another way: To avoid these, cover every path with root rules that have no if, as the first rule of the starter policy does.

How people’s approvals are counted

An approval can count when an account with write access gives it in a GitHub review or an @claude approve comment. It has to be on the latest commit, or on an earlier one that still counts. While a person with write access requests changes on a pull request that has a covered file, the Claude Approvals check normally reads Changes requested once nothing else holds it.

Whether a pull request’s author counts

On a pull request that a person with write access opened, the author can fill one seat without approving, in a set that admits them. Except on a fork’s or an outside contributor’s pull request, the author alone can meet seats: 1. seats: 2 can be the author and one more person.
  • Who holds the author’s seat: at the commit that the pull request was opened with, the person who opened it. After a later push, normally the person who both wrote and pushed the latest commit.
  • When nobody holds it: for example, after a push of a commit that one person wrote and another pushed. The Claude Approvals check’s summary gives the reason, and if you opened the pull request, you can then comment @claude approve.
  • To exclude authors: write seats: [{ count: 1, from: [humans, "!pr/authors"] }]. In a set of named people, name at least one more than count, or an author’s own pull request can wait. On a fork’s pull request, no approval counts toward a set that excludes pr/authors.
  • What "!pr/authors" goes by: the accounts that GitHub names as having written or pushed a commit or opened the pull request. It doesn’t read Co-authored-by lines, and an agent’s commits under another account don’t make a person an author.
  • Bots: a bot fills the seat only in a set that admits it, on a pull request that it opened and whose latest commit it pushed
  • Machine users: an agent that works under a user account other than claude holds the seat as a person does, and can be the one person that a protected file needs. To keep it out, take its login out of the rule’s set with "!", as in [humans, "!acme-ci"]. For protected files, put that set in a rule whose paths name them, marked nested: inherit.

Earlier approvals after a new push

After a push, an earlier approval counts or stops counting by what the push changed:
  • The diff’s text stays identical: an earlier approval that GitHub hasn’t dismissed can count.
  • The diff’s text changes: earlier approvals normally stop counting. Where the policy writes reuse, some can continue to count
Approvals normally asks GitHub to dismiss Claude’s own approval when it evaluates the push, and Claude approves the new commit only if the Claude Approvals check passes again.

Protected files

A protected file is Approvals’ term for a file that controls how pull requests are reviewed, such as the policy file itself. An edit to one can weaken the review of later pull requests. For example, an edit to the policy file can lower the number of people that they need. Where a rule covers a changed file, Approvals normally asks for a person on a change to a protected file. The list of protected files is built in:
  • Policy and classifier files: every policy file, and everything under .claude/classifiers/
  • Review instructions: REVIEW.md at the repository’s root
  • Git files: .gitmodules, .gitattributes, symlinks, and submodule pointers
  • Code owners: any file named CODEOWNERS
Don’t rely on other files being protected. Write a rule for the ones that matter to you, such as .github/, CLAUDE.md, AGENTS.md, .mcp.json, and the rest of .claude/.

Who has to approve a change to a protected file

The person that Approvals asks for can be the pull request’s author:

When Claude approves a change to a protected file

Claude approves a pull request that changes a protected file only if a rule applies to that file and every rule that applies says approves. A rule on "**" can count. Claude doesn’t approve a pull request that changes a .gitattributes file, a symlink, or a submodule pointer, whatever the rules say.

Policy file size and count limits

Keep each file within these limits, or Approvals refuses it: A pull request has limits too. Past them, GitHub lists the Claude Approvals check as Action required:
  • Changed files: 2,000 or more. The check’s title reads Change too large to evaluate. Split the pull request.
  • Commits: more than 250, where a set excludes authors with "!pr/authors". The title reads Too many commits to tell who wrote it. Have an author squash it to 250 commits or fewer and force-push.