RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Diff/herringtondarkholme-megarepo-clinerules-02-development ↔ herringtondarkholme-megarepo-gemini

Comparison

A · Cline rules · HerringtonDarkholme/megarepoB · GEMINI.md · HerringtonDarkholme/megarepo
What each file covers, counted
DimensionSharedOnly in AOnly in BOverlap
Sections014230%
Commands0320%
Section tags52445%

What each file covers

Sections

0 shared · 14 only in A · 23 only in B
  • − Development Guidelines
  • − Technology Stack
  • − When Source Code is Added
  • − Always verify package.json exists first
  • − Install dependencies with appropriate timeout
  • − Build with extended timeout for AI projects
  • − Run tests with adequate time
  • − Build with reasonable timeout for most projects
  • − AI Integration Best Practices
  • − Preferred AI Dependencies
  • − Code Organization
  • − Error Handling Pattern
  • − File Structure Standards
  • − Development Workflow
  • + Gemini CLI Configuration
  • + Configuration layers
  • + Settings files
  • + The `.gemini` directory in your project
  • + Available settings in `settings.json`:
  • + Example `settings.json`:
  • + Shell History
  • + Environment Variables & `.env` Files
  • + Command-Line Arguments
  • + Context Files (Hierarchical Instructional Context)
  • + Example Context File Content (e.g., `GEMINI.md`)
  • + Project: My Awesome TypeScript Library
  • + General Instructions:
  • + Coding Style:
  • + Specific Component: `src/api/client.ts`
  • + Regarding Dependencies:
  • + Context File Management Commands
  • + Best Practices for Context Files
  • + Usage Statistics
  • + Sandboxing
  • + Types of Sandboxing
  • + Configuration
  • + Custom Sandbox Profiles

Commands

0 shared · 3 only in A · 2 only in B
  • − npm install
  • − npm run build
  • − npm test
  • + docker
  • + npm start -- --model gemini-1.5-pro-latest

Section tags

5 shared · 2 only in A · 4 only in B
  • − build
  • − test
  • + types
  • + api
  • + ui
  • + docs
  •   setup
  •   code-style
  •   architecture
  •   dependencies
  •   agent-behaviour

Line diff

+554 added−72 removed16 unchanged2.8% identical
HerringtonDarkholme/megarepo · .clinerules/02-development.md
@@ −1 @@
1# Development Guidelines
2 
3## Technology Stack
4This repository is pre-configured for **Node.js/Next.js development** with AI integrations.
5 
6### When Source Code is Added
7Follow these patterns based on existing repository guidelines:
8 
9```bash
10# Always verify package.json exists first
11test -f package.json && echo "Node.js project detected" || echo "No package.json found"
12 
13# Install dependencies with appropriate timeout
14npm install # Allow 10+ minutes for completion
 
 
 
 
15 
16# Build with extended timeout for AI projects
17npm run build # Allow 60+ minutes - AI projects can have complex builds
18 
19# Run tests with adequate time
20npm test # Allow 30+ minutes for comprehensive test suites
21```
22# Build with reasonable timeout for most projects
23npm run build # Allow 15-30 minutes for most Node.js/Next.js builds with AI integrations
24 
25# Run tests with adequate time
26npm test # Allow 30+ minutes for comprehensive test suites
27## AI Integration Best Practices
 
 
 
 
 
 
28 
29### Preferred AI Dependencies
30When adding AI functionality, use these established packages:
31- `openai` - Official OpenAI API client
32- `@langchain/core` - LangChain framework for AI workflows
33- `@vercel/ai` - Vercel AI SDK for streaming and UI integration
34- `@huggingface/inference` - Hugging Face API client
35- `@anthropic-ai/sdk` - Anthropic Claude API client
36 
37### Code Organization
38- Place AI client configurations in `src/lib/` directory
39- Create reusable AI components in `src/components/ai/`
40- Implement API routes for AI services in `src/app/api/` (Next.js App Router)
41- Define TypeScript types for AI responses in `src/types/`
42 
43### Error Handling Pattern
44```javascript
45// Implement comprehensive error handling for AI services
46try {
47 const response = await aiClient.chat.completions.create({
48 model: "gpt-4",
49 messages: [{ role: "user", content: prompt }]
50 });
51 return response.choices[0].message.content;
52} catch (error) {
53 if (error.code === 'rate_limit_exceeded') {
54 throw new AIRateLimitError('Rate limit exceeded, please try again later');
55 }
56 if (error.code === 'insufficient_quota') {
57 throw new AIQuotaError('API quota exceeded');
58 }
59 throw new AIServiceError(`AI service failed: ${error.message}`);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60}
61```
62 
63## File Structure Standards
64Follow the established minimal structure and expand thoughtfully:
65 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66```
67.
68├── .clinerules/ # Cline AI rules (this directory)
69├── .github/ # GitHub workflows and Copilot instructions
70├── .kiro/steering/ # Kiro AI steering files
71├── .cursorrules # Cursor AI development rules
72├── CLAUDE.md # Claude AI specific configuration
73├── GEMINI.md # Gemini CLI configuration
74├── AGENT.md # Universal AI agent instructions
75├── package.json # Dependencies and scripts (when added)
76├── src/ # Source code (when added)
77│ ├── lib/ # AI clients and utilities
78│ ├── components/ # React components including AI components
79│ ├── app/ # Next.js App Router (pages and API routes)
80│ └── types/ # TypeScript definitions
81└── public/ # Static assets
82```
83 
84## Development Workflow
851. **Before Changes**: Check repository state and existing patterns
862. **During Development**: Follow TypeScript best practices and AI patterns
873. **Testing**: Include AI service mocks and error scenario testing
884. **Documentation**: Update relevant AI configuration files as needed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
HerringtonDarkholme/megarepo · GEMINI.md
@@ +1 @@
1# Gemini CLI Configuration
2 
3Gemini CLI offers several ways to configure its behavior, including environment variables, command-line arguments, and settings files. This document outlines the different configuration methods and available settings.
 
4 
5## Configuration layers
 
6 
7Configuration is applied in the following order of precedence (lower numbers are overridden by higher numbers):
 
 
8 
91. **Default values:** Hardcoded defaults within the application.
102. **User settings file:** Global settings for the current user.
113. **Project settings file:** Project-specific settings.
124. **System settings file:** System-wide settings.
135. **Environment variables:** System-wide or session-specific variables, potentially loaded from `.env` files.
146. **Command-line arguments:** Values passed when launching the CLI.
15 
16## Settings files
 
17 
18Gemini CLI uses `settings.json` files for persistent configuration. There are three locations for these files:
 
 
 
 
19 
20- **User settings file:**
21 - **Location:** `~/.gemini/settings.json` (where `~` is your home directory).
22 - **Scope:** Applies to all Gemini CLI sessions for the current user.
23- **Project settings file:**
24 - **Location:** `.gemini/settings.json` within your project's root directory.
25 - **Scope:** Applies only when running Gemini CLI from that specific project. Project settings override user settings.
26- **System settings file:**
27 - **Location:** `/etc/gemini-cli/settings.json` (Linux), `C:\ProgramData\gemini-cli\settings.json` (Windows) or `/Library/Application Support/GeminiCli/settings.json` (macOS). The path can be overridden using the `GEMINI_CLI_SYSTEM_SETTINGS_PATH` environment variable.
28 - **Scope:** Applies to all Gemini CLI sessions on the system, for all users. System settings override user and project settings. May be useful for system administrators at enterprises to have controls over users' Gemini CLI setups.
29 
30**Note on environment variables in settings:** String values within your `settings.json` files can reference environment variables using either `$VAR_NAME` or `${VAR_NAME}` syntax. These variables will be automatically resolved when the settings are loaded. For example, if you have an environment variable `MY_API_TOKEN`, you could use it in `settings.json` like this: `"apiKey": "$MY_API_TOKEN"`.
 
 
 
 
 
 
31 
32### The `.gemini` directory in your project
 
 
 
 
33 
34In addition to a project settings file, a project's `.gemini` directory can contain other project-specific files related to Gemini CLI's operation, such as:
35 
36- [Custom sandbox profiles](#sandboxing) (e.g., `.gemini/sandbox-macos-custom.sb`, `.gemini/sandbox.Dockerfile`).
37 
38### Available settings in `settings.json`:
39 
40- **`contextFileName`** (string or array of strings):
41 - **Description:** Specifies the filename for context files (e.g., `GEMINI.md`, `AGENTS.md`). Can be a single filename or a list of accepted filenames.
42 - **Default:** `GEMINI.md`
43 - **Example:** `"contextFileName": "AGENTS.md"`
44 
45- **`bugCommand`** (object):
46 - **Description:** Overrides the default URL for the `/bug` command.
47 - **Default:** `"urlTemplate": "https://github.com/google-gemini/gemini-cli/issues/new?template=bug_report.yml&title={title}&info={info}"`
48 - **Properties:**
49 - **`urlTemplate`** (string): A URL that can contain `{title}` and `{info}` placeholders.
50 - **Example:**
51 ```json
52 "bugCommand": {
53 "urlTemplate": "https://bug.example.com/new?title={title}&info={info}"
54 }
55 ```
56 
57- **`fileFiltering`** (object):
58 - **Description:** Controls git-aware file filtering behavior for @ commands and file discovery tools.
59 - **Default:** `"respectGitIgnore": true, "enableRecursiveFileSearch": true`
60 - **Properties:**
61 - **`respectGitIgnore`** (boolean): Whether to respect .gitignore patterns when discovering files. When set to `true`, git-ignored files (like `node_modules/`, `dist/`, `.env`) are automatically excluded from @ commands and file listing operations.
62 - **`enableRecursiveFileSearch`** (boolean): Whether to enable searching recursively for filenames under the current tree when completing @ prefixes in the prompt.
63 - **Example:**
64 ```json
65 "fileFiltering": {
66 "respectGitIgnore": true,
67 "enableRecursiveFileSearch": false
68 }
69 ```
70 
71- **`coreTools`** (array of strings):
72 - **Description:** Allows you to specify a list of core tool names that should be made available to the model. This can be used to restrict the set of built-in tools. See [Built-in Tools](../core/tools-api.md#built-in-tools) for a list of core tools. You can also specify command-specific restrictions for tools that support it, like the `ShellTool`. For example, `"coreTools": ["ShellTool(ls -l)"]` will only allow the `ls -l` command to be executed.
73 - **Default:** All tools available for use by the Gemini model.
74 - **Example:** `"coreTools": ["ReadFileTool", "GlobTool", "ShellTool(ls)"]`.
75 
76- **`excludeTools`** (array of strings):
77 - **Description:** Allows you to specify a list of core tool names that should be excluded from the model. A tool listed in both `excludeTools` and `coreTools` is excluded. You can also specify command-specific restrictions for tools that support it, like the `ShellTool`. For example, `"excludeTools": ["ShellTool(rm -rf)"]` will block the `rm -rf` command.
78 - **Default**: No tools excluded.
79 - **Example:** `"excludeTools": ["run_shell_command", "findFiles"]`.
80 - **Security Note:** Command-specific restrictions in
81 `excludeTools` for `run_shell_command` are based on simple string matching and can be easily bypassed. This feature is **not a security mechanism** and should not be relied upon to safely execute untrusted code. It is recommended to use `coreTools` to explicitly select commands
82 that can be executed.
83 
84- **`allowMCPServers`** (array of strings):
85 - **Description:** Allows you to specify a list of MCP server names that should be made available to the model. This can be used to restrict the set of MCP servers to connect to. Note that this will be ignored if `--allowed-mcp-server-names` is set.
86 - **Default:** All MCP servers are available for use by the Gemini model.
87 - **Example:** `"allowMCPServers": ["myPythonServer"]`.
88 - **Security Note:** This uses simple string matching on MCP server names, which can be modified. If you're a system administrator looking to prevent users from bypassing this, consider configuring the `mcpServers` at the system settings level such that the user will not be able to configure any MCP servers of their own. This should not be used as an airtight security mechanism.
89 
90- **`excludeMCPServers`** (array of strings):
91 - **Description:** Allows you to specify a list of MCP server names that should be excluded from the model. A server listed in both `excludeMCPServers` and `allowMCPServers` is excluded. Note that this will be ignored if `--allowed-mcp-server-names` is set.
92 - **Default**: No MCP servers excluded.
93 - **Example:** `"excludeMCPServers": ["myNodeServer"]`.
94 - **Security Note:** This uses simple string matching on MCP server names, which can be modified. If you're a system administrator looking to prevent users from bypassing this, consider configuring the `mcpServers` at the system settings level such that the user will not be able to configure any MCP servers of their own. This should not be used as an airtight security mechanism.
95 
96- **`autoAccept`** (boolean):
97 - **Description:** Controls whether the CLI automatically accepts and executes tool calls that are considered safe (e.g., read-only operations) without explicit user confirmation. If set to `true`, the CLI will bypass the confirmation prompt for tools deemed safe.
98 - **Default:** `false`
99 - **Example:** `"autoAccept": true`
100 
101- **`theme`** (string):
102 - **Description:** Sets the visual [theme](./themes.md) for Gemini CLI.
103 - **Default:** `"Default"`
104 - **Example:** `"theme": "GitHub"`
105 
106- **`vimMode`** (boolean):
107 - **Description:** Enables or disables vim mode for input editing. When enabled, the input area supports vim-style navigation and editing commands with NORMAL and INSERT modes. The vim mode status is displayed in the footer and persists between sessions.
108 - **Default:** `false`
109 - **Example:** `"vimMode": true`
110 
111- **`sandbox`** (boolean or string):
112 - **Description:** Controls whether and how to use sandboxing for tool execution. If set to `true`, Gemini CLI uses a pre-built `gemini-cli-sandbox` Docker image. For more information, see [Sandboxing](#sandboxing).
113 - **Default:** `false`
114 - **Example:** `"sandbox": "docker"`
115 
116- **`toolDiscoveryCommand`** (string):
117 - **Description:** Defines a custom shell command for discovering tools from your project. The shell command must return on `stdout` a JSON array of [function declarations](https://ai.google.dev/gemini-api/docs/function-calling#function-declarations). Tool wrappers are optional.
118 - **Default:** Empty
119 - **Example:** `"toolDiscoveryCommand": "bin/get_tools"`
120 
121- **`toolCallCommand`** (string):
122 - **Description:** Defines a custom shell command for calling a specific tool that was discovered using `toolDiscoveryCommand`. The shell command must meet the following criteria:
123 - It must take function `name` (exactly as in [function declaration](https://ai.google.dev/gemini-api/docs/function-calling#function-declarations)) as first command line argument.
124 - It must read function arguments as JSON on `stdin`, analogous to [`functionCall.args`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#functioncall).
125 - It must return function output as JSON on `stdout`, analogous to [`functionResponse.response.content`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#functionresponse).
126 - **Default:** Empty
127 - **Example:** `"toolCallCommand": "bin/call_tool"`
128 
129- **`mcpServers`** (object):
130 - **Description:** Configures connections to one or more Model-Context Protocol (MCP) servers for discovering and using custom tools. Gemini CLI attempts to connect to each configured MCP server to discover available tools. If multiple MCP servers expose a tool with the same name, the tool names will be prefixed with the server alias you defined in the configuration (e.g., `serverAlias__actualToolName`) to avoid conflicts. Note that the system might strip certain schema properties from MCP tool definitions for compatibility.
131 - **Default:** Empty
132 - **Properties:**
133 - **`<SERVER_NAME>`** (object): The server parameters for the named server.
134 - `command` (string, required): The command to execute to start the MCP server.
135 - `args` (array of strings, optional): Arguments to pass to the command.
136 - `env` (object, optional): Environment variables to set for the server process.
137 - `cwd` (string, optional): The working directory in which to start the server.
138 - `timeout` (number, optional): Timeout in milliseconds for requests to this MCP server.
139 - `trust` (boolean, optional): Trust this server and bypass all tool call confirmations.
140 - `includeTools` (array of strings, optional): List of tool names to include from this MCP server. When specified, only the tools listed here will be available from this server (whitelist behavior). If not specified, all tools from the server are enabled by default.
141 - `excludeTools` (array of strings, optional): List of tool names to exclude from this MCP server. Tools listed here will not be available to the model, even if they are exposed by the server. **Note:** `excludeTools` takes precedence over `includeTools` - if a tool is in both lists, it will be excluded.
142 - **Example:**
143 ```json
144 "mcpServers": {
145 "myPythonServer": {
146 "command": "python",
147 "args": ["mcp_server.py", "--port", "8080"],
148 "cwd": "./mcp_tools/python",
149 "timeout": 5000,
150 "includeTools": ["safe_tool", "file_reader"],
151 },
152 "myNodeServer": {
153 "command": "node",
154 "args": ["mcp_server.js"],
155 "cwd": "./mcp_tools/node",
156 "excludeTools": ["dangerous_tool", "file_deleter"]
157 },
158 "myDockerServer": {
159 "command": "docker",
160 "args": ["run", "-i", "--rm", "-e", "API_KEY", "ghcr.io/foo/bar"],
161 "env": {
162 "API_KEY": "$MY_API_TOKEN"
163 }
164 }
165 }
166 ```
167 
168- **`checkpointing`** (object):
169 - **Description:** Configures the checkpointing feature, which allows you to save and restore conversation and file states. See the [Checkpointing documentation](../checkpointing.md) for more details.
170 - **Default:** `{"enabled": false}`
171 - **Properties:**
172 - **`enabled`** (boolean): When `true`, the `/restore` command is available.
173 
174- **`preferredEditor`** (string):
175 - **Description:** Specifies the preferred editor to use for viewing diffs.
176 - **Default:** `vscode`
177 - **Example:** `"preferredEditor": "vscode"`
178 
179- **`telemetry`** (object)
180 - **Description:** Configures logging and metrics collection for Gemini CLI. For more information, see [Telemetry](../telemetry.md).
181 - **Default:** `{"enabled": false, "target": "local", "otlpEndpoint": "http://localhost:4317", "logPrompts": true}`
182 - **Properties:**
183 - **`enabled`** (boolean): Whether or not telemetry is enabled.
184 - **`target`** (string): The destination for collected telemetry. Supported values are `local` and `gcp`.
185 - **`otlpEndpoint`** (string): The endpoint for the OTLP Exporter.
186 - **`logPrompts`** (boolean): Whether or not to include the content of user prompts in the logs.
187 - **Example:**
188 ```json
189 "telemetry": {
190 "enabled": true,
191 "target": "local",
192 "otlpEndpoint": "http://localhost:16686",
193 "logPrompts": false
194 }
195 ```
196- **`usageStatisticsEnabled`** (boolean):
197 - **Description:** Enables or disables the collection of usage statistics. See [Usage Statistics](#usage-statistics) for more information.
198 - **Default:** `true`
199 - **Example:**
200 ```json
201 "usageStatisticsEnabled": false
202 ```
203 
204- **`hideTips`** (boolean):
205 - **Description:** Enables or disables helpful tips in the CLI interface.
206 - **Default:** `false`
207 - **Example:**
208 
209 ```json
210 "hideTips": true
211 ```
212 
213- **`hideBanner`** (boolean):
214 - **Description:** Enables or disables the startup banner (ASCII art logo) in the CLI interface.
215 - **Default:** `false`
216 - **Example:**
217 
218 ```json
219 "hideBanner": true
220 ```
221 
222- **`maxSessionTurns`** (number):
223 - **Description:** Sets the maximum number of turns for a session. If the session exceeds this limit, the CLI will stop processing and start a new chat.
224 - **Default:** `-1` (unlimited)
225 - **Example:**
226 ```json
227 "maxSessionTurns": 10
228 ```
229 
230- **`summarizeToolOutput`** (object):
231 - **Description:** Enables or disables the summarization of tool output. You can specify the token budget for the summarization using the `tokenBudget` setting.
232 - Note: Currently only the `run_shell_command` tool is supported.
233 - **Default:** `{}` (Disabled by default)
234 - **Example:**
235 ```json
236 "summarizeToolOutput": {
237 "run_shell_command": {
238 "tokenBudget": 2000
239 }
240 }
241 ```
242 
243- **`excludedProjectEnvVars`** (array of strings):
244 - **Description:** Specifies environment variables that should be excluded from being loaded from project `.env` files. This prevents project-specific environment variables (like `DEBUG=true`) from interfering with gemini-cli behavior. Variables from `.gemini/.env` files are never excluded.
245 - **Default:** `["DEBUG", "DEBUG_MODE"]`
246 - **Example:**
247 ```json
248 "excludedProjectEnvVars": ["DEBUG", "DEBUG_MODE", "NODE_ENV"]
249 ```
250 
251- **`includeDirectories`** (array of strings):
252 - **Description:** Specifies an array of additional absolute or relative paths to include in the workspace context. This allows you to work with files across multiple directories as if they were one. Paths can use `~` to refer to the user's home directory. This setting can be combined with the `--include-directories` command-line flag.
253 - **Default:** `[]`
254 - **Example:**
255 ```json
256 "includeDirectories": [
257 "/path/to/another/project",
258 "../shared-library",
259 "~/common-utils"
260 ]
261 ```
262 
263- **`loadMemoryFromIncludeDirectories`** (boolean):
264 - **Description:** Controls the behavior of the `/memory refresh` command. If set to `true`, `GEMINI.md` files should be loaded from all directories that are added. If set to `false`, `GEMINI.md` should only be loaded from the current directory.
265 - **Default:** `false`
266 - **Example:**
267 ```json
268 "loadMemoryFromIncludeDirectories": true
269 ```
270 
271- **`chatCompression`** (object):
272 - **Description:** Controls the settings for chat history compression, both automatic and
273 when manually invoked through the /compress command.
274 - **Properties:**
275 - **`contextPercentageThreshold`** (number): A value between 0 and 1 that specifies the token threshold for compression as a percentage of the model's total token limit. For example, a value of `0.6` will trigger compression when the chat history exceeds 60% of the token limit.
276 - **Example:**
277 ```json
278 "chatCompression": {
279 "contextPercentageThreshold": 0.6
280 }
281 ```
282 
283- **`showLineNumbers`** (boolean):
284 - **Description:** Controls whether line numbers are displayed in code blocks in the CLI output.
285 - **Default:** `true`
286 - **Example:**
287 ```json
288 "showLineNumbers": false
289 ```
290 
291### Example `settings.json`:
292 
293```json
294{
295 "theme": "GitHub",
296 "sandbox": "docker",
297 "toolDiscoveryCommand": "bin/get_tools",
298 "toolCallCommand": "bin/call_tool",
299 "mcpServers": {
300 "mainServer": {
301 "command": "bin/mcp_server.py"
302 },
303 "anotherServer": {
304 "command": "node",
305 "args": ["mcp_server.js", "--verbose"]
306 }
307 },
308 "telemetry": {
309 "enabled": true,
310 "target": "local",
311 "otlpEndpoint": "http://localhost:4317",
312 "logPrompts": true
313 },
314 "usageStatisticsEnabled": true,
315 "hideTips": false,
316 "hideBanner": false,
317 "maxSessionTurns": 10,
318 "summarizeToolOutput": {
319 "run_shell_command": {
320 "tokenBudget": 100
321 }
322 },
323 "excludedProjectEnvVars": ["DEBUG", "DEBUG_MODE", "NODE_ENV"],
324 "includeDirectories": ["path/to/dir1", "~/path/to/dir2", "../path/to/dir3"],
325 "loadMemoryFromIncludeDirectories": true
326}
327```
328 
329## Shell History
 
330 
331The CLI keeps a history of shell commands you run. To avoid conflicts between different projects, this history is stored in a project-specific directory within your user's home folder.
332 
333- **Location:** `~/.gemini/tmp/<project_hash>/shell_history`
334 - `<project_hash>` is a unique identifier generated from your project's root path.
335 - The history is stored in a file named `shell_history`.
336 
337## Environment Variables & `.env` Files
338 
339Environment variables are a common way to configure applications, especially for sensitive information like API keys or for settings that might change between environments.
340 
341The CLI automatically loads environment variables from an `.env` file. The loading order is:
342 
3431. `.env` file in the current working directory.
3442. If not found, it searches upwards in parent directories until it finds an `.env` file or reaches the project root (identified by a `.git` folder) or the home directory.
3453. If still not found, it looks for `~/.env` (in the user's home directory).
346 
347**Environment Variable Exclusion:** Some environment variables (like `DEBUG` and `DEBUG_MODE`) are automatically excluded from being loaded from project `.env` files to prevent interference with gemini-cli behavior. Variables from `.gemini/.env` files are never excluded. You can customize this behavior using the `excludedProjectEnvVars` setting in your `settings.json` file.
348 
349- **`GEMINI_API_KEY`** (Required):
350 - Your API key for the Gemini API.
351 - **Crucial for operation.** The CLI will not function without it.
352 - Set this in your shell profile (e.g., `~/.bashrc`, `~/.zshrc`) or an `.env` file.
353- **`GEMINI_MODEL`**:
354 - Specifies the default Gemini model to use.
355 - Overrides the hardcoded default
356 - Example: `export GEMINI_MODEL="gemini-2.5-flash"`
357- **`GOOGLE_API_KEY`**:
358 - Your Google Cloud API key.
359 - Required for using Vertex AI in express mode.
360 - Ensure you have the necessary permissions.
361 - Example: `export GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY"`.
362- **`GOOGLE_CLOUD_PROJECT`**:
363 - Your Google Cloud Project ID.
364 - Required for using Code Assist or Vertex AI.
365 - If using Vertex AI, ensure you have the necessary permissions in this project.
366 - **Cloud Shell Note:** When running in a Cloud Shell environment, this variable defaults to a special project allocated for Cloud Shell users. If you have `GOOGLE_CLOUD_PROJECT` set in your global environment in Cloud Shell, it will be overridden by this default. To use a different project in Cloud Shell, you must define `GOOGLE_CLOUD_PROJECT` in a `.env` file.
367 - Example: `export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"`.
368- **`GOOGLE_APPLICATION_CREDENTIALS`** (string):
369 - **Description:** The path to your Google Application Credentials JSON file.
370 - **Example:** `export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/credentials.json"`
371- **`OTLP_GOOGLE_CLOUD_PROJECT`**:
372 - Your Google Cloud Project ID for Telemetry in Google Cloud
373 - Example: `export OTLP_GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"`.
374- **`GOOGLE_CLOUD_LOCATION`**:
375 - Your Google Cloud Project Location (e.g., us-central1).
376 - Required for using Vertex AI in non express mode.
377 - Example: `export GOOGLE_CLOUD_LOCATION="YOUR_PROJECT_LOCATION"`.
378- **`GEMINI_SANDBOX`**:
379 - Alternative to the `sandbox` setting in `settings.json`.
380 - Accepts `true`, `false`, `docker`, `podman`, or a custom command string.
381- **`SEATBELT_PROFILE`** (macOS specific):
382 - Switches the Seatbelt (`sandbox-exec`) profile on macOS.
383 - `permissive-open`: (Default) Restricts writes to the project folder (and a few other folders, see `packages/cli/src/utils/sandbox-macos-permissive-open.sb`) but allows other operations.
384 - `strict`: Uses a strict profile that declines operations by default.
385 - `<profile_name>`: Uses a custom profile. To define a custom profile, create a file named `sandbox-macos<profile_name>.sb` in your project's `.gemini/` directory (e.g., `my-project/.gemini/sandbox-macos-custom.sb`).
386- **`DEBUG` or `DEBUG_MODE`** (often used by underlying libraries or the CLI itself):
387 - Set to `true` or `1` to enable verbose debug logging, which can be helpful for troubleshooting.
388 - **Note:** These variables are automatically excluded from project `.env` files by default to prevent interference with gemini-cli behavior. Use `.gemini/.env` files if you need to set these for gemini-cli specifically.
389- **`NO_COLOR`**:
390 - Set to any value to disable all color output in the CLI.
391- **`CLI_TITLE`**:
392 - Set to a string to customize the title of the CLI.
393- **`CODE_ASSIST_ENDPOINT`**:
394 - Specifies the endpoint for the code assist server.
395 - This is useful for development and testing.
396 
397## Command-Line Arguments
398 
399Arguments passed directly when running the CLI can override other configurations for that specific session.
400 
401- **`--model <model_name>`** (**`-m <model_name>`**):
402 - Specifies the Gemini model to use for this session.
403 - Example: `npm start -- --model gemini-1.5-pro-latest`
404- **`--prompt <your_prompt>`** (**`-p <your_prompt>`**):
405 - Used to pass a prompt directly to the command. This invokes Gemini CLI in a non-interactive mode.
406- **`--prompt-interactive <your_prompt>`** (**`-i <your_prompt>`**):
407 - Starts an interactive session with the provided prompt as the initial input.
408 - The prompt is processed within the interactive session, not before it.
409 - Cannot be used when piping input from stdin.
410 - Example: `gemini -i "explain this code"`
411- **`--sandbox`** (**`-s`**):
412 - Enables sandbox mode for this session.
413- **`--sandbox-image`**:
414 - Sets the sandbox image URI.
415- **`--debug`** (**`-d`**):
416 - Enables debug mode for this session, providing more verbose output.
417- **`--all-files`** (**`-a`**):
418 - If set, recursively includes all files within the current directory as context for the prompt.
419- **`--help`** (or **`-h`**):
420 - Displays help information about command-line arguments.
421- **`--show-memory-usage`**:
422 - Displays the current memory usage.
423- **`--yolo`**:
424 - Enables YOLO mode, which automatically approves all tool calls.
425- **`--approval-mode <mode>`**:
426 - Sets the approval mode for tool calls. Available modes:
427 - `default`: Prompt for approval on each tool call (default behavior)
428 - `auto_edit`: Automatically approve edit tools (replace, write_file) while prompting for others
429 - `yolo`: Automatically approve all tool calls (equivalent to `--yolo`)
430 - Cannot be used together with `--yolo`. Use `--approval-mode=yolo` instead of `--yolo` for the new unified approach.
431 - Example: `gemini --approval-mode auto_edit`
432- **`--telemetry`**:
433 - Enables [telemetry](../telemetry.md).
434- **`--telemetry-target`**:
435 - Sets the telemetry target. See [telemetry](../telemetry.md) for more information.
436- **`--telemetry-otlp-endpoint`**:
437 - Sets the OTLP endpoint for telemetry. See [telemetry](../telemetry.md) for more information.
438- **`--telemetry-otlp-protocol`**:
439 - Sets the OTLP protocol for telemetry (`grpc` or `http`). Defaults to `grpc`. See [telemetry](../telemetry.md) for more information.
440- **`--telemetry-log-prompts`**:
441 - Enables logging of prompts for telemetry. See [telemetry](../telemetry.md) for more information.
442- **`--checkpointing`**:
443 - Enables [checkpointing](../checkpointing.md).
444- **`--extensions <extension_name ...>`** (**`-e <extension_name ...>`**):
445 - Specifies a list of extensions to use for the session. If not provided, all available extensions are used.
446 - Use the special term `gemini -e none` to disable all extensions.
447 - Example: `gemini -e my-extension -e my-other-extension`
448- **`--list-extensions`** (**`-l`**):
449 - Lists all available extensions and exits.
450- **`--proxy`**:
451 - Sets the proxy for the CLI.
452 - Example: `--proxy http://localhost:7890`.
453- **`--include-directories <dir1,dir2,...>`**:
454 - Includes additional directories in the workspace for multi-directory support.
455 - Can be specified multiple times or as comma-separated values.
456 - 5 directories can be added at maximum.
457 - Example: `--include-directories /path/to/project1,/path/to/project2` or `--include-directories /path/to/project1 --include-directories /path/to/project2`
458- **`--version`**:
459 - Displays the version of the CLI.
460 
461## Context Files (Hierarchical Instructional Context)
462 
463While not strictly configuration for the CLI's _behavior_, context files (defaulting to `GEMINI.md` but configurable via the `contextFileName` setting) are crucial for configuring the _instructional context_ (also referred to as "memory") provided to the Gemini model. This powerful feature allows you to give project-specific instructions, coding style guides, or any relevant background information to the AI, making its responses more tailored and accurate to your needs. The CLI includes UI elements, such as an indicator in the footer showing the number of loaded context files, to keep you informed about the active context.
464 
465- **Purpose:** These Markdown files contain instructions, guidelines, or context that you want the Gemini model to be aware of during your interactions. The system is designed to manage this instructional context hierarchically.
466 
467### Example Context File Content (e.g., `GEMINI.md`)
468 
469Here's a conceptual example of what a context file at the root of a TypeScript project might contain:
470 
471```markdown
472# Project: My Awesome TypeScript Library
473 
474## General Instructions:
475 
476- When generating new TypeScript code, please follow the existing coding style.
477- Ensure all new functions and classes have JSDoc comments.
478- Prefer functional programming paradigms where appropriate.
479- All code should be compatible with TypeScript 5.0 and Node.js 20+.
480 
481## Coding Style:
482 
483- Use 2 spaces for indentation.
484- Interface names should be prefixed with `I` (e.g., `IUserService`).
485- Private class members should be prefixed with an underscore (`_`).
486- Always use strict equality (`===` and `!==`).
487 
488## Specific Component: `src/api/client.ts`
489 
490- This file handles all outbound API requests.
491- When adding new API call functions, ensure they include robust error handling and logging.
492- Use the existing `fetchWithRetry` utility for all GET requests.
493 
494## Regarding Dependencies:
495 
496- Avoid introducing new external dependencies unless absolutely necessary.
497- If a new dependency is required, please state the reason.
498```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
499 
500This example demonstrates how you can provide general project context, specific coding conventions, and even notes about particular files or components. The more relevant and precise your context files are, the better the AI can assist you. Project-specific context files are highly encouraged to establish conventions and context.
501 
502- **Hierarchical Loading and Precedence:** The CLI implements a sophisticated hierarchical memory system by loading context files (e.g., `GEMINI.md`) from several locations. Content from files lower in this list (more specific) typically overrides or supplements content from files higher up (more general). The exact concatenation order and final context can be inspected using the `/memory show` command. The typical loading order is:
503 1. **Global Context File:**
504 - Location: `~/.gemini/<contextFileName>` (e.g., `~/.gemini/GEMINI.md` in your user home directory).
505 - Scope: Provides default instructions for all your projects.
506 2. **Project Root & Ancestors Context Files:**
507 - Location: The CLI searches for the configured context file in the current working directory and then in each parent directory up to either the git repository root or the user's home directory.
508 - Scope: Provides project-specific context, with files closer to your current directory taking higher precedence.
509 3. **Include Directories Context Files (if configured):**
510 - Location: Context files from directories specified in `includeDirectories` setting (controlled by `loadMemoryFromIncludeDirectories` setting).
511 - Scope: Additional project context from related directories.
512 
513### Context File Management Commands
514 
515The CLI provides several commands to help you manage and understand your context:
516 
517- **`/memory show`**: Displays the full context that will be provided to the model, including all loaded context files and their sources.
518- **`/memory refresh`**: Reloads all context files from disk, useful when you've made changes to context files during a session.
519- **`/memory clear`**: Temporarily clears the loaded context for the current session (context will be reloaded on next session).
520 
521### Best Practices for Context Files
522 
5231. **Keep it Relevant:** Include information that's directly useful for the tasks you'll be performing with the AI.
5242. **Be Specific:** Provide concrete examples and guidelines rather than vague descriptions.
5253. **Update Regularly:** Keep your context files current with your project's evolution.
5264. **Use Hierarchy:** Place general guidelines in higher-level context files and specific details in project-specific files.
5275. **Test and Iterate:** Use `/memory show` to verify your context is loading correctly and refine based on the AI's responses.
528 
529## Usage Statistics
530 
531Gemini CLI can collect anonymous usage statistics to help improve the tool. This data includes information about command usage, error rates, and performance metrics, but does not include sensitive information like your code, prompts, or personal data.
532 
533- **Control:** You can enable or disable usage statistics collection using the `usageStatisticsEnabled` setting in your `settings.json` file.
534- **Privacy:** All collected data is anonymized and aggregated. No personally identifiable information or code content is collected.
535- **Transparency:** The CLI will inform you when usage statistics are being collected and provide options to opt out.
536 
537## Sandboxing
538 
539Sandboxing provides an additional layer of security when using Gemini CLI by isolating tool execution from your main system. This is particularly useful when working with untrusted code or when you want to limit the potential impact of AI-generated commands.
540 
541### Types of Sandboxing
542 
5431. **Docker Sandboxing** (`"sandbox": "docker"`):
544 - Uses Docker containers to isolate tool execution
545 - Requires Docker to be installed and running
546 - Provides strong isolation from the host system
547 
5482. **Podman Sandboxing** (`"sandbox": "podman"`):
549 - Similar to Docker but uses Podman as the container runtime
550 - Useful in environments where Docker is not available
551 
5523. **Custom Sandboxing** (`"sandbox": "custom-command"`):
553 - Allows you to specify a custom sandboxing command
554 - Provides flexibility for specialized environments
555 
556### Configuration
557 
558You can enable sandboxing through:
559- Settings file: `"sandbox": true` or `"sandbox": "docker"`
560- Environment variable: `GEMINI_SANDBOX=true`
561- Command line: `--sandbox` flag
562 
563### Custom Sandbox Profiles
564 
565For advanced users, you can create custom sandbox profiles by placing configuration files in your project's `.gemini/` directory:
566 
567- **Docker:** `.gemini/sandbox.Dockerfile`
568- **macOS Seatbelt:** `.gemini/sandbox-macos-<profile_name>.sb`
569 
570These custom profiles allow you to define specific security policies and runtime environments for your project's needs.
@@ −1 +1 @@
1−# Development Guidelines
1+# Gemini CLI Configuration
22  
3−## Technology Stack
4−This repository is pre-configured for **Node.js/Next.js development** with AI integrations.
3+Gemini CLI offers several ways to configure its behavior, including environment variables, command-line arguments, and settings files. This document outlines the different configuration methods and available settings.
54  
6−### When Source Code is Added
7−Follow these patterns based on existing repository guidelines:
5+## Configuration layers
86  
9−```bash
10−# Always verify package.json exists first
11−test -f package.json && echo "Node.js project detected" || echo "No package.json found"
7+Configuration is applied in the following order of precedence (lower numbers are overridden by higher numbers):
128  
13−# Install dependencies with appropriate timeout
14−npm install # Allow 10+ minutes for completion
9+1. **Default values:** Hardcoded defaults within the application.
10+2. **User settings file:** Global settings for the current user.
11+3. **Project settings file:** Project-specific settings.
12+4. **System settings file:** System-wide settings.
13+5. **Environment variables:** System-wide or session-specific variables, potentially loaded from `.env` files.
14+6. **Command-line arguments:** Values passed when launching the CLI.
1515  
16−# Build with extended timeout for AI projects
17−npm run build # Allow 60+ minutes - AI projects can have complex builds
16+## Settings files
1817  
19−# Run tests with adequate time
20−npm test # Allow 30+ minutes for comprehensive test suites
21−```
22−# Build with reasonable timeout for most projects
23−npm run build # Allow 15-30 minutes for most Node.js/Next.js builds with AI integrations
18+Gemini CLI uses `settings.json` files for persistent configuration. There are three locations for these files:
2419  
25−# Run tests with adequate time
26−npm test # Allow 30+ minutes for comprehensive test suites
27−## AI Integration Best Practices
20+- **User settings file:**
21+ - **Location:** `~/.gemini/settings.json` (where `~` is your home directory).
22+ - **Scope:** Applies to all Gemini CLI sessions for the current user.
23+- **Project settings file:**
24+ - **Location:** `.gemini/settings.json` within your project's root directory.
25+ - **Scope:** Applies only when running Gemini CLI from that specific project. Project settings override user settings.
26+- **System settings file:**
27+ - **Location:** `/etc/gemini-cli/settings.json` (Linux), `C:\ProgramData\gemini-cli\settings.json` (Windows) or `/Library/Application Support/GeminiCli/settings.json` (macOS). The path can be overridden using the `GEMINI_CLI_SYSTEM_SETTINGS_PATH` environment variable.
28+ - **Scope:** Applies to all Gemini CLI sessions on the system, for all users. System settings override user and project settings. May be useful for system administrators at enterprises to have controls over users' Gemini CLI setups.
2829  
29−### Preferred AI Dependencies
30−When adding AI functionality, use these established packages:
31−- `openai` - Official OpenAI API client
32−- `@langchain/core` - LangChain framework for AI workflows
33−- `@vercel/ai` - Vercel AI SDK for streaming and UI integration
34−- `@huggingface/inference` - Hugging Face API client
35−- `@anthropic-ai/sdk` - Anthropic Claude API client
30+**Note on environment variables in settings:** String values within your `settings.json` files can reference environment variables using either `$VAR_NAME` or `${VAR_NAME}` syntax. These variables will be automatically resolved when the settings are loaded. For example, if you have an environment variable `MY_API_TOKEN`, you could use it in `settings.json` like this: `"apiKey": "$MY_API_TOKEN"`.
3631  
37−### Code Organization
38−- Place AI client configurations in `src/lib/` directory
39−- Create reusable AI components in `src/components/ai/`
40−- Implement API routes for AI services in `src/app/api/` (Next.js App Router)
41−- Define TypeScript types for AI responses in `src/types/`
32+### The `.gemini` directory in your project
4233  
43−### Error Handling Pattern
44−```javascript
45−// Implement comprehensive error handling for AI services
46−try {
47− const response = await aiClient.chat.completions.create({
48− model: "gpt-4",
49− messages: [{ role: "user", content: prompt }]
50− });
51− return response.choices[0].message.content;
52−} catch (error) {
53− if (error.code === 'rate_limit_exceeded') {
54− throw new AIRateLimitError('Rate limit exceeded, please try again later');
55− }
56− if (error.code === 'insufficient_quota') {
57− throw new AIQuotaError('API quota exceeded');
58− }
59− throw new AIServiceError(`AI service failed: ${error.message}`);
34+In addition to a project settings file, a project's `.gemini` directory can contain other project-specific files related to Gemini CLI's operation, such as:
35+ 
36+- [Custom sandbox profiles](#sandboxing) (e.g., `.gemini/sandbox-macos-custom.sb`, `.gemini/sandbox.Dockerfile`).
37+ 
38+### Available settings in `settings.json`:
39+ 
40+- **`contextFileName`** (string or array of strings):
41+ - **Description:** Specifies the filename for context files (e.g., `GEMINI.md`, `AGENTS.md`). Can be a single filename or a list of accepted filenames.
42+ - **Default:** `GEMINI.md`
43+ - **Example:** `"contextFileName": "AGENTS.md"`
44+ 
45+- **`bugCommand`** (object):
46+ - **Description:** Overrides the default URL for the `/bug` command.
47+ - **Default:** `"urlTemplate": "https://github.com/google-gemini/gemini-cli/issues/new?template=bug_report.yml&title={title}&info={info}"`
48+ - **Properties:**
49+ - **`urlTemplate`** (string): A URL that can contain `{title}` and `{info}` placeholders.
50+ - **Example:**
51+ ```json
52+ "bugCommand": {
53+ "urlTemplate": "https://bug.example.com/new?title={title}&info={info}"
54+ }
55+ ```
56+ 
57+- **`fileFiltering`** (object):
58+ - **Description:** Controls git-aware file filtering behavior for @ commands and file discovery tools.
59+ - **Default:** `"respectGitIgnore": true, "enableRecursiveFileSearch": true`
60+ - **Properties:**
61+ - **`respectGitIgnore`** (boolean): Whether to respect .gitignore patterns when discovering files. When set to `true`, git-ignored files (like `node_modules/`, `dist/`, `.env`) are automatically excluded from @ commands and file listing operations.
62+ - **`enableRecursiveFileSearch`** (boolean): Whether to enable searching recursively for filenames under the current tree when completing @ prefixes in the prompt.
63+ - **Example:**
64+ ```json
65+ "fileFiltering": {
66+ "respectGitIgnore": true,
67+ "enableRecursiveFileSearch": false
68+ }
69+ ```
70+ 
71+- **`coreTools`** (array of strings):
72+ - **Description:** Allows you to specify a list of core tool names that should be made available to the model. This can be used to restrict the set of built-in tools. See [Built-in Tools](../core/tools-api.md#built-in-tools) for a list of core tools. You can also specify command-specific restrictions for tools that support it, like the `ShellTool`. For example, `"coreTools": ["ShellTool(ls -l)"]` will only allow the `ls -l` command to be executed.
73+ - **Default:** All tools available for use by the Gemini model.
74+ - **Example:** `"coreTools": ["ReadFileTool", "GlobTool", "ShellTool(ls)"]`.
75+ 
76+- **`excludeTools`** (array of strings):
77+ - **Description:** Allows you to specify a list of core tool names that should be excluded from the model. A tool listed in both `excludeTools` and `coreTools` is excluded. You can also specify command-specific restrictions for tools that support it, like the `ShellTool`. For example, `"excludeTools": ["ShellTool(rm -rf)"]` will block the `rm -rf` command.
78+ - **Default**: No tools excluded.
79+ - **Example:** `"excludeTools": ["run_shell_command", "findFiles"]`.
80+ - **Security Note:** Command-specific restrictions in
81+ `excludeTools` for `run_shell_command` are based on simple string matching and can be easily bypassed. This feature is **not a security mechanism** and should not be relied upon to safely execute untrusted code. It is recommended to use `coreTools` to explicitly select commands
82+ that can be executed.
83+ 
84+- **`allowMCPServers`** (array of strings):
85+ - **Description:** Allows you to specify a list of MCP server names that should be made available to the model. This can be used to restrict the set of MCP servers to connect to. Note that this will be ignored if `--allowed-mcp-server-names` is set.
86+ - **Default:** All MCP servers are available for use by the Gemini model.
87+ - **Example:** `"allowMCPServers": ["myPythonServer"]`.
88+ - **Security Note:** This uses simple string matching on MCP server names, which can be modified. If you're a system administrator looking to prevent users from bypassing this, consider configuring the `mcpServers` at the system settings level such that the user will not be able to configure any MCP servers of their own. This should not be used as an airtight security mechanism.
89+ 
90+- **`excludeMCPServers`** (array of strings):
91+ - **Description:** Allows you to specify a list of MCP server names that should be excluded from the model. A server listed in both `excludeMCPServers` and `allowMCPServers` is excluded. Note that this will be ignored if `--allowed-mcp-server-names` is set.
92+ - **Default**: No MCP servers excluded.
93+ - **Example:** `"excludeMCPServers": ["myNodeServer"]`.
94+ - **Security Note:** This uses simple string matching on MCP server names, which can be modified. If you're a system administrator looking to prevent users from bypassing this, consider configuring the `mcpServers` at the system settings level such that the user will not be able to configure any MCP servers of their own. This should not be used as an airtight security mechanism.
95+ 
96+- **`autoAccept`** (boolean):
97+ - **Description:** Controls whether the CLI automatically accepts and executes tool calls that are considered safe (e.g., read-only operations) without explicit user confirmation. If set to `true`, the CLI will bypass the confirmation prompt for tools deemed safe.
98+ - **Default:** `false`
99+ - **Example:** `"autoAccept": true`
100+ 
101+- **`theme`** (string):
102+ - **Description:** Sets the visual [theme](./themes.md) for Gemini CLI.
103+ - **Default:** `"Default"`
104+ - **Example:** `"theme": "GitHub"`
105+ 
106+- **`vimMode`** (boolean):
107+ - **Description:** Enables or disables vim mode for input editing. When enabled, the input area supports vim-style navigation and editing commands with NORMAL and INSERT modes. The vim mode status is displayed in the footer and persists between sessions.
108+ - **Default:** `false`
109+ - **Example:** `"vimMode": true`
110+ 
111+- **`sandbox`** (boolean or string):
112+ - **Description:** Controls whether and how to use sandboxing for tool execution. If set to `true`, Gemini CLI uses a pre-built `gemini-cli-sandbox` Docker image. For more information, see [Sandboxing](#sandboxing).
113+ - **Default:** `false`
114+ - **Example:** `"sandbox": "docker"`
115+ 
116+- **`toolDiscoveryCommand`** (string):
117+ - **Description:** Defines a custom shell command for discovering tools from your project. The shell command must return on `stdout` a JSON array of [function declarations](https://ai.google.dev/gemini-api/docs/function-calling#function-declarations). Tool wrappers are optional.
118+ - **Default:** Empty
119+ - **Example:** `"toolDiscoveryCommand": "bin/get_tools"`
120+ 
121+- **`toolCallCommand`** (string):
122+ - **Description:** Defines a custom shell command for calling a specific tool that was discovered using `toolDiscoveryCommand`. The shell command must meet the following criteria:
123+ - It must take function `name` (exactly as in [function declaration](https://ai.google.dev/gemini-api/docs/function-calling#function-declarations)) as first command line argument.
124+ - It must read function arguments as JSON on `stdin`, analogous to [`functionCall.args`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#functioncall).
125+ - It must return function output as JSON on `stdout`, analogous to [`functionResponse.response.content`](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#functionresponse).
126+ - **Default:** Empty
127+ - **Example:** `"toolCallCommand": "bin/call_tool"`
128+ 
129+- **`mcpServers`** (object):
130+ - **Description:** Configures connections to one or more Model-Context Protocol (MCP) servers for discovering and using custom tools. Gemini CLI attempts to connect to each configured MCP server to discover available tools. If multiple MCP servers expose a tool with the same name, the tool names will be prefixed with the server alias you defined in the configuration (e.g., `serverAlias__actualToolName`) to avoid conflicts. Note that the system might strip certain schema properties from MCP tool definitions for compatibility.
131+ - **Default:** Empty
132+ - **Properties:**
133+ - **`<SERVER_NAME>`** (object): The server parameters for the named server.
134+ - `command` (string, required): The command to execute to start the MCP server.
135+ - `args` (array of strings, optional): Arguments to pass to the command.
136+ - `env` (object, optional): Environment variables to set for the server process.
137+ - `cwd` (string, optional): The working directory in which to start the server.
138+ - `timeout` (number, optional): Timeout in milliseconds for requests to this MCP server.
139+ - `trust` (boolean, optional): Trust this server and bypass all tool call confirmations.
140+ - `includeTools` (array of strings, optional): List of tool names to include from this MCP server. When specified, only the tools listed here will be available from this server (whitelist behavior). If not specified, all tools from the server are enabled by default.
141+ - `excludeTools` (array of strings, optional): List of tool names to exclude from this MCP server. Tools listed here will not be available to the model, even if they are exposed by the server. **Note:** `excludeTools` takes precedence over `includeTools` - if a tool is in both lists, it will be excluded.
142+ - **Example:**
143+ ```json
144+ "mcpServers": {
145+ "myPythonServer": {
146+ "command": "python",
147+ "args": ["mcp_server.py", "--port", "8080"],
148+ "cwd": "./mcp_tools/python",
149+ "timeout": 5000,
150+ "includeTools": ["safe_tool", "file_reader"],
151+ },
152+ "myNodeServer": {
153+ "command": "node",
154+ "args": ["mcp_server.js"],
155+ "cwd": "./mcp_tools/node",
156+ "excludeTools": ["dangerous_tool", "file_deleter"]
157+ },
158+ "myDockerServer": {
159+ "command": "docker",
160+ "args": ["run", "-i", "--rm", "-e", "API_KEY", "ghcr.io/foo/bar"],
161+ "env": {
162+ "API_KEY": "$MY_API_TOKEN"
163+ }
164+ }
165+ }
166+ ```
167+ 
168+- **`checkpointing`** (object):
169+ - **Description:** Configures the checkpointing feature, which allows you to save and restore conversation and file states. See the [Checkpointing documentation](../checkpointing.md) for more details.
170+ - **Default:** `{"enabled": false}`
171+ - **Properties:**
172+ - **`enabled`** (boolean): When `true`, the `/restore` command is available.
173+ 
174+- **`preferredEditor`** (string):
175+ - **Description:** Specifies the preferred editor to use for viewing diffs.
176+ - **Default:** `vscode`
177+ - **Example:** `"preferredEditor": "vscode"`
178+ 
179+- **`telemetry`** (object)
180+ - **Description:** Configures logging and metrics collection for Gemini CLI. For more information, see [Telemetry](../telemetry.md).
181+ - **Default:** `{"enabled": false, "target": "local", "otlpEndpoint": "http://localhost:4317", "logPrompts": true}`
182+ - **Properties:**
183+ - **`enabled`** (boolean): Whether or not telemetry is enabled.
184+ - **`target`** (string): The destination for collected telemetry. Supported values are `local` and `gcp`.
185+ - **`otlpEndpoint`** (string): The endpoint for the OTLP Exporter.
186+ - **`logPrompts`** (boolean): Whether or not to include the content of user prompts in the logs.
187+ - **Example:**
188+ ```json
189+ "telemetry": {
190+ "enabled": true,
191+ "target": "local",
192+ "otlpEndpoint": "http://localhost:16686",
193+ "logPrompts": false
194+ }
195+ ```
196+- **`usageStatisticsEnabled`** (boolean):
197+ - **Description:** Enables or disables the collection of usage statistics. See [Usage Statistics](#usage-statistics) for more information.
198+ - **Default:** `true`
199+ - **Example:**
200+ ```json
201+ "usageStatisticsEnabled": false
202+ ```
203+ 
204+- **`hideTips`** (boolean):
205+ - **Description:** Enables or disables helpful tips in the CLI interface.
206+ - **Default:** `false`
207+ - **Example:**
208+ 
209+ ```json
210+ "hideTips": true
211+ ```
212+ 
213+- **`hideBanner`** (boolean):
214+ - **Description:** Enables or disables the startup banner (ASCII art logo) in the CLI interface.
215+ - **Default:** `false`
216+ - **Example:**
217+ 
218+ ```json
219+ "hideBanner": true
220+ ```
221+ 
222+- **`maxSessionTurns`** (number):
223+ - **Description:** Sets the maximum number of turns for a session. If the session exceeds this limit, the CLI will stop processing and start a new chat.
224+ - **Default:** `-1` (unlimited)
225+ - **Example:**
226+ ```json
227+ "maxSessionTurns": 10
228+ ```
229+ 
230+- **`summarizeToolOutput`** (object):
231+ - **Description:** Enables or disables the summarization of tool output. You can specify the token budget for the summarization using the `tokenBudget` setting.
232+ - Note: Currently only the `run_shell_command` tool is supported.
233+ - **Default:** `{}` (Disabled by default)
234+ - **Example:**
235+ ```json
236+ "summarizeToolOutput": {
237+ "run_shell_command": {
238+ "tokenBudget": 2000
239+ }
240+ }
241+ ```
242+ 
243+- **`excludedProjectEnvVars`** (array of strings):
244+ - **Description:** Specifies environment variables that should be excluded from being loaded from project `.env` files. This prevents project-specific environment variables (like `DEBUG=true`) from interfering with gemini-cli behavior. Variables from `.gemini/.env` files are never excluded.
245+ - **Default:** `["DEBUG", "DEBUG_MODE"]`
246+ - **Example:**
247+ ```json
248+ "excludedProjectEnvVars": ["DEBUG", "DEBUG_MODE", "NODE_ENV"]
249+ ```
250+ 
251+- **`includeDirectories`** (array of strings):
252+ - **Description:** Specifies an array of additional absolute or relative paths to include in the workspace context. This allows you to work with files across multiple directories as if they were one. Paths can use `~` to refer to the user's home directory. This setting can be combined with the `--include-directories` command-line flag.
253+ - **Default:** `[]`
254+ - **Example:**
255+ ```json
256+ "includeDirectories": [
257+ "/path/to/another/project",
258+ "../shared-library",
259+ "~/common-utils"
260+ ]
261+ ```
262+ 
263+- **`loadMemoryFromIncludeDirectories`** (boolean):
264+ - **Description:** Controls the behavior of the `/memory refresh` command. If set to `true`, `GEMINI.md` files should be loaded from all directories that are added. If set to `false`, `GEMINI.md` should only be loaded from the current directory.
265+ - **Default:** `false`
266+ - **Example:**
267+ ```json
268+ "loadMemoryFromIncludeDirectories": true
269+ ```
270+ 
271+- **`chatCompression`** (object):
272+ - **Description:** Controls the settings for chat history compression, both automatic and
273+ when manually invoked through the /compress command.
274+ - **Properties:**
275+ - **`contextPercentageThreshold`** (number): A value between 0 and 1 that specifies the token threshold for compression as a percentage of the model's total token limit. For example, a value of `0.6` will trigger compression when the chat history exceeds 60% of the token limit.
276+ - **Example:**
277+ ```json
278+ "chatCompression": {
279+ "contextPercentageThreshold": 0.6
280+ }
281+ ```
282+ 
283+- **`showLineNumbers`** (boolean):
284+ - **Description:** Controls whether line numbers are displayed in code blocks in the CLI output.
285+ - **Default:** `true`
286+ - **Example:**
287+ ```json
288+ "showLineNumbers": false
289+ ```
290+ 
291+### Example `settings.json`:
292+ 
293+```json
294+{
295+ "theme": "GitHub",
296+ "sandbox": "docker",
297+ "toolDiscoveryCommand": "bin/get_tools",
298+ "toolCallCommand": "bin/call_tool",
299+ "mcpServers": {
300+ "mainServer": {
301+ "command": "bin/mcp_server.py"
302+ },
303+ "anotherServer": {
304+ "command": "node",
305+ "args": ["mcp_server.js", "--verbose"]
306+ }
307+ },
308+ "telemetry": {
309+ "enabled": true,
310+ "target": "local",
311+ "otlpEndpoint": "http://localhost:4317",
312+ "logPrompts": true
313+ },
314+ "usageStatisticsEnabled": true,
315+ "hideTips": false,
316+ "hideBanner": false,
317+ "maxSessionTurns": 10,
318+ "summarizeToolOutput": {
319+ "run_shell_command": {
320+ "tokenBudget": 100
321+ }
322+ },
323+ "excludedProjectEnvVars": ["DEBUG", "DEBUG_MODE", "NODE_ENV"],
324+ "includeDirectories": ["path/to/dir1", "~/path/to/dir2", "../path/to/dir3"],
325+ "loadMemoryFromIncludeDirectories": true
60326 }
61327 ```
62328  
63−## File Structure Standards
64−Follow the established minimal structure and expand thoughtfully:
329+## Shell History
65330  
331+The CLI keeps a history of shell commands you run. To avoid conflicts between different projects, this history is stored in a project-specific directory within your user's home folder.
332+ 
333+- **Location:** `~/.gemini/tmp/<project_hash>/shell_history`
334+ - `<project_hash>` is a unique identifier generated from your project's root path.
335+ - The history is stored in a file named `shell_history`.
336+ 
337+## Environment Variables & `.env` Files
338+ 
339+Environment variables are a common way to configure applications, especially for sensitive information like API keys or for settings that might change between environments.
340+ 
341+The CLI automatically loads environment variables from an `.env` file. The loading order is:
342+ 
343+1. `.env` file in the current working directory.
344+2. If not found, it searches upwards in parent directories until it finds an `.env` file or reaches the project root (identified by a `.git` folder) or the home directory.
345+3. If still not found, it looks for `~/.env` (in the user's home directory).
346+ 
347+**Environment Variable Exclusion:** Some environment variables (like `DEBUG` and `DEBUG_MODE`) are automatically excluded from being loaded from project `.env` files to prevent interference with gemini-cli behavior. Variables from `.gemini/.env` files are never excluded. You can customize this behavior using the `excludedProjectEnvVars` setting in your `settings.json` file.
348+ 
349+- **`GEMINI_API_KEY`** (Required):
350+ - Your API key for the Gemini API.
351+ - **Crucial for operation.** The CLI will not function without it.
352+ - Set this in your shell profile (e.g., `~/.bashrc`, `~/.zshrc`) or an `.env` file.
353+- **`GEMINI_MODEL`**:
354+ - Specifies the default Gemini model to use.
355+ - Overrides the hardcoded default
356+ - Example: `export GEMINI_MODEL="gemini-2.5-flash"`
357+- **`GOOGLE_API_KEY`**:
358+ - Your Google Cloud API key.
359+ - Required for using Vertex AI in express mode.
360+ - Ensure you have the necessary permissions.
361+ - Example: `export GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY"`.
362+- **`GOOGLE_CLOUD_PROJECT`**:
363+ - Your Google Cloud Project ID.
364+ - Required for using Code Assist or Vertex AI.
365+ - If using Vertex AI, ensure you have the necessary permissions in this project.
366+ - **Cloud Shell Note:** When running in a Cloud Shell environment, this variable defaults to a special project allocated for Cloud Shell users. If you have `GOOGLE_CLOUD_PROJECT` set in your global environment in Cloud Shell, it will be overridden by this default. To use a different project in Cloud Shell, you must define `GOOGLE_CLOUD_PROJECT` in a `.env` file.
367+ - Example: `export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"`.
368+- **`GOOGLE_APPLICATION_CREDENTIALS`** (string):
369+ - **Description:** The path to your Google Application Credentials JSON file.
370+ - **Example:** `export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/credentials.json"`
371+- **`OTLP_GOOGLE_CLOUD_PROJECT`**:
372+ - Your Google Cloud Project ID for Telemetry in Google Cloud
373+ - Example: `export OTLP_GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"`.
374+- **`GOOGLE_CLOUD_LOCATION`**:
375+ - Your Google Cloud Project Location (e.g., us-central1).
376+ - Required for using Vertex AI in non express mode.
377+ - Example: `export GOOGLE_CLOUD_LOCATION="YOUR_PROJECT_LOCATION"`.
378+- **`GEMINI_SANDBOX`**:
379+ - Alternative to the `sandbox` setting in `settings.json`.
380+ - Accepts `true`, `false`, `docker`, `podman`, or a custom command string.
381+- **`SEATBELT_PROFILE`** (macOS specific):
382+ - Switches the Seatbelt (`sandbox-exec`) profile on macOS.
383+ - `permissive-open`: (Default) Restricts writes to the project folder (and a few other folders, see `packages/cli/src/utils/sandbox-macos-permissive-open.sb`) but allows other operations.
384+ - `strict`: Uses a strict profile that declines operations by default.
385+ - `<profile_name>`: Uses a custom profile. To define a custom profile, create a file named `sandbox-macos<profile_name>.sb` in your project's `.gemini/` directory (e.g., `my-project/.gemini/sandbox-macos-custom.sb`).
386+- **`DEBUG` or `DEBUG_MODE`** (often used by underlying libraries or the CLI itself):
387+ - Set to `true` or `1` to enable verbose debug logging, which can be helpful for troubleshooting.
388+ - **Note:** These variables are automatically excluded from project `.env` files by default to prevent interference with gemini-cli behavior. Use `.gemini/.env` files if you need to set these for gemini-cli specifically.
389+- **`NO_COLOR`**:
390+ - Set to any value to disable all color output in the CLI.
391+- **`CLI_TITLE`**:
392+ - Set to a string to customize the title of the CLI.
393+- **`CODE_ASSIST_ENDPOINT`**:
394+ - Specifies the endpoint for the code assist server.
395+ - This is useful for development and testing.
396+ 
397+## Command-Line Arguments
398+ 
399+Arguments passed directly when running the CLI can override other configurations for that specific session.
400+ 
401+- **`--model <model_name>`** (**`-m <model_name>`**):
402+ - Specifies the Gemini model to use for this session.
403+ - Example: `npm start -- --model gemini-1.5-pro-latest`
404+- **`--prompt <your_prompt>`** (**`-p <your_prompt>`**):
405+ - Used to pass a prompt directly to the command. This invokes Gemini CLI in a non-interactive mode.
406+- **`--prompt-interactive <your_prompt>`** (**`-i <your_prompt>`**):
407+ - Starts an interactive session with the provided prompt as the initial input.
408+ - The prompt is processed within the interactive session, not before it.
409+ - Cannot be used when piping input from stdin.
410+ - Example: `gemini -i "explain this code"`
411+- **`--sandbox`** (**`-s`**):
412+ - Enables sandbox mode for this session.
413+- **`--sandbox-image`**:
414+ - Sets the sandbox image URI.
415+- **`--debug`** (**`-d`**):
416+ - Enables debug mode for this session, providing more verbose output.
417+- **`--all-files`** (**`-a`**):
418+ - If set, recursively includes all files within the current directory as context for the prompt.
419+- **`--help`** (or **`-h`**):
420+ - Displays help information about command-line arguments.
421+- **`--show-memory-usage`**:
422+ - Displays the current memory usage.
423+- **`--yolo`**:
424+ - Enables YOLO mode, which automatically approves all tool calls.
425+- **`--approval-mode <mode>`**:
426+ - Sets the approval mode for tool calls. Available modes:
427+ - `default`: Prompt for approval on each tool call (default behavior)
428+ - `auto_edit`: Automatically approve edit tools (replace, write_file) while prompting for others
429+ - `yolo`: Automatically approve all tool calls (equivalent to `--yolo`)
430+ - Cannot be used together with `--yolo`. Use `--approval-mode=yolo` instead of `--yolo` for the new unified approach.
431+ - Example: `gemini --approval-mode auto_edit`
432+- **`--telemetry`**:
433+ - Enables [telemetry](../telemetry.md).
434+- **`--telemetry-target`**:
435+ - Sets the telemetry target. See [telemetry](../telemetry.md) for more information.
436+- **`--telemetry-otlp-endpoint`**:
437+ - Sets the OTLP endpoint for telemetry. See [telemetry](../telemetry.md) for more information.
438+- **`--telemetry-otlp-protocol`**:
439+ - Sets the OTLP protocol for telemetry (`grpc` or `http`). Defaults to `grpc`. See [telemetry](../telemetry.md) for more information.
440+- **`--telemetry-log-prompts`**:
441+ - Enables logging of prompts for telemetry. See [telemetry](../telemetry.md) for more information.
442+- **`--checkpointing`**:
443+ - Enables [checkpointing](../checkpointing.md).
444+- **`--extensions <extension_name ...>`** (**`-e <extension_name ...>`**):
445+ - Specifies a list of extensions to use for the session. If not provided, all available extensions are used.
446+ - Use the special term `gemini -e none` to disable all extensions.
447+ - Example: `gemini -e my-extension -e my-other-extension`
448+- **`--list-extensions`** (**`-l`**):
449+ - Lists all available extensions and exits.
450+- **`--proxy`**:
451+ - Sets the proxy for the CLI.
452+ - Example: `--proxy http://localhost:7890`.
453+- **`--include-directories <dir1,dir2,...>`**:
454+ - Includes additional directories in the workspace for multi-directory support.
455+ - Can be specified multiple times or as comma-separated values.
456+ - 5 directories can be added at maximum.
457+ - Example: `--include-directories /path/to/project1,/path/to/project2` or `--include-directories /path/to/project1 --include-directories /path/to/project2`
458+- **`--version`**:
459+ - Displays the version of the CLI.
460+ 
461+## Context Files (Hierarchical Instructional Context)
462+ 
463+While not strictly configuration for the CLI's _behavior_, context files (defaulting to `GEMINI.md` but configurable via the `contextFileName` setting) are crucial for configuring the _instructional context_ (also referred to as "memory") provided to the Gemini model. This powerful feature allows you to give project-specific instructions, coding style guides, or any relevant background information to the AI, making its responses more tailored and accurate to your needs. The CLI includes UI elements, such as an indicator in the footer showing the number of loaded context files, to keep you informed about the active context.
464+ 
465+- **Purpose:** These Markdown files contain instructions, guidelines, or context that you want the Gemini model to be aware of during your interactions. The system is designed to manage this instructional context hierarchically.
466+ 
467+### Example Context File Content (e.g., `GEMINI.md`)
468+ 
469+Here's a conceptual example of what a context file at the root of a TypeScript project might contain:
470+ 
471+```markdown
472+# Project: My Awesome TypeScript Library
473+ 
474+## General Instructions:
475+ 
476+- When generating new TypeScript code, please follow the existing coding style.
477+- Ensure all new functions and classes have JSDoc comments.
478+- Prefer functional programming paradigms where appropriate.
479+- All code should be compatible with TypeScript 5.0 and Node.js 20+.
480+ 
481+## Coding Style:
482+ 
483+- Use 2 spaces for indentation.
484+- Interface names should be prefixed with `I` (e.g., `IUserService`).
485+- Private class members should be prefixed with an underscore (`_`).
486+- Always use strict equality (`===` and `!==`).
487+ 
488+## Specific Component: `src/api/client.ts`
489+ 
490+- This file handles all outbound API requests.
491+- When adding new API call functions, ensure they include robust error handling and logging.
492+- Use the existing `fetchWithRetry` utility for all GET requests.
493+ 
494+## Regarding Dependencies:
495+ 
496+- Avoid introducing new external dependencies unless absolutely necessary.
497+- If a new dependency is required, please state the reason.
66498 ```
67−.
68−├── .clinerules/ # Cline AI rules (this directory)
69−├── .github/ # GitHub workflows and Copilot instructions
70−├── .kiro/steering/ # Kiro AI steering files
71−├── .cursorrules # Cursor AI development rules
72−├── CLAUDE.md # Claude AI specific configuration
73−├── GEMINI.md # Gemini CLI configuration
74−├── AGENT.md # Universal AI agent instructions
75−├── package.json # Dependencies and scripts (when added)
76−├── src/ # Source code (when added)
77−│ ├── lib/ # AI clients and utilities
78−│ ├── components/ # React components including AI components
79−│ ├── app/ # Next.js App Router (pages and API routes)
80−│ └── types/ # TypeScript definitions
81−└── public/ # Static assets
82−```
83499  
84−## Development Workflow
85−1. **Before Changes**: Check repository state and existing patterns
86−2. **During Development**: Follow TypeScript best practices and AI patterns
87−3. **Testing**: Include AI service mocks and error scenario testing
88−4. **Documentation**: Update relevant AI configuration files as needed
500+This example demonstrates how you can provide general project context, specific coding conventions, and even notes about particular files or components. The more relevant and precise your context files are, the better the AI can assist you. Project-specific context files are highly encouraged to establish conventions and context.
501+ 
502+- **Hierarchical Loading and Precedence:** The CLI implements a sophisticated hierarchical memory system by loading context files (e.g., `GEMINI.md`) from several locations. Content from files lower in this list (more specific) typically overrides or supplements content from files higher up (more general). The exact concatenation order and final context can be inspected using the `/memory show` command. The typical loading order is:
503+ 1. **Global Context File:**
504+ - Location: `~/.gemini/<contextFileName>` (e.g., `~/.gemini/GEMINI.md` in your user home directory).
505+ - Scope: Provides default instructions for all your projects.
506+ 2. **Project Root & Ancestors Context Files:**
507+ - Location: The CLI searches for the configured context file in the current working directory and then in each parent directory up to either the git repository root or the user's home directory.
508+ - Scope: Provides project-specific context, with files closer to your current directory taking higher precedence.
509+ 3. **Include Directories Context Files (if configured):**
510+ - Location: Context files from directories specified in `includeDirectories` setting (controlled by `loadMemoryFromIncludeDirectories` setting).
511+ - Scope: Additional project context from related directories.
512+ 
513+### Context File Management Commands
514+ 
515+The CLI provides several commands to help you manage and understand your context:
516+ 
517+- **`/memory show`**: Displays the full context that will be provided to the model, including all loaded context files and their sources.
518+- **`/memory refresh`**: Reloads all context files from disk, useful when you've made changes to context files during a session.
519+- **`/memory clear`**: Temporarily clears the loaded context for the current session (context will be reloaded on next session).
520+ 
521+### Best Practices for Context Files
522+ 
523+1. **Keep it Relevant:** Include information that's directly useful for the tasks you'll be performing with the AI.
524+2. **Be Specific:** Provide concrete examples and guidelines rather than vague descriptions.
525+3. **Update Regularly:** Keep your context files current with your project's evolution.
526+4. **Use Hierarchy:** Place general guidelines in higher-level context files and specific details in project-specific files.
527+5. **Test and Iterate:** Use `/memory show` to verify your context is loading correctly and refine based on the AI's responses.
528+ 
529+## Usage Statistics
530+ 
531+Gemini CLI can collect anonymous usage statistics to help improve the tool. This data includes information about command usage, error rates, and performance metrics, but does not include sensitive information like your code, prompts, or personal data.
532+ 
533+- **Control:** You can enable or disable usage statistics collection using the `usageStatisticsEnabled` setting in your `settings.json` file.
534+- **Privacy:** All collected data is anonymized and aggregated. No personally identifiable information or code content is collected.
535+- **Transparency:** The CLI will inform you when usage statistics are being collected and provide options to opt out.
536+ 
537+## Sandboxing
538+ 
539+Sandboxing provides an additional layer of security when using Gemini CLI by isolating tool execution from your main system. This is particularly useful when working with untrusted code or when you want to limit the potential impact of AI-generated commands.
540+ 
541+### Types of Sandboxing
542+ 
543+1. **Docker Sandboxing** (`"sandbox": "docker"`):
544+ - Uses Docker containers to isolate tool execution
545+ - Requires Docker to be installed and running
546+ - Provides strong isolation from the host system
547+ 
548+2. **Podman Sandboxing** (`"sandbox": "podman"`):
549+ - Similar to Docker but uses Podman as the container runtime
550+ - Useful in environments where Docker is not available
551+ 
552+3. **Custom Sandboxing** (`"sandbox": "custom-command"`):
553+ - Allows you to specify a custom sandboxing command
554+ - Provides flexibility for specialized environments
555+ 
556+### Configuration
557+ 
558+You can enable sandboxing through:
559+- Settings file: `"sandbox": true` or `"sandbox": "docker"`
560+- Environment variable: `GEMINI_SANDBOX=true`
561+- Command line: `--sandbox` flag
562+ 
563+### Custom Sandbox Profiles
564+ 
565+For advanced users, you can create custom sandbox profiles by placing configuration files in your project's `.gemini/` directory:
566+ 
567+- **Docker:** `.gemini/sandbox.Dockerfile`
568+- **macOS Seatbelt:** `.gemini/sandbox-macos-<profile_name>.sb`
569+ 
570+These custom profiles allow you to define specific security policies and runtime environments for your project's needs.
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack