Skip to content

Commit 3b0f730

Browse files
authored
docs: clarify global policy rules application in plan mode (#21864)
1 parent c60856c commit 3b0f730

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

docs/cli/plan-mode.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,27 @@ Plan Mode's default tool restrictions are managed by the
150150
but you can customize these rules by creating your own policies in your
151151
`~/.gemini/policies/` directory (Tier 2).
152152

153+
#### Global vs. mode-specific rules
154+
155+
As described in the
156+
[policy engine documentation](../reference/policy-engine.md#approval-modes), any
157+
rule that does not explicitly specify `modes` is considered "always active" and
158+
will apply to Plan Mode as well.
159+
160+
If you want a rule to apply to other modes but _not_ to Plan Mode, you must
161+
explicitly specify the target modes. For example, to allow `npm test` in default
162+
and Auto-Edit modes but not in Plan Mode:
163+
164+
```toml
165+
[[rule]]
166+
toolName = "run_shell_command"
167+
commandPrefix = "npm test"
168+
decision = "allow"
169+
priority = 100
170+
# By omitting "plan", this rule will not be active in Plan Mode.
171+
modes = ["default", "autoEdit"]
172+
```
173+
153174
#### Example: Automatically approve read-only MCP tools
154175

155176
By default, read-only MCP tools require user confirmation in Plan Mode. You can

0 commit comments

Comments
 (0)