feat(core): overhaul system prompt for rigor, integrity, and intent alignment#17263
feat(core): overhaul system prompt for rigor, integrity, and intent alignment#17263NTaylorMullen merged 1 commit intomainfrom
Conversation
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 focuses on a major refactoring and optimization of the system prompt, which guides the agent's behavior and decision-making. The changes aim to enhance the agent's understanding of its role, improve its communication style, enforce stricter engineering standards, and refine its workflow for various tasks. By clarifying mandates, improving tool usage instructions, and adding new evaluation tests, the PR ensures the agent operates more predictably, efficiently, and in better alignment with user intent, particularly in complex software engineering scenarios. Highlights
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
|
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive overhaul of the system prompt to improve agent behavior, along with several related refactorings and improvements. Key changes include a much more detailed and structured system prompt, renaming the search_file_content tool to grep_search, and refactoring how environment context is provided to the agent. New evaluation tests have been added to validate the new agent behaviors.
My review focuses on performance and correctness. I've identified a performance issue in how the match limit is applied in both the grep and ripgrep tools. The current implementation fetches all results and then truncates them in JavaScript, which can be inefficient. I've suggested using the native --max-count flags available in these tools to limit the results at the source.
Overall, this is a significant and well-structured update that should improve the agent's capabilities. The refactoring work makes the codebase cleaner and more maintainable.
ece0d9e to
d385ff8
Compare
|
Size Change: +39.8 kB (+0.17%) Total Size: 23.9 MB
ℹ️ View Unchanged
|
09d4488 to
814803b
Compare
|
I ran the current set of behavioral evals against this branch for all models: https://github.com/google-gemini/gemini-cli/actions/runs/21453547514 It looks like some of the existing ones might not be passing 3/3 times anymore with these changes. Any of these regressions?
Also the new tests don't seem to pass 3/3 times for Gemini 3.0 at least.
|
…l updates - Refine 'Expertise & Intent Alignment' to default to Inquiry and require explicit Directives for action. - Update 'Technical Integrity' and 'Execution' workflows to prioritize clean abstractions within the target scope while avoiding unrelated refactoring. - Clarify 'Proactiveness' to apply strictly when executing a Directive. - Add 'stop and wait' instruction for resolved inquiries or pending directives to stabilize workflows. - Update and verify prompt snapshots. Part of #17263
- Create `snippets.legacy.ts` as a pure replica of the original system prompt logic. - Introduce `snippets.ts` with the modern Gemini 3 prompt overhaul. - Update `PromptProvider.ts` to select between legacy and overhauled snippets based on the active model. - Make history compression model-aware by passing `config` to `getCompressionPrompt`. - Update unit tests and snapshots to verify correct prompt gating for preview and non-preview models. Part of #17263
…l updates - Refine 'Expertise & Intent Alignment' to default to Inquiry and require explicit Directives for action. - Update 'Technical Integrity' and 'Execution' workflows to prioritize clean abstractions within the target scope while avoiding unrelated refactoring. - Clarify 'Proactiveness' to apply strictly when executing a Directive. - Add 'stop and wait' instruction for resolved inquiries or pending directives to stabilize workflows. - Update and verify prompt snapshots. Part of #17263
- Create `snippets.legacy.ts` as a pure replica of the original system prompt logic. - Introduce `snippets.ts` with the modern Gemini 3 prompt overhaul. - Update `PromptProvider.ts` to select between legacy and overhauled snippets based on the active model. - Make history compression model-aware by passing `config` to `getCompressionPrompt`. - Update unit tests and snapshots to verify correct prompt gating for preview and non-preview models. Part of #17263
e223071 to
c15b1cc
Compare
c96200d to
e2de9b0
Compare
…lignment - Refactored system prompt structure into a Research/Strategy/Execution lifecycle - Modernized technology recommendations (favoring Vanilla CSS and modern stacks) - Integrated structured planning workflow and ecosystem tool checks - Preserved legacy prompt behavior by migrating current main logic to snippets.legacy.ts - Updated tests and snapshots for exhaustive validation
e2de9b0 to
8391fb8
Compare
This is a follow up to #17263, ensuring consistency between snippets.ts and snippets.legacy.ts by removing the redundant planning section from renderFinalShell.

Summary
This PR overhauls the system prompt for Gemini CLI to improve engineering rigor, technical integrity, and alignment with user intent. It introduces a structured Research -> Strategy -> Execution lifecycle while maintaining legacy compatibility for non-preview models.
Details
eslint --fix).snippets.legacy.ts. ThePromptProvidernow dynamically selects between overhauled and legacy snippets based on whether the active model is a "preview model" (Gemini 3 family).prompts.test.tsto validate the new prompt structure and ensure parity for legacy models.Related Issues
Part of the ongoing effort to improve agent reliability and engineering quality.
How to Validate
npm test -w @google/gemini-cli-core -- src/core/prompts.test.tsnpm test -w @google/gemini-cli-core -- src/services/chatCompressionService.test.tsnpm run preflightPre-Merge Checklist