Claude Code vs Gemini CLI: sandbox, approvals and security compared
Claude Code and Google's Gemini CLI side by side on sandboxing, approval modes, network access, hooks, admin policy and public advisories, with a source for every fact.
Claude Code
- Made by
- Anthropic
- Out of the box
- From v2.1.283, interactive terminal and VS Code sessions start in auto mode, where a classifier reviews actions. Without a supported model it starts in Manual.
claude -pand Agent SDK runs start in Manual, which asks before edits, shell commands and network access. - Sandbox
- Yes, off by default. Turn on with
/sandboxorsandbox.enabled. macOS uses Seatbelt, Linux and WSL2 use bubblewrap. Not supported on native Windows. Covers Bash, PowerShell and Monitor commands only. File tools, MCP servers and hooks run outside it. - Public advisories
- 8 with a CVE or GHSA id, 6 rated critical or high
Gemini CLI
- Made by
- Out of the box
- Mode
defaultasks before write tools and before every shell command. Choices are allow once, allow always for the session, or deny. Read-only tools do not ask. - Sandbox
- Optional. macOS uses Seatbelt (
sandbox-exec) with six profiles, defaultpermissive-open. Docker, Podman, gVisor and LXC also work. Turn on with-s,GEMINI_SANDBOXortools.sandbox. The docs do not state a default. - Public advisories
- 1 with a CVE or GHSA id, 1 rated critical or high
On this page
Short answer
Both are terminal agents with an optional macOS Seatbelt sandbox, hooks that can block a tool call, and admin settings users cannot override. Gemini CLI asks before every shell command by default. Claude Code's interactive sessions start in auto mode, where a classifier reviews actions. One change matters before you choose: since June 18, 2026, Google moved free and Google AI Pro or Ultra users to Antigravity CLI. Gemini CLI now serves Gemini Code Assist Standard and Enterprise and paid API keys.
At a glance
Every answer links to the page that says it. Both agents change often, so their own docs win where they differ from this page.
The basics
| Question | Claude Code | Gemini CLI |
|---|---|---|
Runs in | Terminal CLI, VS Code and JetBrains extensions, desktop app, web at claude.ai/code, mobile app, GitHub Actions and GitLab CI/CD, and an Agent SDK.1 | Open-source terminal agent ( gemini). Since June 18, 2026 free individual and Google AI Pro or Ultra access moved to Antigravity CLI (agy). This repo now targets Code Assist Standard or Enterprise users.1 |
Platforms | macOS, Linux, WSL and native Windows. Installs with a script, Homebrew, WinGet, apt, dnf or apk.1 | |
Open source | Yes, Apache License 2.0.1 | |
Models | Choose a model with -m, for example gemini-2.5-flash. The README says the CLI is not tuned for the Gemini 4 series.1 | |
Pricing | No free tier or Google AI plans. Meant for Gemini Code Assist Standard or Enterprise licenses, Code Assist for GitHub, and legacy paid API or Vertex keys with usage-based billing.1 |
Safety controls
| Question | Claude Code | Gemini CLI |
|---|---|---|
Out of the box | From v2.1.283, interactive terminal and VS Code sessions start in auto mode, where a classifier reviews actions. Without a supported model it starts in Manual. claude -p and Agent SDK runs start in Manual, which asks before edits, shell commands and network access.2 | |
Sandbox | Yes, off by default. Turn on with /sandbox or sandbox.enabled. macOS uses Seatbelt, Linux and WSL2 use bubblewrap. Not supported on native Windows. Covers Bash, PowerShell and Monitor commands only. File tools, MCP servers and hooks run outside it.3 | |
Network in commands | ||
Turning approvals off | --dangerously-skip-permissions, same as --permission-mode bypassPermissions. Skips prompts and safety checks. Deny rules and explicit ask rules still apply. Docs say to use it only in containers or VMs. Admins can disable it.2 | |
Permission rules | permissions.allow, ask and deny arrays in settings.json, for example Bash(npm run test *) and Read(./.env). Deny is checked first, then ask, then allow. /permissions lists them.4 | Policy engine TOML files. Each [[rule]] sets toolName, argsPattern or commandPrefix, a decision of allow, deny or ask_user, and a priority. User files live in ~/.gemini/policies/*.toml.4 |
Hooks before a tool runs | Yes. PreToolUse hooks run before a tool call and can block it with exit code 2 or a deny decision. Types are command, http, mcp_tool, prompt and agent. A crashed hook does not block unless onFailure is block.5 | Yes. Hooks in settings.json fire on events such as BeforeTool, AfterTool and SessionStart. BeforeTool can block a call with a JSON deny or exit code 2.5 |
Project instructions | ||
MCP servers | ||
Session history | Plaintext JSONL transcripts at ~/.claude/projects/<project>/<session>.jsonl, prompt history in ~/.claude/history.jsonl. Transcripts are deleted after 30 days by default (cleanupPeriodDays)6 | |
Admin policy | Yes. /Library/Application Support/ClaudeCode/managed-settings.json on macOS, a com.anthropic.claudecode MDM profile, or server-managed settings from the claude.ai admin console. Users and project files cannot override them.8 |
The differences that matter
Who Gemini CLI is for now
Since June 18, 2026, free individual access and Google AI Pro and Ultra plans use Antigravity CLI (agy). Gemini CLI has no free tier and is meant for Gemini Code Assist Standard or Enterprise licenses and paid API or Vertex keys. If you are an individual on a Google AI plan, compare Claude Code with Antigravity CLI.
What runs without asking
Gemini CLI's default mode asks before write tools and before every shell command, and read-only tools run. Claude Code's interactive sessions start in auto mode, where a classifier approves routine actions. Its scripted runs start in Manual mode, which asks.
The sandbox and the network
Both sandboxes are optional on macOS and use Seatbelt. Gemini CLI has six Seatbelt profiles, and the default one allows network access. It also runs in Docker, Podman, gVisor or LXC. Claude Code's sandbox covers shell commands and sends their traffic through a proxy whose list of allowed domains starts empty.
Rules and hooks
Gemini CLI's policy engine reads TOML rules that allow, deny or ask, with priorities and an admin tier users cannot override. Claude Code keeps allow, ask and deny arrays in settings.json. Both have a hook before each tool call that can block it: BeforeTool in Gemini CLI, PreToolUse in Claude Code.
Turning approvals off
Gemini CLI's --yolo approves every tool, works only from the command line, and admins can block it with security.disableYoloMode. Claude Code's --dangerously-skip-permissions skips prompts while deny rules still apply, and admins can disable it.
Public advisories
Gemini CLI has one GitHub advisory, rated critical, fixed in 0.39.1 in April 2026, and a July 2025 prompt-injection issue reported by Tracebit, fixed in 0.1.14. Claude Code's repository lists eight since June 2026, six rated high. All were fixed in releases.
Approval modes
Each agent's modes, from the one that asks most to the one that asks least, with the mode each starts in marked.
Claude Code
- planAsks for some actions
- default (Manual)Asks before each action
- dontAskNever asks
- acceptEditsAsks for some actions
- autoAsks for some actionsStarts here
- bypassPermissionsNever asks
Gemini CLI
- planAsks for some actions
- defaultAsks before each actionStarts here
- auto_editAsks for some actions
- yoloNever asks
Claude Code modes in detail
| Mode | How to turn it on | Asks you | What it allows |
|---|---|---|---|
plan | Shift+Tab, --permission-mode plan or /plan | For some actions | Reads and proposes changes without editing source until you approve the plan. |
default (Manual) | --permission-mode default or permissions.defaultMode | Before each action | Prompts for most edits, shell commands and network access. Reads in the working directory run without asking. |
dontAsk | --permission-mode dontAsk (not in the Shift+Tab cycle) | Never | Denies every call that would prompt. Only reads and pre-approved tools run. |
acceptEdits | Shift+Tab, --permission-mode acceptEdits | For some actions | Auto-approves edits and common filesystem commands in the working directory. Other Bash commands still prompt. |
auto | Shift+Tab, --permission-mode auto or defaultMode in user settings | For some actions | A classifier model blocks risky actions such as curl | bash and force pushes. Pauses and prompts after 3 blocks in a row or 20 in total. |
bypassPermissions | --dangerously-skip-permissions or --permission-mode bypassPermissions | Never | Skips prompts and safety checks. Deny rules and explicit ask rules still apply. Docs say it offers no protection against prompt injection. |
Gemini CLI modes in detail
| Mode | How to turn it on | Asks you | What it allows |
|---|---|---|---|
plan | general.defaultApprovalMode or --approval-mode=plan | For some actions | Strict read-only mode for research and design. |
default | Out of the box, or --approval-mode=default | Before each action | Most write tools and every shell command need confirmation. |
auto_edit | general.defaultApprovalMode or --approval-mode=auto_edit | For some actions | Edit tools are auto-approved. Other tools still ask. |
yolo | --yolo or --approval-mode=yolo (command line only) | Never | All tools are auto-approved. Policy rules can still deny. |
Where their settings live
Claude Code
| Path | What it holds |
|---|---|
~/.claude/settings.json | User settings, permissions and hooks |
.claude/settings.json | Project settings, shared in git |
.claude/settings.local.json | Personal project settings, gitignored |
/Library/Application Support/ClaudeCode/managed-settings.json | Admin-managed policy on macOS |
~/.claude.json | Account state, trust decisions, local and user MCP servers |
.mcp.json | Project MCP servers |
~/.claude/projects/ | Session transcripts and auto memory |
~/.claude/history.jsonl | Prompt history |
~/.claude/file-history/ | Pre-edit file snapshots for checkpoint restore |
CLAUDE.md | Project instructions |
Gemini CLI
| Path | What it holds |
|---|---|
~/.gemini/settings.json | User settings, MCP servers, hooks |
.gemini/settings.json | Project settings, override user settings |
/Library/Application Support/GeminiCli/settings.json | System settings that outrank user and project |
~/.gemini/policies/*.toml | User policy rules |
/Library/Application Support/GeminiCli/policies | Admin policy rules |
~/.gemini/trustedFolders.json | Saved folder trust choices |
~/.gemini/tmp/<project_hash>/chats/ | Saved sessions |
~/.gemini/history/<project_hash> | Shadow Git repo for checkpoints |
GEMINI.md | Project context and instructions |
Security advisories
Public advisories and well-documented reported issues since 2025. A longer list can mean more people are looking, so read each one rather than the count.
Claude Code
Gemini CLI
Both, newest first
A race in the Edit tool's path check let a process in the Bash sandbox swap a parent directory for a symlink, so the unsandboxed Edit tool could overwrite a file outside the workspace on macOS. CVE-2026-88968.
Fixed in2.1.251Uncontrolled search path let a malicious git executable run arbitrary code. Affects Claude Desktop, listed in the Claude Code repo. CVE-2026-88066.
Fixed inClaude Desktop 1.8089.0A plugin commit SHA pin could be bypassed, allowing installation of attacker-controlled code. CVE-2026-86063.
Fixed in2.1.179Arbitrary file write through write-time symlink following (a time-of-check to time-of-use race). CVE-2026-103435.
Fixed in2.1.129Managed settings were not applied when a stored API key was preferred over enterprise sign-in. CVE-2026-103012.
Fixed in2.1.260Claude Desktop on macOS: opening a malicious file from a Cowork folder could run commands on the host. Listed in the Claude Code repo.
Fixed inClaude Desktop 1.15962.0Git worktree path confusion allowed a sandbox escape and unsandboxed code execution. CVE-2026-55607.
Fixed in2.1.163An insecure temporary file in the
Fixed in/copycommand allowed response disclosure and a symlink-based file write. CVE-2026-46406.2.1.128CVE-2026-12537. In headless mode workspace folders were auto-trusted, so a malicious
Fixed in.envor.gemini/config in an untrusted pull request could run code. Under--yolo, fine-grained tool allowlists were ignored.0.39.1Tracebit showed prompt injection in a README plus a weak command allowlist check could run a command that began with an approved one, with whitespace padding hiding it from the terminal. Reported June 27, 2025. Google reclassified it P1, S1.
Fixed in0.1.14
Strengths and things to watch
Claude Code
What it does well
- Permission rules and hooks are enforced by Claude Code, not by the model, and deny rules apply in every mode.
- Managed settings rank above user, project and command-line values, and admins can disable bypass and auto modes.
- An OS-level sandbox with a domain allowlist and credential and filesystem controls is available, built on an open source runtime.
PreToolUsehooks can block a call before it runs, andonFailure: "block"makes a failed hook fail closed.- Transcripts and pre-edit file snapshots are kept locally, with
claude purgeandcleanupPeriodDaysto control retention.
What to watch for
- The sandbox is off by default and covers Bash, PowerShell and Monitor commands only. Edit, Read, Write, WebFetch, MCP servers and hooks run outside it.
- Sandboxed reads cover most of the machine by default, including
~/.ssh, unlessdenyReador similar settings narrow them. - A failed sandboxed command can be retried unsandboxed with
dangerouslyDisableSandboxunlessallowUnsandboxedCommandsisfalse. - Bash rules match command text, so
Bash(rm *)does not match/bin/rmorbash -c 'rm ...'. The docs point to the sandbox for stronger enforcement. - Transcripts are plaintext, so a value read from a
.envfile or printed by a command is written to~/.claude/projects/.
Gemini CLI
What it does well
- Default mode asks before every shell command and before most write tools.
- The policy engine supports
denyrules and admin-tier policies that users cannot override, with root ownership checks on macOS. - System settings in
/Library/Application Support/GeminiCli/outrank user and project settings. BeforeToolhooks can block a tool call, andsecurity.disableYoloModecan turn the yolo mode off.- The CLI is Apache-2.0, so the sandbox and policy code can be read.
What to watch for
- The sandbox is opt-in. The docs do not state it is on by default, and the default Seatbelt profile allows network access.
- Folder trust docs disagree. The trusted folders page says it is off by default and the settings reference says on. Check
security.folderTrust.enabled. - In CI, untrusted folders fail unless
--skip-trustorGEMINI_CLI_TRUST_WORKSPACE=trueis set. - Workspace policy files in
.gemini/policiesare documented as currently disabled. - Checkpointing is off by default, and session files sit under
~/.gemini/tmpand are pruned after 30 days.
Which should you pick
Pick Claude Code if
- You want Claude models and an agent that also runs in your IDE, the desktop app and CI.
- You want a sandbox whose network starts closed, opened one domain at a time.
- You want a classifier to handle routine approvals.
- You are an individual developer: Gemini CLI no longer has a free or Google AI plan tier.
Pick Gemini CLI if
- Your company has Gemini Code Assist Standard or Enterprise licenses.
- You want to be asked before every shell command by default.
- You want sandbox choices beyond Seatbelt, such as Docker, Podman or gVisor.
- You want to read the source: Gemini CLI is Apache-2.0.
Running both
Gemini CLI reads GEMINI.md, and its context.fileName setting can point it at AGENTS.md or CLAUDE.md too, so one instruction file can reach both. Their enforced settings are separate: Claude Code's in settings.json, Gemini CLI's in ~/.gemini/settings.json and its policy files.
Where Excellent fits
| What Excellent does | Claude Code | Gemini CLI |
|---|---|---|
Reads its session logs (free scan) | Yes | Yes |
Key finder reads its key files | Yes | Yes |
Live check before risky actions (Pro) | Yes, in its own hook settings | Yes, in its own hook settings |
Before a force push to main | Claude Code asks you first | Refuses and tells Gemini CLI to ask you |
Excellent's sandbox (Pro) | Yes, in its own sandbox settings | No |
Rule sharing | Yes | No |
Excellent reads the session logs of both Claude Code and Gemini CLI on your Mac. The free scan shows what each did: your email in request commands or form inputs, keys sitting in logs, secrets files read, history overwritten, checks skipped. Each finding says which agent and where.
With Pro, Excellent adds its live check to each one's own hook settings, after listing what it will change. The same rules apply to both: it blocks your email on its way to a website, an API key typed into a command, and deleting a folder you marked never-delete.
Excellent's sandbox and rule sharing are for Claude Code and Codex only, so here they apply to Claude Code. The check reads what a command says, so it isn't a wall around your Mac.
Questions
Is Gemini CLI still free?
No. Since June 18, 2026, free and Google AI Pro or Ultra access moved to Antigravity CLI. Gemini CLI now serves Gemini Code Assist Standard and Enterprise and paid API or Vertex keys.
Does Gemini CLI have a sandbox?
Yes, optional. On macOS it uses Seatbelt with six profiles, and it also runs in Docker, Podman, gVisor or LXC. Turn it on with -s, GEMINI_SANDBOX or tools.sandbox.
Does Claude Code have a sandbox?
Yes, off by default. It uses Seatbelt on macOS and bubblewrap on Linux, and covers shell commands.
Which one asks more?
Gemini CLI's default mode asks before every shell command and write tool. Claude Code's interactive default, auto mode, lets a classifier approve routine actions, and its Manual mode asks like Gemini CLI does.
Read more
- Claude Code: safety and how to run it
- Gemini CLI: safety and how to run it
- All agents Excellent works with
Sources
Claude Code
- Claude Code docs: Overview
- Claude Code docs: Permission modes
- Claude Code docs: Sandboxing
- Claude Code docs: Permissions
- Claude Code docs: Hooks
- Claude Code docs: Explore the .claude directory
- Claude Code docs: MCP
- Claude Code docs: Deploy managed settings
- anthropics/claude-code: LICENSE.md
- Claude pricing
- anthropics/claude-code: Security advisories
Gemini CLI
- Gemini CLI README (google-gemini/gemini-cli)
- Gemini CLI docs: Sandboxing
- Gemini CLI docs: Trusted folders
- Gemini CLI docs: Policy engine
- Gemini CLI docs: Hooks
- Gemini CLI docs: Settings
- Gemini CLI docs: Configuration reference
- Gemini CLI docs: Checkpointing
- Gemini CLI docs: Session management
- Gemini CLI docs: Shell commands
- GitHub Security Advisory GHSA-wpqr-6v78-jr5g
- Tracebit: Gemini CLI code execution write-up
- Gemini CLI release v0.1.14




