Skip to content

refactor(core): remove memory tool instructions from Gemini 3 prompt#18559

Merged
NTaylorMullen merged 2 commits intomainfrom
ntm/gh.18556.remove-memory-prompt-gemini3
Feb 8, 2026
Merged

refactor(core): remove memory tool instructions from Gemini 3 prompt#18559
NTaylorMullen merged 2 commits intomainfrom
ntm/gh.18556.remove-memory-prompt-gemini3

Conversation

@NTaylorMullen
Copy link
Collaborator

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

  • Deleted toolUsageRememberingFacts from packages/core/src/prompts/snippets.ts.
  • Removed the call to toolUsageRememberingFacts in renderOperationalGuidelines.
  • Cleaned up unused MEMORY_TOOL_NAME import in snippets.ts.
  • Updated core test snapshots to reflect the prompt change.

Related Issues

Fixes #18556

How to Validate

  1. Build the core package: npm run build -w @google/gemini-cli-core
  2. Run memory behavioral evaluations: npx vitest run evals/save_memory.eval.ts --config evals/vitest.config.ts
  3. Verify that all tests pass (Gemini 2.5 still uses the legacy prompt which contains the instructions, while Gemini 3 uses the updated prompt).

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run

- 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
@NTaylorMullen NTaylorMullen requested a review from a team as a code owner February 8, 2026 01:43
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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

  • Prompt Simplification: Explicit memory tool instructions have been removed from the Gemini 3 series system prompt, as these models no longer require such detailed guidance for reliable tool usage.
  • Code Cleanup: The toolUsageRememberingFacts function and its associated import (MEMORY_TOOL_NAME) have been deleted from packages/core/src/prompts/snippets.ts, along with the removal of its call in renderOperationalGuidelines.
  • Test Updates: Core test snapshots have been updated to reflect the changes made to the prompt structure.
Changelog
  • packages/core/src/core/snapshots/prompts.test.ts.snap
    • Removed the 'Memory Tool' instruction block from multiple prompt snapshots, reflecting the updated prompt logic.
  • packages/core/src/prompts/snippets.ts
    • Removed the unused import for MEMORY_TOOL_NAME.
    • Deleted the toolUsageRememberingFacts function.
    • Removed the call to toolUsageRememberingFacts within the renderOperationalGuidelines function.
Activity
  • The pull request was created by NTaylorMullen with the title 'refactor(core): remove memory tool instructions from Gemini 3 prompt'.
  • The author provided a detailed summary, specific changes, and validation steps.
  • The PR addresses issue Explore removing memory tool section from system prompt for Gemini 3 #18556 on the google-gemini/gemini-cli repository.
  • The pre-merge checklist indicates that documentation and tests were updated, and validation was performed on MacOS.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link

github-actions bot commented Feb 8, 2026

Size Change: -654 B (0%)

Total Size: 23.8 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 23.8 MB -654 B (0%)
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB 0 B
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B

compressed-size-action

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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.

@NTaylorMullen NTaylorMullen added this pull request to the merge queue Feb 8, 2026
Merged via the queue into main with commit eee95c5 Feb 8, 2026
28 checks passed
@NTaylorMullen NTaylorMullen deleted the ntm/gh.18556.remove-memory-prompt-gemini3 branch February 8, 2026 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Explore removing memory tool section from system prompt for Gemini 3

2 participants