---
source: https://iinventedlight.com/library/notes/ao-rules-gemini-md-hierarchy.md
title: "Context files: AGENTS.md format and the GEMINI.md load order"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "Apache-2.0 or MIT (repo docs; LICENSE file verified in each GitHub repo); prose restates cited source lines in own words"
license_family: agentops-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Google Gemini CLI docs (GitHub), Provide context with GEMINI.md files, Apache-2.0 (google-gemini/gemini-cli LICENSE); agentsmd/agents.md (GitHub), AGENTS.md README, MIT (agentsmd/agents.md LICENSE)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-09
status: published
checked_on: 2026-11-09
as_of: 2026-11-09
confidence: medium
untested: "No tool or code was run for this note; only the fetched repository documentation was read."
category: agent-operations
topic_area: "agent operations: rules files"
tags: [agents-md, gemini-md, context-files, rules]
client: Librarian
sources:
  - id: S1
    title: "Provide context with GEMINI.md files"
    publisher: Google Gemini CLI docs (GitHub)
    url: https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/gemini-md.md
    accessed: 2026-11-09
    license: "Apache-2.0 (google-gemini/gemini-cli LICENSE)"
  - id: S2
    title: "AGENTS.md README"
    publisher: agentsmd/agents.md (GitHub)
    url: https://github.com/agentsmd/agents.md/blob/main/README.md
    accessed: 2026-11-09
    license: "MIT (agentsmd/agents.md LICENSE)"
---
# Context files: AGENTS.md format and the GEMINI.md load order

**Answer:** AGENTS.md is a simple, open format for guiding coding agents, a README for agents. Gemini CLI loads `GEMINI.md` context files from several locations, joins what it finds, and sends the result to the model with every prompt.

## Why a context file

Instead of repeating instructions in every prompt, define them once in a context file: project-specific instructions, a persona, or coding style guides.

## GEMINI.md load order

1. Global: `~/.gemini/GEMINI.md` gives default instructions for all projects.
2. Workspace: `GEMINI.md` files in configured workspace directories and their parent directories.
3. Just-in-time: when a tool accesses a file or directory, the CLI scans that directory and its ancestors up to a trusted root.

The CLI footer displays the number of loaded context files.

## Inspect and reload

- `/memory show` displays the full, concatenated content of the current hierarchical memory.
- `/memory reload` forces a re-scan and reload of all `GEMINI.md` files.

## Artifacts

- [Context / rules files hierarchy (table)](https://iinventedlight.com/library/artifacts/ao-rules-context-files.table.json)
- [Context / rules files hierarchy (markdown table)](https://iinventedlight.com/library/artifacts/ao-rules-context-files.table.md)
- [Topic packet: ao-rules](https://iinventedlight.com/library/packets/ao-rules.json)

## See also

- [ao-rules-agents-md-evidence](https://iinventedlight.com/library/notes/ao-rules-agents-md-evidence/)
- [ao-rules-context-files-in-practice](https://iinventedlight.com/library/notes/ao-rules-context-files-in-practice/)
- [ao-rules-instruction-adherence](https://iinventedlight.com/library/notes/ao-rules-instruction-adherence/)

## Claims

- id: C1
  claim: AGENTS.md is an open format for coding agents.
  source: S2
  evidence: "AGENTS.md is a simple, open format for guiding coding agents."

- id: C2
  claim: GEMINI.md contents go with every prompt.
  source: S1
  evidence: "and sends them to the model with every prompt."

- id: C3
  claim: The global file is ~/.gemini/GEMINI.md.
  source: S1
  evidence: "Provides default instructions for all your projects."

- id: C4
  claim: /memory show prints the concatenated context.
  source: S1
  evidence: "Displays the full, concatenated content of the current hierarchical memory."

## Sources

- [S1] Provide context with GEMINI.md files. Google Gemini CLI docs (GitHub). https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/gemini-md.md . License: Apache-2.0 (google-gemini/gemini-cli LICENSE). Accessed 2026-11-09.

- [S2] AGENTS.md README. agentsmd/agents.md (GitHub). https://github.com/agentsmd/agents.md/blob/main/README.md . License: MIT (agentsmd/agents.md LICENSE). Accessed 2026-11-09.


License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: GitHub repository docs under Apache License 2.0 (https://www.apache.org/licenses/LICENSE-2.0) or MIT License (https://opensource.org/licenses/MIT), as listed per source; copyright notices remain with the original authors. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
