mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 05:12:55 -07:00
fix(core): allow /memory add to work in plan mode (#20353)
This commit is contained in:
@@ -119,6 +119,7 @@ These are the only allowed tools:
|
|||||||
- **Planning (Write):** [`write_file`] and [`replace`] only allowed for `.md`
|
- **Planning (Write):** [`write_file`] and [`replace`] only allowed for `.md`
|
||||||
files in the `~/.gemini/tmp/<project>/<session-id>/plans/` directory or your
|
files in the `~/.gemini/tmp/<project>/<session-id>/plans/` directory or your
|
||||||
[custom plans directory](#custom-plan-directory-and-policies).
|
[custom plans directory](#custom-plan-directory-and-policies).
|
||||||
|
- **Memory:** [`save_memory`]
|
||||||
- **Skills:** [`activate_skill`] (allows loading specialized instructions and
|
- **Skills:** [`activate_skill`] (allows loading specialized instructions and
|
||||||
resources in a read-only manner)
|
resources in a read-only manner)
|
||||||
|
|
||||||
@@ -277,6 +278,7 @@ performance. You can disable this automatic switching in your settings:
|
|||||||
[`google_web_search`]: /docs/tools/web-search.md
|
[`google_web_search`]: /docs/tools/web-search.md
|
||||||
[`replace`]: /docs/tools/file-system.md#6-replace-edit
|
[`replace`]: /docs/tools/file-system.md#6-replace-edit
|
||||||
[MCP tools]: /docs/tools/mcp-server.md
|
[MCP tools]: /docs/tools/mcp-server.md
|
||||||
|
[`save_memory`]: /docs/tools/memory.md
|
||||||
[`activate_skill`]: /docs/cli/skills.md
|
[`activate_skill`]: /docs/cli/skills.md
|
||||||
[subagents]: /docs/core/subagents.md
|
[subagents]: /docs/core/subagents.md
|
||||||
[policy engine]: /docs/reference/policy-engine.md
|
[policy engine]: /docs/reference/policy-engine.md
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ priority = 70
|
|||||||
modes = ["plan"]
|
modes = ["plan"]
|
||||||
|
|
||||||
[[rule]]
|
[[rule]]
|
||||||
toolName = ["ask_user", "exit_plan_mode"]
|
toolName = ["ask_user", "exit_plan_mode", "save_memory"]
|
||||||
decision = "ask_user"
|
decision = "ask_user"
|
||||||
priority = 70
|
priority = 70
|
||||||
modes = ["plan"]
|
modes = ["plan"]
|
||||||
|
|||||||
@@ -2601,6 +2601,12 @@ describe('PolicyEngine', () => {
|
|||||||
priority: 70,
|
priority: 70,
|
||||||
modes: [ApprovalMode.PLAN],
|
modes: [ApprovalMode.PLAN],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
toolName: 'save_memory',
|
||||||
|
decision: PolicyDecision.ASK_USER,
|
||||||
|
priority: 70,
|
||||||
|
modes: [ApprovalMode.PLAN],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
toolName: 'exit_plan_mode',
|
toolName: 'exit_plan_mode',
|
||||||
decision: PolicyDecision.ASK_USER,
|
decision: PolicyDecision.ASK_USER,
|
||||||
@@ -2638,6 +2644,7 @@ describe('PolicyEngine', () => {
|
|||||||
'web_fetch',
|
'web_fetch',
|
||||||
'write_todos',
|
'write_todos',
|
||||||
'memory',
|
'memory',
|
||||||
|
'save_memory',
|
||||||
'read_tool',
|
'read_tool',
|
||||||
'write_tool',
|
'write_tool',
|
||||||
]);
|
]);
|
||||||
@@ -2667,6 +2674,7 @@ describe('PolicyEngine', () => {
|
|||||||
expect(excluded.has('activate_skill')).toBe(false);
|
expect(excluded.has('activate_skill')).toBe(false);
|
||||||
expect(excluded.has('ask_user')).toBe(false);
|
expect(excluded.has('ask_user')).toBe(false);
|
||||||
expect(excluded.has('exit_plan_mode')).toBe(false);
|
expect(excluded.has('exit_plan_mode')).toBe(false);
|
||||||
|
expect(excluded.has('save_memory')).toBe(false);
|
||||||
// Read-only MCP tool allowed by annotation rule (matched via _serverName)
|
// Read-only MCP tool allowed by annotation rule (matched via _serverName)
|
||||||
expect(excluded.has('read_tool')).toBe(false);
|
expect(excluded.has('read_tool')).toBe(false);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user