How to Give Gemini CLI Project Context with a GEMINI.md File
Create a GEMINI.md memory file so the Gemini CLI knows your project conventions on every run.
The Gemini CLI reads a file named GEMINI.md and loads it as standing instructions, the same way Claude Code reads CLAUDE.md. Use it to record your stack, coding style, and rules so you do not repeat yourself in every prompt. This guide shows where to put it and what to write.
What you need
- The Gemini CLI installed and signed in
- A code project you work in regularly
- A text editor
- About 5 minutes
Step 1: Create GEMINI.md at the project root
Add a file named GEMINI.md in the top folder of your repository. The CLI picks it up automatically whenever you run gemini from that folder or any subfolder. Keep it short and specific, since every word counts against context.
# Project: Invoice API
## Stack
- Node 20, Express, TypeScript
- PostgreSQL via Prisma
- Tests with Vitest
## Conventions
- Use named exports, never default exports.
- All money values are stored in integer cents.
- Never edit files under prisma/migrations by hand.
## Commands
- Run tests: npm test
- Type check: npm run typecheckStep 2: Confirm the CLI loaded it
Start the CLI and run the /memory show command. It prints the combined instructions currently in context, including your GEMINI.md. If it is empty, you are probably running from a folder above the file.
Step 3: Layer global and folder context
You can keep personal defaults in ~/.gemini/GEMINI.md and project rules in the repo file. Subfolders can have their own GEMINI.md too. The CLI merges them, with the most specific file taking priority, so a frontend folder can add UI rules on top of the root file.
Result
Every prompt now starts with your project context baked in. Instead of explaining your stack each time, you can ask Add a discount field to invoices and trust that the agent already knows to store money as integer cents and avoid editing migrations.
Watch related tutorials
2:14
23:41
1:42:18
28:14
41:09
9:47