GEMINI.md Guide
Configure Google's Gemini CLI with context files. Learn about hierarchical loading, memory commands, and best practices for AI-assisted development.
Understanding GEMINI.md
GEMINI.md is a context file for Gemini CLI, Google's open-source AI coding assistant that brings Gemini directly into your terminal. Instead of repeating instructions in every prompt, you define them once in GEMINI.md and Gemini references them automatically.
The format is nearly identical to CLAUDE.md, making it easy to maintain configurations for both tools if you use multiple AI assistants.
File Locations
Gemini CLI loads context files from multiple locations in a hierarchical system:
- Global —
~/.gemini/GEMINI.mdprovides default instructions for all projects - Project-level — CLI searches for GEMINI.md in your current directory and each parent up to the project root (.git folder)
- All found files are concatenated and sent to the model with every prompt
GEMINI.md Format
Memory Commands
Gemini CLI provides commands to interact with loaded context:
/memory showDisplays the full, concatenated content of the current hierarchical memory
/memory refreshForces a re-scan and reload of all GEMINI.md files from all configured locations
/memory add <text>Appends your text to the global ~/.gemini/GEMINI.md file for persistent memories
AGENTS.md Alternative
Gemini CLI also supports AGENTS.md files. If you have both GEMINI.md and AGENTS.md in the same directory, GEMINI.md takes precedence.
AGENTS.md is useful if you want to share instructions across multiple AI tools (Gemini, Claude Code, etc.) since the format is compatible with several tools.
Best Practices
- Modularize for large projects — Prevent context bloat by splitting into focused files
- Use hierarchical files — Global settings in ~/.gemini/, project-specific in repo root
- Keep it concise — The model receives all context with every prompt
- Include commands — Document common shell commands so Gemini can execute them
- Use /memory refresh — After editing GEMINI.md during a session
Related Guides
Frequently Asked Questions
Manage Your GEMINI.md Files Visually
ClaudeMDEditor lets you browse, edit, and organize GEMINI.md files across all your projects. Plus it handles CLAUDE.md, .cursorrules, and more.
One-time purchase for macOS Tahoe (26+)