Skip to content

fix(core): add platform-aware shell guidance#26998

Open
vivekjm wants to merge 2 commits into
google-gemini:mainfrom
vivekjm:fix-modern-windows-shell-guidance
Open

fix(core): add platform-aware shell guidance#26998
vivekjm wants to merge 2 commits into
google-gemini:mainfrom
vivekjm:fix-modern-windows-shell-guidance

Conversation

@vivekjm
Copy link
Copy Markdown

@vivekjm vivekjm commented May 13, 2026

Summary

Adds platform-aware shell guidance to the modern Gemini CLI system prompt so the model is reminded which host OS it is running on before choosing shell commands.

This keeps Windows users from getting nudged toward Unix-only commands in the modern prompt path, while preserving the existing Unix-style examples on non-Windows hosts.

Details

  • Adds a small Shell tool usage section to the modern operational guidelines when shell output efficiency guidance is enabled.
  • Uses process.platform to render Windows-specific inspection examples (type, findstr, Get-Content, Select-String) on win32.
  • Keeps direct renderer tests backward-compatible by making the option optional, while the real prompt provider continues to pass the configured value.
  • Adds coverage for the modern preview-model Windows prompt path and updates prompt snapshots.

Related Issues

Fixes #26591

How to Validate

  • npm test --workspace @google/gemini-cli-core -- prompts.test.ts promptProvider.test.ts
  • npm run typecheck --workspace @google/gemini-cli-core
  • npm run lint --workspace @google/gemini-cli-core -- src/prompts/snippets.ts src/core/prompts.test.ts

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
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@vivekjm vivekjm requested review from a team as code owners May 13, 2026 17:21
@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 enhances the Gemini CLI system prompt by providing context-aware shell guidance. By detecting the host platform at runtime, the model is now explicitly instructed to use appropriate shell commands, preventing Windows users from receiving Unix-centric advice while maintaining existing functionality for other platforms.

Highlights

  • Platform-Aware Shell Guidance: Introduced a dynamic 'Shell tool usage' section in the system prompt that adapts based on the host operating system.
  • Windows Compatibility: Added logic to detect 'win32' platforms and suggest Windows-specific inspection commands like 'type', 'findstr', 'Get-Content', and 'Select-String'.
  • Testing and Verification: Updated prompt snapshots and added unit tests to ensure the model receives correct platform-specific guidance for both Windows and Unix-like environments.
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 the 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 counterproductive. 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.

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.

@google-cla
Copy link
Copy Markdown

google-cla Bot commented May 13, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 13, 2026

🛑 Action Required: Evaluation Approval

Steering changes have been detected in this PR. To prevent regressions, a maintainer must approve the evaluation run before this PR can be merged.

Maintainers:

  1. Go to the Workflow Run Summary.
  2. Click the yellow 'Review deployments' button.
  3. Select the 'eval-gate' environment and click 'Approve'.

Once approved, the evaluation results will be posted here automatically.

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

This pull request introduces shell efficiency guidelines into the core system prompts to improve how the AI agent interacts with the terminal. It adds a new 'Shell tool usage' section to the operational guidelines, providing platform-specific advice for both Unix-like and Windows environments, such as recommending targeted inspection tools like 'grep' or 'findstr' for large outputs. The implementation includes updates to the prompt rendering logic in 'packages/core', new test cases for Windows platform detection, and corresponding snapshot updates. I have no feedback to provide as there were no review comments to assess.

@gemini-cli gemini-cli Bot added priority/p2 Important but can be addressed in a future release. area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality labels May 13, 2026
@gemini-cli
Copy link
Copy Markdown
Contributor

gemini-cli Bot commented May 21, 2026

Hi there! Thank you for your interest in contributing to Gemini CLI.

To ensure we maintain high code quality and focus on our prioritized roadmap, we only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'.

This PR will be closed in 7 days if it remains without that designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding.

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 priority/p2 Important but can be addressed in a future release. status/pr-nudge-sent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gemini CLI does not get context of it's envrionment, it constantly uses linux commands on a windows machine

1 participant