Skip to content

Commit e3551b1

Browse files
Merge branch 'main' into issuerestriction
2 parents 6009577 + 5bd21a2 commit e3551b1

File tree

315 files changed

+8123
-2130
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

315 files changed

+8123
-2130
lines changed

.gemini/skills/docs-writer/SKILL.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ Write precisely to ensure your instructions are unambiguous.
4545
specific verbs.
4646
- **Examples:** Use meaningful names in examples; avoid placeholders like
4747
"foo" or "bar."
48+
- **Quota and limit terminology:** For any content involving resource capacity
49+
or using the word "quota" or "limit", strictly adhere to the guidelines in
50+
the `quota-limit-style-guide.md` resource file. Generally, Use "quota" for the
51+
administrative bucket and "limit" for the numerical ceiling.
4852

4953
### Formatting and syntax
5054
Apply consistent formatting to make documentation visually organized and
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Style Guide: Quota vs. Limit
2+
3+
This guide defines the usage of "quota," "limit," and related terms in
4+
user-facing interfaces.
5+
6+
## TL;DR
7+
8+
- **`quota`**: The administrative "bucket." Use for settings, billing, and
9+
requesting increases. (e.g., "Adjust your storage **quota**.")
10+
- **`limit`**: The real-time numerical "ceiling." Use for error messages when a
11+
user is blocked. (e.g., "You've reached your request **limit**.")
12+
- **When blocked, combine them:** Explain the **limit** that was hit and the
13+
**quota** that is the remedy. (e.g., "You've reached the request **limit** for
14+
your developer **quota**.")
15+
- **Related terms:** Use `usage` for consumption tracking, `restriction` for
16+
fixed rules, and `reset` for when a limit refreshes.
17+
18+
---
19+
20+
## Detailed Guidelines
21+
22+
### Definitions
23+
24+
- **Quota is the "what":** It identifies the category of resource being managed
25+
(e.g., storage quota, GPU quota, request/prompt quota).
26+
- **Limit is the "how much":** It defines the numerical boundary.
27+
28+
Use **quota** when referring to the administrative concept or the request for
29+
more. Use **limit** when discussing the specific point of exhaustion.
30+
31+
### When to use "quota"
32+
33+
Use this term for **account management, billing, and settings.** It describes
34+
the entitlement the user has purchased or been assigned.
35+
36+
**Examples:**
37+
38+
- **Navigation label:** Quota and usage
39+
- **Contextual help:** Your **usage quota** is managed by your organization. To
40+
request an increase, contact your administrator.
41+
42+
### When to use "limit"
43+
44+
Use this term for **real-time feedback, notifications, and error messages.** It
45+
identifies the specific wall the user just hit.
46+
47+
**Examples:**
48+
49+
- **Error message:** You’ve reached the 50-request-per-minute **limit**.
50+
- **Inline warning:** Input exceeds the 32k token **limit**.
51+
52+
### How to use both together
53+
54+
When a user is blocked, combine both terms to explain the **event** (limit) and
55+
the **remedy** (quota).
56+
57+
**Example:**
58+
59+
- **Heading:** Daily usage limit reached
60+
- **Body:** You've reached the maximum daily capacity for your developer quota.
61+
To continue working today, upgrade your quota.

docs/changelogs/preview.md

Lines changed: 163 additions & 189 deletions
Large diffs are not rendered by default.

docs/cli/plan-mode.md

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ implementation. It allows you to:
2121
- [Entering Plan Mode](#entering-plan-mode)
2222
- [Planning Workflow](#planning-workflow)
2323
- [Exiting Plan Mode](#exiting-plan-mode)
24+
- [Commands](#commands)
2425
- [Tool Restrictions](#tool-restrictions)
2526
- [Customizing Planning with Skills](#customizing-planning-with-skills)
2627
- [Customizing Policies](#customizing-policies)
2728
- [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)
2930
- [Custom Plan Directory and Policies](#custom-plan-directory-and-policies)
3031
- [Automatic Model Routing](#automatic-model-routing)
32+
- [Cleanup](#cleanup)
3133

3234
## Enabling Plan Mode
3335

@@ -125,6 +127,10 @@ To exit Plan Mode, you can:
125127
- **Tool:** Gemini CLI calls the [`exit_plan_mode`] tool to present the
126128
finalized plan for your approval.
127129

130+
### Commands
131+
132+
- **`/plan copy`**: Copy the currently approved plan to your clipboard.
133+
128134
## Tool Restrictions
129135

130136
Plan Mode enforces strict safety policies to prevent accidental changes.
@@ -133,6 +139,7 @@ These are the only allowed tools:
133139

134140
- **FileSystem (Read):** [`read_file`], [`list_directory`], [`glob`]
135141
- **Search:** [`grep_search`], [`google_web_search`]
142+
- **Research Subagents:** [`codebase_investigator`], [`cli_help`]
136143
- **Interaction:** [`ask_user`]
137144
- **MCP Tools (Read):** Read-only [MCP tools] (e.g., `github_read_issue`,
138145
`postgres_read_schema`) are allowed.
@@ -203,16 +210,17 @@ priority = 100
203210
modes = ["plan"]
204211
```
205212

206-
#### Example: Enable research subagents in Plan Mode
213+
#### Example: Enable custom subagents in Plan Mode
207214

208-
You can enable experimental research [subagents] like `codebase_investigator` to
209-
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.
210218

211219
`~/.gemini/policies/research-subagents.toml`
212220

213221
```toml
214222
[[rule]]
215-
toolName = "codebase_investigator"
223+
toolName = "my_custom_subagent"
216224
decision = "allow"
217225
priority = 100
218226
modes = ["plan"]
@@ -290,6 +298,24 @@ performance. You can disable this automatic switching in your settings:
290298
}
291299
```
292300

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+
293319
[`list_directory`]: /docs/tools/file-system.md#1-list_directory-readfolder
294320
[`read_file`]: /docs/tools/file-system.md#2-read_file-readfile
295321
[`grep_search`]: /docs/tools/file-system.md#5-grep_search-searchtext
@@ -300,7 +326,10 @@ performance. You can disable this automatic switching in your settings:
300326
[MCP tools]: /docs/tools/mcp-server.md
301327
[`save_memory`]: /docs/tools/memory.md
302328
[`activate_skill`]: /docs/cli/skills.md
329+
[`codebase_investigator`]: /docs/core/subagents.md#codebase_investigator
330+
[`cli_help`]: /docs/core/subagents.md#cli_help
303331
[subagents]: /docs/core/subagents.md
332+
[custom subagents]: /docs/core/subagents.md#creating-custom-subagents
304333
[policy engine]: /docs/reference/policy-engine.md
305334
[`enter_plan_mode`]: /docs/tools/planning.md#1-enter_plan_mode-enterplanmode
306335
[`exit_plan_mode`]: /docs/tools/planning.md#2-exit_plan_mode-exitplanmode
@@ -311,3 +340,4 @@ performance. You can disable this automatic switching in your settings:
311340
[auto model]: /docs/reference/configuration.md#model-settings
312341
[model routing]: /docs/cli/telemetry.md#model-routing
313342
[preferred external editor]: /docs/reference/configuration.md#general
343+
[session retention]: /docs/cli/session-management.md#session-retention

docs/cli/session-management.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,27 +121,36 @@ session lengths.
121121

122122
### Session retention
123123

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:
126135

127136
```json
128137
{
129138
"general": {
130139
"sessionRetention": {
131140
"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
134143
}
135144
}
136145
}
137146
```
138147

139148
- **`enabled`**: (boolean) Master switch for session cleanup. Defaults to
140-
`false`.
149+
`true`.
141150
- **`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"`.
143152
- **`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).
145154
- **`minRetention`**: (string) Minimum retention period (safety limit). Defaults
146155
to `"1d"`. Sessions newer than this period are never deleted by automatic
147156
cleanup.

docs/extensions/reference.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ The manifest file defines the extension's behavior and configuration.
122122
}
123123
},
124124
"contextFileName": "GEMINI.md",
125-
"excludeTools": ["run_shell_command"]
125+
"excludeTools": ["run_shell_command"],
126+
"plan": {
127+
"directory": ".gemini/plans"
128+
}
126129
}
127130
```
128131

@@ -157,6 +160,11 @@ The manifest file defines the extension's behavior and configuration.
157160
`"excludeTools": ["run_shell_command(rm -rf)"]` will block the `rm -rf`
158161
command. Note that this differs from the MCP server `excludeTools`
159162
functionality, which can be listed in the MCP server config.
163+
- `plan`: Planning features configuration.
164+
- `directory`: The directory where planning artifacts are stored. This serves
165+
as a fallback if the user hasn't specified a plan directory in their
166+
settings. If not specified by either the extension or the user, the default
167+
is `~/.gemini/tmp/<project>/<session-id>/plans/`.
160168

161169
When Gemini CLI starts, it loads all the extensions and merges their
162170
configurations. If there are any conflicts, the workspace configuration takes

docs/reference/commands.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,9 @@ Slash commands provide meta-level control over the CLI itself.
270270
one has been generated.
271271
- **Note:** This feature requires the `experimental.plan` setting to be
272272
enabled in your configuration.
273+
- **Sub-commands:**
274+
- **`copy`**:
275+
- **Description:** Copy the currently approved plan to your clipboard.
273276

274277
### `/policies`
275278

docs/reference/configuration.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,11 @@ their corresponding top-level category object in your `settings.json` file.
10141014
- **Default:** `false`
10151015
- **Requires restart:** Yes
10161016

1017+
- **`experimental.taskTracker`** (boolean):
1018+
- **Description:** Enable task tracker tools.
1019+
- **Default:** `false`
1020+
- **Requires restart:** Yes
1021+
10171022
- **`experimental.modelSteering`** (boolean):
10181023
- **Description:** Enable model steering (user hints) to guide the model
10191024
during tool execution.

docs/sidebar.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,14 @@
9494
{ "label": "Agent Skills", "slug": "docs/cli/skills" },
9595
{ "label": "Checkpointing", "slug": "docs/cli/checkpointing" },
9696
{ "label": "Headless mode", "slug": "docs/cli/headless" },
97-
{ "label": "Hooks", "slug": "docs/hooks" },
97+
{
98+
"label": "Hooks",
99+
"collapsed": true,
100+
"items": [
101+
{ "label": "Overview", "slug": "docs/hooks" },
102+
{ "label": "Reference", "slug": "docs/hooks/reference" }
103+
]
104+
},
98105
{ "label": "IDE integration", "slug": "docs/ide-integration" },
99106
{ "label": "MCP servers", "slug": "docs/tools/mcp-server" },
100107
{ "label": "Model routing", "slug": "docs/cli/model-routing" },

eslint.config.js

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ const __dirname = path.dirname(__filename);
2525
const projectRoot = __dirname;
2626
const currentYear = new Date().getFullYear();
2727

28+
const commonRestrictedSyntaxRules = [
29+
{
30+
selector: 'CallExpression[callee.name="require"]',
31+
message: 'Avoid using require(). Use ES6 imports instead.',
32+
},
33+
{
34+
selector: 'ThrowStatement > Literal:not([value=/^\\w+Error:/])',
35+
message:
36+
'Do not throw string literals or non-Error objects. Throw new Error("...") instead.',
37+
},
38+
];
39+
2840
export default tseslint.config(
2941
{
3042
// Global ignores
@@ -120,18 +132,7 @@ export default tseslint.config(
120132
'no-cond-assign': 'error',
121133
'no-debugger': 'error',
122134
'no-duplicate-case': 'error',
123-
'no-restricted-syntax': [
124-
'error',
125-
{
126-
selector: 'CallExpression[callee.name="require"]',
127-
message: 'Avoid using require(). Use ES6 imports instead.',
128-
},
129-
{
130-
selector: 'ThrowStatement > Literal:not([value=/^\\w+Error:/])',
131-
message:
132-
'Do not throw string literals or non-Error objects. Throw new Error("...") instead.',
133-
},
134-
],
135+
'no-restricted-syntax': ['error', ...commonRestrictedSyntaxRules],
135136
'no-unsafe-finally': 'error',
136137
'no-unused-expressions': 'off', // Disable base rule
137138
'@typescript-eslint/no-unused-expressions': [
@@ -171,6 +172,28 @@ export default tseslint.config(
171172
],
172173
},
173174
},
175+
{
176+
// API Response Optionality enforcement for Code Assist
177+
files: ['packages/core/src/code_assist/**/*.{ts,tsx}'],
178+
rules: {
179+
'no-restricted-syntax': [
180+
'error',
181+
...commonRestrictedSyntaxRules,
182+
{
183+
selector:
184+
'TSInterfaceDeclaration[id.name=/.+Response$/] TSPropertySignature:not([optional=true])',
185+
message:
186+
'All fields in API response interfaces (*Response) must be marked as optional (?) to prevent developers from accidentally assuming a field will always be present based on current backend behavior.',
187+
},
188+
{
189+
selector:
190+
'TSTypeAliasDeclaration[id.name=/.+Response$/] TSPropertySignature:not([optional=true])',
191+
message:
192+
'All fields in API response types (*Response) must be marked as optional (?) to prevent developers from accidentally assuming a field will always be present based on current backend behavior.',
193+
},
194+
],
195+
},
196+
},
174197
{
175198
// Rules that only apply to product code
176199
files: ['packages/*/src/**/*.{ts,tsx}'],

0 commit comments

Comments
 (0)