Gemini CLI settings.json Reference
Updated by Alex Sorokoletov
Independent reference, not affiliated with Google. Tables are generated from the Gemini CLI source at v0.62.0 (v0.62.0). Official documentation: geminicli.com.
Gemini CLI reads settings.json from up to four files and merges them in a fixed order: system defaults, then the user file ~/.gemini/settings.json, then the project file .gemini/settings.json, then a system override file that beats both. Command-line flags such as --model and --approval-mode override the merged result for one session.
Where is Gemini CLI settings.json?#
| Applied | Layer | File | Path override |
|---|---|---|---|
| 1 | Built-in defaults | schema defaults (the Default column below) | none |
| 2 | System defaults | /Library/Application Support/GeminiCli/system-defaults.json (macOS), C:\ProgramData\gemini-cli\system-defaults.json (Windows), /etc/gemini-cli/system-defaults.json (Linux) | GEMINI_CLI_SYSTEM_DEFAULTS_PATH |
| 3 | User | ~/.gemini/settings.json | GEMINI_CLI_HOME (moves ~) |
| 4 | Workspace | <project>/.gemini/settings.json (ignored in untrusted folders) | none |
| 5 | System override | /Library/Application Support/GeminiCli/settings.json (macOS), C:\ProgramData\gemini-cli\settings.json (Windows), /etc/gemini-cli/settings.json (Linux) | GEMINI_CLI_SYSTEM_SETTINGS_PATH |
On Windows the user file is %USERPROFILE%\.gemini\settings.json, since ~ is the home directory on every platform. Setting GEMINI_CLI_HOME moves the whole ~/.gemini tree. The project file is read only when the folder is trusted, so a cloned repository cannot change your settings until you trust it. The system override exists for administrators: anything set there wins over user and project values.
Precedence beyond the files: --model beats GEMINI_MODEL, which beats model.name; --approval-mode or --yolo beats general.defaultApprovalMode; --sandbox beats tools.sandbox.
How do settings from several files combine?#
Files are merged in the order above. Objects merge key by key, so a project file can change one field of general without restating the rest; single values and arrays from a later file replace earlier ones. These keys combine across files instead:
| Key | How values from several files combine |
|---|---|
mcpServers | objects merged by top-level name |
policyPaths | arrays joined, duplicates dropped |
context.includeDirectories | arrays concatenated |
context.fileFiltering.customIgnoreFilePaths | arrays joined, duplicates dropped |
tools.exclude | arrays joined, duplicates dropped |
advanced.excludedEnvVars | arrays joined, duplicates dropped |
extensions.disabled | arrays joined, duplicates dropped |
extensions.workspacesWithMigrationNudge | arrays joined, duplicates dropped |
skills.disabled | arrays joined, duplicates dropped |
hooksConfig.disabled | arrays joined, duplicates dropped |
hooks.BeforeTool | arrays concatenated |
hooks.AfterTool | arrays concatenated |
hooks.BeforeAgent | arrays concatenated |
hooks.AfterAgent | arrays concatenated |
hooks.Notification | arrays concatenated |
hooks.SessionStart | arrays concatenated |
hooks.SessionEnd | arrays concatenated |
hooks.PreCompress | arrays concatenated |
hooks.BeforeModel | arrays concatenated |
hooks.AfterModel | arrays concatenated |
hooks.BeforeToolSelection | arrays concatenated |
hooks.<name> | arrays concatenated |
So hooks defined in ~/.gemini/settings.json and in a project's .gemini/settings.json both run, and mcpServers from both files are merged by server name, with the later file winning when both define the same server.
Can settings.json use environment variables?#
| Mechanism | Rule |
|---|---|
| Variables in values | string values expand $VAR, ${VAR} and ${VAR:-default} from the environment before validation; an unset variable is left as written |
| .env discovery | from the working directory upward: .gemini/.env (trusted folders only), then .env in each directory; falls back to ~/.gemini/.env (trusted folders only), then ~/.env; the first file found is loaded |
| .env in untrusted folders | only GEMINI_API_KEY, GOOGLE_API_KEY, GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION are loaded, sanitized; in every folder, variables already set in the shell are never overridden |
| Proxy | no settings key; read from HTTPS_PROXY, https_proxy, HTTP_PROXY, http_proxy (first one set wins) |
A value like "Authorization": "Bearer $MY_TOKEN" in an MCP server's headers, or "url": "${BASE_URL:-http://localhost:8080}/mcp", is resolved at load time, which keeps secrets out of files you commit.
Is there a JSON schema for settings.json?#
Yes. Every key below comes from the generated schema at schemas/settings.schema.json in the Gemini CLI repository. Point an editor at it with a $schema entry to get validation and completion:
{
"$schema": "https://raw.githubusercontent.com/google-gemini/gemini-cli/main/schemas/settings.schema.json",
"general": { "defaultApprovalMode": "auto_edit" },
"hooksConfig": { "enabled": true }
}
Invalid values are reported with the file path when Gemini CLI starts. "Restart" in the table marks keys that only take effect in a new session.
How do I configure MCP servers in settings.json?#
mcpServers maps a server name to its connection. Use command and args for a local stdio server, url with type for SSE or HTTP, or httpUrl for streamable HTTP:
{
"mcpServers": {
"local-tools": {
"command": "node",
"args": ["./mcp/server.js"],
"env": { "API_TOKEN": "$API_TOKEN" },
"timeout": 30000
},
"remote": {
"httpUrl": "https://mcp.example.com/mcp",
"headers": { "Authorization": "Bearer $REMOTE_TOKEN" }
}
}
}
| Field | Type | Description |
|---|---|---|
command | string | Executable invoked for stdio transport. |
args | string[] | Command-line arguments for the stdio transport command. |
env | object | Environment variables to set for the server process. |
cwd | string | Working directory for the server process. |
url | string | URL for SSE or HTTP transport. Use with "type" field to specify transport type. |
httpUrl | string | Streaming HTTP transport URL. |
headers | object | Additional HTTP headers sent to the server. |
tcp | string | TCP address for websocket transport. |
type | stdio | sse | http | Transport type. Use "stdio" for local command, "sse" for Server-Sent Events, or "http" for Streamable HTTP. |
timeout | number | Timeout in milliseconds for MCP requests. |
trust | boolean | Marks the server as trusted. Trusted servers may gain additional capabilities. |
description | string | Human-readable description of the server. |
includeTools | string[] | Subset of tools that should be enabled for this server. When omitted all tools are enabled. |
excludeTools | string[] | Tools that should be disabled for this server even if exposed. |
extension | object | Metadata describing the Gemini CLI extension that owns this MCP server. |
oauth | object | OAuth configuration for authenticating with the server. |
authProviderType | dynamic_discovery | google_credentials | service_account_impersonation | Authentication provider used for acquiring credentials (for example `dynamic_discovery`). |
targetAudience | string | OAuth target audience (CLIENT_ID.apps.googleusercontent.com). |
targetServiceAccount | string | Service account email to impersonate (name@project.iam.gserviceaccount.com). |
trust: true adds a policy rule that allows the server's tools without a prompt, outside plan mode. mcp.allowed and mcp.excluded allow or block servers by name.
All settings.json keys#
| Key | Type | Default | Merge | Restart | Description |
|---|---|---|---|---|---|
mcpServers | map of MCPServerConfig | {} | shallow_merge | yes | Configuration for MCP servers. |
policyPaths | string[] | [] | union | yes | Additional policy files or directories to load. |
adminPolicyPaths | string[] | [] | union | yes | Additional admin policy files or directories to load. |
general | object | — | — | no | General application settings. |
general.preferredEditor | vscode | vscodium | windsurf | cursor | zed | antigravity | sublimetext | lapce | nova | bbedit | vim | neovim | emacs | hx | emacsclient | micro | — | — | no | The preferred editor to open files in. Must be one of the built-in supported identifiers. Use /editor in the CLI to pick interactively, or leave unset to use $VISUAL/$EDITOR. |
general.openEditorInNewWindow | boolean | false | — | no | Open VS Code-family editors in a new window when editing files. |
general.vimMode | boolean | false | — | no | Enable Vim keybindings |
general.defaultApprovalMode | default | auto_edit | plan | "default" | — | no | The default approval mode for tool execution. 'default' prompts for approval, 'auto_edit' auto-approves edit tools, and 'plan' is read-only mode. YOLO mode (auto-approve all actions) can only be enabled via command line (--yolo or --approval-mode=yolo). |
general.devtools | boolean | false | — | no | Enable DevTools inspector on launch. |
general.enableAutoUpdate | boolean | true | — | no | Enable automatic updates. |
general.enableAutoUpdateNotification | boolean | true | — | no | Enable update notification prompts. |
general.enableNotifications | boolean | false | — | no | Enable terminal run-event notifications for action-required prompts and session completion. |
general.notificationMethod | auto | osc9 | osc777 | bell | "auto" | — | no | How to send terminal notifications. |
general.checkpointing | object | — | — | yes | Session checkpointing settings. |
general.checkpointing.enabled | boolean | false | — | yes | Enable session checkpointing for recovery |
general.plan | object | — | — | yes | Planning features configuration. |
general.plan.enabled | boolean | true | — | yes | Enable Plan Mode for read-only safety during planning. |
general.plan.directory | string | — | — | yes | The directory where planning artifacts are stored. If not specified, defaults to the system temporary directory. A custom directory requires a policy to allow write access in Plan Mode. |
general.plan.modelRouting | boolean | true | — | no | Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pro for the planning phase and Flash for the implementation phase. |
general.retryFetchErrors | boolean | true | — | no | Retry on "exception TypeError: fetch failed sending request" errors. |
general.maxAttempts | number | 10 | — | no | Maximum number of attempts for requests to the main chat model. Cannot exceed 10. |
general.debugKeystrokeLogging | boolean | false | — | no | Enable debug logging of keystrokes to the console. |
general.sessionRetention | object | — | — | no | Settings for automatic session cleanup. |
general.sessionRetention.enabled | boolean | true | — | no | Enable automatic session cleanup |
general.sessionRetention.maxAge | string | "30d" | — | no | Automatically delete chats older than this time period (e.g., "30d", "7d", "24h", "1w") |
general.sessionRetention.maxCount | number | — | — | no | Alternative: Maximum number of sessions to keep (most recent) |
general.sessionRetention.minRetention | string | "1d" | — | no | Minimum retention period (safety limit, defaults to "1d") |
general.topicUpdateNarration | boolean | true | — | no | Enable the Topic & Update communication model for reduced chattiness and structured progress reporting. |
general.logRagSnippets | boolean | false | — | no | Log full Code Customization (RAG) retrieved snippets to a local file for debugging. |
output | object | — | — | no | Settings for the CLI output. |
output.format | text | json | "text" | — | no | The format of the CLI output. Can be `text` or `json`. |
ui | object | — | — | no | User interface settings. |
ui.debugRainbow | boolean | false | — | yes | Enable debug rainbow rendering. Only useful for debugging rendering bugs and performance issues. |
ui.theme | string | — | — | no | The color theme for the UI. See the CLI themes guide for available options. |
ui.autoThemeSwitching | boolean | true | — | no | Automatically switch between default light and dark themes based on terminal background color. |
ui.terminalBackgroundPollingInterval | number | 60 | — | no | Interval in seconds to poll the terminal background color. |
ui.customThemes | map of CustomTheme | {} | — | no | Custom theme definitions. |
ui.hideWindowTitle | boolean | false | — | yes | Hide the window title bar |
ui.inlineThinkingMode | off | full | "off" | — | no | Display model thinking inline: off or full. |
ui.showStatusInTitle | boolean | false | — | no | Show Gemini CLI model thoughts in the terminal window title during the working phase |
ui.dynamicWindowTitle | boolean | true | — | no | Update the terminal window title with current status icons (Ready: ◇, Action Required: ✋, Working: ✦) |
ui.showHomeDirectoryWarning | boolean | true | — | yes | Show a warning when running Gemini CLI in the home directory. |
ui.showCompatibilityWarnings | boolean | true | — | yes | Show warnings about terminal or OS compatibility issues. |
ui.hideTips | boolean | false | — | no | Hide helpful tips in the UI |
ui.escapePastedAtSymbols | boolean | false | — | no | When enabled, @ symbols in pasted text are escaped to prevent unintended @path expansion. |
ui.showShortcutsHint | boolean | true | — | no | Show the "? for shortcuts" hint above the input. |
ui.compactToolOutput | boolean | true | — | no | Display tool outputs (like directory listings and file reads) in a compact, structured format. |
ui.hideBanner | boolean | false | — | no | Hide the application banner |
ui.hideContextSummary | boolean | false | — | no | Hide the context summary (GEMINI.md, MCP servers) above the input. |
ui.footer | object | — | — | no | Settings for the footer. |
ui.footer.items | string[] | — | — | no | List of item IDs to display in the footer. Rendered in order |
ui.footer.showLabels | boolean | true | — | no | Display a second line above the footer items with descriptive headers (e.g., /model). |
ui.footer.hideCWD | boolean | false | — | no | Hide the current working directory in the footer. |
ui.footer.hideSandboxStatus | boolean | false | — | no | Hide the sandbox status indicator in the footer. |
ui.footer.hideModelInfo | boolean | false | — | no | Hide the model name and context usage in the footer. |
ui.footer.hideContextPercentage | boolean | true | — | no | Hides the context window usage percentage. |
ui.hideFooter | boolean | false | — | no | Hide the footer from the UI |
ui.collapseDrawerDuringApproval | boolean | true | — | no | Whether to collapse the UI drawer when a tool is awaiting confirmation. |
ui.showMemoryUsage | boolean | false | — | no | Display memory usage information in the UI |
ui.showLineNumbers | boolean | true | — | no | Show line numbers in the chat. |
ui.showCitations | boolean | false | — | no | Show citations for generated text in the chat. |
ui.showModelInfoInChat | boolean | false | — | no | Show the model name in the chat for each model turn. |
ui.showUserIdentity | boolean | true | — | no | Show the signed-in user's identity (e.g. email) in the UI. |
ui.useAlternateBuffer | boolean | false | — | yes | Use an alternate screen buffer for the UI, preserving shell history. |
ui.renderProcess | boolean | true | — | yes | Enable Ink render process for the UI. |
ui.terminalBuffer | boolean | false | — | yes | Use the new terminal buffer architecture for rendering. |
ui.useBackgroundColor | boolean | true | — | no | Whether to use background colors in the UI. |
ui.incrementalRendering | boolean | true | — | yes | Enable incremental rendering for the UI. This option will reduce flickering but may cause rendering artifacts. Only supported when useAlternateBuffer is enabled. |
ui.showSpinner | boolean | true | — | no | Show the spinner during operations. |
ui.loadingPhrases | tips | witty | all | off | "off" | — | no | What to show while the model is working: tips, witty comments, all, or off. |
ui.errorVerbosity | low | full | "low" | — | no | Controls whether recoverable errors are hidden (low) or fully shown (full). |
ui.customWittyPhrases | string[] | [] | — | no | Custom witty phrases to display during loading. When provided, the CLI cycles through these instead of the defaults. |
ui.accessibility | object | — | — | yes | Accessibility settings. |
ui.accessibility.enableLoadingPhrases | boolean | true | — | yes | @deprecated Use ui.loadingPhrases instead. Enable loading phrases during operations. |
ui.accessibility.screenReader | boolean | false | — | yes | Render output in plain-text to be more screen reader accessible |
ide | object | — | — | yes | IDE integration settings. |
ide.enabled | boolean | false | — | yes | Enable IDE integration mode. |
ide.hasSeenNudge | boolean | false | — | no | Whether the user has seen the IDE integration nudge. |
privacy | object | — | — | yes | Privacy-related settings. |
privacy.usageStatisticsEnabled | boolean | true | — | yes | Enable collection of usage statistics |
telemetry | object | — | — | yes | Telemetry configuration. |
billing | object | — | — | no | Billing and AI credits settings. |
billing.overageStrategy | ask | always | never | "ask" | — | no | How to handle quota exhaustion when AI credits are available. 'ask' prompts each time, 'always' automatically uses credits, 'never' disables credit usage. |
billing.vertexAi | object | — | — | yes | Vertex AI request routing settings. |
billing.vertexAi.requestType | dedicated | shared | — | — | yes | Sets the X-Vertex-AI-LLM-Request-Type header for Vertex AI requests. |
billing.vertexAi.sharedRequestType | priority | flex | — | — | yes | Sets the X-Vertex-AI-LLM-Shared-Request-Type header for Vertex AI requests. |
model | object | — | — | no | Settings related to the generative model. |
model.name | string | — | — | no | The Gemini model to use for conversations. |
model.maxSessionTurns | number | -1 | — | no | Maximum number of user/model/tool turns to keep in a session. -1 means unlimited. |
model.summarizeToolOutput | map of SummarizeToolOutputSettings | — | — | no | Enables or disables summarization of tool output. Configure per-tool token budgets (for example {"run_shell_command": {"tokenBudget": 2000}}). Currently only the run_shell_command tool supports summarization. |
model.compressionThreshold | number | 0.5 | — | yes | The fraction of context usage at which to trigger context compression (e.g. 0.2, 0.3). |
model.disableLoopDetection | boolean | false | — | yes | Disable automatic detection and prevention of infinite loops. |
model.skipNextSpeakerCheck | boolean | true | — | no | Skip the next speaker check. |
modelConfigs | object | — | — | no | Model configurations. |
modelConfigs.aliases | object | (large default, see schema) | — | no | Named presets for model configs. Can be used in place of a model name and can inherit from other aliases using an `extends` property. |
modelConfigs.customAliases | object | {} | — | no | Custom named presets for model configs. These are merged with (and override) the built-in aliases. |
modelConfigs.customOverrides | any[] | [] | — | no | Custom model config overrides. These are merged with (and added to) the built-in overrides. |
modelConfigs.overrides | any[] | [] | — | no | Apply specific configuration overrides based on matches, with a primary key of model (or alias). The most specific match will be used. |
modelConfigs.modelDefinitions | map of ModelDefinition | (large default, see schema) | — | yes | Registry of model metadata, including tier, family, and features. |
modelConfigs.modelIdResolutions | map of ModelResolution | (large default, see schema) | — | yes | Rules for resolving requested model names to concrete model IDs based on context. |
modelConfigs.classifierIdResolutions | map of ModelResolution | (large default, see schema) | — | yes | Rules for resolving classifier tiers (flash, pro) to concrete model IDs. |
modelConfigs.modelChains | map of ModelPolicyChain | (large default, see schema) | — | yes | Availability policy chains defining fallback behavior for models. |
agents | object | — | — | yes | Settings for subagents. |
agents.overrides | map of AgentOverride | {} | — | yes | Override settings for specific agents, e.g. to disable the agent, set a custom model config, or run config. |
agents.browser | object | — | — | yes | Settings specific to the browser agent. |
agents.browser.sessionMode | persistent | isolated | existing | "persistent" | — | yes | Session mode: 'persistent', 'isolated', or 'existing'. |
agents.browser.headless | boolean | false | — | yes | Run browser in headless mode. |
agents.browser.profilePath | string | — | — | yes | Path to browser profile directory for session persistence. |
agents.browser.visualModel | string | — | — | yes | Model for the visual agent's analyze_screenshot tool. When set, enables the tool. |
agents.browser.allowedDomains | string[] | ["github.com", "*.google.com", "localhost"] | — | yes | A list of allowed domains for the browser agent (e.g., ["github.com", "*.google.com"]). |
agents.browser.disableUserInput | boolean | true | — | no | Disable user input on browser window during automation. |
agents.browser.maxActionsPerTask | number | 100 | — | no | The maximum number of tool calls allowed per browser task. Enforcement is hard: the agent will be terminated when the limit is reached. |
agents.browser.confirmSensitiveActions | boolean | false | — | yes | Require manual confirmation for sensitive browser actions (e.g., fill_form, evaluate_script). |
agents.browser.blockFileUploads | boolean | false | — | yes | Hard-block file upload requests from the browser agent. |
context | object | — | — | no | Settings for managing context provided to the model. |
context.fileName | string | string[] | — | — | no | The name of the context file or files to load into memory. Accepts either a single string or an array of strings. |
context.importFormat | string | — | — | no | The format to use when importing memory. |
context.includeDirectoryTree | boolean | true | — | no | Whether to include the directory tree of the current working directory in the initial request to the model. |
context.discoveryMaxDirs | number | 200 | — | no | Maximum number of directories to search for memory. |
context.memoryBoundaryMarkers | string[] | [".git"] | — | yes | File or directory names that mark the boundary for GEMINI.md discovery. The upward traversal stops at the first directory containing any of these markers. An empty array disables parent traversal. |
context.includeDirectories | string[] | [] | concat | no | Additional directories to include in the workspace context. Missing directories will be skipped with a warning. |
context.loadMemoryFromIncludeDirectories | boolean | false | — | no | Controls how /memory reload loads GEMINI.md files. When true, include directories are scanned; when false, only the current directory is used. |
context.fileFiltering | object | — | — | yes | Settings for git-aware file filtering. |
context.fileFiltering.respectGitIgnore | boolean | true | — | yes | Respect .gitignore files when searching. |
context.fileFiltering.respectGeminiIgnore | boolean | true | — | yes | Respect .geminiignore files when searching. |
context.fileFiltering.enableFileWatcher | boolean | false | — | yes | Enable file watcher updates for @ file suggestions (experimental). |
context.fileFiltering.enableRecursiveFileSearch | boolean | true | — | yes | Enable recursive file search functionality when completing @ references in the prompt. |
context.fileFiltering.enableFuzzySearch | boolean | true | — | yes | Enable fuzzy search when searching for files. |
context.fileFiltering.customIgnoreFilePaths | string[] | [] | union | yes | Additional ignore file paths to respect. These files take precedence over .geminiignore and .gitignore. Files earlier in the array take precedence over files later in the array, e.g. the first file takes precedence over the second one. |
tools | object | — | — | yes | Settings for built-in and custom tools. |
tools.sandbox | boolean | string | object | — | — | yes | Legacy full-process sandbox execution environment. Set to a boolean to enable or disable the sandbox, provide a string path to a sandbox profile, or specify an explicit sandbox command (e.g., "docker", "podman", "lxc", "windows-native"). |
tools.sandboxAllowedPaths | string[] | [] | — | yes | List of additional paths that the sandbox is allowed to access. |
tools.sandboxNetworkAccess | boolean | false | — | yes | Whether the sandbox is allowed to access the network. |
tools.shell | object | — | — | no | Settings for shell execution. |
tools.shell.enableInteractiveShell | boolean | true | — | yes | Use node-pty for an interactive shell experience. Fallback to child_process still applies. |
tools.shell.backgroundCompletionBehavior | silent | inject | notify | "silent" | — | no | Controls what happens when a background shell command finishes. 'silent' (default): quietly exits in background. 'inject': automatically returns output to agent. 'notify': shows brief message in chat. |
tools.shell.pager | string | "cat" | — | no | The pager command to use for shell output. Defaults to `cat`. |
tools.shell.showColor | boolean | true | — | no | Show color in shell output. |
tools.shell.inactivityTimeout | number | 300 | — | no | The maximum time in seconds allowed without output from the shell command. Defaults to 5 minutes. |
tools.shell.enableShellOutputEfficiency | boolean | true | — | no | Enable shell output efficiency optimizations for better performance. |
tools.core | string[] | — | — | yes | Restrict the set of built-in tools with an allowlist. Match semantics mirror tools.allowed; see the built-in tools documentation for available names. |
tools.allowed | string[] | — | — | yes | Tool names that bypass the confirmation dialog. Useful for trusted commands (for example ["run_shell_command(git)", "run_shell_command(npm test)"]). See shell tool command restrictions for matching details. |
tools.confirmationRequired | string[] | — | — | yes | Tool names that always require user confirmation. Takes precedence over allowed tools and core tool allowlists. |
tools.exclude | string[] | — | union | yes | Tool names to exclude from discovery. |
tools.discoveryCommand | string | — | — | yes | Command to run for tool discovery. |
tools.callCommand | string | — | — | yes | Defines a custom shell command for invoking discovered tools. The command must take the tool name as the first argument, read JSON arguments from stdin, and emit JSON results on stdout. |
tools.useRipgrep | boolean | true | — | no | Use ripgrep for file content search instead of the fallback implementation. Provides faster search performance. |
tools.truncateToolOutputThreshold | number | 40000 | — | yes | Maximum characters to show when truncating large tool outputs. Set to 0 or negative to disable truncation. |
tools.disableLLMCorrection | boolean | true | — | yes | Disable LLM-based error correction for edit tools. When enabled, tools will fail immediately if exact string matches are not found, instead of attempting to self-correct. |
mcp | object | — | — | yes | Settings for Model Context Protocol (MCP) servers. |
mcp.serverCommand | string | — | — | yes | Command to start an MCP server. |
mcp.allowed | string[] | — | — | yes | A list of MCP servers to allow. |
mcp.excluded | string[] | — | — | yes | A list of MCP servers to exclude. |
useWriteTodos | boolean | true | — | no | Enable the write_todos tool. |
security | object | — | — | yes | Security-related settings. |
security.toolSandboxing | boolean | false | — | yes | Tool-level sandboxing. Isolates individual tools instead of the entire CLI process. |
security.disableYoloMode | boolean | false | — | yes | Disable YOLO mode, even if enabled by a flag. |
security.disableAlwaysAllow | boolean | false | — | yes | Disable "Always allow" options in tool confirmation dialogs. |
security.enablePermanentToolApproval | boolean | false | — | no | Enable the "Allow for all future sessions" option in tool confirmation dialogs. |
security.autoAddToPolicyByDefault | boolean | false | — | no | When enabled, the "Allow for all future sessions" option becomes the default choice for low-risk tools in trusted workspaces. |
security.blockGitExtensions | boolean | false | — | yes | Blocks installing and loading extensions from Git. |
security.allowedExtensions | string[] | [] | — | yes | List of Regex patterns for allowed extensions. If nonempty, only extensions that match the patterns in this list are allowed. Overrides the blockGitExtensions setting. |
security.folderTrust | object | — | — | no | Settings for folder trust. |
security.folderTrust.enabled | boolean | true | — | yes | Setting to track whether Folder trust is enabled. |
security.environmentVariableRedaction | object | — | — | no | Settings for environment variable redaction. |
security.environmentVariableRedaction.allowed | string[] | [] | — | yes | Environment variables to always allow (bypass redaction). |
security.environmentVariableRedaction.blocked | string[] | [] | — | yes | Environment variables to always redact. |
security.environmentVariableRedaction.enabled | boolean | false | — | yes | Enable redaction of environment variables that may contain secrets. |
security.auth | object | — | — | yes | Authentication settings. |
security.auth.selectedType | string | — | — | yes | The currently selected authentication type. |
security.auth.enforcedType | string | — | — | yes | The required auth type. If this does not match the selected auth type, the user will be prompted to re-authenticate. |
security.auth.useExternal | boolean | — | — | yes | Whether to use an external authentication flow. |
security.enableConseca | boolean | false | — | yes | Enable the context-aware security checker. This feature uses an LLM to dynamically generate and enforce security policies for tool use based on your prompt, providing an additional layer of protection against unintended actions. |
advanced | object | — | — | yes | Advanced settings for power users. |
advanced.autoConfigureMemory | boolean | true | — | yes | Automatically configure Node.js memory limits. Note: Because memory is allocated during the initial process boot, this setting is only read from the global user settings file and ignores workspace-level overrides. |
advanced.dnsResolutionOrder | string | — | — | yes | The DNS resolution order. |
advanced.excludedEnvVars | string[] | ["DEBUG", "DEBUG_MODE"] | union | no | Environment variables to exclude from project context. |
advanced.ignoreLocalEnv | boolean | false | — | yes | Whether to ignore generic .env files in the project directory. |
advanced.bugCommand | object | — | — | no | Configuration for the bug report command. |
experimental | object | — | — | yes | Setting to enable experimental features |
experimental.gemma | boolean | true | — | yes | Enable access to Gemma 4 models via Gemini API. |
experimental.voiceMode | boolean | false | — | no | Enable experimental voice dictation and commands (/voice, /voice model). |
experimental.voice | object | — | — | no | Settings for voice mode and transcription. |
experimental.voice.activationMode | push-to-talk | toggle | "push-to-talk" | — | no | How to trigger voice recording with the Space key. |
experimental.voice.backend | gemini-live | whisper | "gemini-live" | — | no | The backend to use for voice transcription. Note: When using the Gemini Live backend, voice recordings are sent to Google Cloud for transcription. |
experimental.voice.whisperModel | ggml-tiny.en.bin | ggml-base.en.bin | ggml-large-v3-turbo-q5_0.bin | ggml-large-v3-turbo-q8_0.bin | "ggml-base.en.bin" | — | no | The Whisper model to use for local transcription. |
experimental.voice.stopGracePeriodMs | number | 4000 | — | no | How long to wait for final transcription after stopping recording. |
experimental.adk | object | — | — | yes | Settings for the Agent Development Kit (ADK). |
experimental.adk.agentSessionNoninteractiveEnabled | boolean | false | — | yes | Enable non-interactive agent sessions. |
experimental.adk.agentSessionInteractiveEnabled | boolean | false | — | yes | Enable the agent session implementation for the interactive CLI. |
experimental.adk.agentSessionSubagentEnabled | boolean | false | — | yes | Route subagent invocations through the AgentSession protocol instead of legacy executors. |
experimental.enableAgents | boolean | true | — | yes | Enable local and remote subagents. |
experimental.worktrees | boolean | false | — | yes | Enable automated Git worktree management for parallel work. |
experimental.extensionManagement | boolean | true | — | yes | Enable extension management features. |
experimental.extensionConfig | boolean | true | — | yes | Enable requesting and fetching of extension settings. |
experimental.extensionRegistry | boolean | false | — | yes | Enable extension registry explore UI. |
experimental.extensionRegistryURI | string | "https://geminicli.com/extensions.json" | — | yes | The URI (web URL or local file path) of the extension registry. |
experimental.extensionReloading | boolean | false | — | yes | Enables extension loading/unloading within the CLI session. |
experimental.useOSC52Paste | boolean | false | — | no | Use OSC 52 for pasting. This may be more robust than the default system when using remote terminal sessions (if your terminal is configured to allow it). |
experimental.useOSC52Copy | boolean | false | — | no | Use OSC 52 for copying. This may be more robust than the default system when using remote terminal sessions (if your terminal is configured to allow it). |
experimental.taskTracker | boolean | false | — | yes | Enable task tracker tools. |
experimental.modelSteering | boolean | false | — | no | Enable model steering (user hints) to guide the model during tool execution. |
experimental.directWebFetch | boolean | false | — | yes | Enable web fetch behavior that bypasses LLM summarization. |
experimental.dynamicModelConfiguration | boolean | false | — | yes | Enable dynamic model configuration (definitions, resolutions, and chains) via settings. |
experimental.gemmaModelRouter | object | — | — | yes | Enable Gemma model router (experimental). |
experimental.gemmaModelRouter.enabled | boolean | false | — | yes | Enable the Gemma Model Router (experimental). Requires a local endpoint serving Gemma via the Gemini API using LiteRT-LM shim. |
experimental.gemmaModelRouter.autoStartServer | boolean | false | — | yes | Automatically start the LiteRT-LM server when Gemini CLI starts and the Gemma router is enabled. |
experimental.gemmaModelRouter.binaryPath | string | "" | — | yes | Custom path to the LiteRT-LM binary. Leave empty to use the default location (~/.gemini/bin/litert/). |
experimental.gemmaModelRouter.classifier | object | — | — | yes | Classifier configuration. |
experimental.gemmaModelRouter.classifier.host | string | "http://localhost:9379" | — | yes | The host of the classifier. |
experimental.gemmaModelRouter.classifier.model | string | "gemma3-1b-gpu-custom" | — | yes | The model to use for the classifier. Only tested on `gemma3-1b-gpu-custom`. |
experimental.stressTestProfile | boolean | false | — | yes | Significantly lowers token limits to force early garbage collection and distillation for testing purposes. |
experimental.autoMemory | boolean | false | — | yes | Automatically extract memory patches and skills from past sessions in the background. Every change is written as a unified diff `.patch` file under `<projectMemoryDir>/.inbox/<kind>/` and held for review in /memory inbox; nothing is applied until you approve it. |
experimental.generalistProfile | boolean | false | — | yes | Suitable for general coding and software development tasks. |
experimental.powerUserProfile | boolean | false | — | yes | Less cache friendly version of the generalist profile. |
experimental.contextManagement | boolean | false | — | yes | Enable logic for context management. |
experimental.topicUpdateNarration | boolean | false | — | no | Deprecated: Use general.topicUpdateNarration instead. |
extensions | object | — | — | yes | Settings for extensions. |
extensions.disabled | string[] | [] | union | yes | List of disabled extensions. |
extensions.workspacesWithMigrationNudge | string[] | [] | union | no | List of workspaces for which the migration nudge has been shown. |
skills | object | — | — | yes | Settings for agent skills. |
skills.enabled | boolean | true | — | yes | Enable Agent Skills. |
skills.disabled | string[] | [] | union | yes | List of disabled skills. |
hooksConfig | object | — | — | no | Hook configurations for intercepting and customizing agent behavior. |
hooksConfig.enabled | boolean | true | — | yes | Canonical toggle for the hooks system. When disabled, no hooks will be executed. |
hooksConfig.disabled | string[] | [] | union | no | List of hook names (commands) that should be disabled. Hooks in this list will not execute even if configured. |
hooksConfig.notifications | boolean | true | — | no | Show visual indicators when hooks are executing. |
hooks | map of any[] | — | — | no | Event-specific hook configurations. |
hooks.BeforeTool | object[] | [] | concat | no | Hooks that execute before tool execution. Can intercept, validate, or modify tool calls. |
hooks.AfterTool | object[] | [] | concat | no | Hooks that execute after tool execution. Can process results, log outputs, or trigger follow-up actions. |
hooks.BeforeAgent | object[] | [] | concat | no | Hooks that execute before agent loop starts. Can set up context or initialize resources. |
hooks.AfterAgent | object[] | [] | concat | no | Hooks that execute after agent loop completes. Can perform cleanup or summarize results. |
hooks.Notification | object[] | [] | concat | no | Hooks that execute on notification events (errors, warnings, info). Can log or alert on specific conditions. |
hooks.SessionStart | object[] | [] | concat | no | Hooks that execute when a session starts. Can initialize session-specific resources or state. |
hooks.SessionEnd | object[] | [] | concat | no | Hooks that execute when a session ends. Can perform cleanup or persist session data. |
hooks.PreCompress | object[] | [] | concat | no | Hooks that execute before chat history compression. Can back up or analyze conversation before compression. |
hooks.BeforeModel | object[] | [] | concat | no | Hooks that execute before LLM requests. Can modify prompts, inject context, or control model parameters. |
hooks.AfterModel | object[] | [] | concat | no | Hooks that execute after LLM responses. Can process outputs, extract information, or log interactions. |
hooks.BeforeToolSelection | object[] | [] | concat | no | Hooks that execute before tool selection. Can filter or prioritize available tools dynamically. |
contextManagement | object | — | — | yes | Settings for agent history and tool distillation context management. |
contextManagement.historyWindow | object | — | — | yes | — |
contextManagement.historyWindow.maxTokens | number | 150000 | — | yes | The number of tokens to allow before triggering compression. |
contextManagement.historyWindow.retainedTokens | number | 40000 | — | yes | The number of tokens to always retain. |
contextManagement.messageLimits | object | — | — | yes | — |
contextManagement.messageLimits.normalMaxTokens | number | 2500 | — | yes | The target number of tokens to budget for a normal conversation turn. |
contextManagement.messageLimits.retainedMaxTokens | number | 12000 | — | yes | The maximum number of tokens a single conversation turn can consume before truncation. |
contextManagement.messageLimits.normalizationHeadRatio | number | 0.25 | — | yes | The ratio of tokens to retain from the beginning of a truncated message (0.0 to 1.0). |
contextManagement.tools | object | — | — | yes | — |
contextManagement.tools.distillation | object | — | — | yes | — |
contextManagement.tools.distillation.maxOutputTokens | number | 10000 | — | yes | Maximum tokens to show to the model when truncating large tool outputs. |
contextManagement.tools.distillation.summarizationThresholdTokens | number | 20000 | — | yes | Threshold above which truncated tool outputs will be summarized by an LLM. |
contextManagement.tools.outputMasking | object | — | — | yes | Advanced settings for tool output masking to manage context window efficiency. |
contextManagement.tools.outputMasking.protectionThresholdTokens | number | 50000 | — | yes | Minimum number of tokens to protect from masking (most recent tool outputs). |
contextManagement.tools.outputMasking.minPrunableThresholdTokens | number | 30000 | — | yes | Minimum prunable tokens required to trigger a masking pass. |
contextManagement.tools.outputMasking.protectLatestTurn | boolean | true | — | yes | Ensures the absolute latest turn is never masked, regardless of token count. |
admin | object | — | replace | no | Settings configured remotely by enterprise admins. |
admin.secureModeEnabled | boolean | false | replace | no | If true, disallows YOLO mode and "Always allow" options from being used. |
admin.extensions | object | — | replace | no | Extensions-specific admin settings. |
admin.extensions.enabled | boolean | true | replace | no | If false, disallows extensions from being installed or used. |
admin.mcp | object | — | replace | no | MCP-specific admin settings. |
admin.mcp.enabled | boolean | true | replace | no | If false, disallows MCP servers from being used. |
admin.mcp.config | map of MCPServerConfig | {} | replace | no | Admin-configured MCP servers (allowlist). |
admin.mcp.requiredConfig | map of RequiredMcpServerConfig | {} | replace | no | Admin-required MCP servers that are always injected. |
admin.skills | object | — | replace | no | Agent Skills-specific admin settings. |
admin.skills.enabled | boolean | true | replace | no | If false, disallows agent skills from being used. |
Frequently asked questions#
Where is the Gemini CLI settings.json file?#
Your user settings are in ~/.gemini/settings.json (on Windows %USERPROFILE%\.gemini\settings.json), and project settings in .gemini/settings.json at the project root. System-wide files live in /etc/gemini-cli/ on Linux, /Library/Application Support/GeminiCli/ on macOS and C:\ProgramData\gemini-cli\ on Windows: system-defaults.json below user settings and settings.json above everything.
Which settings file wins in Gemini CLI?#
The system override file wins, then the project .gemini/settings.json, then ~/.gemini/settings.json, then system-defaults.json, then built-in defaults. Hook arrays, mcpServers, tools.exclude, context.includeDirectories and a few other lists combine across files instead of replacing each other. Project settings are skipped entirely in untrusted folders.
How do I set a proxy for Gemini CLI?#
There is no proxy key in settings.json. Gemini CLI reads the proxy from the HTTPS_PROXY, https_proxy, HTTP_PROXY or http_proxy environment variable, taking the first one that is set. Export it in your shell profile, or put it in a .env file such as ~/.env; .env files supply it only in trusted folders.
How do I put an API key in Gemini CLI settings?#
Keep the key out of settings.json. Set GEMINI_API_KEY in your environment or in a .env file: ~/.env is always read, .gemini/.env files only in trusted folders. For values that must appear in settings, such as an MCP server token, write "$MY_TOKEN" or "${MY_TOKEN}" and the variable is substituted when the file loads.
Can I use comments in Gemini CLI settings.json?#
Yes. Gemini CLI strips JSON comments before parsing, so // and /* */ comments are allowed in every settings.json layer, and trustedFolders.json is read the same way. Editors that validate against the schema may still flag comments unless the file is opened as JSON with comments (JSONC).
Why are my project settings ignored?#
Project settings in .gemini/settings.json apply only in trusted folders. In an untrusted folder Gemini CLI merges system and user settings and skips the project file, along with its hooks. Trust the folder when prompted, add it to ~/.gemini/trustedFolders.json, or start with --skip-trust for a single session.
Sources
- Gemini CLI official documentation
- Gemini CLI release notes
schemas/settings.schema.json: generated JSON Schema for settings.json (at v0.62.0)packages/cli/src/config/settingsSchema.ts: settings schema source (merge strategies) (at v0.62.0)packages/cli/src/utils/deepMerge.ts: merge algorithm (at v0.62.0)packages/cli/src/config/settings.ts: settings file paths, merge order, .env discovery (at v0.62.0)packages/core/src/config/storage.ts: user and workspace paths (at v0.62.0)packages/core/src/utils/paths.ts: homedir() and GEMINI_CLI_HOME (at v0.62.0)packages/cli/src/utils/envVarResolver.ts: $VAR expansion in settings values (at v0.62.0)packages/cli/src/config/config.ts: proxy from environment variables (at v0.62.0)
Release-by-release changes: Gemini CLI version tracker. All Gemini CLI pages: Gemini CLI reference index.