Skip to content

Fix #28227: add support for AGENTS.md out of the box#28240

Open
vichu3d-dev wants to merge 2 commits into
google-gemini:mainfrom
vichu3d-dev:fix-agents-md
Open

Fix #28227: add support for AGENTS.md out of the box#28240
vichu3d-dev wants to merge 2 commits into
google-gemini:mainfrom
vichu3d-dev:fix-agents-md

Conversation

@vichu3d-dev

Copy link
Copy Markdown

Fixes #28227

Description

This PR fixes an issue where the AGENTS.md context file was ignored by default unless explicitly listed in the user's ~/.gemini/settings.json.

Changes made:

  • Updated the core memoryTool to use the array ['GEMINI.md', 'AGENTS.md'] as the default context filenames, ensuring GEMINI.md retains its priority.
  • Simplified resetGeminiMdFilename() usage in the CLI initialization to cleanly fallback to this new core default.
  • Updated the testing suite expectations to match the new behavior.

@vichu3d-dev vichu3d-dev requested review from a team as code owners July 2, 2026 07:48
@google-cla

google-cla Bot commented Jul 2, 2026

Copy link
Copy Markdown

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 github-actions Bot added the size/m A medium sized PR label Jul 2, 2026
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

📊 PR Size: size/M

  • Lines changed: 77
  • Additions: +40
  • Deletions: -37
  • Files changed: 6

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

🛑 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.

@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 system's context awareness by adding 'AGENTS.md' as a default configuration file alongside 'GEMINI.md'. By updating the core memory tool and associated initialization logic, the system now automatically prioritizes these files without requiring manual user configuration in settings.json, while maintaining backward compatibility and improving test coverage.

Highlights

  • Support for AGENTS.md: Updated the core memory tool to include 'AGENTS.md' alongside 'GEMINI.md' as a default context filename, ensuring it is recognized out of the box.
  • Refactored Configuration: Simplified the CLI initialization and reset logic for context filenames by defaulting to the new core array, reducing the need for explicit configuration.
  • Updated Documentation and Tests: Updated system prompt documentation and adjusted test suites to reflect the new default context file behavior.
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.

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

Copy link
Copy Markdown
Contributor

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 adds AGENTS.md as a default context file alongside GEMINI.md by introducing DEFAULT_CONTEXT_FILENAMES and updating the default configuration, system prompts, and associated tests. The reviewer noted an inconsistency in resetGeminiMdFilename where the fallback logic for an empty array still references the single DEFAULT_CONTEXT_FILENAME instead of the new DEFAULT_CONTEXT_FILENAMES array.

Comment on lines 56 to 58
export function resetGeminiMdFilename(
filename: string | string[] = DEFAULT_CONTEXT_FILENAME,
filename: string | string[] = DEFAULT_CONTEXT_FILENAMES,
): void {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

In resetGeminiMdFilename, when the filtered cleaned array is empty (for example, if an empty array [] or only invalid/non-existent paths are passed), the function falls back to DEFAULT_CONTEXT_FILENAME (which is 'GEMINI.md') on line 69:

if (cleaned.length === 0) {
  currentGeminiMdFilename = DEFAULT_CONTEXT_FILENAME;
}

Since the new default context filenames are DEFAULT_CONTEXT_FILENAMES (['GEMINI.md', 'AGENTS.md']), this fallback should be updated to DEFAULT_CONTEXT_FILENAMES to ensure consistency and that AGENTS.md is not ignored in fallback scenarios.

@vichu3d-dev

Copy link
Copy Markdown
Author

@google-gemini/gemini-cli-maintainers @google-gemini/gemini-cli-prompt-approvers

Hi team!

This PR fixes the issue where AGENTS.md was ignored by default. I've updated the core fallback logic, adjusted the snapshot tests, and addressed the feedback from the gemini-code-assist[bot] to ensure all fallback scenarios correctly map to the new DEFAULT_CONTEXT_FILENAMES array.

All CI checks are currently passing. Whenever you have a moment, I'd appreciate a review so we can get this merged in! Thank you!

@gemini-cli gemini-cli Bot added priority/p1 Important and should be addressed in the near term. area/core Issues related to User Interface, OS Support, Core Functionality labels Jul 3, 2026
@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 Jul 3, 2026
@gemini-cli

gemini-cli Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

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 area/core Issues related to User Interface, OS Support, Core Functionality priority/p1 Important and should be addressed in the near term. priority/p2 Important but can be addressed in a future release. size/m A medium sized PR status/pr-nudge-sent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AGENTS.md silently not loaded — not in default context.fileName list in v0.49.0 (parity with agents.md convention)

1 participant