Support for .gemini_ignore and per-file-type configuration for context and instructions
What would you like to be added?
Hi Team,
I believe two enhancements could significantly improve the flexibility and safety of using Gemini in codebases:
- Support for a .gemini_ignore file (find a better name ,please) It would be highly beneficial to support a .gemini_ignore file, similar to .gitignore, in order to:
-
Exclude sensitive or irrelevant files/directories from being read or included in context.
-
Provide developers more granular control over what content is available to Gemini during interaction.
-
Reduce noise and potential security/privacy risks during context processing.
This would be particularly helpful in environments where many files are not meant to be used by AI models.
- Per-file-type instruction configuration Rather than relying solely on a single Gemini.md file, it would be very useful to allow per-file-type instruction customization.
For example this could work similarly to what GitHub Copilot offers in its customization options, providing contextual behavior based on file type.
These additions would give users more safety, control, and adaptability when working in real-world projects.
Thanks for your consideration and great work on the project!
Why is this needed?
Improved safety: Prevent accidental exposure of sensitive files or credentials during AI processing.
Context quality: Avoid cluttering the model with files that are not relevant to the current task, improving the precision of responses.
Workflow control: Give teams the ability to define behavior more precisely, especially in large or polyglot codebases.
Consistency: Match expectations already set by other tools like .gitignore or .dockerignore, aligning with developers' mental models.
Productivity boost: Reduces friction in multi-language projects where instructions may vary significantly depending on file type or domain.
Additional context
No response
Have you tried .geminiignore? After inspecting code, i see there is already .gemiignore to ignore files
https://github.com/google-gemini/gemini-cli/blob/524ede52d23c2c2d400cde3a80aaf54ba669cd02/packages/core/src/tools/read-file.ts#L106C1-L116C4
Have you tried .geminiignore? After inspecting code, i see there is already .gemiignore to ignore files
https://github.com/google-gemini/gemini-cli/blob/524ede52d23c2c2d400cde3a80aaf54ba669cd02/packages/core/src/tools/read-file.ts#L106C1-L116C4
Thanks, I have found some reference :
https://github.com/google-gemini/gemini-cli/blob/524ede52d23c2c2d400cde3a80aaf54ba669cd02/packages/core/src/services/fileDiscoveryService.ts#L11
but NO documentations.
Maybe an explanation in doc about functions and limits could be useful.
We just opened #3677 to better document the .geminiignore feature.
We just opened #3677 to better document the
.geminiignorefeature.
Thanks..
hoping also for custom instructions: if it will be possible also read github copilot folder instructions... :)
Found possible duplicate issues:
- #2092: (#0.9148326465387746)
Hello! As part of our effort to keep our backlog manageable and focus on the most active issues, we are tidying up older reports.
It looks like this issue hasn't been active for a while, so we are closing it for now. However, if you are still experiencing this bug on the latest stable build, please feel free to comment on this issue or create a new one with updated details.
Thank you for your contribution!