Gemini CLI vs Claude Code: Config File Map
GEMINI.md maps to CLAUDE.md, .gemini/commands/*.toml to skills, and the policy engine to permission rules. A file-by-file map from both official docs, checked 2026-11-10.
- Instructions: Gemini CLI loads ~/.gemini/GEMINI.md plus GEMINI.md files in the workspace and its parents; Claude Code loads ~/.claude/CLAUDE.md plus CLAUDE.md files in the working directory and above. Both support @file imports. Gemini CLI reads AGENTS.md only if you add it to context.fileName; Claude Code reads it when no CLAUDE.md exists.
- Settings: ~/.gemini/settings.json and .gemini/settings.json, with a system settings file that overrides all others; Claude Code uses ~/.claude/settings.json, .claude/settings.json, .claude/settings.local.json and managed settings.
- To share one set of instructions, the Claude Code docs suggest an @AGENTS.md import in CLAUDE.md, and the Gemini CLI docs show context.fileName listing AGENTS.md.
Gemini CLI and Claude Code organize the same kinds of things in different files. Instructions live in GEMINI.md or CLAUDE.md, settings in ~/.gemini/settings.json or ~/.claude/settings.json, and approvals in a TOML policy engine or JSON permission rules. This article is a map between the two, item by item, for readers who use both or are moving from one to the other.
Every fact comes from the official docs as fetched on 2026-11-10: the Gemini CLI repository’s docs/ (latest release v0.67.0) and code.claude.com (latest Claude Code on npm 2.1.322). We did not run either tool for this article. Where one side’s docs say nothing, the table says so instead of guessing. Pricing and free tiers are out of scope; see the related reading at the end.
The map at a glance
| Item | Gemini CLI | Claude Code |
|---|---|---|
| Instruction file | GEMINI.md (name configurable with context.fileName) | CLAUDE.md, CLAUDE.local.md, .claude/rules/*.md |
| User-wide instructions | ~/.gemini/GEMINI.md | ~/.claude/CLAUDE.md |
| Imports | @file.md, relative or absolute | @path, relative or absolute, up to four hops deep |
| AGENTS.md | Read if listed in context.fileName | Read when no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md exists in the working directory or above (v2.1.277+) |
| User settings | ~/.gemini/settings.json | ~/.claude/settings.json |
| Project settings | .gemini/settings.json | .claude/settings.json, .claude/settings.local.json |
| Admin settings | System settings file (overrides all files) | Managed settings (highest precedence) |
| Ignore file | .geminiignore | No ignore file described; Read deny rules instead |
| Custom commands | .gemini/commands/*.toml | Merged into skills; .claude/commands/*.md still works |
| Skills | ~/.gemini/skills/, .gemini/skills/ (and .agents/skills/ aliases) | ~/.claude/skills/, .claude/skills/ |
| MCP servers | mcpServers in settings.json; gemini mcp add | .mcp.json (project) or ~/.claude.json (local, user); claude mcp add |
| Hooks | hooks in settings.json | hooks in settings files, plugins, skill and subagent frontmatter |
| Tool approval rules | Policy engine, ~/.gemini/policies/*.toml | permissions allow / ask / deny in settings |
| Folder trust | Trusted Folders (off by default) | Workspace trust dialog in interactive sessions |
| Headless | -p, --output-format | claude -p, --output-format, --bare |
Sources: the sections below (all checked 2026-11-10).
Instruction files
Gemini CLI loads context files in three layers: the global ~/.gemini/GEMINI.md, GEMINI.md files in your workspace directories and their parents, and “just-in-time” GEMINI.md files it finds when a tool touches a directory, up to a trusted root. It concatenates everything it finds and sends it with every prompt. The upward search stops at a directory containing a boundary marker, .git by default (context.memoryBoundaryMarkers). /memory show prints the combined content, and /memory reload rescans the files. Large files can be split with @./components/instructions.md-style imports; the import processor guards against circular imports. context.fileName changes the file name or takes a list such as ["AGENTS.md", "CONTEXT.md", "GEMINI.md"].
(source: https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/gemini-md.md, checked 2026-11-10) (source: https://github.com/google-gemini/gemini-cli/blob/main/docs/reference/memport.md, checked 2026-11-10) (source: https://github.com/google-gemini/gemini-cli/blob/main/docs/reference/configuration.md, checked 2026-11-10)
Claude Code loads ~/.claude/CLAUDE.md, the project’s ./CLAUDE.md or ./.claude/CLAUDE.md, a personal ./CLAUDE.local.md, and an organization-managed file. Files in the working directory and every directory above it load at launch; files in subdirectories load once Claude works on a file there. @path/to/import pulls in other files, with relative paths resolved from the importing file and a maximum depth of four hops. Imports of files outside the working directory need a one-time approval. .claude/rules/ holds topic files, and rules with paths frontmatter apply only to matching files. On this page /memory is where you toggle auto memory; we found no equivalent of /memory show in the pages we checked.
AGENTS.md is the clearest difference. Claude Code reads AGENTS.md by default only when no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md exists in the working directory or above it, and reading it directly needs v2.1.277 or later. Gemini CLI reads AGENTS.md only if you name it in context.fileName.
(source: https://code.claude.com/docs/en/claude-md, checked 2026-11-10)
Settings files and precedence
| Layer | Gemini CLI | Claude Code |
|---|---|---|
| Lowest | Built-in defaults, then a system defaults file | User ~/.claude/settings.json |
| User | ~/.gemini/settings.json | (above) |
| Project | .gemini/settings.json | Shared .claude/settings.json, then local .claude/settings.local.json |
| Command line | Above environment variables | Above project files |
| Highest | Command-line arguments; the system settings file overrides every other settings file | Managed settings |
Gemini CLI’s order, lowest to highest: defaults, system defaults file, user settings, project settings, system settings, environment variables (including .env), command-line arguments. The system files live at /etc/gemini-cli/ on Linux, C:\ProgramData\gemini-cli\ on Windows and /Library/Application Support/GeminiCli/ on macOS. String values can reference environment variables as $VAR, ${VAR} or ${VAR:-DEFAULT}.
Claude Code’s order, highest first: managed settings, command line, project local, shared project, user. Settings files are strict JSON.
(source: https://github.com/google-gemini/gemini-cli/blob/main/docs/reference/configuration.md, checked 2026-11-10) (source: https://code.claude.com/docs/en/settings, checked 2026-11-10)
Ignore files
.geminiignore sits at the project root and follows .gitignore conventions (globs, trailing / for directories, ! to negate). Tools that support it exclude matching paths; for example, @ file sharing skips them. Changes take effect after you restart the session. context.fileFiltering.respectGitIgnore and respectGeminiIgnore both default to true.
(source: https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/gemini-ignore.md, checked 2026-11-10) (source: https://github.com/google-gemini/gemini-cli/blob/main/docs/reference/configuration.md, checked 2026-11-10)
The Claude Code pages we checked describe no ignore file. The documented tool is a permission rule such as Read(./.env) in deny. Read and Edit deny rules apply to built-in file tools, recognized Bash file commands (cat, head, tail, sed, tee) and redirection targets, not to commands that read without naming the file, such as grep -r, or scripts that open files themselves. On .gitignore, the env-vars page says the Glob tool returns gitignored files by default (CLAUDE_CODE_GLOB_NO_IGNORE=false changes that) and that @ autocomplete has its own respectGitignore setting.
(source: https://code.claude.com/docs/en/permissions, checked 2026-11-10) (source: https://code.claude.com/docs/en/env-vars, checked 2026-11-10)
Custom commands and skills
Gemini CLI custom commands are TOML files with a required prompt and an optional description. User commands live in ~/.gemini/commands/, project commands in .gemini/commands/, and a project command wins over a user command of the same name. Subdirectories become namespaces: git/commit.toml is /git:commit. Inside prompt, {{args}} takes arguments, !{...} runs a shell command and @{...} injects a file. /commands reload picks up changes.
Gemini CLI skills are directories with a SKILL.md, found in built-in, extension, user (~/.gemini/skills/ or ~/.agents/skills/) and workspace (.gemini/skills/ or .agents/skills/) tiers. Only names and descriptions load at session start. When the model calls activate_skill, you confirm, and then the body and the skill’s directory are added.
(source: https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/custom-commands.md, checked 2026-11-10) (source: https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/skills.md, checked 2026-11-10)
In Claude Code, custom commands have been merged into skills. .claude/commands/deploy.md and .claude/skills/deploy/SKILL.md both create /deploy, and existing command files keep working. Skills take $ARGUMENTS and $ARGUMENTS[N], and a !`command` line runs a command and inserts its output before Claude sees the skill. The Claude Code skills page we checked does not mention .agents/skills/.
| Feature | Gemini CLI command (TOML) | Claude Code skill / command (Markdown) |
|---|---|---|
| Arguments | {{args}} | $ARGUMENTS, $ARGUMENTS[N] |
| Shell output | !{...} | !`...` |
| File content | @{...} | No equivalent stated in the pages we checked |
| Namespaces | Subdirectory → /dir:name | Plugin skills appear as /plugin-name:skill-name |
(source: https://code.claude.com/docs/en/skills, checked 2026-11-10)
MCP servers
Gemini CLI reads MCP servers from mcpServers in settings.json. gemini mcp add writes them, with -s, --scope set to user or project (default project). Tools are exposed as mcp_<server>_<tool>. --trust bypasses all tool-call confirmations for that server.
Claude Code has three scopes. Local (the default) and user servers are stored in ~/.claude.json; project servers go in .mcp.json at the project root, meant to be shared. A project server from .mcp.json shows as pending until you approve it in an interactive session. In claude -p runs and Agent SDK sessions there is no prompt, so Claude Code loads .mcp.json servers without asking; use disabledMcpjsonServers to keep one out (Source: https://code.claude.com/docs/en/mcp, checked 2026-11-15).
(source: https://github.com/google-gemini/gemini-cli/blob/main/docs/tools/mcp-server.md, checked 2026-11-10) (source: https://code.claude.com/docs/en/mcp, checked 2026-11-10)
Hooks
Both tools configure hooks in settings.json. The Gemini CLI docs warn that hooks execute arbitrary code with your user privileges. Event names differ: Gemini CLI has BeforeTool and AfterTool, BeforeAgent, BeforeModel and others; Claude Code’s equivalents for tool calls are PreToolUse and PostToolUse. In both, exit code 2 blocks. Gemini CLI treats exit 0 output as JSON and any other code as a warning. Gemini CLI provides GEMINI_PROJECT_DIR and also CLAUDE_PROJECT_DIR as an alias “for compatibility”.
Gemini CLI merges hooks from project, user and system settings and from extensions. It fingerprints project hooks: if a hook’s name or command changes, for example after git pull, it warns before running it. Claude Code reads hooks from ~/.claude/settings.json, .claude/settings.json, .claude/settings.local.json, managed settings, plugins, and skill or subagent frontmatter.
(source: https://github.com/google-gemini/gemini-cli/blob/main/docs/hooks/index.md, checked 2026-11-10) (source: https://code.claude.com/docs/en/hooks, checked 2026-11-10)
Approvals, trust and sandboxes
Gemini CLI’s policy engine reads TOML rules from ~/.gemini/policies/*.toml and admin directories. Each rule decides allow, deny or ask_user, and the highest-priority match wins. In non-interactive mode ask_user counts as deny. Rules can be tied to approval modes: default, autoEdit, plan and yolo. The docs warn that the workspace tier (.gemini/policies in a project) currently has no effect, so use user or admin policies.
Trusted Folders is off by default; you enable it in user settings. An untrusted folder runs in a “safe mode” that ignores the project’s .gemini/settings.json and .env, does not connect MCP servers, and does not load custom commands. In a headless run with the feature on, an untrusted folder makes the CLI exit with FatalUntrustedWorkspaceError. Sandboxing is enabled with -s, GEMINI_SANDBOX=true or tools.sandbox, with macOS Seatbelt, Docker/Podman, Windows, gVisor and LXC options.
(source: https://github.com/google-gemini/gemini-cli/blob/main/docs/reference/policy-engine.md, checked 2026-11-10) (source: https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/trusted-folders.md, checked 2026-11-10) (source: https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/sandbox.md, checked 2026-11-10)
Claude Code evaluates permission rules in order: deny, then ask, then allow; the first match decides. Permission modes include default, acceptEdits, plan, auto, dontAsk and bypassPermissions. A hook that exits with code 2 stops a tool call before permission rules run, but a hook’s “allow” does not override a deny or ask rule. For enforcement that does not depend on command text, the permissions page points to sandboxing. In interactive sessions, Claude Code shows a workspace trust dialog for folders you haven’t trusted, and project MCP servers have their own approval.
(source: https://code.claude.com/docs/en/permissions, checked 2026-11-10) (source: https://code.claude.com/docs/en/security, checked 2026-11-10)
Headless runs
Gemini CLI goes headless in a non-TTY environment or with -p. --output-format gives a single JSON object (response, stats, error) or newline-delimited JSON events. Exit codes are 0 success, 1 general error, 42 input error and 53 turn limit exceeded.
Claude Code uses claude -p with --output-format json or stream-json; the JSON result includes total_cost_usd. It exits 0 on success and non-zero on failure. One difference matters for CI. Without --bare, a -p session runs the project’s hooks and connects .mcp.json servers even in a folder you never trusted, with no trust dialog. --bare skips hooks, skills, custom commands, MCP servers, auto memory and CLAUDE.md. The docs call it the recommended mode for scripts.
(source: https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/headless.md, checked 2026-11-10) (source: https://code.claude.com/docs/en/headless, checked 2026-11-10)
Using one set of instructions in both
What the docs support, and what they leave open:
- Put shared rules in
AGENTS.md. For Gemini CLI, add it tocontext.fileName, for example["AGENTS.md", "GEMINI.md"]. For Claude Code, either have noCLAUDE.md(it then readsAGENTS.md), or write@AGENTS.mdat the top ofCLAUDE.mdand add Claude-specific lines below. The Claude Code docs show the second form for projects that also need aCLAUDE.md. - Keep tool-specific settings apart.
.gemini/settings.jsonand.claude/settings.jsonhave different keys. Neither doc describes reading the other’s file. - Commands do not carry over as-is. TOML with
{{args}}and Markdown with$ARGUMENTSare different formats. A Gemini CLI.agents/skills/alias exists, but the Claude Code skills page does not list that path. Whether oneSKILL.mdworks unchanged in both is unverified. - Hooks need two configs. Event names differ. Gemini CLI’s
CLAUDE_PROJECT_DIRalias helps a script run under both, but we did not test a shared script. - Ignore and deny are not the same. A
.geminiignoreline does not become a Claude Code deny rule; write both if a file must stay out.
Related reading
- Gemini CLI Getting Started: Install, Auth and Free Quotas: install, sign-in and the free tier.
- Claude Code Permissions and settings.json: A Cheat Sheet: permission rules and settings files.
- How to Create Claude Code Skills (SKILL.md): writing and placing a skill.
- Aider vs Claude Code: Models, Git and Instructions: another terminal agent compared with Claude Code.
- AI Coding Tools Compared: Plans and Prices (2026): plans and prices across tools.
- Claude Code Setup and Daily Operations: our hub for Claude Code configuration.
Summary
GEMINI.mdmaps toCLAUDE.md. Both load a user file plus files up the directory tree, and both support@imports.- Gemini CLI reads
AGENTS.mdonly throughcontext.fileName; Claude Code reads it when no CLAUDE.md exists or through@AGENTS.md. - Settings:
~/.gemini/settings.jsonand.gemini/settings.jsonwith a system override file, versus Claude Code’s user, project, local and managed settings. .geminiignorehas no ignore-file counterpart in the Claude Code docs we checked; Read deny rules are the nearest mechanism and do not covergrep -ror scripts..gemini/commands/*.tomlmaps to Claude Code skills (and the merged.claude/commands/); argument and injection syntax differ.- MCP:
mcpServersin settings versus.mcp.jsonand~/.claude.json. Hooks:BeforeToolversusPreToolUse; exit 2 blocks in both. - Approvals: TOML policy engine and Trusted Folders versus deny/ask/allow rules and the workspace trust dialog.
- Checked against both official docs on 2026-11-10. We did not run either tool for this article.
FAQ
- What is the Gemini CLI equivalent of CLAUDE.md?
- GEMINI.md. Gemini CLI loads ~/.gemini/GEMINI.md, GEMINI.md files in the workspace directories and their parents, and GEMINI.md files it finds just in time when a tool touches a directory. All found files are concatenated and sent with every prompt.
- Can Gemini CLI and Claude Code share AGENTS.md?
- Yes, per both docs. Gemini CLI reads AGENTS.md when you list it in context.fileName in settings.json. Claude Code reads AGENTS.md when no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md exists in the working directory or above, or through an @AGENTS.md import in CLAUDE.md. Reading it directly needs Claude Code v2.1.277 or later.
- Where do custom commands go in each tool?
- Gemini CLI uses TOML files in ~/.gemini/commands/ or .gemini/commands/; a project command overrides a user command with the same name. Claude Code merged custom commands into skills: .claude/commands/<name>.md and .claude/skills/<name>/SKILL.md both create /<name>.
- What replaces .geminiignore in Claude Code?
- The Claude Code docs we checked describe no ignore file. The closest documented mechanism is a Read deny rule in permissions, which covers built-in file tools and recognized Bash file commands but not commands like grep -r or scripts that open files themselves.
- How do I run each tool headless?
- Gemini CLI runs headless with -p or in a non-TTY environment, with --output-format json or streaming JSON. Claude Code uses claude -p with --output-format json or stream-json; --bare skips hooks, skills, MCP servers and CLAUDE.md for reproducible runs.