Skip to content

Commit a67d0cb

Browse files
jkcinouyegemini-code-assist[bot]jerop
authored andcommitted
Docs: Update plan mode docs (google-gemini#19682)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Jerop Kipruto <jerop@google.com>
1 parent 493ca10 commit a67d0cb

File tree

2 files changed

+84
-103
lines changed

2 files changed

+84
-103
lines changed

docs/cli/plan-mode.md

Lines changed: 77 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Plan Mode (experimental)
22

33
Plan Mode is a read-only environment for architecting robust solutions before
4-
implementation. It allows you to:
4+
implementation. With Plan Mode, you can:
55

66
- **Research:** Explore the project in a read-only state to prevent accidental
77
changes.
@@ -16,118 +16,98 @@ implementation. It allows you to:
1616
> GitHub.
1717
> - Use the **/bug** command within Gemini CLI to file an issue.
1818
19-
- [Enabling Plan Mode](#enabling-plan-mode)
20-
- [How to use Plan Mode](#how-to-use-plan-mode)
21-
- [Entering Plan Mode](#entering-plan-mode)
22-
- [Planning Workflow](#planning-workflow)
23-
- [Exiting Plan Mode](#exiting-plan-mode)
24-
- [Commands](#commands)
25-
- [Tool Restrictions](#tool-restrictions)
26-
- [Customizing Planning with Skills](#customizing-planning-with-skills)
27-
- [Customizing Policies](#customizing-policies)
28-
- [Example: Allow git commands in Plan Mode](#example-allow-git-commands-in-plan-mode)
29-
- [Example: Enable custom subagents in Plan Mode](#example-enable-custom-subagents-in-plan-mode)
30-
- [Custom Plan Directory and Policies](#custom-plan-directory-and-policies)
31-
- [Automatic Model Routing](#automatic-model-routing)
32-
- [Cleanup](#cleanup)
33-
34-
## Enabling Plan Mode
35-
36-
To use Plan Mode, enable it via **/settings** (search for **Plan**) or add the
37-
following to your `settings.json`:
19+
## How to enable Plan Mode
3820

39-
```json
40-
{
41-
"experimental": {
42-
"plan": true
43-
}
44-
}
45-
```
46-
47-
## How to use Plan Mode
48-
49-
### Entering Plan Mode
21+
Enable Plan Mode in **Settings** or by editing your configuration file.
5022

51-
You can configure Gemini CLI to start in Plan Mode by default or enter it
52-
manually during a session.
53-
54-
- **Configuration:** Configure Gemini CLI to start directly in Plan Mode by
55-
default:
56-
1. Type `/settings` in the CLI.
57-
2. Search for **Default Approval Mode**.
58-
3. Set the value to **Plan**.
59-
60-
Alternatively, use the `gemini --approval-mode=plan` CLI flag or manually
61-
update:
23+
- **Settings:** Use the `/settings` command and set **Plan** to `true`.
24+
- **Configuration:** Add the following to your `settings.json`:
6225

6326
```json
6427
{
65-
"general": {
66-
"defaultApprovalMode": "plan"
28+
"experimental": {
29+
"plan": true
6730
}
6831
}
6932
```
7033

71-
- **Keyboard Shortcut:** Press `Shift+Tab` to cycle through approval modes
34+
## How to enter Plan Mode
35+
36+
Plan Mode integrates seamlessly into your workflow, letting you switch between
37+
planning and execution as needed.
38+
39+
You can either configure Gemini CLI to start in Plan Mode by default or enter
40+
Plan Mode manually during a session.
41+
42+
### Launch in Plan Mode
43+
44+
To start Gemini CLI directly in Plan Mode by default:
45+
46+
1. Use the `/settings` command.
47+
2. Set **Default Approval Mode** to `Plan`.
48+
49+
To launch Gemini CLI in Plan Mode once:
50+
51+
1. Use `gemini --approval-mode=plan` when launching Gemini CLI.
52+
53+
### Enter Plan Mode manually
54+
55+
To start Plan Mode while using Gemini CLI:
56+
57+
- **Keyboard shortcut:** Press `Shift+Tab` to cycle through approval modes
7258
(`Default` -> `Auto-Edit` -> `Plan`).
7359

7460
> **Note:** Plan Mode is automatically removed from the rotation when Gemini
7561
> CLI is actively processing or showing confirmation dialogs.
7662
7763
- **Command:** Type `/plan` in the input box.
7864

79-
- **Natural Language:** Ask Gemini CLI to "start a plan for...". Gemini CLI then
65+
- **Natural Language:** Ask Gemini CLI to "start a plan for...". Gemini CLI
8066
calls the [`enter_plan_mode`] tool to switch modes.
8167
> **Note:** This tool is not available when Gemini CLI is in [YOLO mode].
8268
83-
### Planning Workflow
84-
85-
Plan Mode uses an adaptive planning workflow where the research depth, plan
86-
structure, and consultation level are proportional to the task's complexity:
87-
88-
1. **Explore & Analyze:** Analyze requirements and use read-only tools to map
89-
affected modules and identify dependencies.
90-
2. **Consult:** The depth of consultation is proportional to the task's
91-
complexity:
92-
- **Simple Tasks:** Proceed directly to drafting.
93-
- **Standard Tasks:** Present a summary of viable approaches via
94-
[`ask_user`] for selection.
95-
- **Complex Tasks:** Present detailed trade-offs for at least two viable
96-
approaches via [`ask_user`] and obtain approval before drafting.
97-
3. **Draft:** Write a detailed implementation plan to the
98-
[plans directory](#custom-plan-directory-and-policies). The plan's structure
99-
adapts to the task:
100-
- **Simple Tasks:** Focused on specific **Changes** and **Verification**
101-
steps.
102-
- **Standard Tasks:** Includes an **Objective**, **Key Files & Context**,
103-
**Implementation Steps**, and **Verification & Testing**.
104-
- **Complex Tasks:** Comprehensive plans including **Background &
105-
Motivation**, **Scope & Impact**, **Proposed Solution**, **Alternatives
106-
Considered**, a phased **Implementation Plan**, **Verification**, and
107-
**Migration & Rollback** strategies.
108-
4. **Review & Approval:** Use the [`exit_plan_mode`] tool to present the plan
109-
and formally request approval.
110-
- **Approve:** Exit Plan Mode and start implementation.
111-
- **Iterate:** Provide feedback to refine the plan.
112-
- **Refine manually:** Press **Ctrl + X** to open the plan file in your
113-
[preferred external editor]. This allows you to manually refine the plan
114-
steps before approval. If you make any changes and save the file, the CLI
115-
will automatically send the updated plan back to the agent for review and
116-
iteration.
69+
## How to use Plan Mode
70+
71+
Plan Mode lets you collaborate with Gemini CLI to design a solution before
72+
Gemini CLI takes action.
73+
74+
1. **Provide a goal:** Start by describing what you want to achieve. Gemini CLI
75+
will then enter Plan Mode (if it's not already) to research the task.
76+
2. **Review research and provide input:** As Gemini CLI analyzes your codebase,
77+
it may ask you questions or present different implementation options using
78+
[`ask_user`]. Provide your preferences to help guide the design.
79+
3. **Review the plan:** Once Gemini CLI has a proposed strategy, it creates a
80+
detailed implementation plan as a Markdown file in your plans directory. You
81+
can open and read this file to understand the proposed changes.
82+
4. **Approve or iterate:** Gemini CLI will present the finalized plan for your
83+
approval.
84+
- **Approve:** If you're satisfied with the plan, approve it to start the
85+
implementation immediately: **Yes, automatically accept edits** or **Yes,
86+
manually accept edits**.
87+
- **Iterate:** If the plan needs adjustments, provide feedback. Gemini CLI
88+
will refine the strategy and update the plan.
89+
- **Cancel:** You can cancel your plan with `Esc`.
11790

11891
For more complex or specialized planning tasks, you can
119-
[customize the planning workflow with skills](#customizing-planning-with-skills).
92+
[customize the planning workflow with skills](#custom-planning-with-skills).
12093

121-
### Exiting Plan Mode
94+
## How to exit Plan Mode
12295

123-
To exit Plan Mode, you can:
96+
You can exit Plan Mode at any time, whether you have finalized a plan or want to
97+
switch back to another mode.
12498

125-
- **Keyboard Shortcut:** Press `Shift+Tab` to cycle to the desired mode.
99+
- **Approve a plan:** When Gemini CLI presents a finalized plan, approving it
100+
automatically exits Plan Mode and starts the implementation.
101+
- **Keyboard shortcut:** Press `Shift+Tab` to cycle to the desired mode.
102+
- **Natural language:** Ask Gemini CLI to "exit plan mode" or "stop planning."
126103

127-
- **Tool:** Gemini CLI calls the [`exit_plan_mode`] tool to present the
128-
finalized plan for your approval.
104+
## Customization and best practices
129105

130-
### Commands
106+
Plan Mode is secure by default, but you can adapt it to fit your specific
107+
workflows. You can customize how Gemini CLI plans by using skills, adjusting
108+
safety policies, or changing where plans are stored.
109+
110+
## Commands
131111

132112
- **`/plan copy`**: Copy the currently approved plan to your clipboard.
133113

@@ -141,7 +121,7 @@ These are the only allowed tools:
141121
- **Search:** [`grep_search`], [`google_web_search`]
142122
- **Research Subagents:** [`codebase_investigator`], [`cli_help`]
143123
- **Interaction:** [`ask_user`]
144-
- **MCP Tools (Read):** Read-only [MCP tools] (e.g., `github_read_issue`,
124+
- **MCP tools (Read):** Read-only [MCP tools] (for example, `github_read_issue`,
145125
`postgres_read_schema`) are allowed.
146126
- **Planning (Write):** [`write_file`] and [`replace`] only allowed for `.md`
147127
files in the `~/.gemini/tmp/<project>/<session-id>/plans/` directory or your
@@ -150,12 +130,12 @@ These are the only allowed tools:
150130
- **Skills:** [`activate_skill`] (allows loading specialized instructions and
151131
resources in a read-only manner)
152132

153-
### Customizing Planning with Skills
133+
### Custom planning with skills
154134

155135
You can use [Agent Skills](./skills.md) to customize how Gemini CLI approaches
156136
planning for specific types of tasks. When a skill is activated during Plan
157137
Mode, its specialized instructions and procedural workflows will guide the
158-
research, design and planning phases.
138+
research, design, and planning phases.
159139

160140
For example:
161141

@@ -170,7 +150,7 @@ To use a skill in Plan Mode, you can explicitly ask Gemini CLI to "use the
170150
`<skill-name>` skill to plan..." or Gemini CLI may autonomously activate it
171151
based on the task description.
172152

173-
### Customizing Policies
153+
### Custom policies
174154

175155
Plan Mode's default tool restrictions are managed by the [policy engine] and
176156
defined in the built-in [`plan.toml`] file. The built-in policy (Tier 1)
@@ -194,10 +174,13 @@ priority = 100
194174
modes = ["plan"]
195175
```
196176

177+
For more information on how the policy engine works, see the [policy engine]
178+
docs.
179+
197180
#### Example: Allow git commands in Plan Mode
198181

199-
This rule allows you to check the repository status and see changes while in
200-
Plan Mode.
182+
This rule lets you check the repository status and see changes while in Plan
183+
Mode.
201184

202185
`~/.gemini/policies/git-research.toml`
203186

@@ -229,10 +212,7 @@ modes = ["plan"]
229212
Tell Gemini CLI it can use these tools in your prompt, for example: _"You can
230213
check ongoing changes in git."_
231214

232-
For more information on how the policy engine works, see the [policy engine]
233-
docs.
234-
235-
### Custom Plan Directory and Policies
215+
### Custom plan directory and policies
236216

237217
By default, planning artifacts are stored in a managed temporary directory
238218
outside your project: `~/.gemini/tmp/<project>/<session-id>/plans/`.

docs/tools/planning.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Gemini CLI planning tools
22

3-
Planning tools allow the Gemini model to switch into a safe, read-only "Plan
4-
Mode" for researching and planning complex changes, and to signal the
5-
finalization of a plan to the user.
3+
Planning tools let Gemini CLI switch into a safe, read-only "Plan Mode" for
4+
researching and planning complex changes, and to signal the finalization of a
5+
plan to the user.
66

77
## 1. `enter_plan_mode` (EnterPlanMode)
88

@@ -18,11 +18,12 @@ and planning.
1818
- **File:** `enter-plan-mode.ts`
1919
- **Parameters:**
2020
- `reason` (string, optional): A short reason explaining why the agent is
21-
entering plan mode (e.g., "Starting a complex feature implementation").
21+
entering plan mode (for example, "Starting a complex feature
22+
implementation").
2223
- **Behavior:**
2324
- Switches the CLI's approval mode to `PLAN`.
2425
- Notifies the user that the agent has entered Plan Mode.
25-
- **Output (`llmContent`):** A message indicating the switch, e.g.,
26+
- **Output (`llmContent`):** A message indicating the switch, for example,
2627
`Switching to Plan mode.`
2728
- **Confirmation:** Yes. The user is prompted to confirm entering Plan Mode.
2829

@@ -37,7 +38,7 @@ finalized plan to the user and requests approval to start the implementation.
3738
- **Parameters:**
3839
- `plan_path` (string, required): The path to the finalized Markdown plan
3940
file. This file MUST be located within the project's temporary plans
40-
directory (e.g., `~/.gemini/tmp/<project>/plans/`).
41+
directory (for example, `~/.gemini/tmp/<project>/plans/`).
4142
- **Behavior:**
4243
- Validates that the `plan_path` is within the allowed directory and that the
4344
file exists and has content.

0 commit comments

Comments
 (0)