Skip to content
AgentAtlas

GEMINI.md in Gemini CLI: context file locations, imports and /memory

How do I set up GEMINI.md context files in Gemini CLI?

Put shared instructions in ~/.gemini/GEMINI.md and project instructions in a GEMINI.md at your project root. Gemini CLI loads all found context files, joins them, and sends them with every prompt. Use /memory show to see what is loaded and /memory reload after edits.

Compare: rules and instruction files in every AI coding agent →

Where Gemini CLI looks for GEMINI.md

Gemini CLI loads context files in a fixed order and concatenates them.

  • Global: ~/.gemini/GEMINI.md applies to all your projects.
  • Workspace: GEMINI.md files in your configured workspace directories and their parent directories.
  • Just in time: when a tool reads a file or folder, the CLI scans that folder and its ancestors, up to a trusted root, for more GEMINI.md files.
  • The CLI footer shows how many context files are loaded.

Write a project GEMINI.md

Create GEMINI.md at your project root with plain Markdown instructions.

GEMINI.md

# Project: My TypeScript Library

## General Instructions

- When you generate new TypeScript code, follow the existing coding style.
- Ensure all new functions and classes have JSDoc comments.

## Coding Style

- Use 2 spaces for indentation.
- Always use strict equality (=== and !==).

Split large files with imports

Import other Markdown files with the @file.md syntax. Relative and absolute paths both work.

GEMINI.md with imports

# Main GEMINI.md file

This is the main content.

@./components/instructions.md

@../shared/style-guide.md

Inspect and reload context with /memory

  • /memory show prints the full concatenated context the model receives.
  • /memory reload rescans and reloads every GEMINI.md file.

Inside Gemini CLI

/memory show
/memory reload

Use AGENTS.md or another file name

Set context.fileName in settings.json to a name or a list of names. This lets Gemini CLI read AGENTS.md files too.

settings.json

{
  "context": {
    "fileName": ["AGENTS.md", "CONTEXT.md", "GEMINI.md"]
  }
}

Note: the Gemini CLI docs say unpaid tier and Google One users had Gemini CLI replaced by Antigravity CLI on June 18, 2026.

Sources

More Gemini CLI guides

Reviewed Oct 23, 2026. Settings change often; the linked vendor docs are the source of truth.

Built an MCP server? Get it listed everywhere →

Shipping an Android app? Google Play needs 12 testers for 14 days first. Get them with Tester Exchange →