refactor(core): remove memory tool instructions from Gemini 3 prompt#18559
refactor(core): remove memory tool instructions from Gemini 3 prompt#18559NTaylorMullen merged 2 commits intomainfrom
Conversation
- Removes the toolUsageRememberingFacts guideline as it is no longer necessary for Gemini 3 series models. - Verification confirms that behavioral evaluations for memory still pass without explicit instructions. Fixes #18556
Summary of ChangesHello @NTaylorMullen, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the core system prompt for Gemini 3 models by eliminating redundant memory tool instructions. This optimization is based on the improved reliability of Gemini 3 models in utilizing the memory tool without explicit guidance, leading to a cleaner and more efficient prompt structure. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Size Change: -654 B (0%) Total Size: 23.8 MB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request removes explicit memory tool instructions from the system prompt, targeting Gemini 3 models. The implementation removes the instruction-generating function and its call, and updates snapshots accordingly. My review identifies a potential issue: the removal is unconditional, which might affect other models using the same prompt logic, contrary to the stated intent of targeting only Gemini 3. This could lead to unexpected behavior in non-Gemini 3 models.
| ## Tool Usage | ||
| - **Parallelism:** Execute multiple independent tool calls in parallel when feasible (i.e. searching the codebase). | ||
| - **Command Execution:** Use the '${SHELL_TOOL_NAME}' tool for running shell commands, remembering the safety rule to explain modifying commands first.${toolUsageInteractive(options.interactive)}${toolUsageRememberingFacts(options)} | ||
| - **Command Execution:** Use the '${SHELL_TOOL_NAME}' tool for running shell commands, remembering the safety rule to explain modifying commands first.${toolUsageInteractive(options.interactive)} |
There was a problem hiding this comment.
The PR title and description state this change is for Gemini 3 models. However, toolUsageRememberingFacts() is removed unconditionally, affecting all models using renderOperationalGuidelines. Since other parts of this prompt are conditional on options.isGemini3, it implies this function is used for more than just Gemini 3 models.
If the removal is only intended for Gemini 3, it should be conditional. For example:
- **Command Execution:** ...${toolUsageInteractive(options.interactive)}${options.isGemini3 ? '' : toolUsageRememberingFacts(options)}This would require re-adding the toolUsageRememberingFacts function and its import.
Summary
This PR removes the explicit memory tool instructions from the Gemini 3 series system prompt. These instructions were previously necessary for earlier models to correctly utilize the memory tool, but Gemini 3 models exhibit high reliability in using the tool without explicit guidance.
Details
toolUsageRememberingFactsfrompackages/core/src/prompts/snippets.ts.toolUsageRememberingFactsinrenderOperationalGuidelines.MEMORY_TOOL_NAMEimport insnippets.ts.Related Issues
Fixes #18556
How to Validate
npm run build -w @google/gemini-cli-corenpx vitest run evals/save_memory.eval.ts --config evals/vitest.config.tsPre-Merge Checklist