Skip to content

feat(prompts): implement Topic-Action-Summary model for verbosity reduction#21503

Merged
Abhijit-2592 merged 3 commits intomainfrom
abhijit-2592/model-verbosity-explorations
Mar 14, 2026
Merged

feat(prompts): implement Topic-Action-Summary model for verbosity reduction#21503
Abhijit-2592 merged 3 commits intomainfrom
abhijit-2592/model-verbosity-explorations

Conversation

@Abhijit-2592
Copy link
Copy Markdown
Contributor

@Abhijit-2592 Abhijit-2592 commented Mar 7, 2026

Summary

This PR implements the Topic Model (refined from the experimental Topic & Update model) and introduces a new experimental setting, topicUpdateNarration, to control it. This model significantly reduces terminal noise and 'excessive scrolling' during multi-turn tasks by suppressing repetitive tool-call narration and focusing on broad logical phases.

Details

The current 'Explain Before Acting' mandate forced the model to narrate every tool call, creating massive scroll noise when combined with high-volume output. This refactor:

  • Mandates a Topic Model: Every task or broad phase (e.g., Research, Implementation) begins with a single, high-signal header in the format Topic: <Phase> : <Summary>.
  • Enforces Silence: All subsequent tool calls and reasoning within that Topic are executed in complete silence (zero text output).
  • Streamlined Logic: Removes the experimental 'Update' heartbeat to further reduce verbosity, relying on broad logical transitions for signaling progress.
  • Safety Preservation: Explicitly preserves mandatory safety explanations for critical shell commands, ensuring security rules override the silence mandate.

Configuration & Implementation

  • Added experimental.topicUpdateNarration to the settings schema (packages/cli/src/config/settingsSchema.ts).
  • Updated the core Config and loadCliConfig to support and map this new setting.
  • Refactored PromptProvider and snippets.ts to dynamically adjust system instructions based on the setting.
  • Fixed a syntax error in snippets.ts (escaped backtick) and corrected broken nesting in settingsSchema.ts.
  • Regenerated settings JSON schema and documentation.

Related Issues

Fixes #21304 (Context Verbosity Epic - Phase 1)

How to Validate

  1. Enable the setting: Add "topicUpdateNarration": true to your .gemini/settings.json under the experimental block.
  2. Verify prompt injection: Run with DEBUG=gemini-cli:prompts or check config list to ensure the setting is active.
  3. Run a multi-turn task:
    • Success Turn 1: The agent MUST start with a header like Topic: <Research> : Analyzing code patterns followed by tools.
    • Success Turn 2+: Subsequent turns within the same phase MUST contain only tool calls and zero text output.

Recommended Test Prompts

  1. Bug Fix Flow: "Find why the unit tests in packages/core/src/routing are failing, fix the underlying issue, and verify the fix by running the tests again."
  2. Architectural Audit: "Analyze the codebase to find all places where we use vi.stubEnv. Once found, pick one test file in packages/core and refactor it to use a custom test helper instead, then confirm the tests still pass."
  3. Tool Implementation: "Research how built-in tools are registered in the core package. Then, plan and implement a new 'hello-world' tool that simply returns a greeting string."
  4. Cross-Package Feature: "I want to add a new 'telemetry' setting to the experimental section. First, find where settings are defined in both packages/cli and packages/core. Then, plan the change and implement the new setting in both packages."
  5. Dependency Cleanup: "Identify all unused imports in packages/core/src/prompts/promptProvider.ts. Remove them, and then check if the package still builds correctly."

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

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 introduces a "Topic-Action-Summary" communication model within the system instructions to significantly reduce verbose output and improve clarity during multi-turn tasks. The change aims to streamline the interaction by mandating a concise plan summary at the start of each phase, followed by silent tool execution, and clear signaling of strategic pivots, ultimately addressing the problem of excessive scrolling and enhancing user experience.

Highlights

  • Topic-Action-Summary Model: Implemented a new communication pattern where tasks begin with a high-signal, one-line summary of the proposed plan, followed by silent execution of tool calls.
  • Enforced Action Silence: Mandated that all subsequent responses within the same topic must contain only tool calls with zero text output, reducing terminal noise.
  • Strategic Transition Signaling: Introduced a mechanism for signaling major pivots or transitions to new broad topics with a single high-signal line, maintaining transparency during strategy shifts.
  • Refined Tone and Style Guidelines: Updated operational guidelines to emphasize extreme brevity, high-signal output, and the importance of absolute silence during action phases, aligning with the new communication model.
Changelog
  • packages/core/src/prompts/snippets.ts
    • Replaced the previous 'Explain Before Acting' mandate with a detailed 'Topic-Action-Summary' communication pattern, outlining specific rules for initial topic statements, silent action phases, strategic transitions, and final summaries.
    • Modified tone and style guidelines to explicitly require high-signal output, extreme brevity (aiming for one line of text output per response), and absolute silence during action phases, reinforcing the new communication model.
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.

Copy link
Copy Markdown
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

The pull request introduces a new "Topic-Action-Summary" communication model. However, a critical vulnerability has been identified: the "absolute silence" mandate for the Action phase directly conflicts with the mandatory safety rule requiring explanations for critical shell commands. This weakens a key safety control, potentially leading to unpredictable model behavior and compromising user understanding of dangerous commands. An explicit exception for safety-critical explanations from the silence mandate is recommended to resolve this conflict, aligning with the principle of explicit safety instructions for agent deviations.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 7, 2026

Size Change: +3.46 kB (+0.01%)

Total Size: 26.1 MB

Filename Size Change
./bundle/chunk-IX7UT4XO.js 0 B -13.4 MB (removed) 🏆
./bundle/chunk-S363URX6.js 0 B -3.62 MB (removed) 🏆
./bundle/core-BITOVHVD.js 0 B -40.3 kB (removed) 🏆
./bundle/devtoolsService-XNHSIYXL.js 0 B -27.7 kB (removed) 🏆
./bundle/interactiveCli-GJYFQR3H.js 0 B -1.59 MB (removed) 🏆
./bundle/oauth2-provider-QE7XPRTD.js 0 B -9.19 kB (removed) 🏆
./bundle/chunk-25R3AHNP.js 13.4 MB +13.4 MB (new file) 🆕
./bundle/chunk-ZUMB2CSN.js 3.62 MB +3.62 MB (new file) 🆕
./bundle/core-CTVQ7KWK.js 40.3 kB +40.3 kB (new file) 🆕
./bundle/devtoolsService-CP4O35KV.js 27.7 kB +27.7 kB (new file) 🆕
./bundle/interactiveCli-K4CCP3PM.js 1.59 MB +1.59 MB (new file) 🆕
./bundle/oauth2-provider-JQF7RVJK.js 9.19 kB +9.19 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size Change
./bundle/chunk-34MYV7JD.js 2.45 kB 0 B
./bundle/chunk-37ZTTFQF.js 966 kB 0 B
./bundle/chunk-5AUYMPVF.js 858 B 0 B
./bundle/chunk-664ZODQF.js 124 kB 0 B
./bundle/chunk-BXZA3XKQ.js 1.95 MB 0 B
./bundle/chunk-DAHVX5MI.js 206 kB 0 B
./bundle/chunk-IUUIT4SU.js 56.5 kB 0 B
./bundle/chunk-RJTRUG2J.js 39.8 kB 0 B
./bundle/devtools-36NN55EP.js 696 kB 0 B
./bundle/dist-T73EYRDX.js 356 B 0 B
./bundle/gemini.js 695 kB +71 B (+0.01%)
./bundle/getMachineId-bsd-TXG52NKR.js 1.55 kB 0 B
./bundle/getMachineId-darwin-7OE4DDZ6.js 1.55 kB 0 B
./bundle/getMachineId-linux-SHIFKOOX.js 1.34 kB 0 B
./bundle/getMachineId-unsupported-5U5DOEYY.js 1.06 kB 0 B
./bundle/getMachineId-win-6KLLGOI4.js 1.72 kB 0 B
./bundle/memoryDiscovery-ZBBGU3A2.js 922 B 0 B
./bundle/multipart-parser-KPBZEGQU.js 11.7 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js 221 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js 227 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js 11.5 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/types.js 132 B 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-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B
./bundle/sandbox-macos-strict-open.sb 4.82 kB 0 B
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB 0 B
./bundle/src-QVCVGIUX.js 47 kB 0 B
./bundle/tree-sitter-7U6MW5PS.js 274 kB 0 B
./bundle/tree-sitter-bash-34ZGLXVX.js 1.84 MB 0 B
./bundle/undici-4X2YZID5.js 360 B 0 B

compressed-size-action

@gemini-cli gemini-cli bot added priority/p1 Important and should be addressed in the near term. area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. labels Mar 7, 2026
@Abhijit-2592 Abhijit-2592 force-pushed the abhijit-2592/model-verbosity-explorations branch from 9b14afb to 32b05f6 Compare March 10, 2026 22:47
@Abhijit-2592 Abhijit-2592 requested review from a team as code owners March 10, 2026 22:47
@Abhijit-2592 Abhijit-2592 force-pushed the abhijit-2592/model-verbosity-explorations branch 6 times, most recently from 0942e07 to 1efa099 Compare March 12, 2026 21:35
@Abhijit-2592 Abhijit-2592 force-pushed the abhijit-2592/model-verbosity-explorations branch from 1efa099 to 423f4e6 Compare March 13, 2026 20:59
@Abhijit-2592 Abhijit-2592 requested a review from a team as a code owner March 13, 2026 20:59
@Abhijit-2592 Abhijit-2592 force-pushed the abhijit-2592/model-verbosity-explorations branch from 423f4e6 to 933d726 Compare March 13, 2026 21:47
@Abhijit-2592 Abhijit-2592 requested a review from gundermanc March 13, 2026 22:27
- Add 'topicUpdateNarration' to experimental settings schema and core Config.
- Update PromptProvider to pass the setting to system prompt snippets.
- Refactor workflowStepStrategy to suppress strategy summaries when narration is enabled.
- Fix syntax error in snippets.ts (escaped backtick) and broken nesting in settingsSchema.ts.
- Regenerate settings JSON schema and documentation.
- Update core and prompt provider tests to mock the new config property and refresh snapshots.
- Refactor 'Topic & Update Narration' into a streamlined 'Topic Model'.
- Remove the periodic 'Update' heartbeat to further reduce model verbosity.
- Enforce a strict 'Topic: <Phase> : <Summary>' header format for broad logical transitions.
- Mandate complete silence for all tool executions between phase changes.
- Update Operational Guidelines and examples to reflect the name and format changes.
@Abhijit-2592 Abhijit-2592 force-pushed the abhijit-2592/model-verbosity-explorations branch from 933d726 to a8ce070 Compare March 13, 2026 22:46
@Abhijit-2592 Abhijit-2592 added this pull request to the merge queue Mar 13, 2026
@Abhijit-2592 Abhijit-2592 removed this pull request from the merge queue due to a manual request Mar 13, 2026
- Fix spelling of 'beginning' in the Topic Initialization section.
- Explicitly require the use of 'internal thought blocks' instead of generic 'thoughts' to ensure reasoning remains hidden from the user interface.
- Add an 'IMPORTANT' clarification section distinguishing between standard text output for Topic headers and internal thought blocks.
@Abhijit-2592 Abhijit-2592 added this pull request to the merge queue Mar 14, 2026
Merged via the queue into main with commit 9f7691f Mar 14, 2026
26 of 27 checks passed
@Abhijit-2592 Abhijit-2592 deleted the abhijit-2592/model-verbosity-explorations branch March 14, 2026 05:26
@Abhijit-2592 Abhijit-2592 restored the abhijit-2592/model-verbosity-explorations branch March 19, 2026 18:12
@Abhijit-2592 Abhijit-2592 deleted the abhijit-2592/model-verbosity-explorations branch March 19, 2026 18:30
kunal-10-cloud pushed a commit to kunal-10-cloud/gemini-cli that referenced this pull request Mar 21, 2026
SUNDRAM07 pushed a commit to SUNDRAM07/gemini-cli that referenced this pull request Mar 30, 2026
warrenzhu25 pushed a commit to warrenzhu25/gemini-cli that referenced this pull request Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. priority/p1 Important and should be addressed in the near term.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ensure model verbosity is consistent

2 participants