@google/gemini-cli-core 0.32.0-preview.0 → 0.33.0-preview.0

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 (216) hide show
  1. package/README.md +11 -9
  2. package/dist/docs/CONTRIBUTING.md +7 -4
  3. package/dist/docs/changelogs/index.md +24 -2
  4. package/dist/docs/changelogs/latest.md +389 -310
  5. package/dist/docs/changelogs/preview.md +186 -394
  6. package/dist/docs/cli/cli-reference.md +12 -12
  7. package/dist/docs/cli/custom-commands.md +9 -0
  8. package/dist/docs/cli/enterprise.md +19 -0
  9. package/dist/docs/cli/model.md +5 -14
  10. package/dist/docs/cli/plan-mode.md +38 -7
  11. package/dist/docs/cli/sandbox.md +42 -2
  12. package/dist/docs/cli/session-management.md +16 -7
  13. package/dist/docs/cli/settings.md +10 -10
  14. package/dist/docs/cli/telemetry.md +29 -0
  15. package/dist/docs/cli/tutorials/automation.md +101 -5
  16. package/dist/docs/cli/tutorials/mcp-setup.md +8 -0
  17. package/dist/docs/cli/tutorials/skills-getting-started.md +8 -0
  18. package/dist/docs/extensions/reference.md +9 -1
  19. package/dist/docs/extensions/writing-extensions.md +16 -0
  20. package/dist/docs/get-started/authentication.md +86 -5
  21. package/dist/docs/get-started/installation.md +1 -1
  22. package/dist/docs/hooks/best-practices.md +33 -1
  23. package/dist/docs/hooks/writing-hooks.md +24 -0
  24. package/dist/docs/ide-integration/index.md +8 -0
  25. package/dist/docs/reference/commands.md +3 -0
  26. package/dist/docs/reference/configuration.md +19 -15
  27. package/dist/docs/reference/keyboard-shortcuts.md +10 -0
  28. package/dist/docs/reference/policy-engine.md +10 -0
  29. package/dist/docs/resources/faq.md +8 -0
  30. package/dist/docs/resources/troubleshooting.md +4 -1
  31. package/dist/docs/sidebar.json +8 -1
  32. package/dist/src/agents/a2aUtils.d.ts +2 -0
  33. package/dist/src/agents/a2aUtils.js +12 -0
  34. package/dist/src/agents/a2aUtils.js.map +1 -1
  35. package/dist/src/agents/a2aUtils.test.js +50 -1
  36. package/dist/src/agents/a2aUtils.test.js.map +1 -1
  37. package/dist/src/agents/agentLoader.d.ts +2 -1
  38. package/dist/src/agents/agentLoader.js +17 -4
  39. package/dist/src/agents/agentLoader.js.map +1 -1
  40. package/dist/src/agents/agentLoader.test.js +46 -0
  41. package/dist/src/agents/agentLoader.test.js.map +1 -1
  42. package/dist/src/agents/auth-provider/factory.js +6 -3
  43. package/dist/src/agents/auth-provider/factory.js.map +1 -1
  44. package/dist/src/agents/auth-provider/http-provider.d.ts +28 -0
  45. package/dist/src/agents/auth-provider/http-provider.js +73 -0
  46. package/dist/src/agents/auth-provider/http-provider.js.map +1 -0
  47. package/dist/src/agents/auth-provider/http-provider.test.d.ts +6 -0
  48. package/dist/src/agents/auth-provider/http-provider.test.js +112 -0
  49. package/dist/src/agents/auth-provider/http-provider.test.js.map +1 -0
  50. package/dist/src/agents/auth-provider/types.d.ts +5 -0
  51. package/dist/src/agents/browser/browserAgentInvocation.d.ts +2 -3
  52. package/dist/src/agents/browser/browserAgentInvocation.js +1 -1
  53. package/dist/src/agents/browser/browserAgentInvocation.js.map +1 -1
  54. package/dist/src/agents/local-executor.js +36 -7
  55. package/dist/src/agents/local-executor.js.map +1 -1
  56. package/dist/src/agents/local-executor.test.js +18 -13
  57. package/dist/src/agents/local-executor.test.js.map +1 -1
  58. package/dist/src/agents/local-invocation.d.ts +3 -4
  59. package/dist/src/agents/local-invocation.js +164 -11
  60. package/dist/src/agents/local-invocation.js.map +1 -1
  61. package/dist/src/agents/local-invocation.test.js +49 -29
  62. package/dist/src/agents/local-invocation.test.js.map +1 -1
  63. package/dist/src/agents/registry.js +66 -12
  64. package/dist/src/agents/registry.js.map +1 -1
  65. package/dist/src/agents/registry.test.js +220 -0
  66. package/dist/src/agents/registry.test.js.map +1 -1
  67. package/dist/src/agents/remote-invocation.d.ts +2 -1
  68. package/dist/src/agents/remote-invocation.js +20 -2
  69. package/dist/src/agents/remote-invocation.js.map +1 -1
  70. package/dist/src/agents/remote-invocation.test.js +62 -10
  71. package/dist/src/agents/remote-invocation.test.js.map +1 -1
  72. package/dist/src/agents/subagent-tool.js.map +1 -1
  73. package/dist/src/agents/subagent-tool.test.js +7 -0
  74. package/dist/src/agents/subagent-tool.test.js.map +1 -1
  75. package/dist/src/agents/types.d.ts +18 -0
  76. package/dist/src/agents/types.js +6 -0
  77. package/dist/src/agents/types.js.map +1 -1
  78. package/dist/src/code_assist/server.js.map +1 -1
  79. package/dist/src/config/config.d.ts +11 -4
  80. package/dist/src/config/config.js +23 -47
  81. package/dist/src/config/config.js.map +1 -1
  82. package/dist/src/config/config.test.js +29 -101
  83. package/dist/src/config/config.test.js.map +1 -1
  84. package/dist/src/core/client.js +5 -3
  85. package/dist/src/core/client.js.map +1 -1
  86. package/dist/src/core/client.test.js +47 -7
  87. package/dist/src/core/client.test.js.map +1 -1
  88. package/dist/src/core/coreToolHookTriggers.d.ts +3 -3
  89. package/dist/src/core/coreToolHookTriggers.js.map +1 -1
  90. package/dist/src/core/coreToolScheduler.js +38 -22
  91. package/dist/src/core/coreToolScheduler.js.map +1 -1
  92. package/dist/src/core/geminiChat.d.ts +2 -2
  93. package/dist/src/core/geminiChat.js +3 -0
  94. package/dist/src/core/geminiChat.js.map +1 -1
  95. package/dist/src/core/loggingContentGenerator.d.ts +1 -0
  96. package/dist/src/core/loggingContentGenerator.js +31 -1
  97. package/dist/src/core/loggingContentGenerator.js.map +1 -1
  98. package/dist/src/core/loggingContentGenerator.test.js +94 -0
  99. package/dist/src/core/loggingContentGenerator.test.js.map +1 -1
  100. package/dist/src/generated/git-commit.d.ts +2 -2
  101. package/dist/src/generated/git-commit.js +2 -2
  102. package/dist/src/hooks/hookRunner.js +30 -4
  103. package/dist/src/hooks/hookRunner.js.map +1 -1
  104. package/dist/src/index.d.ts +1 -0
  105. package/dist/src/index.js +1 -0
  106. package/dist/src/index.js.map +1 -1
  107. package/dist/src/mcp/mcp-oauth-provider.d.ts +43 -0
  108. package/dist/src/mcp/mcp-oauth-provider.js +67 -0
  109. package/dist/src/mcp/mcp-oauth-provider.js.map +1 -0
  110. package/dist/src/mcp/mcp-oauth-provider.test.d.ts +6 -0
  111. package/dist/src/mcp/mcp-oauth-provider.test.js +63 -0
  112. package/dist/src/mcp/mcp-oauth-provider.test.js.map +1 -0
  113. package/dist/src/policy/config.d.ts +1 -1
  114. package/dist/src/policy/config.js +4 -3
  115. package/dist/src/policy/config.js.map +1 -1
  116. package/dist/src/policy/policies/plan.toml +50 -13
  117. package/dist/src/policy/policies/read-only.toml +12 -11
  118. package/dist/src/policy/policies/write.toml +12 -11
  119. package/dist/src/policy/policies/yolo.toml +21 -11
  120. package/dist/src/policy/policy-engine.test.js +62 -2
  121. package/dist/src/policy/policy-engine.test.js.map +1 -1
  122. package/dist/src/policy/toml-loader.d.ts +19 -1
  123. package/dist/src/policy/toml-loader.js +127 -0
  124. package/dist/src/policy/toml-loader.js.map +1 -1
  125. package/dist/src/policy/toml-loader.test.js +218 -14
  126. package/dist/src/policy/toml-loader.test.js.map +1 -1
  127. package/dist/src/prompts/snippets.js +7 -7
  128. package/dist/src/prompts/snippets.js.map +1 -1
  129. package/dist/src/scheduler/scheduler.js +1 -1
  130. package/dist/src/scheduler/scheduler.js.map +1 -1
  131. package/dist/src/scheduler/scheduler.test.js +1 -1
  132. package/dist/src/scheduler/scheduler.test.js.map +1 -1
  133. package/dist/src/scheduler/state-manager.d.ts +1 -2
  134. package/dist/src/scheduler/state-manager.js +19 -10
  135. package/dist/src/scheduler/state-manager.js.map +1 -1
  136. package/dist/src/scheduler/tool-executor.d.ts +3 -2
  137. package/dist/src/scheduler/tool-executor.js +89 -32
  138. package/dist/src/scheduler/tool-executor.js.map +1 -1
  139. package/dist/src/scheduler/tool-executor.test.js +191 -0
  140. package/dist/src/scheduler/tool-executor.test.js.map +1 -1
  141. package/dist/src/scheduler/types.d.ts +3 -4
  142. package/dist/src/services/chatRecordingService.js +12 -0
  143. package/dist/src/services/chatRecordingService.js.map +1 -1
  144. package/dist/src/services/chatRecordingService.test.js +15 -4
  145. package/dist/src/services/chatRecordingService.test.js.map +1 -1
  146. package/dist/src/services/loopDetectionService.d.ts +2 -1
  147. package/dist/src/services/loopDetectionService.js +49 -11
  148. package/dist/src/services/loopDetectionService.js.map +1 -1
  149. package/dist/src/services/loopDetectionService.test.js +63 -22
  150. package/dist/src/services/loopDetectionService.test.js.map +1 -1
  151. package/dist/src/skills/builtin/skill-creator/scripts/package_skill.cjs +35 -10
  152. package/dist/src/tools/ask-user.d.ts +1 -0
  153. package/dist/src/tools/ask-user.js +2 -1
  154. package/dist/src/tools/ask-user.js.map +1 -1
  155. package/dist/src/tools/definitions/base-declarations.d.ts +51 -0
  156. package/dist/src/tools/definitions/base-declarations.js +75 -1
  157. package/dist/src/tools/definitions/base-declarations.js.map +1 -1
  158. package/dist/src/tools/definitions/coreTools.d.ts +1 -1
  159. package/dist/src/tools/definitions/coreTools.js +5 -1
  160. package/dist/src/tools/definitions/coreTools.js.map +1 -1
  161. package/dist/src/tools/definitions/dynamic-declaration-helpers.js +14 -12
  162. package/dist/src/tools/definitions/dynamic-declaration-helpers.js.map +1 -1
  163. package/dist/src/tools/definitions/model-family-sets/default-legacy.js +97 -81
  164. package/dist/src/tools/definitions/model-family-sets/default-legacy.js.map +1 -1
  165. package/dist/src/tools/definitions/model-family-sets/gemini-3.js +99 -82
  166. package/dist/src/tools/definitions/model-family-sets/gemini-3.js.map +1 -1
  167. package/dist/src/tools/enter-plan-mode.d.ts +1 -0
  168. package/dist/src/tools/enter-plan-mode.js +2 -1
  169. package/dist/src/tools/enter-plan-mode.js.map +1 -1
  170. package/dist/src/tools/exit-plan-mode.d.ts +1 -0
  171. package/dist/src/tools/exit-plan-mode.js +2 -1
  172. package/dist/src/tools/exit-plan-mode.js.map +1 -1
  173. package/dist/src/tools/mcp-client.d.ts +6 -0
  174. package/dist/src/tools/mcp-client.js +14 -0
  175. package/dist/src/tools/mcp-client.js.map +1 -1
  176. package/dist/src/tools/mcp-tool.js +20 -9
  177. package/dist/src/tools/mcp-tool.js.map +1 -1
  178. package/dist/src/tools/mcp-tool.test.js +48 -1
  179. package/dist/src/tools/mcp-tool.test.js.map +1 -1
  180. package/dist/src/tools/read-file.test.js +7 -0
  181. package/dist/src/tools/read-file.test.js.map +1 -1
  182. package/dist/src/tools/shell.d.ts +2 -3
  183. package/dist/src/tools/shell.js +10 -9
  184. package/dist/src/tools/shell.js.map +1 -1
  185. package/dist/src/tools/tool-names.d.ts +2 -2
  186. package/dist/src/tools/tool-names.js +14 -4
  187. package/dist/src/tools/tool-names.js.map +1 -1
  188. package/dist/src/tools/tool-names.test.js +2 -0
  189. package/dist/src/tools/tool-names.test.js.map +1 -1
  190. package/dist/src/tools/tool-registry.d.ts +3 -2
  191. package/dist/src/tools/tool-registry.js +41 -5
  192. package/dist/src/tools/tool-registry.js.map +1 -1
  193. package/dist/src/tools/tool-registry.test.js +42 -7
  194. package/dist/src/tools/tool-registry.test.js.map +1 -1
  195. package/dist/src/tools/tools.d.ts +6 -4
  196. package/dist/src/tools/tools.js.map +1 -1
  197. package/dist/src/utils/constants.d.ts +3 -0
  198. package/dist/src/utils/constants.js +3 -0
  199. package/dist/src/utils/constants.js.map +1 -1
  200. package/dist/src/utils/errors.d.ts +4 -0
  201. package/dist/src/utils/errors.js +6 -0
  202. package/dist/src/utils/errors.js.map +1 -1
  203. package/dist/src/utils/errors.test.js +20 -1
  204. package/dist/src/utils/errors.test.js.map +1 -1
  205. package/dist/src/utils/fetch.js +1 -1
  206. package/dist/src/utils/fetch.js.map +1 -1
  207. package/dist/src/utils/fileUtils.d.ts +0 -1
  208. package/dist/src/utils/fileUtils.js +5 -7
  209. package/dist/src/utils/fileUtils.js.map +1 -1
  210. package/dist/src/utils/tool-utils.d.ts +11 -4
  211. package/dist/src/utils/tool-utils.js +18 -5
  212. package/dist/src/utils/tool-utils.js.map +1 -1
  213. package/dist/src/utils/tool-utils.test.js +8 -0
  214. package/dist/src/utils/tool-utils.test.js.map +1 -1
  215. package/dist/tsconfig.tsbuildinfo +1 -1
  216. package/package.json +1 -1
@@ -5,18 +5,18 @@ and parameters.
5
5
 
6
6
  ## CLI commands
7
7
 
8
- | Command | Description | Example |
9
- | ---------------------------------- | ---------------------------------- | --------------------------------------------------- |
10
- | `gemini` | Start interactive REPL | `gemini` |
11
- | `gemini "query"` | Query non-interactively, then exit | `gemini "explain this project"` |
12
- | `cat file \| gemini` | Process piped content | `cat logs.txt \| gemini` |
13
- | `gemini -i "query"` | Execute and continue interactively | `gemini -i "What is the purpose of this project?"` |
14
- | `gemini -r "latest"` | Continue most recent session | `gemini -r "latest"` |
15
- | `gemini -r "latest" "query"` | Continue session with a new prompt | `gemini -r "latest" "Check for type errors"` |
16
- | `gemini -r "<session-id>" "query"` | Resume session by ID | `gemini -r "abc123" "Finish this PR"` |
17
- | `gemini update` | Update to latest version | `gemini update` |
18
- | `gemini extensions` | Manage extensions | See [Extensions Management](#extensions-management) |
19
- | `gemini mcp` | Configure MCP servers | See [MCP Server Management](#mcp-server-management) |
8
+ | Command | Description | Example |
9
+ | ---------------------------------- | ---------------------------------- | ------------------------------------------------------------ |
10
+ | `gemini` | Start interactive REPL | `gemini` |
11
+ | `gemini "query"` | Query non-interactively, then exit | `gemini "explain this project"` |
12
+ | `cat file \| gemini` | Process piped content | `cat logs.txt \| gemini`<br>`Get-Content logs.txt \| gemini` |
13
+ | `gemini -i "query"` | Execute and continue interactively | `gemini -i "What is the purpose of this project?"` |
14
+ | `gemini -r "latest"` | Continue most recent session | `gemini -r "latest"` |
15
+ | `gemini -r "latest" "query"` | Continue session with a new prompt | `gemini -r "latest" "Check for type errors"` |
16
+ | `gemini -r "<session-id>" "query"` | Resume session by ID | `gemini -r "abc123" "Finish this PR"` |
17
+ | `gemini update` | Update to latest version | `gemini update` |
18
+ | `gemini extensions` | Manage extensions | See [Extensions Management](#extensions-management) |
19
+ | `gemini mcp` | Configure MCP servers | See [MCP Server Management](#mcp-server-management) |
20
20
 
21
21
  ### Positional arguments
22
22
 
@@ -278,11 +278,20 @@ Let's create a global command that asks the model to refactor a piece of code.
278
278
  First, ensure the user commands directory exists, then create a `refactor`
279
279
  subdirectory for organization and the final TOML file.
280
280
 
281
+ **macOS/Linux**
282
+
281
283
  ```bash
282
284
  mkdir -p ~/.gemini/commands/refactor
283
285
  touch ~/.gemini/commands/refactor/pure.toml
284
286
  ```
285
287
 
288
+ **Windows (PowerShell)**
289
+
290
+ ```powershell
291
+ New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.gemini\commands\refactor"
292
+ New-Item -ItemType File -Force -Path "$env:USERPROFILE\.gemini\commands\refactor\pure.toml"
293
+ ```
294
+
286
295
  **2. Add the content to the file:**
287
296
 
288
297
  Open `~/.gemini/commands/refactor/pure.toml` in your editor and add the
@@ -203,6 +203,15 @@ with the actual Gemini CLI process, which inherits the environment variable.
203
203
  This makes it significantly more difficult for a user to bypass the enforced
204
204
  settings.
205
205
 
206
+ **PowerShell Profile (Windows alternative):**
207
+
208
+ On Windows, administrators can achieve similar results by adding the environment
209
+ variable to the system-wide or user-specific PowerShell profile:
210
+
211
+ ```powershell
212
+ Add-Content -Path $PROFILE -Value '$env:GEMINI_CLI_SYSTEM_SETTINGS_PATH="C:\ProgramData\gemini-cli\settings.json"'
213
+ ```
214
+
206
215
  ## User isolation in shared environments
207
216
 
208
217
  In shared compute environments (like ML experiment runners or shared build
@@ -214,12 +223,22 @@ use the `GEMINI_CLI_HOME` environment variable to point to a unique directory
214
223
  for a specific user or job. The CLI will create a `.gemini` folder inside the
215
224
  specified path.
216
225
 
226
+ **macOS/Linux**
227
+
217
228
  ```bash
218
229
  # Isolate state for a specific job
219
230
  export GEMINI_CLI_HOME="/tmp/gemini-job-123"
220
231
  gemini
221
232
  ```
222
233
 
234
+ **Windows (PowerShell)**
235
+
236
+ ```powershell
237
+ # Isolate state for a specific job
238
+ $env:GEMINI_CLI_HOME="C:\temp\gemini-job-123"
239
+ gemini
240
+ ```
241
+
223
242
  ## Restricting tool access
224
243
 
225
244
  You can significantly enhance security by controlling which tools the Gemini
@@ -19,24 +19,15 @@ Use the following command in Gemini CLI:
19
19
 
20
20
  Running this command will open a dialog with your options:
21
21
 
22
- | Option | Description | Models |
23
- | ----------------- | -------------------------------------------------------------- | ---------------------------------------------------------------------- |
24
- | Auto (Gemini 3) | Let the system choose the best Gemini 3 model for your task. | gemini-3-pro-preview (if enabled), gemini-3-flash-preview (if enabled) |
25
- | Auto (Gemini 2.5) | Let the system choose the best Gemini 2.5 model for your task. | gemini-2.5-pro, gemini-2.5-flash |
26
- | Manual | Select a specific model. | Any available model. |
22
+ | Option | Description | Models |
23
+ | ----------------- | -------------------------------------------------------------- | -------------------------------------------- |
24
+ | Auto (Gemini 3) | Let the system choose the best Gemini 3 model for your task. | gemini-3-pro-preview, gemini-3-flash-preview |
25
+ | Auto (Gemini 2.5) | Let the system choose the best Gemini 2.5 model for your task. | gemini-2.5-pro, gemini-2.5-flash |
26
+ | Manual | Select a specific model. | Any available model. |
27
27
 
28
28
  We recommend selecting one of the above **Auto** options. However, you can
29
29
  select **Manual** to select a specific model from those available.
30
30
 
31
- ### Gemini 3 and preview features
32
-
33
- > **Note:** Gemini 3 is not currently available on all account types. To learn
34
- > more about Gemini 3 access, refer to
35
- > [Gemini 3 on Gemini CLI](../get-started/gemini-3.md).
36
-
37
- To enable Gemini 3 Pro and Gemini 3 Flash (if available), enable
38
- [**Preview Features** by using the `settings` command](../cli/settings.md).
39
-
40
31
  You can also use the `--model` flag to specify a particular Gemini model on
41
32
  startup. For more details, refer to the
42
33
  [configuration documentation](../reference/configuration.md).
@@ -21,13 +21,15 @@ implementation. It allows you to:
21
21
  - [Entering Plan Mode](#entering-plan-mode)
22
22
  - [Planning Workflow](#planning-workflow)
23
23
  - [Exiting Plan Mode](#exiting-plan-mode)
24
+ - [Commands](#commands)
24
25
  - [Tool Restrictions](#tool-restrictions)
25
26
  - [Customizing Planning with Skills](#customizing-planning-with-skills)
26
27
  - [Customizing Policies](#customizing-policies)
27
28
  - [Example: Allow git commands in Plan Mode](#example-allow-git-commands-in-plan-mode)
28
- - [Example: Enable research subagents in Plan Mode](#example-enable-research-subagents-in-plan-mode)
29
+ - [Example: Enable custom subagents in Plan Mode](#example-enable-custom-subagents-in-plan-mode)
29
30
  - [Custom Plan Directory and Policies](#custom-plan-directory-and-policies)
30
31
  - [Automatic Model Routing](#automatic-model-routing)
32
+ - [Cleanup](#cleanup)
31
33
 
32
34
  ## Enabling Plan Mode
33
35
 
@@ -109,8 +111,9 @@ structure, and consultation level are proportional to the task's complexity:
109
111
  - **Iterate:** Provide feedback to refine the plan.
110
112
  - **Refine manually:** Press **Ctrl + X** to open the plan file in your
111
113
  [preferred external editor]. This allows you to manually refine the plan
112
- steps before approval. The CLI will automatically refresh and show the
113
- updated plan after you save and close the editor.
114
+ steps before approval. If you make any changes and save the file, the CLI
115
+ will automatically send the updated plan back to the agent for review and
116
+ iteration.
114
117
 
115
118
  For more complex or specialized planning tasks, you can
116
119
  [customize the planning workflow with skills](#customizing-planning-with-skills).
@@ -124,6 +127,10 @@ To exit Plan Mode, you can:
124
127
  - **Tool:** Gemini CLI calls the [`exit_plan_mode`] tool to present the
125
128
  finalized plan for your approval.
126
129
 
130
+ ### Commands
131
+
132
+ - **`/plan copy`**: Copy the currently approved plan to your clipboard.
133
+
127
134
  ## Tool Restrictions
128
135
 
129
136
  Plan Mode enforces strict safety policies to prevent accidental changes.
@@ -132,6 +139,7 @@ These are the only allowed tools:
132
139
 
133
140
  - **FileSystem (Read):** [`read_file`], [`list_directory`], [`glob`]
134
141
  - **Search:** [`grep_search`], [`google_web_search`]
142
+ - **Research Subagents:** [`codebase_investigator`], [`cli_help`]
135
143
  - **Interaction:** [`ask_user`]
136
144
  - **MCP Tools (Read):** Read-only [MCP tools] (e.g., `github_read_issue`,
137
145
  `postgres_read_schema`) are allowed.
@@ -202,16 +210,17 @@ priority = 100
202
210
  modes = ["plan"]
203
211
  ```
204
212
 
205
- #### Example: Enable research subagents in Plan Mode
213
+ #### Example: Enable custom subagents in Plan Mode
206
214
 
207
- You can enable experimental research [subagents] like `codebase_investigator` to
208
- help gather architecture details during the planning phase.
215
+ Built-in research [subagents] like [`codebase_investigator`] and [`cli_help`]
216
+ are enabled by default in Plan Mode. You can enable additional [custom
217
+ subagents] by adding a rule to your policy.
209
218
 
210
219
  `~/.gemini/policies/research-subagents.toml`
211
220
 
212
221
  ```toml
213
222
  [[rule]]
214
- toolName = "codebase_investigator"
223
+ toolName = "my_custom_subagent"
215
224
  decision = "allow"
216
225
  priority = 100
217
226
  modes = ["plan"]
@@ -289,6 +298,24 @@ performance. You can disable this automatic switching in your settings:
289
298
  }
290
299
  ```
291
300
 
301
+ ## Cleanup
302
+
303
+ By default, Gemini CLI automatically cleans up old session data, including all
304
+ associated plan files and task trackers.
305
+
306
+ - **Default behavior:** Sessions (and their plans) are retained for **30 days**.
307
+ - **Configuration:** You can customize this behavior via the `/settings` command
308
+ (search for **Session Retention**) or in your `settings.json` file. See
309
+ [session retention] for more details.
310
+
311
+ Manual deletion also removes all associated artifacts:
312
+
313
+ - **Command Line:** Use `gemini --delete-session <index|id>`.
314
+ - **Session Browser:** Press `/resume`, navigate to a session, and press `x`.
315
+
316
+ If you use a [custom plans directory](#custom-plan-directory-and-policies),
317
+ those files are not automatically deleted and must be managed manually.
318
+
292
319
  [`list_directory`]: /docs/tools/file-system.md#1-list_directory-readfolder
293
320
  [`read_file`]: /docs/tools/file-system.md#2-read_file-readfile
294
321
  [`grep_search`]: /docs/tools/file-system.md#5-grep_search-searchtext
@@ -299,7 +326,10 @@ performance. You can disable this automatic switching in your settings:
299
326
  [MCP tools]: /docs/tools/mcp-server.md
300
327
  [`save_memory`]: /docs/tools/memory.md
301
328
  [`activate_skill`]: /docs/cli/skills.md
329
+ [`codebase_investigator`]: /docs/core/subagents.md#codebase_investigator
330
+ [`cli_help`]: /docs/core/subagents.md#cli_help
302
331
  [subagents]: /docs/core/subagents.md
332
+ [custom subagents]: /docs/core/subagents.md#creating-custom-subagents
303
333
  [policy engine]: /docs/reference/policy-engine.md
304
334
  [`enter_plan_mode`]: /docs/tools/planning.md#1-enter_plan_mode-enterplanmode
305
335
  [`exit_plan_mode`]: /docs/tools/planning.md#2-exit_plan_mode-exitplanmode
@@ -310,3 +340,4 @@ performance. You can disable this automatic switching in your settings:
310
340
  [auto model]: /docs/reference/configuration.md#model-settings
311
341
  [model routing]: /docs/cli/telemetry.md#model-routing
312
342
  [preferred external editor]: /docs/reference/configuration.md#general
343
+ [session retention]: /docs/cli/session-management.md#session-retention
@@ -55,12 +55,27 @@ from your organization's registry.
55
55
  ```bash
56
56
  # Enable sandboxing with command flag
57
57
  gemini -s -p "analyze the code structure"
58
+ ```
59
+
60
+ **Use environment variable**
61
+
62
+ **macOS/Linux**
58
63
 
59
- # Use environment variable
64
+ ```bash
60
65
  export GEMINI_SANDBOX=true
61
66
  gemini -p "run the test suite"
67
+ ```
68
+
69
+ **Windows (PowerShell)**
62
70
 
63
- # Configure in settings.json
71
+ ```powershell
72
+ $env:GEMINI_SANDBOX="true"
73
+ gemini -p "run the test suite"
74
+ ```
75
+
76
+ **Configure in settings.json**
77
+
78
+ ```json
64
79
  {
65
80
  "tools": {
66
81
  "sandbox": "docker"
@@ -99,26 +114,51 @@ use cases.
99
114
 
100
115
  To disable SELinux labeling for volume mounts, you can set the following:
101
116
 
117
+ **macOS/Linux**
118
+
102
119
  ```bash
103
120
  export SANDBOX_FLAGS="--security-opt label=disable"
104
121
  ```
105
122
 
123
+ **Windows (PowerShell)**
124
+
125
+ ```powershell
126
+ $env:SANDBOX_FLAGS="--security-opt label=disable"
127
+ ```
128
+
106
129
  Multiple flags can be provided as a space-separated string:
107
130
 
131
+ **macOS/Linux**
132
+
108
133
  ```bash
109
134
  export SANDBOX_FLAGS="--flag1 --flag2=value"
110
135
  ```
111
136
 
137
+ **Windows (PowerShell)**
138
+
139
+ ```powershell
140
+ $env:SANDBOX_FLAGS="--flag1 --flag2=value"
141
+ ```
142
+
112
143
  ## Linux UID/GID handling
113
144
 
114
145
  The sandbox automatically handles user permissions on Linux. Override these
115
146
  permissions with:
116
147
 
148
+ **macOS/Linux**
149
+
117
150
  ```bash
118
151
  export SANDBOX_SET_UID_GID=true # Force host UID/GID
119
152
  export SANDBOX_SET_UID_GID=false # Disable UID/GID mapping
120
153
  ```
121
154
 
155
+ **Windows (PowerShell)**
156
+
157
+ ```powershell
158
+ $env:SANDBOX_SET_UID_GID="true" # Force host UID/GID
159
+ $env:SANDBOX_SET_UID_GID="false" # Disable UID/GID mapping
160
+ ```
161
+
122
162
  ## Troubleshooting
123
163
 
124
164
  ### Common issues
@@ -121,27 +121,36 @@ session lengths.
121
121
 
122
122
  ### Session retention
123
123
 
124
- To prevent your history from growing indefinitely, enable automatic cleanup
125
- policies in your settings.
124
+ By default, Gemini CLI automatically cleans up old session data to prevent your
125
+ history from growing indefinitely. When a session is deleted, Gemini CLI also
126
+ removes all associated data, including implementation plans, task trackers, tool
127
+ outputs, and activity logs.
128
+
129
+ The default policy is to **retain sessions for 30 days**.
130
+
131
+ #### Configuration
132
+
133
+ You can customize these policies using the `/settings` command or by manually
134
+ editing your `settings.json` file:
126
135
 
127
136
  ```json
128
137
  {
129
138
  "general": {
130
139
  "sessionRetention": {
131
140
  "enabled": true,
132
- "maxAge": "30d", // Keep sessions for 30 days
133
- "maxCount": 50 // Keep the 50 most recent sessions
141
+ "maxAge": "30d",
142
+ "maxCount": 50
134
143
  }
135
144
  }
136
145
  }
137
146
  ```
138
147
 
139
148
  - **`enabled`**: (boolean) Master switch for session cleanup. Defaults to
140
- `false`.
149
+ `true`.
141
150
  - **`maxAge`**: (string) Duration to keep sessions (for example, "24h", "7d",
142
- "4w"). Sessions older than this are deleted.
151
+ "4w"). Sessions older than this are deleted. Defaults to `"30d"`.
143
152
  - **`maxCount`**: (number) Maximum number of sessions to retain. The oldest
144
- sessions exceeding this count are deleted.
153
+ sessions exceeding this count are deleted. Defaults to undefined (unlimited).
145
154
  - **`minRetention`**: (string) Minimum retention period (safety limit). Defaults
146
155
  to `"1d"`. Sessions newer than this period are never deleted by automatic
147
156
  cleanup.
@@ -32,8 +32,8 @@ they appear in the UI.
32
32
  | Plan Model Routing | `general.plan.modelRouting` | Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pro for the planning phase and Flash for the implementation phase. | `true` |
33
33
  | Max Chat Model Attempts | `general.maxAttempts` | Maximum number of attempts for requests to the main chat model. Cannot exceed 10. | `10` |
34
34
  | Debug Keystroke Logging | `general.debugKeystrokeLogging` | Enable debug logging of keystrokes to the console. | `false` |
35
- | Enable Session Cleanup | `general.sessionRetention.enabled` | Enable automatic session cleanup | `false` |
36
- | Keep chat history | `general.sessionRetention.maxAge` | Automatically delete chats older than this time period (e.g., "30d", "7d", "24h", "1w") | `undefined` |
35
+ | Enable Session Cleanup | `general.sessionRetention.enabled` | Enable automatic session cleanup | `true` |
36
+ | Keep chat history | `general.sessionRetention.maxAge` | Automatically delete chats older than this time period (e.g., "30d", "7d", "24h", "1w") | `"30d"` |
37
37
 
38
38
  ### Output
39
39
 
@@ -60,7 +60,7 @@ they appear in the UI.
60
60
  | Hide CWD | `ui.footer.hideCWD` | Hide the current working directory path in the footer. | `false` |
61
61
  | Hide Sandbox Status | `ui.footer.hideSandboxStatus` | Hide the sandbox status indicator in the footer. | `false` |
62
62
  | Hide Model Info | `ui.footer.hideModelInfo` | Hide the model name and context usage in the footer. | `false` |
63
- | Hide Context Window Percentage | `ui.footer.hideContextPercentage` | Hides the context window remaining percentage. | `true` |
63
+ | Hide Context Window Percentage | `ui.footer.hideContextPercentage` | Hides the context window usage percentage. | `true` |
64
64
  | Hide Footer | `ui.hideFooter` | Hide the footer from the UI | `false` |
65
65
  | Show Memory Usage | `ui.showMemoryUsage` | Display memory usage information in the UI | `false` |
66
66
  | Show Line Numbers | `ui.showLineNumbers` | Show line numbers in the chat. | `true` |
@@ -89,13 +89,13 @@ they appear in the UI.
89
89
 
90
90
  ### Model
91
91
 
92
- | UI Label | Setting | Description | Default |
93
- | ----------------------- | ---------------------------- | -------------------------------------------------------------------------------------- | ----------- |
94
- | Model | `model.name` | The Gemini model to use for conversations. | `undefined` |
95
- | Max Session Turns | `model.maxSessionTurns` | Maximum number of user/model/tool turns to keep in a session. -1 means unlimited. | `-1` |
96
- | Compression Threshold | `model.compressionThreshold` | The fraction of context usage at which to trigger context compression (e.g. 0.2, 0.3). | `0.5` |
97
- | Disable Loop Detection | `model.disableLoopDetection` | Disable automatic detection and prevention of infinite loops. | `false` |
98
- | Skip Next Speaker Check | `model.skipNextSpeakerCheck` | Skip the next speaker check. | `true` |
92
+ | UI Label | Setting | Description | Default |
93
+ | ----------------------------- | ---------------------------- | -------------------------------------------------------------------------------------- | ----------- |
94
+ | Model | `model.name` | The Gemini model to use for conversations. | `undefined` |
95
+ | Max Session Turns | `model.maxSessionTurns` | Maximum number of user/model/tool turns to keep in a session. -1 means unlimited. | `-1` |
96
+ | Context Compression Threshold | `model.compressionThreshold` | The fraction of context usage at which to trigger context compression (e.g. 0.2, 0.3). | `0.5` |
97
+ | Disable Loop Detection | `model.disableLoopDetection` | Disable automatic detection and prevention of infinite loops. | `false` |
98
+ | Skip Next Speaker Check | `model.skipNextSpeakerCheck` | Skip the next speaker check. | `true` |
99
99
 
100
100
  ### Context
101
101
 
@@ -103,23 +103,52 @@ Before using either method below, complete these steps:
103
103
 
104
104
  1. Set your Google Cloud project ID:
105
105
  - For telemetry in a separate project from inference:
106
+
107
+ **macOS/Linux**
108
+
106
109
  ```bash
107
110
  export OTLP_GOOGLE_CLOUD_PROJECT="your-telemetry-project-id"
108
111
  ```
112
+
113
+ **Windows (PowerShell)**
114
+
115
+ ```powershell
116
+ $env:OTLP_GOOGLE_CLOUD_PROJECT="your-telemetry-project-id"
117
+ ```
118
+
109
119
  - For telemetry in the same project as inference:
120
+
121
+ **macOS/Linux**
122
+
110
123
  ```bash
111
124
  export GOOGLE_CLOUD_PROJECT="your-project-id"
112
125
  ```
113
126
 
127
+ **Windows (PowerShell)**
128
+
129
+ ```powershell
130
+ $env:GOOGLE_CLOUD_PROJECT="your-project-id"
131
+ ```
132
+
114
133
  2. Authenticate with Google Cloud:
115
134
  - If using a user account:
116
135
  ```bash
117
136
  gcloud auth application-default login
118
137
  ```
119
138
  - If using a service account:
139
+
140
+ **macOS/Linux**
141
+
120
142
  ```bash
121
143
  export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/service-account.json"
122
144
  ```
145
+
146
+ **Windows (PowerShell)**
147
+
148
+ ```powershell
149
+ $env:GOOGLE_APPLICATION_CREDENTIALS="C:\path\to\your\service-account.json"
150
+ ```
151
+
123
152
  3. Make sure your account or service account has these IAM roles:
124
153
  - Cloud Trace Agent
125
154
  - Monitoring Metric Writer
@@ -37,10 +37,18 @@ output.
37
37
 
38
38
  Pipe a file:
39
39
 
40
+ **macOS/Linux**
41
+
40
42
  ```bash
41
43
  cat error.log | gemini "Explain why this failed"
42
44
  ```
43
45
 
46
+ **Windows (PowerShell)**
47
+
48
+ ```powershell
49
+ Get-Content error.log | gemini "Explain why this failed"
50
+ ```
51
+
44
52
  Pipe a command:
45
53
 
46
54
  ```bash
@@ -57,7 +65,10 @@ results to a file.
57
65
  You have a folder of Python scripts and want to generate a `README.md` for each
58
66
  one.
59
67
 
60
- 1. Save the following code as `generate_docs.sh`:
68
+ 1. Save the following code as `generate_docs.sh` (or `generate_docs.ps1` for
69
+ Windows):
70
+
71
+ **macOS/Linux (`generate_docs.sh`)**
61
72
 
62
73
  ```bash
63
74
  #!/bin/bash
@@ -72,13 +83,34 @@ one.
72
83
  done
73
84
  ```
74
85
 
86
+ **Windows PowerShell (`generate_docs.ps1`)**
87
+
88
+ ```powershell
89
+ # Loop through all Python files
90
+ Get-ChildItem -Filter *.py | ForEach-Object {
91
+ Write-Host "Generating docs for $($_.Name)..."
92
+
93
+ $newName = $_.Name -replace '\.py$', '.md'
94
+ # Ask Gemini CLI to generate the documentation and print it to stdout
95
+ gemini "Generate a Markdown documentation summary for @$($_.Name). Print the result to standard output." | Out-File -FilePath $newName -Encoding utf8
96
+ }
97
+ ```
98
+
75
99
  2. Make the script executable and run it in your directory:
76
100
 
101
+ **macOS/Linux**
102
+
77
103
  ```bash
78
104
  chmod +x generate_docs.sh
79
105
  ./generate_docs.sh
80
106
  ```
81
107
 
108
+ **Windows (PowerShell)**
109
+
110
+ ```powershell
111
+ .\generate_docs.ps1
112
+ ```
113
+
82
114
  This creates a corresponding Markdown file for every Python file in the
83
115
  folder.
84
116
 
@@ -90,7 +122,10 @@ like `jq`. To get pure JSON data from the model, combine the
90
122
 
91
123
  ### Scenario: Extract and return structured data
92
124
 
93
- 1. Save the following script as `generate_json.sh`:
125
+ 1. Save the following script as `generate_json.sh` (or `generate_json.ps1` for
126
+ Windows):
127
+
128
+ **macOS/Linux (`generate_json.sh`)**
94
129
 
95
130
  ```bash
96
131
  #!/bin/bash
@@ -105,13 +140,35 @@ like `jq`. To get pure JSON data from the model, combine the
105
140
  gemini --output-format json "Return a raw JSON object with keys 'version' and 'deps' from @package.json" | jq -r '.response' > data.json
106
141
  ```
107
142
 
108
- 2. Run `generate_json.sh`:
143
+ **Windows PowerShell (`generate_json.ps1`)**
144
+
145
+ ```powershell
146
+ # Ensure we are in a project root
147
+ if (-not (Test-Path "package.json")) {
148
+ Write-Error "Error: package.json not found."
149
+ exit 1
150
+ }
151
+
152
+ # Extract data (requires jq installed, or you can use ConvertFrom-Json)
153
+ $output = gemini --output-format json "Return a raw JSON object with keys 'version' and 'deps' from @package.json" | ConvertFrom-Json
154
+ $output.response | Out-File -FilePath data.json -Encoding utf8
155
+ ```
156
+
157
+ 2. Run the script:
158
+
159
+ **macOS/Linux**
109
160
 
110
161
  ```bash
111
162
  chmod +x generate_json.sh
112
163
  ./generate_json.sh
113
164
  ```
114
165
 
166
+ **Windows (PowerShell)**
167
+
168
+ ```powershell
169
+ .\generate_json.ps1
170
+ ```
171
+
115
172
  3. Check `data.json`. The file should look like this:
116
173
 
117
174
  ```json
@@ -129,8 +186,10 @@ Use headless mode to perform custom, automated AI tasks.
129
186
 
130
187
  ### Scenario: Create a "Smart Commit" alias
131
188
 
132
- You can add a function to your shell configuration (like `.zshrc` or `.bashrc`)
133
- to create a `git commit` wrapper that writes the message for you.
189
+ You can add a function to your shell configuration to create a `git commit`
190
+ wrapper that writes the message for you.
191
+
192
+ **macOS/Linux (Bash/Zsh)**
134
193
 
135
194
  1. Open your `.zshrc` file (or `.bashrc` if you use Bash) in your preferred
136
195
  text editor.
@@ -170,6 +229,43 @@ to create a `git commit` wrapper that writes the message for you.
170
229
  source ~/.zshrc
171
230
  ```
172
231
 
232
+ **Windows (PowerShell)**
233
+
234
+ 1. Open your PowerShell profile in your preferred text editor.
235
+
236
+ ```powershell
237
+ notepad $PROFILE
238
+ ```
239
+
240
+ 2. Scroll to the very bottom of the file and paste this code:
241
+
242
+ ```powershell
243
+ function gcommit {
244
+ # Get the diff of staged changes
245
+ $diff = git diff --staged
246
+
247
+ if (-not $diff) {
248
+ Write-Host "No staged changes to commit."
249
+ return
250
+ }
251
+
252
+ # Ask Gemini to write the message
253
+ Write-Host "Generating commit message..."
254
+ $msg = $diff | gemini "Write a concise Conventional Commit message for this diff. Output ONLY the message."
255
+
256
+ # Commit with the generated message
257
+ git commit -m "$msg"
258
+ }
259
+ ```
260
+
261
+ Save your file and exit.
262
+
263
+ 3. Run this command to make the function available immediately:
264
+
265
+ ```powershell
266
+ . $PROFILE
267
+ ```
268
+
173
269
  4. Use your new command:
174
270
 
175
271
  ```bash
@@ -20,10 +20,18 @@ Most MCP servers require authentication. For GitHub, you need a PAT.
20
20
  **Read/Write** access to **Issues** and **Pull Requests**.
21
21
  3. Store it in your environment:
22
22
 
23
+ **macOS/Linux**
24
+
23
25
  ```bash
24
26
  export GITHUB_PERSONAL_ACCESS_TOKEN="github_pat_..."
25
27
  ```
26
28
 
29
+ **Windows (PowerShell)**
30
+
31
+ ```powershell
32
+ $env:GITHUB_PERSONAL_ACCESS_TOKEN="github_pat_..."
33
+ ```
34
+
27
35
  ## How to configure Gemini CLI
28
36
 
29
37
  You tell Gemini about new servers by editing your `settings.json`.
@@ -14,10 +14,18 @@ responding correctly.
14
14
 
15
15
  1. Run the following command to create the folders:
16
16
 
17
+ **macOS/Linux**
18
+
17
19
  ```bash
18
20
  mkdir -p .gemini/skills/api-auditor/scripts
19
21
  ```
20
22
 
23
+ **Windows (PowerShell)**
24
+
25
+ ```powershell
26
+ New-Item -ItemType Directory -Force -Path ".gemini\skills\api-auditor\scripts"
27
+ ```
28
+
21
29
  ### Create the definition
22
30
 
23
31
  1. Create a file at `.gemini/skills/api-auditor/SKILL.md`. This tells the agent