@google/gemini-cli-core 0.21.0-nightly.20251218.739c02bd6 → 0.21.0-nightly.20251220.41a1a3eed

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/dist/docs/CONTRIBUTING.md +546 -0
  2. package/dist/docs/architecture.md +80 -0
  3. package/dist/docs/assets/connected_devtools.png +0 -0
  4. package/dist/docs/assets/gemini-screenshot.png +0 -0
  5. package/dist/docs/assets/release_patch.png +0 -0
  6. package/dist/docs/assets/theme-ansi-light.png +0 -0
  7. package/dist/docs/assets/theme-ansi.png +0 -0
  8. package/dist/docs/assets/theme-atom-one.png +0 -0
  9. package/dist/docs/assets/theme-ayu-light.png +0 -0
  10. package/dist/docs/assets/theme-ayu.png +0 -0
  11. package/dist/docs/assets/theme-custom.png +0 -0
  12. package/dist/docs/assets/theme-default-light.png +0 -0
  13. package/dist/docs/assets/theme-default.png +0 -0
  14. package/dist/docs/assets/theme-dracula.png +0 -0
  15. package/dist/docs/assets/theme-github-light.png +0 -0
  16. package/dist/docs/assets/theme-github.png +0 -0
  17. package/dist/docs/assets/theme-google-light.png +0 -0
  18. package/dist/docs/assets/theme-xcode-light.png +0 -0
  19. package/dist/docs/changelogs/index.md +592 -0
  20. package/dist/docs/changelogs/latest.md +225 -0
  21. package/dist/docs/changelogs/preview.md +129 -0
  22. package/dist/docs/changelogs/releases.md +896 -0
  23. package/dist/docs/cli/authentication.md +3 -0
  24. package/dist/docs/cli/checkpointing.md +94 -0
  25. package/dist/docs/cli/commands.md +354 -0
  26. package/dist/docs/cli/configuration.md +780 -0
  27. package/dist/docs/cli/custom-commands.md +315 -0
  28. package/dist/docs/cli/enterprise.md +565 -0
  29. package/dist/docs/cli/gemini-ignore.md +71 -0
  30. package/dist/docs/cli/gemini-md.md +108 -0
  31. package/dist/docs/cli/generation-settings.md +210 -0
  32. package/dist/docs/cli/headless.md +388 -0
  33. package/dist/docs/cli/index.md +63 -0
  34. package/dist/docs/cli/keyboard-shortcuts.md +143 -0
  35. package/dist/docs/cli/model-routing.md +37 -0
  36. package/dist/docs/cli/model.md +62 -0
  37. package/dist/docs/cli/sandbox.md +171 -0
  38. package/dist/docs/cli/session-management.md +158 -0
  39. package/dist/docs/cli/settings.md +112 -0
  40. package/dist/docs/cli/system-prompt.md +93 -0
  41. package/dist/docs/cli/telemetry.md +791 -0
  42. package/dist/docs/cli/themes.md +237 -0
  43. package/dist/docs/cli/token-caching.md +20 -0
  44. package/dist/docs/cli/trusted-folders.md +95 -0
  45. package/dist/docs/cli/tutorials.md +83 -0
  46. package/dist/docs/cli/uninstall.md +47 -0
  47. package/dist/docs/core/index.md +101 -0
  48. package/dist/docs/core/memport.md +244 -0
  49. package/dist/docs/core/policy-engine.md +267 -0
  50. package/dist/docs/core/tools-api.md +131 -0
  51. package/dist/docs/examples/proxy-script.md +83 -0
  52. package/dist/docs/extensions/extension-releasing.md +183 -0
  53. package/dist/docs/extensions/getting-started-extensions.md +245 -0
  54. package/dist/docs/extensions/index.md +293 -0
  55. package/dist/docs/faq.md +154 -0
  56. package/dist/docs/get-started/authentication.md +321 -0
  57. package/dist/docs/get-started/configuration-v1.md +888 -0
  58. package/dist/docs/get-started/configuration.md +1444 -0
  59. package/dist/docs/get-started/deployment.md +143 -0
  60. package/dist/docs/get-started/examples.md +219 -0
  61. package/dist/docs/get-started/gemini-3.md +116 -0
  62. package/dist/docs/get-started/index.md +71 -0
  63. package/dist/docs/get-started/installation.md +141 -0
  64. package/dist/docs/hooks/best-practices.md +806 -0
  65. package/dist/docs/hooks/index.md +665 -0
  66. package/dist/docs/hooks/reference.md +168 -0
  67. package/dist/docs/hooks/writing-hooks.md +1026 -0
  68. package/dist/docs/ide-integration/ide-companion-spec.md +267 -0
  69. package/dist/docs/ide-integration/index.md +202 -0
  70. package/dist/docs/index.md +147 -0
  71. package/dist/docs/integration-tests.md +211 -0
  72. package/dist/docs/issue-and-pr-automation.md +134 -0
  73. package/dist/docs/local-development.md +128 -0
  74. package/dist/docs/mermaid/context.mmd +103 -0
  75. package/dist/docs/mermaid/render-path.mmd +64 -0
  76. package/dist/docs/npm.md +62 -0
  77. package/dist/docs/quota-and-pricing.md +158 -0
  78. package/dist/docs/release-confidence.md +164 -0
  79. package/dist/docs/releases.md +540 -0
  80. package/dist/docs/sidebar.json +297 -0
  81. package/dist/docs/tools/file-system.md +217 -0
  82. package/dist/docs/tools/index.md +95 -0
  83. package/dist/docs/tools/mcp-server.md +1044 -0
  84. package/dist/docs/tools/memory.md +54 -0
  85. package/dist/docs/tools/shell.md +260 -0
  86. package/dist/docs/tools/todos.md +57 -0
  87. package/dist/docs/tools/web-fetch.md +59 -0
  88. package/dist/docs/tools/web-search.md +42 -0
  89. package/dist/docs/tos-privacy.md +96 -0
  90. package/dist/docs/troubleshooting.md +158 -0
  91. package/dist/google-gemini-cli-core-0.21.0-nightly.20251219.70696e364.tgz +0 -0
  92. package/dist/src/agents/delegate-to-agent-tool.test.js +1 -0
  93. package/dist/src/agents/delegate-to-agent-tool.test.js.map +1 -1
  94. package/dist/src/agents/introspection-agent.d.ts +23 -0
  95. package/dist/src/agents/introspection-agent.js +72 -0
  96. package/dist/src/agents/introspection-agent.js.map +1 -0
  97. package/dist/src/agents/introspection-agent.test.d.ts +6 -0
  98. package/dist/src/agents/introspection-agent.test.js +47 -0
  99. package/dist/src/agents/introspection-agent.test.js.map +1 -0
  100. package/dist/src/agents/local-executor.d.ts +0 -6
  101. package/dist/src/agents/local-executor.js +73 -47
  102. package/dist/src/agents/local-executor.js.map +1 -1
  103. package/dist/src/agents/local-executor.test.d.ts +1 -7
  104. package/dist/src/agents/local-executor.test.js +27 -9
  105. package/dist/src/agents/local-executor.test.js.map +1 -1
  106. package/dist/src/agents/registry.d.ts +1 -0
  107. package/dist/src/agents/registry.js +51 -7
  108. package/dist/src/agents/registry.js.map +1 -1
  109. package/dist/src/agents/registry.test.js +112 -1
  110. package/dist/src/agents/registry.test.js.map +1 -1
  111. package/dist/src/agents/toml-loader.d.ts +65 -0
  112. package/dist/src/agents/toml-loader.js +176 -0
  113. package/dist/src/agents/toml-loader.js.map +1 -0
  114. package/dist/src/agents/toml-loader.test.d.ts +6 -0
  115. package/dist/src/agents/toml-loader.test.js +190 -0
  116. package/dist/src/agents/toml-loader.test.js.map +1 -0
  117. package/dist/src/availability/modelAvailabilityService.d.ts +2 -1
  118. package/dist/src/config/config.d.ts +9 -0
  119. package/dist/src/config/config.js +29 -0
  120. package/dist/src/config/config.js.map +1 -1
  121. package/dist/src/config/config.test.js +59 -1
  122. package/dist/src/config/config.test.js.map +1 -1
  123. package/dist/src/config/storage.d.ts +2 -0
  124. package/dist/src/config/storage.js +6 -0
  125. package/dist/src/config/storage.js.map +1 -1
  126. package/dist/src/config/storage.test.js +8 -0
  127. package/dist/src/config/storage.test.js.map +1 -1
  128. package/dist/src/core/client.js +8 -4
  129. package/dist/src/core/client.js.map +1 -1
  130. package/dist/src/core/client.test.js +20 -0
  131. package/dist/src/core/client.test.js.map +1 -1
  132. package/dist/src/core/clientHookTriggers.js +2 -2
  133. package/dist/src/core/clientHookTriggers.js.map +1 -1
  134. package/dist/src/core/coreToolHookTriggers.js +3 -3
  135. package/dist/src/core/coreToolHookTriggers.js.map +1 -1
  136. package/dist/src/core/geminiChatHookTriggers.js +3 -3
  137. package/dist/src/core/geminiChatHookTriggers.js.map +1 -1
  138. package/dist/src/core/sessionHookTriggers.js +3 -3
  139. package/dist/src/core/sessionHookTriggers.js.map +1 -1
  140. package/dist/src/generated/git-commit.d.ts +2 -2
  141. package/dist/src/generated/git-commit.js +2 -2
  142. package/dist/src/hooks/hookEventHandler.js +10 -4
  143. package/dist/src/hooks/hookEventHandler.js.map +1 -1
  144. package/dist/src/hooks/hookEventHandler.test.js +40 -0
  145. package/dist/src/hooks/hookEventHandler.test.js.map +1 -1
  146. package/dist/src/hooks/hookPlanner.js +3 -1
  147. package/dist/src/hooks/hookPlanner.js.map +1 -1
  148. package/dist/src/hooks/hookPlanner.test.js +61 -0
  149. package/dist/src/hooks/hookPlanner.test.js.map +1 -1
  150. package/dist/src/hooks/hookRegistry.d.ts +1 -1
  151. package/dist/src/hooks/hookRegistry.js +2 -2
  152. package/dist/src/hooks/hookRegistry.js.map +1 -1
  153. package/dist/src/hooks/hookRegistry.test.js +73 -0
  154. package/dist/src/hooks/hookRegistry.test.js.map +1 -1
  155. package/dist/src/hooks/hookRunner.js +14 -10
  156. package/dist/src/hooks/hookRunner.js.map +1 -1
  157. package/dist/src/hooks/hookRunner.test.js +81 -33
  158. package/dist/src/hooks/hookRunner.test.js.map +1 -1
  159. package/dist/src/hooks/types.d.ts +2 -0
  160. package/dist/src/hooks/types.js.map +1 -1
  161. package/dist/src/mcp/oauth-provider.js +6 -2
  162. package/dist/src/mcp/oauth-provider.js.map +1 -1
  163. package/dist/src/mcp/oauth-provider.test.js +4 -1
  164. package/dist/src/mcp/oauth-provider.test.js.map +1 -1
  165. package/dist/src/mcp/oauth-utils.d.ts +8 -1
  166. package/dist/src/mcp/oauth-utils.js +30 -1
  167. package/dist/src/mcp/oauth-utils.js.map +1 -1
  168. package/dist/src/mcp/oauth-utils.test.js +42 -0
  169. package/dist/src/mcp/oauth-utils.test.js.map +1 -1
  170. package/dist/src/services/contextManager.d.ts +5 -11
  171. package/dist/src/services/contextManager.js +20 -17
  172. package/dist/src/services/contextManager.js.map +1 -1
  173. package/dist/src/services/contextManager.test.js +40 -41
  174. package/dist/src/services/contextManager.test.js.map +1 -1
  175. package/dist/src/services/shellExecutionService.js +18 -2
  176. package/dist/src/services/shellExecutionService.js.map +1 -1
  177. package/dist/src/tools/get-internal-docs.d.ts +27 -0
  178. package/dist/src/tools/get-internal-docs.js +129 -0
  179. package/dist/src/tools/get-internal-docs.js.map +1 -0
  180. package/dist/src/tools/get-internal-docs.test.d.ts +6 -0
  181. package/dist/src/tools/get-internal-docs.test.js +56 -0
  182. package/dist/src/tools/get-internal-docs.test.js.map +1 -0
  183. package/dist/src/tools/tool-names.d.ts +14 -0
  184. package/dist/src/tools/tool-names.js +55 -0
  185. package/dist/src/tools/tool-names.js.map +1 -1
  186. package/dist/src/tools/tool-names.test.d.ts +6 -0
  187. package/dist/src/tools/tool-names.test.js +43 -0
  188. package/dist/src/tools/tool-names.test.js.map +1 -0
  189. package/dist/src/tools/tool-registry.d.ts +0 -1
  190. package/dist/src/tools/tool-registry.js +1 -1
  191. package/dist/src/tools/tool-registry.js.map +1 -1
  192. package/dist/src/tools/tool-registry.test.js +2 -1
  193. package/dist/src/tools/tool-registry.test.js.map +1 -1
  194. package/dist/src/utils/environmentContext.js +3 -0
  195. package/dist/src/utils/environmentContext.js.map +1 -1
  196. package/dist/src/utils/environmentContext.test.js +2 -0
  197. package/dist/src/utils/environmentContext.test.js.map +1 -1
  198. package/dist/src/utils/events.d.ts +3 -2
  199. package/dist/src/utils/events.js.map +1 -1
  200. package/dist/src/utils/googleQuotaErrors.js +20 -0
  201. package/dist/src/utils/googleQuotaErrors.js.map +1 -1
  202. package/dist/src/utils/googleQuotaErrors.test.js +53 -2
  203. package/dist/src/utils/googleQuotaErrors.test.js.map +1 -1
  204. package/dist/src/utils/memoryDiscovery.js +1 -1
  205. package/dist/src/utils/memoryDiscovery.js.map +1 -1
  206. package/dist/src/utils/memoryDiscovery.test.js +3 -1
  207. package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
  208. package/dist/src/utils/shell-utils.js +25 -4
  209. package/dist/src/utils/shell-utils.js.map +1 -1
  210. package/dist/tsconfig.tsbuildinfo +1 -1
  211. package/package.json +1 -6
  212. package/dist/google-gemini-cli-core-0.21.0-nightly.20251216.bb0c0d8ee.tgz +0 -0
@@ -0,0 +1,888 @@
1
+ # Gemini CLI configuration
2
+
3
+ **Note on deprecated configuration format**
4
+
5
+ This document describes the legacy v1 format for the `settings.json` file. This
6
+ format is now deprecated.
7
+
8
+ - The new format will be supported in the stable release starting
9
+ **[09/10/25]**.
10
+ - Automatic migration from the old format to the new format will begin on
11
+ **[09/17/25]**.
12
+
13
+ For details on the new, recommended format, please see the
14
+ [current Configuration documentation](./configuration.md).
15
+
16
+ Gemini CLI offers several ways to configure its behavior, including environment
17
+ variables, command-line arguments, and settings files. This document outlines
18
+ the different configuration methods and available settings.
19
+
20
+ ## Configuration layers
21
+
22
+ Configuration is applied in the following order of precedence (lower numbers are
23
+ overridden by higher numbers):
24
+
25
+ 1. **Default values:** Hardcoded defaults within the application.
26
+ 2. **System defaults file:** System-wide default settings that can be
27
+ overridden by other settings files.
28
+ 3. **User settings file:** Global settings for the current user.
29
+ 4. **Project settings file:** Project-specific settings.
30
+ 5. **System settings file:** System-wide settings that override all other
31
+ settings files.
32
+ 6. **Environment variables:** System-wide or session-specific variables,
33
+ potentially loaded from `.env` files.
34
+ 7. **Command-line arguments:** Values passed when launching the CLI.
35
+
36
+ ## Settings files
37
+
38
+ Gemini CLI uses JSON settings files for persistent configuration. There are four
39
+ locations for these files:
40
+
41
+ - **System defaults file:**
42
+ - **Location:** `/etc/gemini-cli/system-defaults.json` (Linux),
43
+ `C:\ProgramData\gemini-cli\system-defaults.json` (Windows) or
44
+ `/Library/Application Support/GeminiCli/system-defaults.json` (macOS). The
45
+ path can be overridden using the `GEMINI_CLI_SYSTEM_DEFAULTS_PATH`
46
+ environment variable.
47
+ - **Scope:** Provides a base layer of system-wide default settings. These
48
+ settings have the lowest precedence and are intended to be overridden by
49
+ user, project, or system override settings.
50
+ - **User settings file:**
51
+ - **Location:** `~/.gemini/settings.json` (where `~` is your home directory).
52
+ - **Scope:** Applies to all Gemini CLI sessions for the current user. User
53
+ settings override system defaults.
54
+ - **Project settings file:**
55
+ - **Location:** `.gemini/settings.json` within your project's root directory.
56
+ - **Scope:** Applies only when running Gemini CLI from that specific project.
57
+ Project settings override user settings and system defaults.
58
+ - **System settings file:**
59
+ - **Location:** `/etc/gemini-cli/settings.json` (Linux),
60
+ `C:\ProgramData\gemini-cli\settings.json` (Windows) or
61
+ `/Library/Application Support/GeminiCli/settings.json` (macOS). The path can
62
+ be overridden using the `GEMINI_CLI_SYSTEM_SETTINGS_PATH` environment
63
+ variable.
64
+ - **Scope:** Applies to all Gemini CLI sessions on the system, for all users.
65
+ System settings act as overrides, taking precedence over all other settings
66
+ files. May be useful for system administrators at enterprises to have
67
+ controls over users' Gemini CLI setups.
68
+
69
+ **Note on environment variables in settings:** String values within your
70
+ `settings.json` files can reference environment variables using either
71
+ `$VAR_NAME` or `${VAR_NAME}` syntax. These variables will be automatically
72
+ resolved when the settings are loaded. For example, if you have an environment
73
+ variable `MY_API_TOKEN`, you could use it in `settings.json` like this:
74
+ `"apiKey": "$MY_API_TOKEN"`.
75
+
76
+ > **Note for Enterprise Users:** For guidance on deploying and managing Gemini
77
+ > CLI in a corporate environment, please see the
78
+ > [Enterprise Configuration](../cli/enterprise.md) documentation.
79
+
80
+ ### The `.gemini` directory in your project
81
+
82
+ In addition to a project settings file, a project's `.gemini` directory can
83
+ contain other project-specific files related to Gemini CLI's operation, such as:
84
+
85
+ - [Custom sandbox profiles](#sandboxing) (e.g.,
86
+ `.gemini/sandbox-macos-custom.sb`, `.gemini/sandbox.Dockerfile`).
87
+
88
+ ### Available settings in `settings.json`:
89
+
90
+ - **`contextFileName`** (string or array of strings):
91
+ - **Description:** Specifies the filename for context files (e.g.,
92
+ `GEMINI.md`, `AGENTS.md`). Can be a single filename or a list of accepted
93
+ filenames.
94
+ - **Default:** `GEMINI.md`
95
+ - **Example:** `"contextFileName": "AGENTS.md"`
96
+
97
+ - **`bugCommand`** (object):
98
+ - **Description:** Overrides the default URL for the `/bug` command.
99
+ - **Default:**
100
+ `"urlTemplate": "https://github.com/google-gemini/gemini-cli/issues/new?template=bug_report.yml&title={title}&info={info}"`
101
+ - **Properties:**
102
+ - **`urlTemplate`** (string): A URL that can contain `{title}` and `{info}`
103
+ placeholders.
104
+ - **Example:**
105
+ ```json
106
+ "bugCommand": {
107
+ "urlTemplate": "https://bug.example.com/new?title={title}&info={info}"
108
+ }
109
+ ```
110
+
111
+ - **`fileFiltering`** (object):
112
+ - **Description:** Controls git-aware file filtering behavior for @ commands
113
+ and file discovery tools.
114
+ - **Default:** `"respectGitIgnore": true, "enableRecursiveFileSearch": true`
115
+ - **Properties:**
116
+ - **`respectGitIgnore`** (boolean): Whether to respect .gitignore patterns
117
+ when discovering files. When set to `true`, git-ignored files (like
118
+ `node_modules/`, `dist/`, `.env`) are automatically excluded from @
119
+ commands and file listing operations.
120
+ - **`enableRecursiveFileSearch`** (boolean): Whether to enable searching
121
+ recursively for filenames under the current tree when completing @
122
+ prefixes in the prompt.
123
+ - **`disableFuzzySearch`** (boolean): When `true`, disables the fuzzy search
124
+ capabilities when searching for files, which can improve performance on
125
+ projects with a large number of files.
126
+ - **Example:**
127
+ ```json
128
+ "fileFiltering": {
129
+ "respectGitIgnore": true,
130
+ "enableRecursiveFileSearch": false,
131
+ "disableFuzzySearch": true
132
+ }
133
+ ```
134
+
135
+ ### Troubleshooting file search performance
136
+
137
+ If you are experiencing performance issues with file searching (e.g., with `@`
138
+ completions), especially in projects with a very large number of files, here are
139
+ a few things you can try in order of recommendation:
140
+
141
+ 1. **Use `.geminiignore`:** Create a `.geminiignore` file in your project root
142
+ to exclude directories that contain a large number of files that you don't
143
+ need to reference (e.g., build artifacts, logs, `node_modules`). Reducing
144
+ the total number of files crawled is the most effective way to improve
145
+ performance.
146
+
147
+ 2. **Disable fuzzy search:** If ignoring files is not enough, you can disable
148
+ fuzzy search by setting `disableFuzzySearch` to `true` in your
149
+ `settings.json` file. This will use a simpler, non-fuzzy matching algorithm,
150
+ which can be faster.
151
+
152
+ 3. **Disable recursive file search:** As a last resort, you can disable
153
+ recursive file search entirely by setting `enableRecursiveFileSearch` to
154
+ `false`. This will be the fastest option as it avoids a recursive crawl of
155
+ your project. However, it means you will need to type the full path to files
156
+ when using `@` completions.
157
+
158
+ - **`coreTools`** (array of strings):
159
+ - **Description:** Allows you to specify a list of core tool names that should
160
+ be made available to the model. This can be used to restrict the set of
161
+ built-in tools. See [Built-in Tools](../core/tools-api.md#built-in-tools)
162
+ for a list of core tools. You can also specify command-specific restrictions
163
+ for tools that support it, like the `ShellTool`. For example,
164
+ `"coreTools": ["ShellTool(ls -l)"]` will only allow the `ls -l` command to
165
+ be executed.
166
+ - **Default:** All tools available for use by the Gemini model.
167
+ - **Example:** `"coreTools": ["ReadFileTool", "GlobTool", "ShellTool(ls)"]`.
168
+
169
+ - **`allowedTools`** (array of strings):
170
+ - **Default:** `undefined`
171
+ - **Description:** A list of tool names that will bypass the confirmation
172
+ dialog. This is useful for tools that you trust and use frequently. The
173
+ match semantics are the same as `coreTools`.
174
+ - **Example:** `"allowedTools": ["ShellTool(git status)"]`.
175
+
176
+ - **`excludeTools`** (array of strings):
177
+ - **Description:** Allows you to specify a list of core tool names that should
178
+ be excluded from the model. A tool listed in both `excludeTools` and
179
+ `coreTools` is excluded. You can also specify command-specific restrictions
180
+ for tools that support it, like the `ShellTool`. For example,
181
+ `"excludeTools": ["ShellTool(rm -rf)"]` will block the `rm -rf` command.
182
+ - **Default**: No tools excluded.
183
+ - **Example:** `"excludeTools": ["run_shell_command", "findFiles"]`.
184
+ - **Security Note:** Command-specific restrictions in `excludeTools` for
185
+ `run_shell_command` are based on simple string matching and can be easily
186
+ bypassed. This feature is **not a security mechanism** and should not be
187
+ relied upon to safely execute untrusted code. It is recommended to use
188
+ `coreTools` to explicitly select commands that can be executed.
189
+
190
+ - **`allowMCPServers`** (array of strings):
191
+ - **Description:** Allows you to specify a list of MCP server names that
192
+ should be made available to the model. This can be used to restrict the set
193
+ of MCP servers to connect to. Note that this will be ignored if
194
+ `--allowed-mcp-server-names` is set.
195
+ - **Default:** All MCP servers are available for use by the Gemini model.
196
+ - **Example:** `"allowMCPServers": ["myPythonServer"]`.
197
+ - **Security note:** This uses simple string matching on MCP server names,
198
+ which can be modified. If you're a system administrator looking to prevent
199
+ users from bypassing this, consider configuring the `mcpServers` at the
200
+ system settings level such that the user will not be able to configure any
201
+ MCP servers of their own. This should not be used as an airtight security
202
+ mechanism.
203
+
204
+ - **`excludeMCPServers`** (array of strings):
205
+ - **Description:** Allows you to specify a list of MCP server names that
206
+ should be excluded from the model. A server listed in both
207
+ `excludeMCPServers` and `allowMCPServers` is excluded. Note that this will
208
+ be ignored if `--allowed-mcp-server-names` is set.
209
+ - **Default**: No MCP servers excluded.
210
+ - **Example:** `"excludeMCPServers": ["myNodeServer"]`.
211
+ - **Security note:** This uses simple string matching on MCP server names,
212
+ which can be modified. If you're a system administrator looking to prevent
213
+ users from bypassing this, consider configuring the `mcpServers` at the
214
+ system settings level such that the user will not be able to configure any
215
+ MCP servers of their own. This should not be used as an airtight security
216
+ mechanism.
217
+
218
+ - **`autoAccept`** (boolean):
219
+ - **Description:** Controls whether the CLI automatically accepts and executes
220
+ tool calls that are considered safe (e.g., read-only operations) without
221
+ explicit user confirmation. If set to `true`, the CLI will bypass the
222
+ confirmation prompt for tools deemed safe.
223
+ - **Default:** `false`
224
+ - **Example:** `"autoAccept": true`
225
+
226
+ - **`theme`** (string):
227
+ - **Description:** Sets the visual [theme](../cli/themes.md) for Gemini CLI.
228
+ - **Default:** `"Default"`
229
+ - **Example:** `"theme": "GitHub"`
230
+
231
+ - **`vimMode`** (boolean):
232
+ - **Description:** Enables or disables vim mode for input editing. When
233
+ enabled, the input area supports vim-style navigation and editing commands
234
+ with NORMAL and INSERT modes. The vim mode status is displayed in the footer
235
+ and persists between sessions.
236
+ - **Default:** `false`
237
+ - **Example:** `"vimMode": true`
238
+
239
+ - **`sandbox`** (boolean or string):
240
+ - **Description:** Controls whether and how to use sandboxing for tool
241
+ execution. If set to `true`, Gemini CLI uses a pre-built
242
+ `gemini-cli-sandbox` Docker image. For more information, see
243
+ [Sandboxing](#sandboxing).
244
+ - **Default:** `false`
245
+ - **Example:** `"sandbox": "docker"`
246
+
247
+ - **`toolDiscoveryCommand`** (string):
248
+ - **Description:** Defines a custom shell command for discovering tools from
249
+ your project. The shell command must return on `stdout` a JSON array of
250
+ [function declarations](https://ai.google.dev/gemini-api/docs/function-calling#function-declarations).
251
+ Tool wrappers are optional.
252
+ - **Default:** Empty
253
+ - **Example:** `"toolDiscoveryCommand": "bin/get_tools"`
254
+
255
+ - **`toolCallCommand`** (string):
256
+ - **Description:** Defines a custom shell command for calling a specific tool
257
+ that was discovered using `toolDiscoveryCommand`. The shell command must
258
+ meet the following criteria:
259
+ - It must take function `name` (exactly as in
260
+ [function declaration](https://ai.google.dev/gemini-api/docs/function-calling#function-declarations))
261
+ as first command line argument.
262
+ - It must read function arguments as JSON on `stdin`, analogous to
263
+ [`functionCall.args`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#functioncall).
264
+ - It must return function output as JSON on `stdout`, analogous to
265
+ [`functionResponse.response.content`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#functionresponse).
266
+ - **Default:** Empty
267
+ - **Example:** `"toolCallCommand": "bin/call_tool"`
268
+
269
+ - **`mcpServers`** (object):
270
+ - **Description:** Configures connections to one or more Model-Context
271
+ Protocol (MCP) servers for discovering and using custom tools. Gemini CLI
272
+ attempts to connect to each configured MCP server to discover available
273
+ tools. If multiple MCP servers expose a tool with the same name, the tool
274
+ names will be prefixed with the server alias you defined in the
275
+ configuration (e.g., `serverAlias__actualToolName`) to avoid conflicts. Note
276
+ that the system might strip certain schema properties from MCP tool
277
+ definitions for compatibility. At least one of `command`, `url`, or
278
+ `httpUrl` must be provided. If multiple are specified, the order of
279
+ precedence is `httpUrl`, then `url`, then `command`.
280
+ - **Default:** Empty
281
+ - **Properties:**
282
+ - **`<SERVER_NAME>`** (object): The server parameters for the named server.
283
+ - `command` (string, optional): The command to execute to start the MCP
284
+ server via standard I/O.
285
+ - `args` (array of strings, optional): Arguments to pass to the command.
286
+ - `env` (object, optional): Environment variables to set for the server
287
+ process.
288
+ - `cwd` (string, optional): The working directory in which to start the
289
+ server.
290
+ - `url` (string, optional): The URL of an MCP server that uses Server-Sent
291
+ Events (SSE) for communication.
292
+ - `httpUrl` (string, optional): The URL of an MCP server that uses
293
+ streamable HTTP for communication.
294
+ - `headers` (object, optional): A map of HTTP headers to send with
295
+ requests to `url` or `httpUrl`.
296
+ - `timeout` (number, optional): Timeout in milliseconds for requests to
297
+ this MCP server.
298
+ - `trust` (boolean, optional): Trust this server and bypass all tool call
299
+ confirmations.
300
+ - `description` (string, optional): A brief description of the server,
301
+ which may be used for display purposes.
302
+ - `includeTools` (array of strings, optional): List of tool names to
303
+ include from this MCP server. When specified, only the tools listed here
304
+ will be available from this server (allowlist behavior). If not
305
+ specified, all tools from the server are enabled by default.
306
+ - `excludeTools` (array of strings, optional): List of tool names to
307
+ exclude from this MCP server. Tools listed here will not be available to
308
+ the model, even if they are exposed by the server. **Note:**
309
+ `excludeTools` takes precedence over `includeTools` - if a tool is in
310
+ both lists, it will be excluded.
311
+ - **Example:**
312
+ ```json
313
+ "mcpServers": {
314
+ "myPythonServer": {
315
+ "command": "python",
316
+ "args": ["mcp_server.py", "--port", "8080"],
317
+ "cwd": "./mcp_tools/python",
318
+ "timeout": 5000,
319
+ "includeTools": ["safe_tool", "file_reader"],
320
+ },
321
+ "myNodeServer": {
322
+ "command": "node",
323
+ "args": ["mcp_server.js"],
324
+ "cwd": "./mcp_tools/node",
325
+ "excludeTools": ["dangerous_tool", "file_deleter"]
326
+ },
327
+ "myDockerServer": {
328
+ "command": "docker",
329
+ "args": ["run", "-i", "--rm", "-e", "API_KEY", "ghcr.io/foo/bar"],
330
+ "env": {
331
+ "API_KEY": "$MY_API_TOKEN"
332
+ }
333
+ },
334
+ "mySseServer": {
335
+ "url": "http://localhost:8081/events",
336
+ "headers": {
337
+ "Authorization": "Bearer $MY_SSE_TOKEN"
338
+ },
339
+ "description": "An example SSE-based MCP server."
340
+ },
341
+ "myStreamableHttpServer": {
342
+ "httpUrl": "http://localhost:8082/stream",
343
+ "headers": {
344
+ "X-API-Key": "$MY_HTTP_API_KEY"
345
+ },
346
+ "description": "An example Streamable HTTP-based MCP server."
347
+ }
348
+ }
349
+ ```
350
+
351
+ - **`checkpointing`** (object):
352
+ - **Description:** Configures the checkpointing feature, which allows you to
353
+ save and restore conversation and file states. See the
354
+ [Checkpointing documentation](../cli/checkpointing.md) for more details.
355
+ - **Default:** `{"enabled": false}`
356
+ - **Properties:**
357
+ - **`enabled`** (boolean): When `true`, the `/restore` command is available.
358
+
359
+ - **`preferredEditor`** (string):
360
+ - **Description:** Specifies the preferred editor to use for viewing diffs.
361
+ - **Default:** `vscode`
362
+ - **Example:** `"preferredEditor": "vscode"`
363
+
364
+ - **`telemetry`** (object)
365
+ - **Description:** Configures logging and metrics collection for Gemini CLI.
366
+ For more information, see [Telemetry](../cli/telemetry.md).
367
+ - **Default:**
368
+ `{"enabled": false, "target": "local", "otlpEndpoint": "http://localhost:4317", "logPrompts": true}`
369
+ - **Properties:**
370
+ - **`enabled`** (boolean): Whether or not telemetry is enabled.
371
+ - **`target`** (string): The destination for collected telemetry. Supported
372
+ values are `local` and `gcp`.
373
+ - **`otlpEndpoint`** (string): The endpoint for the OTLP Exporter.
374
+ - **`logPrompts`** (boolean): Whether or not to include the content of user
375
+ prompts in the logs.
376
+ - **Example:**
377
+ ```json
378
+ "telemetry": {
379
+ "enabled": true,
380
+ "target": "local",
381
+ "otlpEndpoint": "http://localhost:16686",
382
+ "logPrompts": false
383
+ }
384
+ ```
385
+ - **`usageStatisticsEnabled`** (boolean):
386
+ - **Description:** Enables or disables the collection of usage statistics. See
387
+ [Usage Statistics](#usage-statistics) for more information.
388
+ - **Default:** `true`
389
+ - **Example:**
390
+ ```json
391
+ "usageStatisticsEnabled": false
392
+ ```
393
+
394
+ - **`hideTips`** (boolean):
395
+ - **Description:** Enables or disables helpful tips in the CLI interface.
396
+ - **Default:** `false`
397
+ - **Example:**
398
+
399
+ ```json
400
+ "hideTips": true
401
+ ```
402
+
403
+ - **`hideBanner`** (boolean):
404
+ - **Description:** Enables or disables the startup banner (ASCII art logo) in
405
+ the CLI interface.
406
+ - **Default:** `false`
407
+ - **Example:**
408
+
409
+ ```json
410
+ "hideBanner": true
411
+ ```
412
+
413
+ - **`maxSessionTurns`** (number):
414
+ - **Description:** Sets the maximum number of turns for a session. If the
415
+ session exceeds this limit, the CLI will stop processing and start a new
416
+ chat.
417
+ - **Default:** `-1` (unlimited)
418
+ - **Example:**
419
+ ```json
420
+ "maxSessionTurns": 10
421
+ ```
422
+
423
+ - **`summarizeToolOutput`** (object):
424
+ - **Description:** Enables or disables the summarization of tool output. You
425
+ can specify the token budget for the summarization using the `tokenBudget`
426
+ setting.
427
+ - Note: Currently only the `run_shell_command` tool is supported.
428
+ - **Default:** `{}` (Disabled by default)
429
+ - **Example:**
430
+ ```json
431
+ "summarizeToolOutput": {
432
+ "run_shell_command": {
433
+ "tokenBudget": 2000
434
+ }
435
+ }
436
+ ```
437
+
438
+ - **`excludedProjectEnvVars`** (array of strings):
439
+ - **Description:** Specifies environment variables that should be excluded
440
+ from being loaded from project `.env` files. This prevents project-specific
441
+ environment variables (like `DEBUG=true`) from interfering with gemini-cli
442
+ behavior. Variables from `.gemini/.env` files are never excluded.
443
+ - **Default:** `["DEBUG", "DEBUG_MODE"]`
444
+ - **Example:**
445
+ ```json
446
+ "excludedProjectEnvVars": ["DEBUG", "DEBUG_MODE", "NODE_ENV"]
447
+ ```
448
+
449
+ - **`includeDirectories`** (array of strings):
450
+ - **Description:** Specifies an array of additional absolute or relative paths
451
+ to include in the workspace context. Missing directories will be skipped
452
+ with a warning by default. Paths can use `~` to refer to the user's home
453
+ directory. This setting can be combined with the `--include-directories`
454
+ command-line flag.
455
+ - **Default:** `[]`
456
+ - **Example:**
457
+ ```json
458
+ "includeDirectories": [
459
+ "/path/to/another/project",
460
+ "../shared-library",
461
+ "~/common-utils"
462
+ ]
463
+ ```
464
+
465
+ - **`loadMemoryFromIncludeDirectories`** (boolean):
466
+ - **Description:** Controls the behavior of the `/memory refresh` command. If
467
+ set to `true`, `GEMINI.md` files should be loaded from all directories that
468
+ are added. If set to `false`, `GEMINI.md` should only be loaded from the
469
+ current directory.
470
+ - **Default:** `false`
471
+ - **Example:**
472
+ ```json
473
+ "loadMemoryFromIncludeDirectories": true
474
+ ```
475
+
476
+ - **`showLineNumbers`** (boolean):
477
+ - **Description:** Controls whether line numbers are displayed in code blocks
478
+ in the CLI output.
479
+ - **Default:** `true`
480
+ - **Example:**
481
+ ```json
482
+ "showLineNumbers": false
483
+ ```
484
+
485
+ - **`accessibility`** (object):
486
+ - **Description:** Configures accessibility features for the CLI.
487
+ - **Properties:**
488
+ - **`screenReader`** (boolean): Enables screen reader mode, which adjusts
489
+ the TUI for better compatibility with screen readers. This can also be
490
+ enabled with the `--screen-reader` command-line flag, which will take
491
+ precedence over the setting.
492
+ - **`disableLoadingPhrases`** (boolean): Disables the display of loading
493
+ phrases during operations.
494
+ - **Default:** `{"screenReader": false, "disableLoadingPhrases": false}`
495
+ - **Example:**
496
+ ```json
497
+ "accessibility": {
498
+ "screenReader": true,
499
+ "disableLoadingPhrases": true
500
+ }
501
+ ```
502
+
503
+ ### Example `settings.json`:
504
+
505
+ ```json
506
+ {
507
+ "theme": "GitHub",
508
+ "sandbox": "docker",
509
+ "toolDiscoveryCommand": "bin/get_tools",
510
+ "toolCallCommand": "bin/call_tool",
511
+ "mcpServers": {
512
+ "mainServer": {
513
+ "command": "bin/mcp_server.py"
514
+ },
515
+ "anotherServer": {
516
+ "command": "node",
517
+ "args": ["mcp_server.js", "--verbose"]
518
+ }
519
+ },
520
+ "telemetry": {
521
+ "enabled": true,
522
+ "target": "local",
523
+ "otlpEndpoint": "http://localhost:4317",
524
+ "logPrompts": true
525
+ },
526
+ "usageStatisticsEnabled": true,
527
+ "hideTips": false,
528
+ "hideBanner": false,
529
+ "maxSessionTurns": 10,
530
+ "summarizeToolOutput": {
531
+ "run_shell_command": {
532
+ "tokenBudget": 100
533
+ }
534
+ },
535
+ "excludedProjectEnvVars": ["DEBUG", "DEBUG_MODE", "NODE_ENV"],
536
+ "includeDirectories": ["path/to/dir1", "~/path/to/dir2", "../path/to/dir3"],
537
+ "loadMemoryFromIncludeDirectories": true
538
+ }
539
+ ```
540
+
541
+ ## Shell history
542
+
543
+ The CLI keeps a history of shell commands you run. To avoid conflicts between
544
+ different projects, this history is stored in a project-specific directory
545
+ within your user's home folder.
546
+
547
+ - **Location:** `~/.gemini/tmp/<project_hash>/shell_history`
548
+ - `<project_hash>` is a unique identifier generated from your project's root
549
+ path.
550
+ - The history is stored in a file named `shell_history`.
551
+
552
+ ## Environment variables and `.env` files
553
+
554
+ Environment variables are a common way to configure applications, especially for
555
+ sensitive information like API keys or for settings that might change between
556
+ environments. For authentication setup, see the
557
+ [Authentication documentation](./authentication.md) which covers all available
558
+ authentication methods.
559
+
560
+ The CLI automatically loads environment variables from an `.env` file. The
561
+ loading order is:
562
+
563
+ 1. `.env` file in the current working directory.
564
+ 2. If not found, it searches upwards in parent directories until it finds an
565
+ `.env` file or reaches the project root (identified by a `.git` folder) or
566
+ the home directory.
567
+ 3. If still not found, it looks for `~/.env` (in the user's home directory).
568
+
569
+ **Environment variable exclusion:** Some environment variables (like `DEBUG` and
570
+ `DEBUG_MODE`) are automatically excluded from being loaded from project `.env`
571
+ files to prevent interference with gemini-cli behavior. Variables from
572
+ `.gemini/.env` files are never excluded. You can customize this behavior using
573
+ the `excludedProjectEnvVars` setting in your `settings.json` file.
574
+
575
+ - **`GEMINI_API_KEY`**:
576
+ - Your API key for the Gemini API.
577
+ - One of several available [authentication methods](./authentication.md).
578
+ - Set this in your shell profile (e.g., `~/.bashrc`, `~/.zshrc`) or an `.env`
579
+ file.
580
+ - **`GEMINI_MODEL`**:
581
+ - Specifies the default Gemini model to use.
582
+ - Overrides the hardcoded default
583
+ - Example: `export GEMINI_MODEL="gemini-2.5-flash"`
584
+ - **`GOOGLE_API_KEY`**:
585
+ - Your Google Cloud API key.
586
+ - Required for using Vertex AI in express mode.
587
+ - Ensure you have the necessary permissions.
588
+ - Example: `export GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY"`.
589
+ - **`GOOGLE_CLOUD_PROJECT`**:
590
+ - Your Google Cloud Project ID.
591
+ - Required for using Code Assist or Vertex AI.
592
+ - If using Vertex AI, ensure you have the necessary permissions in this
593
+ project.
594
+ - **Cloud Shell note:** When running in a Cloud Shell environment, this
595
+ variable defaults to a special project allocated for Cloud Shell users. If
596
+ you have `GOOGLE_CLOUD_PROJECT` set in your global environment in Cloud
597
+ Shell, it will be overridden by this default. To use a different project in
598
+ Cloud Shell, you must define `GOOGLE_CLOUD_PROJECT` in a `.env` file.
599
+ - Example: `export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"`.
600
+ - **`GOOGLE_APPLICATION_CREDENTIALS`** (string):
601
+ - **Description:** The path to your Google Application Credentials JSON file.
602
+ - **Example:**
603
+ `export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/credentials.json"`
604
+ - **`OTLP_GOOGLE_CLOUD_PROJECT`**:
605
+ - Your Google Cloud Project ID for Telemetry in Google Cloud
606
+ - Example: `export OTLP_GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"`.
607
+ - **`GOOGLE_CLOUD_LOCATION`**:
608
+ - Your Google Cloud Project Location (e.g., us-central1).
609
+ - Required for using Vertex AI in non express mode.
610
+ - Example: `export GOOGLE_CLOUD_LOCATION="YOUR_PROJECT_LOCATION"`.
611
+ - **`GEMINI_SANDBOX`**:
612
+ - Alternative to the `sandbox` setting in `settings.json`.
613
+ - Accepts `true`, `false`, `docker`, `podman`, or a custom command string.
614
+ - **`HTTP_PROXY` / `HTTPS_PROXY`**:
615
+ - Specifies the proxy server to use for outgoing HTTP/HTTPS requests.
616
+ - Example: `export HTTPS_PROXY="http://proxy.example.com:8080"`
617
+ - **`SEATBELT_PROFILE`** (macOS specific):
618
+ - Switches the Seatbelt (`sandbox-exec`) profile on macOS.
619
+ - `permissive-open`: (Default) Restricts writes to the project folder (and a
620
+ few other folders, see
621
+ `packages/cli/src/utils/sandbox-macos-permissive-open.sb`) but allows other
622
+ operations.
623
+ - `strict`: Uses a strict profile that declines operations by default.
624
+ - `<profile_name>`: Uses a custom profile. To define a custom profile, create
625
+ a file named `sandbox-macos-<profile_name>.sb` in your project's `.gemini/`
626
+ directory (e.g., `my-project/.gemini/sandbox-macos-custom.sb`).
627
+ - **`DEBUG` or `DEBUG_MODE`** (often used by underlying libraries or the CLI
628
+ itself):
629
+ - Set to `true` or `1` to enable verbose debug logging, which can be helpful
630
+ for troubleshooting.
631
+ - **Note:** These variables are automatically excluded from project `.env`
632
+ files by default to prevent interference with gemini-cli behavior. Use
633
+ `.gemini/.env` files if you need to set these for gemini-cli specifically.
634
+ - **`NO_COLOR`**:
635
+ - Set to any value to disable all color output in the CLI.
636
+ - **`CLI_TITLE`**:
637
+ - Set to a string to customize the title of the CLI.
638
+ - **`CODE_ASSIST_ENDPOINT`**:
639
+ - Specifies the endpoint for the code assist server.
640
+ - This is useful for development and testing.
641
+
642
+ ## Command-line arguments
643
+
644
+ Arguments passed directly when running the CLI can override other configurations
645
+ for that specific session.
646
+
647
+ - **`--model <model_name>`** (**`-m <model_name>`**):
648
+ - Specifies the Gemini model to use for this session.
649
+ - Example: `npm start -- --model gemini-1.5-pro-latest`
650
+ - **`--prompt <your_prompt>`** (**`-p <your_prompt>`**):
651
+ - Used to pass a prompt directly to the command. This invokes Gemini CLI in a
652
+ non-interactive mode.
653
+ - **`--prompt-interactive <your_prompt>`** (**`-i <your_prompt>`**):
654
+ - Starts an interactive session with the provided prompt as the initial input.
655
+ - The prompt is processed within the interactive session, not before it.
656
+ - Cannot be used when piping input from stdin.
657
+ - Example: `gemini -i "explain this code"`
658
+ - **`--sandbox`** (**`-s`**):
659
+ - Enables sandbox mode for this session.
660
+ - **`--sandbox-image`**:
661
+ - Sets the sandbox image URI.
662
+ - **`--debug`** (**`-d`**):
663
+ - Enables debug mode for this session, providing more verbose output.
664
+
665
+ - **`--help`** (or **`-h`**):
666
+ - Displays help information about command-line arguments.
667
+ - **`--show-memory-usage`**:
668
+ - Displays the current memory usage.
669
+ - **`--yolo`**:
670
+ - Enables YOLO mode, which automatically approves all tool calls.
671
+ - **`--approval-mode <mode>`**:
672
+ - Sets the approval mode for tool calls. Available modes:
673
+ - `default`: Prompt for approval on each tool call (default behavior)
674
+ - `auto_edit`: Automatically approve edit tools (replace, write_file) while
675
+ prompting for others
676
+ - `yolo`: Automatically approve all tool calls (equivalent to `--yolo`)
677
+ - Cannot be used together with `--yolo`. Use `--approval-mode=yolo` instead of
678
+ `--yolo` for the new unified approach.
679
+ - Example: `gemini --approval-mode auto_edit`
680
+ - **`--allowed-tools <tool1,tool2,...>`**:
681
+ - A comma-separated list of tool names that will bypass the confirmation
682
+ dialog.
683
+ - Example: `gemini --allowed-tools "ShellTool(git status)"`
684
+ - **`--telemetry`**:
685
+ - Enables [telemetry](../cli/telemetry.md).
686
+ - **`--telemetry-target`**:
687
+ - Sets the telemetry target. See [telemetry](../cli/telemetry.md) for more
688
+ information.
689
+ - **`--telemetry-otlp-endpoint`**:
690
+ - Sets the OTLP endpoint for telemetry. See [telemetry](../cli/telemetry.md)
691
+ for more information.
692
+ - **`--telemetry-otlp-protocol`**:
693
+ - Sets the OTLP protocol for telemetry (`grpc` or `http`). Defaults to `grpc`.
694
+ See [telemetry](../cli/telemetry.md) for more information.
695
+ - **`--telemetry-log-prompts`**:
696
+ - Enables logging of prompts for telemetry. See
697
+ [telemetry](../cli/telemetry.md) for more information.
698
+ - **`--extensions <extension_name ...>`** (**`-e <extension_name ...>`**):
699
+ - Specifies a list of extensions to use for the session. If not provided, all
700
+ available extensions are used.
701
+ - Use the special term `gemini -e none` to disable all extensions.
702
+ - Example: `gemini -e my-extension -e my-other-extension`
703
+ - **`--list-extensions`** (**`-l`**):
704
+ - Lists all available extensions and exits.
705
+ - **`--include-directories <dir1,dir2,...>`**:
706
+ - Includes additional directories in the workspace for multi-directory
707
+ support.
708
+ - Can be specified multiple times or as comma-separated values.
709
+ - 5 directories can be added at maximum.
710
+ - Example: `--include-directories /path/to/project1,/path/to/project2` or
711
+ `--include-directories /path/to/project1 --include-directories /path/to/project2`
712
+ - **`--screen-reader`**:
713
+ - Enables screen reader mode for accessibility.
714
+ - **`--version`**:
715
+ - Displays the version of the CLI.
716
+
717
+ ## Context files (hierarchical instructional context)
718
+
719
+ While not strictly configuration for the CLI's _behavior_, context files
720
+ (defaulting to `GEMINI.md` but configurable via the `contextFileName` setting)
721
+ are crucial for configuring the _instructional context_ (also referred to as
722
+ "memory") provided to the Gemini model. This powerful feature allows you to give
723
+ project-specific instructions, coding style guides, or any relevant background
724
+ information to the AI, making its responses more tailored and accurate to your
725
+ needs. The CLI includes UI elements, such as an indicator in the footer showing
726
+ the number of loaded context files, to keep you informed about the active
727
+ context.
728
+
729
+ - **Purpose:** These Markdown files contain instructions, guidelines, or context
730
+ that you want the Gemini model to be aware of during your interactions. The
731
+ system is designed to manage this instructional context hierarchically.
732
+
733
+ ### Example context file content (e.g., `GEMINI.md`)
734
+
735
+ Here's a conceptual example of what a context file at the root of a TypeScript
736
+ project might contain:
737
+
738
+ ```markdown
739
+ # Project: My Awesome TypeScript Library
740
+
741
+ ## General Instructions:
742
+
743
+ - When generating new TypeScript code, please follow the existing coding style.
744
+ - Ensure all new functions and classes have JSDoc comments.
745
+ - Prefer functional programming paradigms where appropriate.
746
+ - All code should be compatible with TypeScript 5.0 and Node.js 20+.
747
+
748
+ ## Coding Style:
749
+
750
+ - Use 2 spaces for indentation.
751
+ - Interface names should be prefixed with `I` (e.g., `IUserService`).
752
+ - Private class members should be prefixed with an underscore (`_`).
753
+ - Always use strict equality (`===` and `!==`).
754
+
755
+ ## Specific Component: `src/api/client.ts`
756
+
757
+ - This file handles all outbound API requests.
758
+ - When adding new API call functions, ensure they include robust error handling
759
+ and logging.
760
+ - Use the existing `fetchWithRetry` utility for all GET requests.
761
+
762
+ ## Regarding Dependencies:
763
+
764
+ - Avoid introducing new external dependencies unless absolutely necessary.
765
+ - If a new dependency is required, please state the reason.
766
+ ```
767
+
768
+ This example demonstrates how you can provide general project context, specific
769
+ coding conventions, and even notes about particular files or components. The
770
+ more relevant and precise your context files are, the better the AI can assist
771
+ you. Project-specific context files are highly encouraged to establish
772
+ conventions and context.
773
+
774
+ - **Hierarchical loading and precedence:** The CLI implements a sophisticated
775
+ hierarchical memory system by loading context files (e.g., `GEMINI.md`) from
776
+ several locations. Content from files lower in this list (more specific)
777
+ typically overrides or supplements content from files higher up (more
778
+ general). The exact concatenation order and final context can be inspected
779
+ using the `/memory show` command. The typical loading order is:
780
+ 1. **Global context file:**
781
+ - Location: `~/.gemini/<contextFileName>` (e.g., `~/.gemini/GEMINI.md` in
782
+ your user home directory).
783
+ - Scope: Provides default instructions for all your projects.
784
+ 2. **Project root and ancestors context files:**
785
+ - Location: The CLI searches for the configured context file in the
786
+ current working directory and then in each parent directory up to either
787
+ the project root (identified by a `.git` folder) or your home directory.
788
+ - Scope: Provides context relevant to the entire project or a significant
789
+ portion of it.
790
+ 3. **Sub-directory context files (contextual/local):**
791
+ - Location: The CLI also scans for the configured context file in
792
+ subdirectories _below_ the current working directory (respecting common
793
+ ignore patterns like `node_modules`, `.git`, etc.). The breadth of this
794
+ search is limited to 200 directories by default, but can be configured
795
+ with a `memoryDiscoveryMaxDirs` field in your `settings.json` file.
796
+ - Scope: Allows for highly specific instructions relevant to a particular
797
+ component, module, or subsection of your project.
798
+ - **Concatenation and UI indication:** The contents of all found context files
799
+ are concatenated (with separators indicating their origin and path) and
800
+ provided as part of the system prompt to the Gemini model. The CLI footer
801
+ displays the count of loaded context files, giving you a quick visual cue
802
+ about the active instructional context.
803
+ - **Importing content:** You can modularize your context files by importing
804
+ other Markdown files using the `@path/to/file.md` syntax. For more details,
805
+ see the [Memory Import Processor documentation](../core/memport.md).
806
+ - **Commands for memory management:**
807
+ - Use `/memory refresh` to force a re-scan and reload of all context files
808
+ from all configured locations. This updates the AI's instructional context.
809
+ - Use `/memory show` to display the combined instructional context currently
810
+ loaded, allowing you to verify the hierarchy and content being used by the
811
+ AI.
812
+ - See the [Commands documentation](../cli/commands.md#memory) for full details
813
+ on the `/memory` command and its sub-commands (`show` and `refresh`).
814
+
815
+ By understanding and utilizing these configuration layers and the hierarchical
816
+ nature of context files, you can effectively manage the AI's memory and tailor
817
+ the Gemini CLI's responses to your specific needs and projects.
818
+
819
+ ## Sandboxing
820
+
821
+ The Gemini CLI can execute potentially unsafe operations (like shell commands
822
+ and file modifications) within a sandboxed environment to protect your system.
823
+
824
+ Sandboxing is disabled by default, but you can enable it in a few ways:
825
+
826
+ - Using `--sandbox` or `-s` flag.
827
+ - Setting `GEMINI_SANDBOX` environment variable.
828
+ - Sandbox is enabled when using `--yolo` or `--approval-mode=yolo` by default.
829
+
830
+ By default, it uses a pre-built `gemini-cli-sandbox` Docker image.
831
+
832
+ For project-specific sandboxing needs, you can create a custom Dockerfile at
833
+ `.gemini/sandbox.Dockerfile` in your project's root directory. This Dockerfile
834
+ can be based on the base sandbox image:
835
+
836
+ ```dockerfile
837
+ FROM gemini-cli-sandbox
838
+
839
+ # Add your custom dependencies or configurations here
840
+ # For example:
841
+ # RUN apt-get update && apt-get install -y some-package
842
+ # COPY ./my-config /app/my-config
843
+ ```
844
+
845
+ When `.gemini/sandbox.Dockerfile` exists, you can use `BUILD_SANDBOX`
846
+ environment variable when running Gemini CLI to automatically build the custom
847
+ sandbox image:
848
+
849
+ ```bash
850
+ BUILD_SANDBOX=1 gemini -s
851
+ ```
852
+
853
+ ## Usage statistics
854
+
855
+ To help us improve the Gemini CLI, we collect anonymized usage statistics. This
856
+ data helps us understand how the CLI is used, identify common issues, and
857
+ prioritize new features.
858
+
859
+ **What we collect:**
860
+
861
+ - **Tool calls:** We log the names of the tools that are called, whether they
862
+ succeed or fail, and how long they take to execute. We do not collect the
863
+ arguments passed to the tools or any data returned by them.
864
+ - **API requests:** We log the Gemini model used for each request, the duration
865
+ of the request, and whether it was successful. We do not collect the content
866
+ of the prompts or responses.
867
+ - **Session information:** We collect information about the configuration of the
868
+ CLI, such as the enabled tools and the approval mode.
869
+
870
+ **What we DON'T collect:**
871
+
872
+ - **Personally identifiable information (PII):** We do not collect any personal
873
+ information, such as your name, email address, or API keys.
874
+ - **Prompt and response content:** We do not log the content of your prompts or
875
+ the responses from the Gemini model.
876
+ - **File content:** We do not log the content of any files that are read or
877
+ written by the CLI.
878
+
879
+ **How to opt out:**
880
+
881
+ You can opt out of usage statistics collection at any time by setting the
882
+ `usageStatisticsEnabled` property to `false` in your `settings.json` file:
883
+
884
+ ```json
885
+ {
886
+ "usageStatisticsEnabled": false
887
+ }
888
+ ```