Claude Code, OpenAI’s Codex CLI, and Google’s Gemini CLI all ask before running at least some shell commands, but they draw the line in different places by default. Claude Code auto-runs a fixed list of read-only commands and asks about everything else; Codex CLI’s default posture lets commands run inside a sandboxed workspace and only interrupts you when a command tries to leave it; Gemini CLI, out of the box, prompts before every tool call, including shell commands, until you change its approval mode.
That difference matters the moment you wire one of these tools into a script, a CI job, or a long unattended session, because “default” stops meaning “safe default” and starts meaning “whatever runs when nobody is watching.” Below is a table built directly from each vendor’s own current documentation, followed by what the differences actually mean once you’re the one configuring the thing.
Two terms the table uses
Approval mode is the setting that decides whether the tool pauses to ask you before it acts, or just acts. Sandboxing is a separate, stricter layer: an OS-level boundary that blocks a process from touching files or network outside an allowed area, regardless of what any approval setting says. Codex CLI is the only one of the three that names its sandbox boundary as a distinct, configurable setting from its approval policy; Claude Code and Gemini CLI mostly fold the two together into a single “mode.”
What each tool does by default, in its own documentation’s words
| Tool | Out-of-the-box behavior for shell commands | How to loosen it | How to remove approval entirely |
|---|---|---|---|
| Claude Code | Default (Manual) mode prompts on first use of each tool. Bash commands require approval except a built-in, non-configurable read-only set: ls, cat, echo, pwd, head, tail, grep, find, wc, which, diff, stat, du, cd, and read-only git. |
permissions.allow rules in a settings.json file, written as patterns like Bash(npm run *), or switching to acceptEdits, auto, or plan mode. |
A permissive mode skips prompts outright, except for a short list of actions no mode auto-approves. Anthropic’s own docs warn to use it “only in isolated environments like containers or VMs.” |
| OpenAI Codex CLI | Documented as a pair of independent settings rather than one single default: a sandbox mode (read-only, workspace-write, or danger-full-access) and an approval policy (on-request or never; a third policy, untrusted, is retired). OpenAI’s own docs describe workspace-write as “the default low-friction mode for local work,” paired with on-request, which lets commands run inside the sandbox without prompting and only asks when a command needs to escalate past it. |
The app’s permissions menu offers this combination directly as “Approve for me”: keep the workspace-write sandbox, route only requests flagged as potentially unsafe to review. | The “Full access” preset, which is danger-full-access plus never: no sandbox, no prompts. |
| Gemini CLI | general.defaultApprovalMode in settings.json defaults to "default", which prompts for approval before tool calls — shell commands included, with no built-in read-only exception list the way Claude Code has one. |
Set the mode to auto_edit, which auto-approves the edit tools (replace, write_file) while shell commands still prompt; or list specific commands in tools.allowed, e.g. run_shell_command(git). |
A full-automation mode auto-approves every tool call, but it can only be turned on from the command line — it cannot be set in settings.json, and an administrator can block it entirely with security.disableYoloMode. |
One gap is worth naming instead of papering over: unlike Claude Code’s single named default mode or Gemini CLI’s single defaultApprovalMode key, OpenAI’s current documentation doesn’t name one setting as “the” default for everyone — it documents sandbox mode and approval policy as two independent dials and describes workspace-write + on-request as the common low-risk combination, not a hardcoded factory setting. Anyone deciding between these tools on this basis should treat that as a real structural difference, not a detail OpenAI left out of a table.
Why Claude Code’s read-only list is narrower than it looks
Claude Code’s auto-approved list covers inspection commands only, and even those have exceptions. A command with write-capable flags, like find . -delete or sed -i, still prompts even when it matches a pattern the permission rules would otherwise approve, because Claude Code parses the command rather than trusting the program name alone. Compound commands are split and checked piece by piece, too: an allow rule for npm run * doesn’t cover npm run build && rm -rf dist, because the second half has to clear its own check. That’s a meaningfully stricter default than “anything that looks like a read command runs” — it’s closer to “anything we can prove is read-only runs.”
Why Codex CLI’s sandbox is the odd one out, and that’s the point
Codex CLI is the only one of the three whose sandbox is enforced by the operating system rather than by the tool parsing command text. On macOS it uses the built-in Seatbelt framework; on Linux it needs bubblewrap (bwrap) on the PATH, falling back to a bundled helper that needs unprivileged user namespaces, with Ubuntu 24.04 sometimes needing its own AppArmor profile; Windows enforces it natively through PowerShell. That OS-level enforcement is a different kind of guarantee than a permission rule: a rule can be out-argued by a cleverly-formed command (Claude Code’s own docs flag this limitation directly, warning that a deny rule for one command form doesn’t stop the same binary called by its full path), but a sandbox boundary that blocks filesystem or network access at the kernel level doesn’t care how the command was spelled.
Why Gemini CLI’s default is the most conservative of the three
Gemini CLI ships with no shell auto-approval list at all; default mode prompts for every tool call until you either flip to auto_edit (which still leaves shell commands prompting) or hand-list specific commands under tools.allowed. That makes it the slowest of the three to use interactively out of the box, but also the one with the smallest attack surface before anyone has touched a setting. The trade-off shows up again at the top: Gemini CLI’s most permissive mode is deliberately kept out of reach of a committed settings file — it only turns on from a command-line flag — which stops a shared, checked-in settings.json from silently giving every teammate a no-prompts session.
What this means for a CI pipeline versus a laptop
An unattended CI job needs the opposite of what a laptop session needs: predictable, scoped automation rather than fast iteration. For CI, Codex CLI’s workspace-write + on-request pairing or Claude Code’s scripted allow rules both keep the blast radius to the checked-out repository, while Gemini CLI’s tools.allowed list is the closest equivalent for naming exactly which commands a pipeline may run without a human present. None of the three vendors’ docs recommend their fullest-access mode for anything other than a disposable, isolated container, and Claude Code’s documentation says so explicitly rather than leaving it implied.
For a personal dev machine, the calculus flips toward whichever tool’s default already matches how much you trust a given repository: Codex CLI’s workspace-write default lets routine local commands through without turning into a stream of prompts, while Claude Code and Gemini CLI both start from “ask first” and let you earn trust per-command with saved allow rules. Neither approach is more secure in the abstract — they just put the friction in different places, and which one feels right depends on whether you’d rather approve commands once per project or review a shorter list up front.
None of this replaces reading the actual permission grant an MCP server or CLI tool is asking for before you connect it — a generous shell-command default on the CLI itself doesn’t tell you anything about what a third-party server plugged into that CLI can also do once it’s trusted. That’s a separate review, and it matters just as much as the defaults compared above.
A concrete way to see the difference: point all three tools at the same routine task, like running a project’s test suite and fixing a failing assertion. Claude Code will likely prompt once for the test-runner command (unless it’s already allow-listed) and again for the file edit, Codex CLI will run both inside its workspace-write sandbox without a prompt as long as neither step tries to reach outside the repository or the network, and Gemini CLI will prompt for both unless tools.allowed already names the test command. None of the three is wrong — they’re just optimized for a different assumption about how much a first-time user should see before anything executes.
For configuring Claude Code’s own permission modes against a specific pipeline, see our walkthrough on configuring Claude Code’s dontAsk permission mode for a CI pipeline, step by step. If an MCP server is also in the mix, the permissions it asks for are a separate check worth doing before you connect it — see reviewing an MCP server’s permissions before you connect it to Claude Code — and the same before-you-grant-access habit applies to a scheduling assistant, as in our checklist for auditing an AI scheduling assistant’s calendar permissions. If you’re running one of these tools alongside Claude’s other agentic capabilities, Claude’s Computer Use toolset vs. its Browser Use toolset covers a related permission surface worth understanding before you grant either one broad access.
Sources used directly for this comparison: Anthropic’s Claude Code permissions documentation; OpenAI’s Codex CLI sandboxing documentation and its agent approvals and security overview; and Google’s Gemini CLI configuration reference.



