Skip to content

feat(core): conditionally include ctrl+f prompt based on interactive shell setting#18561

Merged
NTaylorMullen merged 1 commit intomainfrom
ntm/gh.interactive-shell-prompt
Feb 9, 2026
Merged

feat(core): conditionally include ctrl+f prompt based on interactive shell setting#18561
NTaylorMullen merged 1 commit intomainfrom
ntm/gh.interactive-shell-prompt

Conversation

@NTaylorMullen
Copy link
Collaborator

Summary

This PR updates the system prompt to conditionally include the ctrl + f instruction. Currently, this instruction is shown whenever the CLI is in interactive mode. However, it only makes sense if interactive shells are also enabled. This change ensures the instruction is only displayed when both conditions are met.

Details

  • Renamed enableInteractiveShell to interactiveShellEnabled in OperationalGuidelinesOptions.
  • Updated toolUsageInteractive to accept interactiveShellEnabled and conditionally render the ctrl + f sentence.
  • Updated renderOperationalGuidelines to pass the new option.
  • Updated PromptProvider to retrieve the setting from config.isInteractiveShellEnabled().
  • Updated unit tests in prompts.test.ts to verify the logic and updated snapshots.
  • Applied similar changes to snippets.legacy.ts for consistency.

Related Issues

N/A

How to Validate

Run the following command to execute the tests:

npm test -w @google/gemini-cli-core -- src/core/prompts.test.ts

Verify that the tests for ctrl + f instructions pass and that snapshots are correct.

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

@NTaylorMullen NTaylorMullen requested a review from a team as a code owner February 8, 2026 01:56
@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 refines the user experience by making the ctrl + f prompt for interactive shell focus context-aware. Previously, this instruction would appear whenever the CLI was interactive, even if interactive shells were not truly active. The change ensures the prompt is only displayed when it's relevant, improving clarity and reducing unnecessary information for users by aligning the prompt with the actual interactive shell capabilities.

Highlights

  • Conditional 'ctrl + f' Prompt: The system prompt now only includes the 'ctrl + f' instruction for focusing into the shell when both the CLI is in interactive mode and interactive shells are explicitly enabled, improving contextual relevance.
  • Refactored Prompt Logic: The toolUsageInteractive function was updated to accept a new interactiveShellEnabled parameter, allowing for the conditional rendering of the 'ctrl + f' instruction within the interactive command guidelines.
  • Configuration Integration: The PromptProvider now retrieves the isInteractiveShellEnabled setting from the configuration to correctly inform the prompt generation, ensuring the instruction is displayed only when appropriate.
  • Updated Tests and Snapshots: New unit tests were added to validate the conditional logic for the 'ctrl + f' instruction, and existing prompt snapshots were updated to reflect the changes in the interactive command guidelines.
Changelog
  • packages/core/src/core/snapshots/prompts.test.ts.snap
    • Updated snapshot tests to reflect the new conditional interactive command guidelines in the system prompt.
  • packages/core/src/core/prompts.test.ts
    • Added new unit tests to specifically verify the conditional inclusion/exclusion of the ctrl + f instruction based on the isInteractiveShellEnabled setting.
  • packages/core/src/prompts/promptProvider.ts
    • Modified to pass the interactiveShellEnabled configuration setting to the getOperationalGuidelines function, enabling conditional prompt generation.
  • packages/core/src/prompts/snippets.legacy.ts
    • Added interactiveShellEnabled property to the OperationalGuidelinesOptions interface.
    • Updated the toolUsageInteractive function signature and implementation to accept and utilize the new interactiveShellEnabled boolean for conditional prompt text generation.
    • Revised the 'Interactive Commands' guideline text to be more nuanced, emphasizing preference for non-interactive commands while also introducing the conditional ctrl + f hint.
  • packages/core/src/prompts/snippets.ts
    • Applied the same interface and function modifications as snippets.legacy.ts to support the conditional ctrl + f prompt.
Activity
  • The pull request introduces a new feature (feat(core)) to enhance the core functionality.
  • The author, NTaylorMullen, provided a detailed summary, specific changes, and validation steps.
  • Unit tests were added and updated to cover the new conditional logic for prompt display.
  • The changes were validated on MacOS using npm run.
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
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 correctly implements the conditional inclusion of the ctrl + f instruction in the system prompt. The changes ensure the instruction is only shown when both the CLI is in interactive mode and interactive shells are enabled. The logic is sound, with the new interactiveShellEnabled option correctly propagated from the configuration to the prompt rendering snippets. The addition of unit tests to verify both scenarios (enabled/disabled) is a great practice and ensures the change is robust. The updated snapshots reflect the intended changes accurately. Overall, this is a well-executed feature enhancement.

@github-actions
Copy link

github-actions bot commented Feb 8, 2026

Size Change: +1.25 kB (+0.01%)

Total Size: 23.9 MB

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

compressed-size-action

@gemini-cli gemini-cli bot added the status/need-issue Pull requests that need to have an associated issue. label Feb 8, 2026
@NTaylorMullen NTaylorMullen force-pushed the ntm/gh.interactive-shell-prompt branch 3 times, most recently from e79e71c to 118ab40 Compare February 8, 2026 23:49
…shell setting

- Update system prompt snippets to support interactiveShellEnabled option
- Conditionally render ctrl+f instruction in toolUsageInteractive
- Pass isInteractiveShellEnabled() from PromptProvider
- Add unit tests and update snapshots to verify behavior
@NTaylorMullen NTaylorMullen force-pushed the ntm/gh.interactive-shell-prompt branch from 118ab40 to e5408c6 Compare February 8, 2026 23:50
@NTaylorMullen NTaylorMullen added this pull request to the merge queue Feb 9, 2026
Merged via the queue into main with commit 97a4e62 Feb 9, 2026
26 checks passed
@NTaylorMullen NTaylorMullen deleted the ntm/gh.interactive-shell-prompt branch February 9, 2026 00:31
aswinashok44 pushed a commit to aswinashok44/gemini-cli that referenced this pull request Feb 9, 2026
kuishou68 pushed a commit to iOfficeAI/aioncli that referenced this pull request Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/need-issue Pull requests that need to have an associated issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants