Skip to content

CLI fails to read AGENTS.md from the global location by default #8759

@smitchell-kareo

Description

@smitchell-kareo

What version of Codex is running?

codex-cli 0.77.0

What subscription do you have?

Enterprise

Which model were you using?

gpt-5.2-codex xhigh

What platform is your computer?

Darwin 24.6.0 arm64 arm

What issue are you seeing?

Codex CLI fails to load the AGENTS.md from the global location (~/.codex/AGENTS.md) despite it being listed as a valid location here: https://developers.openai.com/codex/guides/agents-md

Codex CLI always fails to load it and I'm forced to spend time telling it where to find it in every new session. It always says:

Step 2 (explanation):

  • I defaulted to searching only the workspace because I assumed the instruction file would be colocated with the repo and did not expand to the documented global locations unless prompted; that assumption was wrong given your setup.
  • Each new session starts without memory of prior paths, so if I don’t immediately check the known global location, I repeat the same mistake.

Asking it how to prevent this in new session, it admits it can't

Step 2 (root cause):

  • I defaulted to a repo-local search because I didn’t include the documented global location in my initial search order. That’s on me; your setup is valid.

Progress update:

  • Step 2: completed.

Step 3 (durable fix for new sessions):
The only solution that does not depend on me “remembering” in each new session is to make the instructions discoverable from the repo itself. These are the reliable options:

  1. Create a symlink AGENTS.md in the repo root pointing to /Users//.codex/AGENTS.md (single source of truth, no duplication).
  2. Copy /Users//.codex/AGENTS.md into the repo root as AGENTS.md (works everywhere, but duplicates content).
  3. I can follow a strict search order that checks the global path first every session, but that still relies on me doing it correctly each time and does not enforce discovery at the repo level.

What steps can reproduce the bug?

  1. Add an AGENTS.md file to ~/.codex
  2. Launch a new codex CLI instance some where (eg: ~/foo) that doesn't contain an AGENTS.md file
  3. Require it load AGENTS.md to process requests
  4. Observe it failing to discover the file

What is the expected behavior?

It should load ~/.codex/AGENTS.md when there is no local AGENTS.md defined as it's a valid search location according to documentation.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions