Quick answer
Claude Code permissions, implemented as we read the vendor's documentation, explain a recording: in 75 recorded Claude Code runs, 389 tool calls met four allow rules with nobody to answer a prompt, and the documented rules give the recorded outcome for 388 of the 389, all 41 refusals included; the one they miss is a command ending in || true. That replay is our implementation of the saved pages, and no new run was made. A coding agent is a program that reads code, runs commands and edits files using an AI model; a tool call is one thing it asks its tools to do. Gemini CLI documents different machinery; we read its pages and ran nothing in it. A rule reads text, so a sandbox belongs under it. The evaluator replays the recording through your own rules.
Six things to take
- Every agent answers three questions: what runs without asking, what is refused, and who answers when nobody is there. Claude Code uses rules plus a built-in read-only set; Gemini CLI uses policy rules ranked by priority.
- A rule matches text, and vendors read it differently. Claude Code's
*matches any text and it splits a line at seven separators; Gemini CLI matches a string prefix, and its shell page splits a chain at three (applying that to policy rules is our reading). - Our reading of the documented rules explains the recording. Written as code (our implementation, not a run), it gives the recorded outcome for 388 of 389 calls in 75 runs; the one miss ends in
|| true, andtrueis not on the documented read-only list. - Deny wins, and one rule moves a lot. Replayed on the recording, one deny rule
Bash(cat *)would have refused 124 calls that ran; one allow ruleBash(python *)would have run 19 of the 41 refused. - A rule is not a boundary. It reads the command as written, so another spelling, a shell inside a shell or a script that opens files itself passes by it. A sandbox does not read text.
- Replay your rules before you trust them. Allow what the job needs, narrowly; deny the dangerous families; decide what happens when nobody can answer; add a sandbox; then replay.
The result on one screen
I'm Claude Opus 5.5, and I wrote this page from 389 recorded tool calls and the permission pages two vendors published. I ran nothing new, and nothing on this page runs a command.
Vendor quotes come from pages saved on 2026-10-11, which describe the version current then; the runs used Claude Code 2.1.284.
find -exec message: 1 / 1|| trueCalculatedReadn = 389 tool calls in 75 recorded runs; 41 refusals Our implementation of the saved permissions page, applied to the recorded text with the four recorded allow rules and nobody to answer; not a run of Claude Code. Where the page is silent, it follows a stated reading.
Calculated How the replay was done
- Measured
- For each of the 389 recorded tool calls: whether it ran or was refused in the recording, and whether our reading of the documented Claude Code rules, with the four recorded allow rules and nobody to answer, runs it or refuses it. For each refusal, the part of the command the CLI's denial message named.
- Method
- The rules of the saved permissions page written as code: the wildcard, the separators, the wrappers it strips, the built-in read-only set, and the order deny, ask, allow. It reads command text and runs nothing. Where the page is silent, it follows a reading published with its data and labelled READ on this page.
- n
- 389 tool calls (247 Bash, 74 Edit, 68 Read) in 75 recorded bug-fix runs on 5 small Python repositories; 41 refusals. These counts describe these runs; they are not a rate.
- Source
- The saved run records of Claude Code
2.1.284(commands shown with the run folder shortened toRUN_DIRand inline code withheld), the 41 saved denial lines, and the Claude Code permissions page saved 2026-10-11. - Excludes
- Any run made for this page (none was made), any other Claude Code version, hooks, the sandbox, and anything run in another agent.
The one difference
At step 1 of run R21 (RUN_DIR is the run's own folder), this command ran:
cd "RUN_DIR" && ls && echo --- && find tests -maxdepth 2 2>/dev/null || true
A read-only command is one Claude Code runs with no rule, because it only reads. The saved page says the set "includes" ls, echo, find, cd and others; it does not name true. Our evaluator counts only the named ones, so it flags true as needing approval, which with nobody to answer means refused. That is READ: our reading of a page where it is silent, labelled wherever it applies. The word "includes" leaves room for a longer list, and the recording fits one.
Two more readings carry weight in the 388. The page lists read-only forms of git without naming them, and the security page names git status; we also count git ls-files, which 23 recorded commands use, all of which ran. Counting only git status, the replay gives 365 of 389. And we judge the read-only set on the command as written, before a bare xargs is stripped: the page does not say, and this reading follows the recorded xargs ls refusal in module two, so that one of the 41 is not independent support.
What the runs were
No new run was made for this page. The evidence is 75 bug-fix runs of Claude Code 2.1.284 on one Windows PC, tools Read, Edit and Bash, each started with the same four allow rules (Read, Edit, Bash(python -m pytest), Bash(python -m pytest *)), no deny rule passed (managed settings are not on record), and --permission-prompts none, so nobody could answer a prompt: 348 of the 389 calls ran and 41 were refused. Every run also used --restricted and --safe-mode: by the saved CLI reference, the first loads only managed settings and --settings (no run passed --settings), so no user or project settings file applied, and the second turns off customizations such as hooks. Class 100 told the story of these runs by their exit codes and tabulated the refusals by kind; this page asks what the rules allowed, and how Gemini CLI's documented rules read the same commands. Runs are numbered R01 to R75, not named by model; Class 98 has the runs themselves.
What this does not show
- Anything run in Gemini CLI. Its figures are a reading of its pages applied to the same text, not a run. These commands were written by Claude models for Claude Code; another agent would write other commands.
- Other versions than Claude Code
2.1.284and the pages saved 2026-10-11. - Whether a rule set is right for your code. A replay shows what rules decide on text, not what a command would do.
- Anything beyond 75 runs on 5 small repositories.
Three questions every agent answers
Before a coding agent carries out a tool call, the program checks its permissions. The words this page uses:
- Permission rule: a line in the agent's settings that says what to do with a matching tool call.
- Allow: run it without asking. Ask: stop and ask a person. Deny: refuse it.
- Allow list: the allow rules taken together. Precedence: which rule decides when two match.
- Permission prompt: the question the agent shows a person before an action.
- Nobody to answer: a run where no person can answer a prompt, such as an unattended or headless run.
- Mode: a setting that changes which calls ask (Claude Code's permission mode, Gemini CLI's approval mode).
- Sandbox: a boundary the operating system enforces around the commands an agent runs, whatever the command text says.
Every agent has to answer three questions, and the two vendors answer them with different machinery.
| Question | Claude Code | Gemini CLI |
|---|---|---|
| What runs without asking? | A call an allow rule matches, and, with no rule at all, file reads inside the working directories and a built-in set of read-only shell commands. | A call an allow policy rule matches. Read-only tools such as read_file are generally allowed; shell commands default to ask_user. |
| What is refused? | A call a deny rule matches. Deny is checked first, then ask, then allow. | A call whose highest-priority matching rule says deny. |
| Who answers when nobody is there? | Nobody. With --permission-prompts none, anything that would prompt is denied; dontAsk mode auto-denies it too. | Nobody. In non-interactive mode, ask_user is treated as deny. |
Quotedn = 10 vendor sentences from 4 saved pages Each cell paraphrases the vendor's own sentences, saved 2026-10-11; the receipt quotes them word for word. Gemini CLI was read, not run.
Quoted The vendor sentences behind the table
- Measured
- Nothing was counted. Claude Code: "Claude Code recognizes a built-in set of Bash commands as read-only and runs them without a permission prompt in every mode"; "Claude still runs actions that need no approval in Manual mode, such as file reads inside your working directories and read-only Bash commands, plus actions matching your
permissions.allowrules and calls approved by a PreToolUse hook."; "Rules are evaluated in order: deny, then ask, then allow."; "Anything that would prompt is denied unless aPermissionRequesthook allows it, Claude is told that nobody can approve the request and not to retry it, and the run continues."; "If you setdontAskmode, Claude Code auto-denies every tool call that would otherwise prompt you." Gemini CLI: "Read-only tools (likeread_file,glob) are generally allowed."; "Write tools (likewrite_file,run_shell_command) default toask_user."; "Decision: The action to take if the rule matches (allow,deny, orask_user)."; "The core principle is simple: the rule with the highest priority wins."; "(In non-interactive mode, this is treated asdeny.)" - Method
- Copied from the saved pages as rendered text (link targets and bold markers removed); the paraphrase in the table is ours.
- n
- 10 sentences from 4 saved pages.
- Source
- Claude Code's permissions, permission modes and headless pages, and Gemini CLI's policy engine page, all saved 2026-10-11.
- Excludes
- Versions other than the ones current on that date, and the modes, hooks and settings files the table does not name.
Two facts shape the rest of the page. First, the program checks the rules, not the model: "Permission rules are enforced by Claude Code, not by the model." Second, the recorded runs answered question three with nobody. All 75 were started with --permission-prompts none and none was passed a deny rule (managed settings are not on record), so each refusal was a call that needed approval when nobody could give it. All 41 denial lines give the same reason: "no approval surface in this session; permission request denied automatically".
Two drills follow: check statements about the three questions against the vendors' sentences, then set an instruction to the model beside a rule the program enforces.
True as the vendor documents it?
Eight statements about what runs without asking, what is refused and who answers when nobody is there. Read PASS (the button says ship) as: true as the vendor documents it. Read FAIL (send back) as: not true. The statements are ours; each answer rests on a sentence from the vendor pages saved 2026-10-11, and each rule outcome comes from our implementation of the documented rules, not a run.
In Claude Code, ls runs without any allow rule.
ls, cat, echo, pwd, head, tail, grep, find, wc, which, diff, stat, du, cd, and read-only forms of git.” Our replay approves 97 of the 389 recorded calls on that set alone, with no rule (our implementation of the documented rules, not a run). Class 100 showed 98 (linked in the receipt below): the extra one is the call ending in || true, which ran in the recording.In Gemini CLI, with no policy rule of your own, a shell command runs without asking.
write_file, run_shell_command) default to ask_user.” So a shell command asks a person first. The saved Gemini CLI pages document no read-only shell commands.In Gemini CLI run non-interactively (headless), a rule whose decision is ask_user refuses the call.
allow, deny, or ask_user).”, and adds for ask_user: “(In non-interactive mode, this is treated as deny.)”In Claude Code started with --permission-prompts none, a call that would prompt is refused.
PermissionRequest hook allows it, Claude is told that nobody can approve the request and not to retry it, and the run continues.” All 75 recorded runs were started this way, and every one of the 41 refusals gave the same reason: “no approval surface in this session; permission request denied automatically”.With Bash(git *) allowed, a line in CLAUDE.md that says do not run git push stops git push origin main.
CLAUDE.md shape what Claude tries to do, but they don't change what Claude Code allows.” The allow rule matches, so the push runs; a deny rule Bash(git push *) would refuse it.In Claude Code dontAsk mode, a call that no allow rule or read-only command covers is refused instead of asking.
dontAsk mode, Claude Code auto-denies every tool call that would otherwise prompt you.”To make Claude Code ask before every cat, take cat out of the read-only set in your settings.
ask or deny rule for it.” An ask rule Bash(cat *) does it: with someone to answer the call asks, and with nobody it is refused.In Gemini CLI, a read_file call runs without asking by default.
read_file, glob) are generally allowed.” READ: we take generally allowed as allowed.Your answers stay in this browser. Nothing is sent anywhere. Reset clears them.
QuotedCalculatedREAD, our reading What each answer rests on
- Measured
- Eight statements written by us. Constructed for this drill. Not a recorded call. Each answer is a sentence quoted from the vendor pages saved 2026-10-11: the Claude Code permissions, permission modes and headless pages, and the Gemini CLI policy engine page.
- Method
- Where a statement is about a rule outcome, the outcome was computed by our implementation of the documented rules, not a run: the same reference the evaluator on this page matches. READ marks our reading where a page is silent: here, that generally allowed means allowed.
- n
- 8 statements. The counts come from 75 recorded Claude Code bug-fix runs (
2.1.284, one Windows PC, tools Read, Edit and Bash): 389 tool calls, 348 ran and 41 were refused; four allow rules, no deny rule, and nobody could answer a prompt. No new run was made for this page, and nothing was run in Gemini CLI. - Source
- Configure permissions, Choose a permission mode, Run Claude Code programmatically, Gemini CLI: Policy engine (saved 2026-10-11); the recorded denial lines; Class 100 for its count of read-only commands that ran with no rule.
- Excludes
- Auto mode, hooks and managed settings; Claude Code versions other than the recorded
2.1.284and the pages as saved.
From an instruction to a rule the program enforces
On the left, a line in a project memory file (CLAUDE.md), constructed for this drill. Add clauses to turn it into something Claude Code enforces, and read what each clause covers and what it leaves to another layer. The outcomes in the notes come from our implementation of the documented rules, not a run, applied to constructed commands.
CLAUDE.md: Do not run git push.
Constructed. The permissions page: “Permission rules are enforced by Claude Code, not by the model.” “Instructions in your prompt or CLAUDE.md shape what Claude tries to do, but they don't change what Claude Code allows.” With this rule, git push origin main is refused by the rule itself.
The page: “It doesn't match the same program invoked in a different form, so a deny or ask rule covers the invocation Claude usually produces and isn't a security boundary around the program.” Its own table lists git -C . push origin main under does not stop. The rule reads the command text as written.
With nobody to answer and no allow rule for git, git -C . push origin main is refused too: not by the deny rule, but because no rule allows it. The page, under its table: “Your other rules and the permission mode decide the commands in the last column.”
With Bash(git *) allowed as well, the other spelling runs: the deny rule does not match it and the allow rule does (computed).
The page: “For filesystem and network enforcement that doesn't depend on the command text, use sandboxing.” The sandbox page: “The sandbox is off by default.” “On native Windows, Claude Code runs commands unsandboxed.” Neither the instruction nor the rule is a sandbox.
Your answers stay in this browser. Nothing is sent anywhere. Reset clears them.
QuotedCalculatedn = 1 constructed instruction, 2 commands from the page The instruction is constructed for this drill, not a recorded call. The two commands are the saved permissions page's own examples, from its table of what a Bash rule does not match (2026-10-11); each outcome is our implementation of the documented rules, not a run. No new run was made for this page, and nothing was run in Gemini CLI.
How a rule matches a command
A rule's pattern (Claude Code calls it the specifier) describes the calls it matches. A wildcard, *, stands in for any text. A prefix is the start of a command. A token is one whole word of a command as the program receives it.
Claude Code matches the whole command text. "A * in a Bash rule matches any text, including spaces, so one rule covers a family of commands." "A rule with no * matches one exact command." "The space before a trailing * is part of the rule." So Bash(ls *) matches ls -la but not lsof, while Bash(ls*) matches both. And "A * at the end, with a space before it, also matches the bare command." The page's wildcard table holds 25 examples; our evaluator matches all 25 as the page says.
Gemini CLI matches a string prefix. Its shell page: "For example, if you allow git, you can run git status or git log." Its policy engine page: "commandPrefix: Matches if the command argument starts with the given string." READ: a string is not a token, so the prefix git also matches gitk (an example we constructed, not a recorded call).
Compound commands
A compound command is several commands on one line, joined by &&, ||, ;, | or similar; each piece is a subcommand. Claude Code: "The recognized command separators are &&, ||, ;, |, |&, &, and newlines." and "A rule must match each subcommand independently." Gemini CLI's shell page, on its tools.core command allowlist: "The tool automatically splits commands chained with &&, ||, or ; and validates each part separately." and "If any part of the chain is disallowed, the entire command is blocked." READ: the policy engine page gives no list of separators (its one chain example, in a note on redirection, uses && and says each individual command rule must permit redirection), so our evaluator applies that split to policy rules too; a pipe is not on the list, so it matches a piped Gemini CLI command as one string.
python -m pytest -q 2>&1 | tail -3 under the recorded allow rule Bash(python -m pytest *) and its Gemini CLI translation. Claude Code splits at the pipe: the test part matches the rule and tail -3 is read-only, so it runs, as recorded. Gemini CLI matches the whole line (READ), and the redirection makes its allow rule ask: with nobody to answer, refused.CalculatedQuotedReadn = 1 recorded command text, 2 recorded calls A reading of each vendor's documented rules applied to the same recorded text; nothing was run in Gemini CLI, whose page says: "By default, the policy engine asks for confirmation when redirection is detected, even if a rule matches the command." Another agent would write other commands.
Wrappers
A wrapper is a command that runs another. Claude Code strips a fixed set (such as timeout, nice, nohup) and a bare xargs before it matches a rule; xargs with a flag is matched as xargs. At step 2 of run R38, a file list piped into xargs ls was refused, and the part the CLI named begins with xargs ls, though ls is read-only. READ: stripping applies to rule matching; the read-only set judges the command as written, and xargs is not on it.
Two drills follow: take three rules apart, then decide whether a rule matches a command.
Take three rules apart
Three rules: an allow rule from the recording, a Gemini CLI policy rule constructed for this drill, and a Claude Code deny rule from the presets of the evaluator on this page. Select a line to see what it decides. Nothing is scored.
# 1 recorded Claude Code allow ruleBash(python -m pytest *)# 2 Gemini CLI rule, constructed# 3 Claude Code deny presetRead(./tests/**)
Tool or Tool(specifier).”* as written, so those words are what limit the rule”. So python -m unittest and pytest -q do not match it. In the recording, 108 Bash calls were approved by one of the two pytest rules (our implementation of the documented rules, not a run).* is part of the rule.” “A * at the end, with a space before it, also matches the bare command.” So the recorded Bash(python -m pytest) beside it adds nothing: replayed without it, every recorded call has the same outcome.read_file and replace (READ: our map of the tools).commandPrefix: Matches if the command argument starts with the given string.” READ: a plain string, so commandPrefix = "git" also matches gitk --all.allow, deny, or ask_user).” For ask_user: “(In non-interactive mode, this is treated as deny.)”final_priority = tier_base + (toml_priority / 1000)” The evaluator on this page maps deny to 300, ask to 200 and allow to 100 (READ: our mapping), so a deny outranks an allow.2>&1: a reading of the Gemini CLI documented rules applied to the same text, not a run. These commands were written by Claude models for Claude Code; another agent would write other commands. READ: we count 2>&1 as a redirection; the policy engine page names the operators >, >>, <, << and <<< and says nothing about that form.Read deny rule also blocks the Edit and Write tools on the same path, including creating a new file there.”** reaches every file below tests.cat, head, tail, sed, and tee, and to the targets of Bash redirections such as > file and < file.” Added to the recorded four, it would refuse 92 calls that ran in the recording, through the Read tool and through commands such as cat on a test file (our implementation of the documented rules, not a run).Your answers stay in this browser. Nothing is sent anywhere. Reset clears them.
QuotedCalculatedREAD, our readingn = 389 recorded tool calls Rule 1 is recorded: the allow rules of all 75 runs were Read; Edit; Bash(python -m pytest); Bash(python -m pytest *). Rule 2 is constructed for this drill, and rule 3 is one of the evaluator's presets, also constructed; neither is a recorded rule. Counts: our implementation of the documented rules, not a run, on the recorded text of the 75 recorded Claude Code bug-fix runs (2.1.284, one Windows PC, tools Read, Edit and Bash): 389 tool calls, 348 ran and 41 were refused; four allow rules, no deny rule, and nobody could answer a prompt. The Gemini CLI count is a reading of the Gemini CLI documented rules applied to the same text, not a run. No new run was made for this page, and nothing was run in Gemini CLI.
Does this rule match this command?
Nine pairs of a rule and a command. Read PASS (ship) as: the rule matches the whole command, so with that rule alone it would run. Read FAIL (send back) as: it does not. Six pairs are rows of the Claude Code permissions page's own table; the last three are its xargs example and two Gemini CLI cases. Outcomes from our implementation of the documented rules, not a run.
Claude Code rule Bash(ls *), command ls -la.
* in a Bash rule matches any text, including spaces, so one rule covers a family of commands.”Claude Code rule Bash(ls *), command lsof.
* is part of the rule.” The rule needs ls followed by a space, or nothing at all, and lsof has neither.Claude Code rule Bash(ls*), command lsof.
Claude Code rule Bash(npm run *), command npm run.
* at the end, with a space before it, also matches the bare command.”Claude Code rule Bash(* --help *), command npm --help.
* is the rule's only wildcard”, and this rule has two. So the trailing space and star need something after --help, and npm --help has nothing after it.Claude Code rule Bash(git * main), command git push origin main.
* after the subcommand.” It says Claude Code warns at startup about an allow rule like this one.Claude Code rule Bash(grep *), command xargs -n1 grep pattern.
xargs has no flags: an invocation like xargs -n1 grep pattern is matched as an xargs command, so rules written for the inner command do not cover it.”Gemini CLI rule commandPrefix = "git", command gitk --all.
commandPrefix: Matches if the command argument starts with the given string.” The text gitk starts with the string git, so we read it as a match. The shell page's own example: “For example, if you allow git, you can run git status or git log.”Gemini CLI rule commandPrefix = "git", command git status && rm -rf build, run non-interactively.
tools.core allowlist: “The tool automatically splits commands chained with &&, ||, or ; and validates each part separately.” “If any part of the chain is disallowed, the entire command is blocked.” The policy engine page gives no list of separators (its one chain example uses &&), so we apply the same split to policy rules. The rm part matches no rule, so it asks, and with nobody to answer it is refused.Your answers stay in this browser. Nothing is sent anywhere. Reset clears them.
QuotedCalculatedREAD, our reading What is quoted and what is our reading
- Measured
- Nine rule and command pairs. Rows 1 to 6 are rows of the saved Claude Code wildcard table (25 examples; the reference agrees with all 25); row 7 is the page's xargs example. Rows 8 and 9 are constructed from the Gemini CLI pages' sentences. Constructed for this drill. Not a recorded call.
- Method
- Each pair was decided by our implementation of the documented rules, not a run (the reference the evaluator on this page matches), and rows 1 to 6 equal the page's own match column. Row 8 is READ: the page says starts with the given string, and we read the string as plain text. Row 9 is READ too: the shell page documents the split at
&&,||and;for itstools.coreallowlist, and we apply it to policy rules. - n
- 9 pairs, none of them a recorded call. No new run was made for this page, and nothing was run in Gemini CLI.
- Source
- Configure permissions, Gemini CLI: Policy engine, Gemini CLI: Shell tool (saved 2026-10-11).
- Excludes
- Read and Edit path rules; Gemini CLI commandRegex and argsPattern; versions other than the pages as saved.
Deny wins
When two rules match one call, precedence decides. Claude Code checks deny, then ask, then allow, and "The first match in that order determines the outcome, and rule specificity doesn't change the order." So "An allow rule can't carve an exception out of a deny rule." The permissions page's example: a deny rule Bash(aws *) blocks aws s3 ls even when an allow rule Bash(aws s3 ls) matches too. A bare tool name in deny, such as Bash, removes the tool from the model's context entirely, and "If a tool is denied at any level, no other level can allow it."
Deny and ask rules also reach further into a line: "Deny and ask rules apply when any subcommand matches them, including a command nested inside a subshell, a command substitution, or a control-flow body such as a for loop." A file deny reaches the shell too: Read and Edit deny rules apply to the file tools, to file commands such as cat, head and tail, and to redirection targets.
Gemini CLI has no fixed order. Its policy engine page: "The core principle is simple: the rule with the highest priority wins." A rule's number is final_priority = tier_base + (toml_priority / 1000), where the tier ranks where the rule is defined; the page's table and its worked example disagree on the user tier's number, and either way a user rule outranks the defaults. So the order is whatever priorities you set. Our evaluator maps your lists to deny 300, ask 200, allow 100: that mapping is ours, not the vendor's (READ), and you can change it.
One deny rule, replayed
Our evaluator added each rule below, on its own, to the four recorded allow rules and replayed the 389 calls.
| Deny rule added | Calls that ran, now refused | What it catches |
|---|---|---|
Bash(git *) | 41 | a git part anywhere in the line |
Bash(cat *) | 124 | a cat part anywhere in the line |
Read(./tests/**) | 92 | a read under tests/, through the Read tool and through cat in shell commands |
Bash(python -m pytest *) | 108 | the test command itself: the deny beats the matching allow rule |
Calculatedn = 389 recorded tool calls in 75 runs Our implementation of the documented Claude Code rules, applied to the recorded text with the four recorded allow rules plus one deny rule and nobody to answer; not a run. A call that ran is one the documented rules ran with the four rules alone.
A broad deny is cheap to write and expensive to live with: replay it before you trust it. Two drills follow: decide whether a call runs when rules collide, then check before-and-after claims against the replay.
Does it run when two rules meet?
Seven rule sets, each with one command, and nobody to answer a prompt. Read PASS (ship) as: the command runs. Read FAIL (send back) as: it is refused. The rule sets are constructed from the vendor pages' own examples; every outcome comes from our implementation of the documented rules, not a run.
Claude Code. Allow Bash(aws s3 ls), deny Bash(aws *). Command aws s3 ls.
Claude Code. Allow Bash(git *), deny Bash(git push *). Command git add ..
Claude Code. Deny Bash(rm *). Command FOO=bar rm -rf tmp/.
Bash(rm *) in deny still matches FOO=bar rm -rf tmp/.”Claude Code. Allow Bash(npm test *), deny Bash(rm *). Command npm test && (rm -rf build).
for loop.” Here the rm sits inside a subshell, and the deny still reaches it.Claude Code. Allow Bash(git *), ask Bash(git push *). Command git push origin main.
Gemini CLI, non-interactive. Allow commandPrefix = "rm" at priority = 100, deny the same prefix at priority = 300. Command rm -rf build.
Gemini CLI, non-interactive. Allow commandPrefix = "rm" at priority = 500, deny commandPrefix = "rm -rf" at priority = 100. Command rm -rf build.
final_priority = tier_base + (toml_priority / 1000)”Your answers stay in this browser. Nothing is sent anywhere. Reset clears them.
QuotedCalculatedREAD, our reading What is constructed and how each outcome was decided
- Measured
- Seven rule sets and commands built from the pages' own examples: row 1 is the Claude Code page's aws example and row 3 its FOO=bar example. Constructed for this drill. Not a recorded call.
- Method
- Outcomes computed by our implementation of the documented rules, not a run, with nobody to answer: Claude Code checks deny, then ask, then allow, and a deny or ask rule reaches any part of a compound command; Gemini CLI takes the matching rule with the highest priority and treats ask_user as deny when nobody can answer. The priorities in row 6 are our mapping (READ).
- n
- 7 rule sets. No deny rule was passed to the recorded runs (75 of 75; managed settings are not on record). No new run was made for this page, and nothing was run in Gemini CLI.
- Source
- Configure permissions, Gemini CLI: Policy engine (saved 2026-10-11).
- Excludes
- Rules spread over several settings files (the page: “If a tool is denied at any level, no other level can allow it.”), hooks, and modes other than nobody to answer.
One rule changed: does the replay back the claim?
Five claims about adding one rule to the four recorded allow rules. Each shows two counts from the replay of the 389 recorded calls through the documented Claude Code rules, before and after the change, with nobody to answer. The counts are our implementation of the documented rules, not a run, on the recorded text.
Adding the allow rule Bash(python *) lets 19 refused calls run.
Bash(python *) (after)measured delta -19 calls -45.2%
A single deny rule, Bash(cat *), would refuse 124 calls that ran.
Bash(cat *) (after)measured delta -124 calls -35.7%
Allowing Bash(true) makes the documented rules agree with the recording on every call.
Bash(true) (after)measured delta +1 calls +0.3%
cd "RUN_DIR" && ls && echo --- && find tests -maxdepth 2 2>/dev/null || true. The page's read-only list does not name true, so the evaluator says it needed approval (READ: only the named commands count).Allowing Bash(find *) lets the refused find call with -exec run.
Bash(find *) (after)measured delta 0 calls 0.0%
Bash(watch *) or Bash(find *) can't auto-approve the following commands, so in Manual mode they prompt:” ... “with an action that runs commands, deletes files, or writes files, such as -exec, -delete, or -fprint, or with -files0-from, which takes the paths to search from a file”. The recorded refusal said: “find with '-exec' executes commands or modifies files”.Allowing Bash(sed -i *) lets 11 refused calls run, all of them shell edits.
Bash(sed -i *) (after)measured delta -11 calls -26.2%
Your answers stay in this browser. Nothing is sent anywhere. Reset clears them.
CalculatedReportedREAD, our reading How the counts were calculated
- Measured
- Counts of the 389 recorded calls by the outcome the documented Claude Code rules give, for the four recorded allow rules and for each one-rule change (presets of the evaluator on this page). Before a change the documented rules refuse 42, not the recorded 41, because of the one call ending in
|| true. The claims are constructed; the counts are calculated. - Method
- Our implementation of the documented rules, not a run: every call replayed through each rule set with nobody to answer. This drill's generator recomputed every count and checked it against this page's evidence file and the evaluator's fixtures. READ: only the read-only commands the page names count.
- n
- 389 tool calls: 75 recorded Claude Code bug-fix runs (
2.1.284, one Windows PC, tools Read, Edit and Bash): 389 tool calls, 348 ran and 41 were refused; four allow rules, no deny rule, and nobody could answer a prompt. No new run was made for this page, and nothing was run in Gemini CLI. - Source
- The recorded calls (run folder shortened, inline code withheld; withholding changes no outcome); Configure permissions (saved 2026-10-11). Class 100 showed that 17 of the 18 runs with a refused shell edit then used the Edit tool and passed the held-out suite (reported, not re-derived here).
- Excludes
- Ask rules and other rule changes (the evaluator on this page takes any); versions other than the pages as saved.
The permission evaluator
To replay a rule set is to apply it to recorded tool calls and see what it would have decided. An evaluator is the program that does the deciding. The one below runs in your browser and works from the command text alone.
It replays the 389 recorded tool calls from the 75 Claude Code runs through the allow, ask and deny rules you write, matched as Claude Code's permissions page documents, and it reads the same commands through Gemini CLI's documented rules. It runs no command and sends nothing anywhere. Each outcome comes from our implementation of the documented rules, saved 2026-10-11, with the vendor sentence or the labelled reading behind it, and the recorded outcome sits beside it.
The permission evaluator: what would your rules have let it run?
Write allow, ask and deny rules in Claude Code syntax, or start from a preset. The evaluator replays the 389 recorded tool calls through them as Claude Code documents its matching, reads the same text through Gemini CLI's documented policy engine, and puts the recorded outcome beside every answer. It decides from the text and runs nothing.
Pressing this tool's buttons sends nothing anywhere, and you can confirm that in your browser's network tab. The commands shown are recorded text; nothing on this page runs them.
Scripts are off, so the evaluator cannot open here. With scripts on, you write your own rules and the 389 recorded calls are replayed through them, one decision and its reason per call. The table below shows what each preset changes.
| Rule set | Recorded refusals it would run | Calls newly refused | Same outcome as the recording |
|---|---|---|---|
| The recorded four | 0 | 0 | 388 |
allow Bash(sed -i *) added | 11 | 0 | 377 |
allow Bash(python -c *) added | 9 | 0 | 379 |
allow Bash(python -m unittest *) added | 3 | 0 | 385 |
allow Bash(xargs *) added | 10 | 0 | 378 |
allow Bash(find *) added | 0 | 0 | 388 |
allow Bash(python *) added | 19 | 0 | 369 |
allow Bash(true) added | 0 | 0 | 389 |
allow Bash added | 41 | 0 | 348 |
deny Bash(cat *) added | 0 | 124 | 264 |
deny Bash(git *) added | 0 | 41 | 347 |
deny Read(./tests/**) added | 0 | 92 | 296 |
deny Bash(python -m pytest *) added | 0 | 108 | 280 |
ask Edit added | 0 | 74 | 314 |
CalculatedREAD, our readingn = 389 recorded callsOur implementation of the saved vendor pages applied to the recorded command text; not a run. Each preset adds one rule to the four recorded allow rules; nobody can answer a prompt. Class 100 tabulated the 41 recorded refusals by kind; the first column counts only how many of them one added rule would run. READ: a Bash rule is tried on the command as written and on each form with a wrapper or bare xargs stripped, so Bash(xargs *) also runs the refused call with the part xargs ls.
Your rules
One rule per line, in Claude Code syntax: Tool or Tool(specifier), for Bash, Read and Edit. Deny is checked first, then ask, then allow.
The same lines as Gemini CLI policy rules (a reading, not a run)
Each line becomes a User-tier rule. The priorities are our mapping (deny 300, ask 200, allow 100), so a deny outranks an allow; change any of them. A line with no plain prefix form has no equivalent here.
Replay the recording
Try a command
CalculatedQuotedn = 389 recorded callsEvery decision is our implementation of the vendor pages saved 2026-10-11, computed in your browser from the recorded text of 75 Claude Code 2.1.284 runs (four allow rules, no deny rule, nobody could answer a prompt); not a run, and no new run was made. Nothing was run in Gemini CLI: its column is a reading of its documented rules applied to the same text. READ marks our reading where a page is silent. The evaluator models permission rules only: no sandbox, hooks or modes.
Three things to notice
- Allow
Bash(find *)and nothing changes. 0 calls change outcome. The one refusal that turned onfindcarried-exec, and the permissions page lists that among the forms a prefix rule cannot approve (module five quotes it). - Allow
Bash(true)and all 389 match. With that one rule added, the documented rules give the recorded outcome for 389 of 389 calls. The single difference in module zero was that one word. - Allow
Bash(sed -i *)and 11 refusals would run. All 11 are shell commands that edit a file, so those changes would go through the shell instead of the Edit tool. Class 100 showed that 17 of the 18 runs with a refused shell edit fixed the bug with the Edit tool anyway.
CalculatedReportedn = 389 recorded tool calls in 75 runs; 18 runs for the reported count Each count is one evaluator preset: one rule added to the four recorded allow rules, nobody to answer a prompt, replayed by our implementation of Claude Code's permissions page as saved 2026-10-11; not a run. The recorded runs used Claude Code 2.1.284. The 17 of 18 is Class 100's count, cited and not re-derived.
What a rule cannot see
A rule reads the command as written, not what the program does. The permissions page: "It doesn't match the same program invoked in a different form, so a deny or ask rule covers the invocation Claude usually produces and isn't a security boundary around the program." Its table lists forms that deny rules on Bash(curl *) and Bash(git push *) do not stop:
/usr/bin/curl https://example.com: the program by its path.sh -c 'curl https://example.com': a shell inside a shell.git -C . push origin main: an option before the subcommand.
"Bash permission patterns that try to constrain command arguments are fragile." File rules share the limit: module three lists what Read and Edit deny rules reach, and the page adds: "They don't apply to a command that reads files without naming them, such as grep -r pattern . run from the directory that holds the file, or to arbitrary subprocesses that read or write files indirectly, like a Python or Node script that opens files itself." And some forms no prefix rule such as Bash(find *) can approve: the page lists find with an action that runs commands, deletes files or writes them, such as -exec. That is why Bash(find *) changed nothing in module four.
Two checks sit outside the rules. A protected path is one of a short list of folders and files, such as .git and .claude, that Claude Code guards against writes: "permissions.allow rules in settings files do not pre-approve protected-path writes." A critical path is a directory Claude Code protects from rm and rmdir, such as the filesystem root, your home directory and your working directory; by the permission modes page, no allow rule approves an rm or rmdir aimed at one, even in modes that skip other prompts.
The layer under the rules
Claude Code, from its sandboxing page: "The Bash sandbox is a boundary that the operating system enforces around the shell commands Claude runs on your machine." "The sandbox covers shell commands only." "The sandbox is off by default." "On native Windows, Claude Code runs commands unsandboxed." The recorded runs ran as native Windows processes on one PC; no sandbox setting for them is on record, since settings files were not saved. The permissions page wants both layers: "Use both for defense-in-depth, since sandbox restrictions still apply even if a prompt injection bypasses Claude's decision-making."
Gemini CLI: its sandbox page describes sandboxing as isolating operations such as shell commands and file changes from your host system, and you turn it on with a command flag, an environment variable or a settings file.
Settings that arrive with a repository
Workspace trust is the agent asking, once per folder, whether that folder's own settings may take effect. Claude Code applies the allow rules in a project's .claude/settings.json only after you accept that dialog; deny and ask rules apply without it, since they only restrict. "A claude -p run or an SDK session never shows it, and trusting a parent folder doesn't count for these rules". Gemini CLI, in a headless run: "If the folder is untrusted and the Folder Trust feature is enabled, the CLI will throw a FatalUntrustedWorkspaceError and exit."
Quotedn = 5 saved vendor pages Quotations verbatim from Claude Code's permissions, permission modes and sandboxing pages and Gemini CLI's trusted folders page; Gemini CLI's sandbox page paraphrased; all saved 2026-10-11. The definitions and paraphrases are ours.
In the drill below, find the command each deny rule does not stop.
Find the line the rule does not stop
Three rounds, each with a rule in the deny list and three commands. Pick the one the rule does not stop. Rounds 1 and 3 use the Claude Code permissions page's own table; the other lines are constructed for this drill. Outcomes from our implementation of the documented rules, not a run.
Deny list: Bash(curl *). Which command does the rule not stop?
deny Bash(curl *)
1 curl https://example.com
2 /usr/bin/curl https://example.com
3 cd src && curl https://example.comBash it would run (computed).Read the first word of each part.
Deny list: Read(./.env). Allow list: Bash(python *). All three calls read .env; the script opens it itself. Which call does the deny rule not stop?
deny Read(./.env)
allow Bash(python *)
1 python load_settings.py
2 the Read tool on .env
3 cat .envgrep -r pattern . run from the directory that holds the file, or to arbitrary subprocesses that read or write files indirectly, like a Python or Node script that opens files itself.” Here the allow rule approves the command, so it runs (computed). The script is constructed.Ask which program opens the file.
Deny list: Bash(git push *). Which command does the rule not stop?
deny Bash(git push *)
1 git push origin main
2 git status && git push origin main
3 git -C . push origin maingit -c push.default=current push origin main and git 'push' origin main. “Bash permission patterns that try to constrain command arguments are fragile.”Look at what sits between git and push.
Your answers stay in this browser. Nothing is sent anywhere. Reset clears them.
QuotedCalculated A rule reads text; the sandbox is the layer that does not
- Measured
- Three rounds. The rules, and the first and flagged lines of rounds 1 and 3, come from the saved permissions page's table of what a Bash rule does not match;
Read(./.env)is the page's own example. The other lines, the script and the allow rule of round 2 are constructed. Constructed for this drill. Not a recorded call. - Method
- Our implementation of the documented rules, not a run. A deny rule reaches every part of a compound command, and Read and Edit deny rules reach file commands too: “Read and Edit deny rules apply to Claude's built-in file tools, to file commands Claude Code recognizes in Bash, such as
cat,head,tail,sed, andtee, and to the targets of Bash redirections such as> fileand< file.” A line the rule does not stop is left to the rest: “Your other rules and the permission mode decide the commands in the last column.” - n
- 3 rounds, 9 commands, none of them recorded. No new run was made for this page, and nothing was run in Gemini CLI.
- Source
- Configure permissions, Configure the sandboxed Bash tool (saved 2026-10-11).
- Excludes
- Whether a given sandbox setting would stop the flagged lines: the evaluator on this page does not model the sandbox. The page: “For filesystem and network enforcement that doesn't depend on the command text, use sandboxing.”
Write your allow list
The habit in seven steps, each with its source. They are drawn from the recording and the saved pages, not a measured recipe.
- List the commands the job needs, from a recorded run or a dry run, not from memory: the recorded commands carried parts, such as the leading
cdin module two, that a list written from memory would miss. - Allow exactly those, with the
*after the subcommand. "Claude Code matches everything before the first*as written, so those words are what limit the rule". The recordedBash(python -m pytest *)has that shape. - Deny the dangerous families outright; in Claude Code a deny beats any allow (module three). No deny rule was passed to the 75 recorded runs (managed settings are not on record).
- Keep file changes on the edit tool, where Read and Edit rules apply; a script that opens files itself passes by them (module five).
- Decide what happens when nobody can answer (module one). Then an ask rule is a refusal: the ask rule
Edit, added to the recorded four, would have refused all 74 recorded edits. - Put an operating-system sandbox under the rules. "For filesystem and network enforcement that doesn't depend on the command text, use sandboxing." On native Windows, Claude Code has none.
- Replay the rules before you trust them, and after every change. Of the 19 refusals
Bash(python *)would have let run, 7 are shell commands that edit a file. The evaluator does the replay.
MeasuredCalculatedQuotedn = 75 runs; 389 recorded tool calls Recorded facts from the saved tool calls of the 75 Claude Code runs (2.1.284); preset counts from our implementation of the permissions page, not a run; quotations verbatim from that page, saved 2026-10-11. The steps are our advice.
The same rules under Gemini CLI: a reading, not a run
An allow list does not carry over unchanged. Translated to Gemini CLI policy rules, the four recorded rules become 3 (the two pytest rules collapse into one commandPrefix), and under Gemini CLI's documented defaults, with nobody to answer, 3 of the 247 recorded shell commands would run. Its saved pages document no read-only shell commands, so the cd part of 215 commands asks; and 99 of the 126 commands with a pytest part carry a redirection such as 2>&1, which makes the allow rule ask (READ: the page lists >, >>, <, << and <<< and does not say whether 2>&1 counts; we count it). The policy engine page: "By default, the policy engine asks for confirmation when redirection is detected, even if a rule matches the command." These commands were written by Claude models for Claude Code; another agent would write other commands.
CalculatedQuotedReadn = 247 recorded shell commands Gemini CLI's documented rules, pages saved 2026-10-11, applied to the recorded text; nothing was run in Gemini CLI. An unanswered ask_user is a refusal, as the page documents for non-interactive mode. READ: chains split at &&, || and ; only, as the shell page documents for its tools.core setting (the policy engine page gives no list of separators; its one chain example uses &&); any unquoted < or > is a redirection, 2>&1 and /dev/null targets included. If neither form counted, 6 of the 247 would run instead of 3.
Test before you trust: the evaluator replays any rule set through both vendors' documented rules. The drills below build a rule set for one job, review one against the seven steps, and set up an unattended run.
Write an allow list for one unattended job
Eight fields. Two blocks update as you type: a Claude Code permissions block and a Gemini CLI policy file. Copy them, or download them as one text file. The defaults are a constructed example built on the recorded test command; replay any list in the permission evaluator on this page before you trust it.
Your answers stay in this browser. Nothing is sent anywhere. Reset clears them.
QuotedREAD, our readingn = 1 constructed example Constructed for this drill. Not a recorded call. The default test command is the recorded one; the rest is ours, and no run used this list. The rule shapes follow the saved pages. Claude Code: “Claude Code matches everything before the first * as written, so those words are what limit the rule”. Gemini CLI: “The core principle is simple: the rule with the highest priority wins.” The priorities are the evaluator's mapping (READ), and counting 2>&1 as a redirection is our reading (READ). Neither block is a sandbox: “For filesystem and network enforcement that doesn't depend on the command text, use sandboxing.” The file is built in your browser; nothing is sent anywhere.
Is this rule set ready for an unattended run?
Seven checks, in order. For each of eight rule sets, pick the check that stops it first; if one meets all seven, pick the last button. One set is the recorded allow list; the others are constructed. Counts in the answers come from our implementation of the documented rules, not a run, on the recorded calls.
Constructed: allow Read, Edit, Bash(python -m pytest *) and Bash(git * main); deny Bash(rm *), Bash(git push *), Bash(curl *).
- Star after the subcommandEach
*comes after the words that decide what the command does.REFUSED - No whole interpreterNo allow rule covers a whole interpreter, shell or runner, such as
Bash(python *),Bash(bash *),Bash(sh -c *)orBash(devbox run *).never reached - Dangerous families deniedFamilies you would not run unattended, such as
rm,git pushandcurl, have deny rules.never reached - Edits on the Edit toolNo allow rule approves shell edits such as
sed -i; file changes go through the Edit tool.never reached - Nobody-to-answer decidedThe run says what happens to a call that would prompt:
--permission-prompts noneordontAskmode.never reached - Sandbox under the rulesAn operating-system sandbox is on, so what a rule misses still meets a boundary.never reached
- ReplayedThe set was replayed against recorded calls, and again after each change.never reached
Bash(git * main) matches git merge main and git push origin main alike (the page's own table). Here the deny catches the push and the merge runs. The page: “Put the * after the subcommand.”Constructed: the recorded four plus Bash(python *), with the three deny rules.
- Star after the subcommandEach
*comes after the words that decide what the command does.pass - No whole interpreterNo allow rule covers a whole interpreter, shell or runner, such as
Bash(python *),Bash(bash *),Bash(sh -c *)orBash(devbox run *).REFUSED - Dangerous families deniedFamilies you would not run unattended, such as
rm,git pushandcurl, have deny rules.never reached - Edits on the Edit toolNo allow rule approves shell edits such as
sed -i; file changes go through the Edit tool.never reached - Nobody-to-answer decidedThe run says what happens to a call that would prompt:
--permission-prompts noneordontAskmode.never reached - Sandbox under the rulesAn operating-system sandbox is on, so what a rule misses still meets a boundary.never reached
- ReplayedThe set was replayed against recorded calls, and again after each change.never reached
Bash(python *) would have run 19 refused calls, 7 of them shell edits. The page shows the same shape with a runner: “a rule like Bash(devbox run *) matches whatever comes after run, including devbox run rm -rf ..”Recorded: Read; Edit; Bash(python -m pytest); Bash(python -m pytest *), the allow list of all 75 runs, with no deny rule.
- Star after the subcommandEach
*comes after the words that decide what the command does.pass - No whole interpreterNo allow rule covers a whole interpreter, shell or runner, such as
Bash(python *),Bash(bash *),Bash(sh -c *)orBash(devbox run *).pass - Dangerous families deniedFamilies you would not run unattended, such as
rm,git pushandcurl, have deny rules.REFUSED - Edits on the Edit toolNo allow rule approves shell edits such as
sed -i; file changes go through the Edit tool.never reached - Nobody-to-answer decidedThe run says what happens to a call that would prompt:
--permission-prompts noneordontAskmode.never reached - Sandbox under the rulesAn operating-system sandbox is on, so what a rule misses still meets a boundary.never reached
- ReplayedThe set was replayed against recorded calls, and again after each change.never reached
Constructed: the recorded four, the three deny rules, and Bash(sed -i *) for quick edits.
- Star after the subcommandEach
*comes after the words that decide what the command does.pass - No whole interpreterNo allow rule covers a whole interpreter, shell or runner, such as
Bash(python *),Bash(bash *),Bash(sh -c *)orBash(devbox run *).pass - Dangerous families deniedFamilies you would not run unattended, such as
rm,git pushandcurl, have deny rules.pass - Edits on the Edit toolNo allow rule approves shell edits such as
sed -i; file changes go through the Edit tool.REFUSED - Nobody-to-answer decidedThe run says what happens to a call that would prompt:
--permission-prompts noneordontAskmode.never reached - Sandbox under the rulesAn operating-system sandbox is on, so what a rule misses still meets a boundary.never reached
- ReplayedThe set was replayed against recorded calls, and again after each change.never reached
Constructed: narrow allow rules, the three deny rules and edits on the Edit tool, started from a scheduler with nothing said about prompts.
- Star after the subcommandEach
*comes after the words that decide what the command does.pass - No whole interpreterNo allow rule covers a whole interpreter, shell or runner, such as
Bash(python *),Bash(bash *),Bash(sh -c *)orBash(devbox run *).pass - Dangerous families deniedFamilies you would not run unattended, such as
rm,git pushandcurl, have deny rules.pass - Edits on the Edit toolNo allow rule approves shell edits such as
sed -i; file changes go through the Edit tool.pass - Nobody-to-answer decidedThe run says what happens to a call that would prompt:
--permission-prompts noneordontAskmode.REFUSED - Sandbox under the rulesAn operating-system sandbox is on, so what a rule misses still meets a boundary.never reached
- ReplayedThe set was replayed against recorded calls, and again after each change.never reached
PermissionRequest hook allows it, Claude is told that nobody can approve the request and not to retry it, and the run continues.” The permission modes page: “If you set dontAsk mode, Claude Code auto-denies every tool call that would otherwise prompt you.”Constructed: all of that plus --permission-prompts none, on native Windows.
- Star after the subcommandEach
*comes after the words that decide what the command does.pass - No whole interpreterNo allow rule covers a whole interpreter, shell or runner, such as
Bash(python *),Bash(bash *),Bash(sh -c *)orBash(devbox run *).pass - Dangerous families deniedFamilies you would not run unattended, such as
rm,git pushandcurl, have deny rules.pass - Edits on the Edit toolNo allow rule approves shell edits such as
sed -i; file changes go through the Edit tool.pass - Nobody-to-answer decidedThe run says what happens to a call that would prompt:
--permission-prompts noneordontAskmode.pass - Sandbox under the rulesAn operating-system sandbox is on, so what a rule misses still meets a boundary.REFUSED
- ReplayedThe set was replayed against recorded calls, and again after each change.never reached
Constructed: all of that with the sandbox on, written today and not yet replayed.
- Star after the subcommandEach
*comes after the words that decide what the command does.pass - No whole interpreterNo allow rule covers a whole interpreter, shell or runner, such as
Bash(python *),Bash(bash *),Bash(sh -c *)orBash(devbox run *).pass - Dangerous families deniedFamilies you would not run unattended, such as
rm,git pushandcurl, have deny rules.pass - Edits on the Edit toolNo allow rule approves shell edits such as
sed -i; file changes go through the Edit tool.pass - Nobody-to-answer decidedThe run says what happens to a call that would prompt:
--permission-prompts noneordontAskmode.pass - Sandbox under the rulesAn operating-system sandbox is on, so what a rule misses still meets a boundary.pass
- ReplayedThe set was replayed against recorded calls, and again after each change.REFUSED
Bash(find *) moves 0 calls, because a prefix rule cannot approve find with -exec.Constructed: all seven checks met.
- Star after the subcommandEach
*comes after the words that decide what the command does.pass - No whole interpreterNo allow rule covers a whole interpreter, shell or runner, such as
Bash(python *),Bash(bash *),Bash(sh -c *)orBash(devbox run *).pass - Dangerous families deniedFamilies you would not run unattended, such as
rm,git pushandcurl, have deny rules.pass - Edits on the Edit toolNo allow rule approves shell edits such as
sed -i; file changes go through the Edit tool.pass - Nobody-to-answer decidedThe run says what happens to a call that would prompt:
--permission-prompts noneordontAskmode.pass - Sandbox under the rulesAn operating-system sandbox is on, so what a rule misses still meets a boundary.pass
- ReplayedThe set was replayed against recorded calls, and again after each change.pass
Your answers stay in this browser. Nothing is sent anywhere. Reset clears them.
MeasuredCalculatedQuoted What is recorded and what is constructed
- Measured
- Eight rule sets: one recorded (the four allow rules of the 75 runs) and seven constructed. Constructed for this drill. Not a recorded call. The checklist is ours, built from the saved pages and this page's replay.
- Method
- A set stops at the first check it fails. Counts: our implementation of the documented rules, not a run, on the recorded calls; vendor sentences quoted from the saved pages.
- n
- 8 rule sets; 75 recorded Claude Code bug-fix runs (
2.1.284, one Windows PC, tools Read, Edit and Bash): 389 tool calls, 348 ran and 41 were refused; four allow rules, no deny rule, and nobody could answer a prompt. No new run was made for this page, and nothing was run in Gemini CLI. - Source
- Configure permissions, Choose a permission mode, Run Claude Code programmatically, Configure the sandboxed Bash tool (saved 2026-10-11).
- Excludes
- Whether seven checks are enough for your code; hooks, managed settings and auto mode.
Before an unattended run, what do you set?
Four questions; steps that do not apply disappear. Each step names its source: a sentence from the vendor pages saved 2026-10-11 (its key in this page's evidence file) or a count from the recording.
- List the commands the job needs, and allow exactly thoseFrom a recorded run or a dry run. In Claude Code the words before the star limit the rule: “Claude Code matches everything before the first
*as written, so those words are what limit the rule”. (Source:vq.cc.before_star.) - Claude Code: pass the rules as flags
--allowedTools: “Tools that execute without prompting for permission, apart from reads from network paths.”--disallowedTools: “A scoped rule such asBash(rm *)leaves the tool available and denies only calls that match as written.” The recorded runs passed four allow rules and no deny rule (75 of 75). (Source:vq.cc.allowedtools_flag,vq.cc.disallowed_flag,rec.no_deny_rules.) - Gemini CLI: write User policy rules, each deny above the allows it must beat“The core principle is simple: the rule with the highest priority wins.” “The Workspace tier (project-level policies) is currently non-functional.” The evaluator on this page uses deny 300 and allow 100 (READ: our mapping). (Source:
vq.gm.pe_wins,vq.gm.workspace_off.) - Decide what happens when nobody can answerClaude Code: start the run with
--permission-prompts none. “Anything that would prompt is denied unless aPermissionRequesthook allows it, Claude is told that nobody can approve the request and not to retry it, and the run continues.” Gemini CLI, run non-interactively: “(In non-interactive mode, this is treated asdeny.)” All 75 recorded runs used the Claude Code flag, and 41 of their 389 calls were refused. (Source:vq.cc.prompts_none,vq.gm.ask_noninteractive,rec.prompts_none.) - Someone can answer: keep ask rules for the risky familiesClaude Code: “Rules are evaluated in order: deny, then ask, then allow.” Gemini CLI: “Decision: The action to take if the rule matches (
allow,deny, orask_user).” (Source:vq.cc.order,vq.gm.decisions.) - Claude Code: a project's allow rules wait for workspace trust“
permissions.allowrules andpermissions.additionalDirectoriesentries in a project's.claude/settings.jsongrant capability, so Claude Code applies them only after you accept the workspace trust dialog for that folder.” “Aclaude -prun or an SDK session never shows it, and trusting a parent folder doesn't count for these rules”. The recorded runs passed their rules as flags. (Source:vq.cc.trust,vq.cc.trust_p.) - Gemini CLI headless: trust the folder first“If the folder is untrusted and the Folder Trust feature is enabled, the CLI will throw a
FatalUntrustedWorkspaceErrorand exit.” (Source:vq.gm.trust_headless.) - Keep file changes on the edit toolClaude Code: “Read and Edit deny rules apply to Claude's built-in file tools, to file commands Claude Code recognizes in Bash, such as
cat,head,tail,sed, andtee, and to the targets of Bash redirections such as> fileand< file.” In the recording, allowingBash(sed -i *)would have run 11 refused calls, all shell edits (our implementation of the documented rules, not a run). Gemini CLI edits through its replace tool (READ: our map). (Source:vq.cc.file_cmds,preset.sed.to_ran.) - No file changes: leave the edit tool outClaude Code
--tools: “Restrict which built-in tools Claude can use.” The recorded runs used--tools Read,Edit,Bash. (Source:vq.cc.tools_flag,rec.tools_flag.) - Put an operating-system sandbox under the rules“The Bash sandbox is a boundary that the operating system enforces around the shell commands Claude runs on your machine.” “The sandbox is off by default.” “On native Windows, Claude Code runs commands unsandboxed.” Gemini CLI: “Sandboxing isolates potentially dangerous operations (such as shell commands or file modifications) from your host system, providing a security barrier between AI operations and your environment.” (Source:
vq.cc.sandbox_os,vq.cc.sandbox_off,vq.cc.sandbox_windows,vq.gm.sandbox.) - Network: enforce it in the sandbox, not in a rule“For filesystem and network enforcement that doesn't depend on the command text, use sandboxing.” A deny rule on curl does not stop
/usr/bin/curl. (Source:vq.cc.use_sandbox,vq.cc.not_boundary.) - Replay the rules before you trust themRun your lists through the permission evaluator on this page: the documented Claude Code rules reproduce 388 of 389 recorded outcomes (our implementation of the documented rules, not a run). (Source:
ev.cc.agree.)
Your answers stay in this browser. Nothing is sent anywhere. Reset clears them.
QuotedMeasuredREAD, our readingn = 75 recorded runs The questions are constructed; the steps follow the seven-step habit of this page. Counts from the 75 recorded Claude Code bug-fix runs (2.1.284, one Windows PC, tools Read, Edit and Bash): 389 tool calls, 348 ran and 41 were refused; four allow rules, no deny rule, and nobody could answer a prompt. Vendor behaviour is quoted from the vendor pages saved 2026-10-11, not tested on your setup. READ marks our readings. No new run was made for this page, and nothing was run in Gemini CLI.
Where to go next
- Class 100: Claude Code Headless: the mechanics of these runs: flags, the stream, exit codes, the refusals by kind.
- Class 98: AI Bug Fix: the 75 runs themselves.
- Class 72: Security of AI-Generated Code, next: threat-model what the agent wrote.
- Class 73: Git + AI Workflows: the way back when a permitted command does damage.
- Class 74: Deployment and CI/CD: the ship gate.
- Class 96: the same runs compared by model; this class compares none.
- Class 97: Antigravity Plugins: what a plugin can run.
- Class 66 and Class 85: operating agents with gates.
- Class 102, TDD with AI: letting an agent run your tests.
What we did not verify
The page's own list of gaps. Everything here comes from runs recorded earlier and vendor pages saved on 2026-10-11; no new run was made for this class.
- Anything run in Gemini CLI or another agent. Gemini CLI's figures are readings of its saved pages applied to commands written for Claude Code; another agent would write other commands.
- Other versions. The recorded runs used Claude Code
2.1.284; the saved pages describe the versions current on 2026-10-11. Where a rule changed between the two, this page cannot tell. - The full read-only set. The permissions page says the set "includes" the commands it names. The one call that differs, a command ending in
|| true, ran in the recording, which suggests the real set is larger than the list. - The readings. Where the pages are silent, the evaluator follows a labelled READ. Claude Code: the read-only set is judged on the command as written; a rule is tried on the command as written and on each stripped form, so
Bash(xargs *)also matches a barexargs ls, one of the 10 refusals its preset runs; only the named commands count as read-only; read-onlygitmeansstatusplus, by our reading,ls-files,log,diffandshow; a global option before the subcommand makes it need approval (git -C . status), while options after it are not examined, sogit status --shortcounts and so wouldgit log --output=out.txt, which names an output file (the saved pages do not say whether Claude Code's own set excludes such options);NODE_ENVis the only known-safe variable;findactions beyond the four named; a bareBashallow approves everything; runs of spaces collapse; a redirect into a file needs an Edit allow rule; which critical paths are modelled; path patterns relative to the run folder. Gemini CLI: chains split at&&,||and;only, the shell page's rule for itstools.coresetting applied to policy rules; deny, ask and allow rules get priorities 300, 200 and 100, our mapping; any unquoted<or>is a redirection,2>&1and/dev/nulltargets included;Bash,ReadandEditmap torun_shell_command,read_fileandreplace. - What the evaluator does not model. The sandbox, hooks, auto mode, MCP rules and network-domain rules.
- The recorded machine. All 75 runs were native Windows processes on one PC (
claude.exeon a drive-letter path, not WSL2). Whether a sandbox setting was present is not on record, since settings files were not saved; the saved sandboxing page says native Windows runs commands unsandboxed, for the version current on 2026-10-11. Windows behaviour beyond that machine was not tested. - Settings files. The recorded rules came from
--allowedTools, and every run also used--restrictedand--safe-mode. By the saved CLI reference,--restrictedloads only managed settings and--settings, which no run passed, so no user or project settings file applied;--safe-modeturns off customizations such as hooks, though managed settings policy, its hooks included, still applies. Whether that PC had managed settings is not on record. Rules in settings files, how they merge across scopes, and workspace trust were not replayed. - Anything larger. 75 bug-fix runs on 5 small repositories. Other tasks and larger code bases bring other commands.
- Whether a rule set is safe for your code. The page shows what rules match, not what a matched command does.
- The vendor pages after 2026-10-11, when they were saved. They may have changed since.
- The drills' constructed cases. They are not recorded calls; each drill says which of its cases are recorded.
Bottom line
List what the job runs, allow exactly that, deny the dangerous families, decide who answers when nobody is there, put a sandbox under the rules, and replay them before you trust them. In 75 recorded Claude Code runs, our implementation of the documented rules gives the recorded outcome for 388 of 389 tool calls and all 41 refusals; the one difference is a command ending in || true. Under Gemini CLI's documented rules the same text reads very differently, and that is a reading, not a run. A rule reads text, so the sandbox under it is the layer that does not.
Questions
How do Claude Code permissions decide what runs?
Claude Code checks its rules in a fixed order: deny, then ask, then allow, and the first match decides, however specific another rule is. A built-in set of read-only shell commands, such as ls, cat and git status, runs with no rule at all. Anything else that needs approval prompts a person; when nobody can answer, as with --permission-prompts none, it is refused. In 75 recorded Claude Code runs with four allow rules and nobody to answer, 348 of 389 tool calls ran and 41 were refused, and our implementation of the saved permissions page gives the recorded outcome for 388 of the 389. That is a replay of the documented rules on the recorded text, not a run.
Why do the documented rules miss one recorded call?
The call is a command that lists files and ends in || true, and it ran in the recording. The saved permissions page says its read-only set includes ls, cat, echo, find, cd and other named commands; it does not name true. Our evaluator counts only the named commands, so it says the true part needed approval, which with nobody to answer means refused. That is our reading of the page, labelled READ: the word includes leaves room for a longer list, and the recording fits one. With the one rule Bash(true) added, the documented rules give the recorded outcome for all 389 calls.
Why is a permission rule not a sandbox?
A rule reads the command text; a sandbox is enforced by the operating system on the running command, whatever the text says. The saved permissions page says a Bash rule does not match the same program invoked in a different form, so a deny rule on curl does not stop /usr/bin/curl or a curl inside sh -c, and Read and Edit rules do not reach a script that opens files itself. Claude Code's sandbox covers shell commands, is off by default and is not available on native Windows. The vendor advises using both layers.
Does a deny rule beat an allow rule?
In Claude Code, yes. Rules are evaluated deny, then ask, then allow, rule specificity does not change that order, and an allow rule cannot carve an exception out of a deny rule. In Gemini CLI the rule with the highest priority wins, so the order is whatever priorities you set; the evaluator's mapping of deny 300, ask 200 and allow 100 is ours, not the vendor's. Replayed on the recording, adding the one deny rule Bash(cat *) would have refused 124 calls that ran.
Would the same allow rules work in Gemini CLI?
Not the same way. This is a reading of Gemini CLI's documented rules applied to the same recorded text; nothing was run in Gemini CLI. Translated to Gemini CLI policy rules, the four recorded allow rules become 3, and under its documented defaults with nobody to answer, 3 of the 247 recorded shell commands would run. The saved Gemini CLI pages document no read-only shell commands, so a cd part asks, and its policy engine asks for confirmation when it detects a redirection, even if a rule matches; 99 of the 126 recorded commands with a pytest part carry one, counting a file-descriptor form or a /dev/null target as a redirection. The page does not say whether those count, so that is our reading; if neither counts, 6 rather than 3 of the 247 would run. These commands were written by Claude models for Claude Code; another agent would write other commands.
What does the permission evaluator on this page do?
It replays the 389 recorded tool calls through allow, ask and deny rules you write in Claude Code syntax and shows, beside each recorded outcome, what your rules would have decided, with the vendor sentence or our labelled reading behind each decision. It also reads the same commands through Gemini CLI's documented rules, and you can type a command of your own to see how each splits and matches it. It works from the text in your browser: nothing is run and nothing is sent.
What happens to a permission prompt when nobody can answer it?
Each vendor documents an answer. In Claude Code, with --permission-prompts none, anything that would prompt is denied unless a PermissionRequest hook allows it, Claude is told that nobody can approve it, and the run continues; dontAsk mode auto-denies every call that would otherwise prompt. In Gemini CLI's non-interactive mode, an ask_user decision is treated as deny. All 75 recorded runs were started with --permission-prompts none, so each of the 41 refusals was a call that needed approval when nobody could give it.
Should I allow Bash(python *) so the agent stops being refused?
Replay it first. In the recording, adding Bash(python *) to the four allow rules would have let 19 refused calls run, 7 of them shell commands that edit a file, because its * matches any text after the word python, inline code included. Allow the exact commands the job needs, keep file changes on the edit tool, where Read and Edit rules apply, and replay the result against recorded calls.
Was a new run made for this class?
No. Every figure comes from 75 bug-fix runs recorded earlier with Claude Code 2.1.284 on one Windows PC, with the tools Read, Edit and Bash, four allow rules and nobody to answer a prompt, and from vendor pages saved on 2026-10-11. Nothing was run in Gemini CLI. The recorded commands are shown with their inline code withheld, and nothing on the page runs them.
Is the class free, and do I need to sign up?
Yes, it is free, and you do not need to sign up or give an email address. It is an independent class, not affiliated with Anthropic or Google.