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
- Global:
~/.gemini/GEMINI.mdgives default instructions for all projects. - Workspace:
GEMINI.mdfiles in configured workspace directories and their parent directories. - 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 showdisplays the full, concatenated content of the current hierarchical memory./memory reloadforces a re-scan and reload of allGEMINI.mdfiles.
Artifacts
- Context / rules files hierarchy (table)
- Context / rules files hierarchy (markdown table)
- Topic packet: ao-rules
See also
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.
License: CC-BY-4.0 · 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).
Cite this
iinventedlight. 2026. "Context files: AGENTS.md format and the GEMINI.md load order." iinventedlight Library, iil:note:7nhkndbf, version of 2026-11-09. https://iinventedlight.com/library/notes/ao-rules-gemini-md-hierarchy/. License: CC-BY-4.0.
@misc{iil_note_7nhkndbf,
author = {{iinventedlight}},
title = {{Context files: AGENTS.md format and the GEMINI.md load order}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-09},
url = {https://iinventedlight.com/library/notes/ao-rules-gemini-md-hierarchy/},
note = {Permanent ID iil:note:7nhkndbf. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/ao-rules-gemini-md-hierarchy.md.