← All notes

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

Artifacts

See also

Claims

Sources

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

Permanent ID: iil:note:7nhkndbf

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.},
}

Markdown

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.