Answer: Codex builds an instruction chain at startup, first reading a global file in the Codex home directory (AGENTS.override.md if it exists, otherwise AGENTS.md), then walking from the project root down to the current working directory, checking each directory for AGENTS.override.md, then AGENTS.md, then any fallback names in project_doc_fallback_filenames, including at most one file per directory. It concatenates files from the root down, joining them with blank lines, and files closer to the current directory override earlier guidance. Status: Confirmed Entry: tool/codex/memory-and-context/agents-md-discovery-precedence Revision: 1 Digest: sha256:d87273a469b9d8f4 (changes whenever the content changes) Timeline: Created: 2026-11-13T03:47:04Z Last changed: 2026-11-13T03:47:04Z Last verified: 2026-11-20T13:34:42Z Next check: 2026-11-21T13:34:42Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of Global scope file order | AGENTS.override.md | [1] | 2026-11-20 Project scope file order | AGENTS.override.md | [1] | 2026-11-20 Files per directory | at most one file per directory | [1] | 2026-11-20 Merge order | concatenates files from the root down, joining them with blank lines | [1] | 2026-11-20 Size limit setting | project_doc_max_bytes | [1] | 2026-11-20 Default size limit | 32 KiB | [1] | 2026-11-20 Sources: [1] OpenAI. "Custom instructions with AGENTS.md". https://learn.chatgpt.com/docs/agent-configuration/agents-md.md Role: primary. Accessed: 2026-11-20T13:34:42Z Quote: "Codex reads `AGENTS.override.md` if it exists. Otherwise, Codex reads `AGENTS.md`." (Supports: Global scope file order) Quote: "it checks for `AGENTS.override.md`, then `AGENTS.md`, then any fallback names in `project_doc_fallback_filenames`" (Supports: Project scope file order) Quote: "Codex includes at most one file per directory." (Supports: Files per directory) Quote: "Codex concatenates files from the root down, joining them with blank lines." (Supports: Merge order) Quote: "stops adding files once the combined size reaches the limit defined by `project_doc_max_bytes`" (Supports: Size limit setting) Quote: "`project_doc_max_bytes` (32 KiB by default)" (Supports: Default size limit) Snapshot SHA-256: 9d1f87a2d1cb55b4782b95abe710692b35b9659789c2db31a22c7074a3383e8e (captured 2026-11-13T03:47:04Z) 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:47:04Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T13:34:42Z. No independent second source is configured for this entry Last successful check: 2026-11-20T13:34:42Z Last attempt: 2026-11-20T13:34:42Z Notes and limitations: Extracted automatically from a single official source (section "How Codex discovers guidance"). Related: https://latestn.com/tool/codex/memory-and-context/composer-predictions-context What context do Codex composer predictions use to suggest my next message? https://latestn.com/tool/codex/memory-and-context/control-memories-per-chat How do I control whether a specific chat can use or contribute to Codex local memories? https://latestn.com/tool/codex/memory-and-context/when-to-update-agents-md When should I update AGENTS.md in Codex? https://latestn.com/tool/codex/integrations/view-pull-request How do I view a pull request in Codex Code Review? https://latestn.com/tool/codex/integrations/webmcp-vs-mcp What is the difference between WebMCP and MCP for ChatGPT and Codex? https://latestn.com/tool/codex/memory-and-context/add-editor-context-to-prompt How do I bring open files and selected code into a Codex IDE prompt? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-13T03:47:04Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/codex/memory-and-context/agents-md-discovery-precedence/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/codex/memory-and-context/agents-md-discovery-precedence POST: https://latestn.com/dispute/tool/codex/memory-and-context/agents-md-discovery-precedence with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/codex/memory-and-context/agents-md-discovery-precedence?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How does Codex discover and load AGENTS.md files for a project? Revision 1, last verified 2026-11-20T13:34:42Z. https://latestn.com/tool/codex/memory-and-context/agents-md-discovery-precedence (accessed 2026-11-21T09:58:36Z). @misc{LatestN_tool_codex_memory_and_context_agents_md_discovery_precedence_r1, title = {How does Codex discover and load AGENTS.md files for a project?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/codex/memory-and-context/agents-md-discovery-precedence}}, note = {Revision 1; digest sha256:d87273a469b9d8f4; last verified 2026-11-20T13:34:42Z; accessed 2026-11-21T09:58:36Z} } 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/codex/memory-and-context/agents-md-discovery-precedence