Answer: The CLI loads GEMINI.md files in a three-level hierarchy: first the global context file at ~/.gemini/GEMINI.md, then environment and workspace context files found in configured workspace directories and their parent directories, and finally just-in-time (JIT) context files scanned when a tool accesses a file or directory. Status: Confirmed Entry: tool/gemini-cli/memory-and-context/context-hierarchy Revision: 1 Digest: sha256:0c8d191cd0362aa2 (changes whenever the content changes) Timeline: Created: 2026-11-13T03:17:30Z Last changed: 2026-11-13T03:17:30Z Last verified: 2026-11-20T12:50:57Z Next check: 2026-11-21T12:50:57Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of Global context file location | ~/.gemini/GEMINI.md | [1] | 2026-11-20 Global context file scope | Provides default instructions for all your projects. | [1] | 2026-11-20 Environment and workspace context file location | The CLI searches for `GEMINI.md` files in your configured workspace directories and their parent directories. | [1] | 2026-11-20 Environment and workspace context file scope | Provides context relevant to the projects you are currently working on. | [1] | 2026-11-20 JIT context file location | When a tool accesses a file or directory, the CLI automatically scans for `GEMINI.md` files in that directory and its ancestors up to a trusted root. | [1] | 2026-11-20 JIT context file scope | Lets the model discover highly specific instructions for particular components only when they are needed. | [1] | 2026-11-20 Sources: [1] Google. "Provide context with GEMINI.md files". https://geminicli.com/docs/cli/gemini-md.md Role: primary. Accessed: 2026-11-20T12:50:57Z Quote: "**Location:** `~/.gemini/GEMINI.md` (in your user home directory)." (Supports: Global context file location) Quote: "**Scope:** Provides default instructions for all your projects." (Supports: Global context file scope) Quote: "**Location:** The CLI searches for `GEMINI.md` files in your configured workspace directories and their parent directories." (Supports: Environment and workspace context file location) Quote: "**Scope:** Provides context relevant to the projects you are currently working on." (Supports: Environment and workspace context file scope) Quote: "**Location:** When a tool accesses a file or directory, the CLI automatically scans for `GEMINI.md` files in that directory and its ancestors up to a trusted root." (Supports: JIT context file location) Quote: "**Scope:** Lets the model discover highly specific instructions for particular components only when they are needed." (Supports: JIT context file scope) Published: 2026-10-16T02:36:07Z Snapshot SHA-256: e5fbfd6d580643a300b5ee0e622d9e2d8f97d4d23460e6b08e1c656251c2f2c2 (captured 2026-11-13T03:17:29Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-13T03:17:30Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T12:50:57Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:50:57Z Last attempt: 2026-11-20T12:50:57Z Notes and limitations: Extracted automatically from a single official source (section "Understand the context hierarchy"). Related: https://latestn.com/tool/gemini-cli/memory-and-context/create-gemini-md-project-rules How do I create a GEMINI.md file to define project-wide rules for Gemini CLI? https://latestn.com/tool/gemini-cli/memory-and-context/customize-context-file-name How do I customize the name of the GEMINI.md context file in Gemini CLI? https://latestn.com/tool/gemini-cli/memory-and-context/disable-auto-memory How do I disable Auto Memory in Gemini CLI? https://latestn.com/tool/gemini-cli/memory-and-context/auto-memory-limitations What are the limitations of Auto Memory in Gemini CLI? https://latestn.com/tool/gemini-cli/memory-and-context/chat-history-compression How does Gemini CLI compress chat history? https://latestn.com/tool/gemini-cli/memory-and-context/circular-import-detection How does Gemini CLI prevent circular imports in GEMINI.md files? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-13T03:17:30Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/gemini-cli/memory-and-context/context-hierarchy/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/gemini-cli/memory-and-context/context-hierarchy POST: https://latestn.com/dispute/tool/gemini-cli/memory-and-context/context-hierarchy with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/gemini-cli/memory-and-context/context-hierarchy?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). What is the context hierarchy for GEMINI.md files in Gemini CLI? Revision 1, last verified 2026-11-20T12:50:57Z. https://latestn.com/tool/gemini-cli/memory-and-context/context-hierarchy (accessed 2026-11-21T09:59:27Z). @misc{LatestN_tool_gemini_cli_memory_and_context_context_hierarchy_r1, title = {What is the context hierarchy for GEMINI.md files in Gemini CLI?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/gemini-cli/memory-and-context/context-hierarchy}}, note = {Revision 1; digest sha256:0c8d191cd0362aa2; last verified 2026-11-20T12:50:57Z; accessed 2026-11-21T09:59:27Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/gemini-cli/memory-and-context/context-hierarchy