Black Friday week: local AI hardware on sale. See the list.
← All guides

Codex AGENTS.md Checklist: 9 Checks When Codex Ignores Your Instructions

Codex reads AGENTS.md files in a fixed order and stops at a size limit. When Codex ignores a rule, one of 9 checks below usually finds the cause. Each check has a yes/no answer and the command that gives it. Checked against the Codex AGENTS.md docs on 27 November 2026.

Jump to 5 sections
  1. The short answer
  2. The checklist
  3. After you edit AGENTS.md
  4. If you also use Claude Code
  5. FAQ

The short answer

Codex reads at most one instruction file per directory, from the project root down to your current directory. It reads AGENTS.override.md first, then AGENTS.md. It stops adding files at the project_doc_max_bytes limit, which is 32 KiB by default.

If a rule does not work, the file is not in that chain, another file replaced it, or the rule is past the limit. The 9 checks below find which one.

Source for every check: the OpenAI AGENTS.md guide (the old developers.openai.com/codex/guides/agents-md URL now redirects there), read on 27 November 2026.

The checklist

Mark each line yes or no. A “no” is your fix.

Is the file in the right place?

  • 1. The file is on the path from the project root to your current directory. Codex starts at the project root (usually the Git root) and walks down to the directory you run it from. A file in a sibling folder is never read. Check: git rev-parse --show-toplevel and pwd. Every AGENTS.md you expect must sit in a folder between those two paths.
  • 2. You start Codex in the directory you think you do. Codex “stops searching once it reaches your current directory.” A rule in services/api/AGENTS.md does not load when you start Codex at the repo root. Check: run codex --cd services/api to start Codex in that folder.
  • 3. The global file is in the Codex home you actually use. The global file lives in ~/.codex unless CODEX_HOME points somewhere else. Check: echo $CODEX_HOME. If it prints a path, your global AGENTS.md must be in that path.

Is something replacing the file?

  • 4. No AGENTS.override.md hides your AGENTS.md. In each directory, Codex reads AGENTS.override.md first and then skips AGENTS.md. The docs say: “Look for an AGENTS.override.md higher in the directory tree or under your Codex home.” Check: find . ~/.codex -name AGENTS.override.md.
  • 5. The filename is exact, or it is on the fallback list. Codex reads AGENTS.override.md, AGENTS.md, and the names in project_doc_fallback_filenames. “Filenames not on this list are ignored.” A file called agents.md or TEAM_GUIDE.md loads only if you list it. Check: grep project_doc_fallback_filenames ~/.codex/config.toml.

Does the content reach the model?

  • 6. The file is not empty. “Codex skips empty files.” An empty file adds nothing to the chain. Check: wc -c AGENTS.md.
  • 7. The full chain is under the size limit. Codex “stops adding files once the combined size reaches the limit defined by project_doc_max_bytes (32 KiB by default).” Files near your current directory come last, so they are the first ones to be cut off. Check: wc -c ~/.codex/AGENTS.md AGENTS.md plus each nested file on the path. If the total is over 32,768 bytes, shorten the files or raise the limit in ~/.codex/config.toml, for example project_doc_max_bytes = 65536.
  • 8. The rule you need is in the file nearest to the work. Codex joins the files from the root down. “Files closer to your current directory override earlier guidance because they appear later in the combined prompt.” If two files disagree, the nearer file wins. Check: grep -rn "your rule" --include=AGENTS.md ..

Did Codex load what you expect?

  • 9. Codex can repeat your instructions back. Run this from the directory you work in:
codex --ask-for-approval never "Summarize the current instructions."

Codex should repeat the global file first, then the project files in order. For a nested folder, the docs use: codex --cd services/payments --ask-for-approval never "List the instruction sources you loaded."

For a full record, start Codex with codex -c log_dir=./.codex-log and read ./.codex-log/codex-tui.log.

After you edit AGENTS.md

Codex builds the instruction chain “once per run; in the TUI this usually means once per launched session.” Start a new run or a new session after each edit. There is no cache to clear.

If you change project_doc_fallback_filenames or project_doc_max_bytes, restart Codex so the new config loads.

If you also use Claude Code

Keep one source of truth for shared rules and do not copy them into a second file. See AGENTS.md vs CLAUDE.md for the split. If Claude Code is the agent that ignores its file, use why your agent ignores CLAUDE.md.

To test that rules actually change agent behavior, see how to test CLAUDE.md, skills and hooks. For a hook-by-hook check on the Claude side, see the Claude Code hooks checklist.

Running agents on a machine with secrets? Use the OpenClaw security checklist too. Instruction files tell an agent what to do; they do not stop it.

FAQ

Why is Codex ignoring my AGENTS.md?

The usual causes are an AGENTS.override.md that replaces it, a file outside the path from the project root to your current directory, an empty file, or rules past the 32 KiB project_doc_max_bytes limit.

How do I see which AGENTS.md files Codex loaded?

Run codex --ask-for-approval never "Summarize the current instructions." from your working directory. Codex should repeat the global file and then the project files in order.

Do I need to restart Codex after I edit AGENTS.md?

Start a new run or a new TUI session. Codex builds the chain at the start of each one, so there is no cache to clear.

Was this guide useful?

Read next

Claude Code Hooks Checklist: 10 Checks When a Hook Does Not Fire or Block
Claude Code hook not running or not blocking? Run 10 yes/no checks: settings file, matcher, exit code 2, PreToolUse JSON, timeout, trust dialog and the debug log.
Your Agent Is Ignoring CLAUDE.md. Here's Where It's Reading Instead
Claude Code follows rules you never wrote and ignores the ones you did. Usually a nested CLAUDE.md in a subfolder is silently overriding your root file.
OpenClaw Keeps Using Claude Instead of Your Local Ollama Model — Fix
OpenClaw keeps calling Claude/Anthropic even though you set up Ollama? Fix the default chat model, kill env overrides, and verify with openclaw models status.
Codex Says the Model Is Not Supported Before It Starts
Codex fails before reading the task because config.toml selects a model the installed CLI cannot use. Update Codex or override the model.