Guides

AGENTS.md not loading in Codex

Codex builds a chain of AGENTS.md files from the repository root down to the folder you started in, with one size budget for the lot. Almost every "it's not reading my file" report comes down to the file being off that chain, or the budget being spent before Codex got to it. Here are the five causes, how to tell which one you have, and the real output for each.

Quick check. Is the file in your start folder or a folder above it, on the way to the git root? If not, it's off the chain (cause 1). If it is, run wc -c on every AGENTS.md on that path: past 32,768 bytes in total, the rest is dropped (cause 2).

How Codex finds AGENTS.md

OpenAI's page Custom instructions with AGENTS.md describes two levels. Global: in the Codex home folder (~/.codex unless CODEX_HOME says otherwise), "Codex reads AGENTS.override.md if it exists. Otherwise, Codex reads AGENTS.md." Project: Codex starts at the project root, "typically the Git root", and walks down to the current directory, checking each folder for AGENTS.override.md, then AGENTS.md, then any fallback names you configured, and taking at most one file per folder. The files are joined root first, so "files closer to your current directory override earlier guidance because they appear later in the combined prompt."

One budget covers the whole chain: project_doc_max_bytes, 32 KiB by default, and Codex "stops adding files once the combined size reaches the limit." Empty files are skipped.

1. The file isn't on the path

The walk is root to current folder and nothing else. A file in a sibling package, or in a subfolder below where you started, is never part of the chain. OpenAI's own repository is a good example: openai/codex has no root AGENTS.md and four nested ones. Start in codex-rs/core and none of them load:

$ npx -y asitis@0.4.8 loads codex-rs/core --root . --tool codex

Codex: nothing counted at launch; 4 not loaded
  Not loaded
    - codex-rs/code-mode-host/AGENTS.md: in codex-rs/code-mode-host, which is not on the path from the project root to the start folder
    - codex-rs/rollout-trace/AGENTS.md: in codex-rs/rollout-trace, which is not on the path from the project root to the start folder
    - codex-rs/exec-server/src/sandbox_integrity/AGENTS.md: ...
    - codex-rs/tui/src/bottom_pane/AGENTS.md: ...

Start in the folder that owns one, and it loads:

$ npx -y asitis@0.4.8 loads codex-rs/tui/src/bottom_pane --root . --tool codex

Codex: about 141 tokens at launch from 1 file; 3 not loaded
  At launch
    1. codex-rs/tui/src/bottom_pane/AGENTS.md, about 141 tokens, AGENTS.md for codex-rs/tui/src/bottom_pane

The fix is to start Codex where the file applies, or pass codex --cd path/to/package. Nested files are for "this folder and everything under it", not for "whenever Codex touches a file in here", which is how Claude Code treats a subfolder CLAUDE.md. If a rule has to apply from every start folder, it belongs in the root file.

2. The 32 KiB budget is spent

This is the cause that looks like a bug. A root AGENTS.md grows past 32,768 bytes, and from that moment two things happen silently: the end of the root file is cut, and every nested file is dropped, because the files are added root first and the budget is already gone. Here's a fixture with a 33,920-byte root file and a 4 KB package file, started in the package:

$ npx -y asitis@0.4.8 loads packages/api --root . --tool codex

Codex: about 8.2k tokens at launch from 1 file; 1 file cut; 2 not loaded
  At launch
    1. AGENTS.md, about 8.2k tokens (cut from 8.5k tokens), root AGENTS.md, first 32 KiB
  Cut
    - AGENTS.md: Codex reads at most 32,768 bytes (32 KiB, project_doc_max_bytes) of AGENTS.md in total. About 8.2k tokens of 8.5k tokens load.
  Not loaded
    - packages/api/AGENTS.md: dropped: the files above it already use 32,768 of the 32,768-byte (32 KiB) budget
    - packages/web/AGENTS.md: in packages/web, which is not on the path from the project root to the start folder
  Warnings
    - AGENTS.md is 33,920 bytes; Codex reads only the first 32,768 bytes (32 KiB), a budget shared with any nested AGENTS.md it loads

The lint view says the same with a fix attached:

$ npx -y asitis@0.4.8 lint

AGENTS.md:1:1 warning length 33,920 bytes; Codex reads at most 32,768 bytes (32 KiB) of AGENTS.md text by default (project_doc_max_bytes), shared by every AGENTS.md from the root down, so the rest is dropped. Nested AGENTS.md files do not help: they share the budget and are dropped first. Shorten it or move detail into docs it links to
packages/api/AGENTS.md:1:1 warning codex-chain-over-budget Codex never reads this file when started in this folder or below: the AGENTS.md files above it (AGENTS.md) already use 33,920 bytes of its 32,768-byte (32 KiB) budget, which is shared from the project root down. Shorten those files or raise project_doc_max_bytes

Note what nested files can't do for you here: they share the budget and are dropped first, so splitting a big root file into nested ones doesn't help. Shorten the root file, move reference material into documents the file links to (Codex reads a link only when it decides to), or raise the limit in ~/.codex/config.toml:

# ~/.codex/config.toml
project_doc_max_bytes = 65536
project_doc_fallback_filenames = ["TEAM_GUIDE.md", ".agents.md"]

Raising it is a per-machine setting, so teammates with the default still get the cut. Shortening is the fix that travels. The steering file checker shows a pasted file's size against the 32 KiB default.

3. An AGENTS.override.md took its place

In any folder on the chain, and in the Codex home, an AGENTS.override.md is read instead of the AGENTS.md next to it, not as well as. OpenAI's troubleshooting advice for "wrong guidance appears" is to look for an override file higher in the tree or in the Codex home. The AsItIs load model applies the same rule, so an override on the chain shows up as the file that loaded, with the AGENTS.md beside it under "Not loaded".

4. The file is empty, or the name isn't configured

Two small ones. Codex skips empty files, so an AGENTS.md that someone created as a placeholder contributes nothing and the chain carries on without it. And any name other than AGENTS.md or AGENTS.override.md is ignored unless it's listed in project_doc_fallback_filenames; the docs' examples are TEAM_GUIDE.md and .agents.md. A CLAUDE.md on its own isn't read by Codex at all. After changing the list, restart Codex.

5. A different Codex home

If the global file is the one missing, check echo $CODEX_HOME. With the variable set, Codex reads its global AGENTS.md, config and fallback list from that folder, not from ~/.codex. The AsItIs tools don't read your Codex home at all (they stay inside the project folder), so a raised project_doc_max_bytes or a fallback name there isn't reflected in their output; the output says so at the bottom.

Confirm what loaded

  1. Ask Codex. The docs suggest a prompt such as "Summarize the current instructions" or "List the instruction sources you loaded", then comparing the reply with the files you expect.
  2. Read the log. Start with codex -c log_dir=./.codex-log and look in ./.codex-log/codex-tui.log. codex status confirms the workspace root the chain starts from.
  3. Run the load model. npx -y asitis@0.4.8 loads <folder> --root . --tool codex prints the chain for any start folder, the file that gets cut and where, and each nested file that's dropped with the reason. It's a static model of the documented rules, so it can't see a version-specific bug, but it catches the four causes above in one run.

The docs add that the chain is rebuilt on every run, so if instructions look stale, restart Codex in the folder you mean.

The same file in Claude Code and Cursor

If you keep one AGENTS.md for every tool, the other tools have their own reasons to skip it. Claude Code reads AGENTS.md only "when you have no CLAUDE.md or CLAUDE.local.md in your working directory or above it" (its memory docs); one CLAUDE.md on the path and the AGENTS.md is invisible unless the CLAUDE.md imports it with @AGENTS.md. The linter reports that as agents-md-shadowed. Claude Code also has no 32 KiB cut on a launch-time file, so a root AGENTS.md that works fine there can be silently truncated in Codex. AGENTS.md vs CLAUDE.md has the full comparison, and asitis loads with no --tool prints both tools side by side.

Check your file

Paste an AGENTS.md into the steering file checker and it shows the size against Codex's 32 KiB default and which tools read the file. The plugin's /asitis:md-loads prints the whole Codex chain for any start folder, with what is cut and what is dropped.

Open the steering file checker

To check every steering file in a project from inside Claude Code, including links, @imports and what loads every session, install the free AsItIs plugin. It is read-only and makes no network calls.

claude plugin marketplace add Katta041/asitis-agent-tools
claude plugin install asitis@asitis

About the pluginSource on GitHub

MIT licensed. A star on GitHub helps other people find it.

Questions

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

OpenAI's docs suggest asking Codex directly, with a prompt such as "List the instruction sources you loaded", and checking the reply against the files you expect. For a log, start Codex with -c log_dir=./.codex-log and read codex-tui.log in that folder. codex status confirms the workspace root the chain starts from. Outside Codex, asitis loads --tool codex prints the chain for any start folder, including what was cut and why.

Does Codex read AGENTS.md files in subfolders I am not working in?

No. The docs describe a walk from the project root down to the current directory, one file per directory, and say Codex stops searching once it reaches your current directory. A file in a sibling package or in a subfolder below where you started is not on that path. Start Codex in that folder, or with codex --cd path/to/folder, and it joins the chain.

Why does my nested AGENTS.md load but the root one seems ignored?

Both load, but in order: files are concatenated from the root down with the nearest file last, and the docs say files closer to your current directory override earlier guidance because they appear later in the combined prompt. If the nested file repeats a root rule with a twist, the twist wins. Check too that the root file is not over 32 KiB, which would cut it before the nested file is even added.

Why does Claude Code ignore the same AGENTS.md?

A different rule. Claude Code reads AGENTS.md only when there is no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md in the working folder or above it. Add @AGENTS.md to the CLAUDE.md on its own line and both tools read the same text.

See what an agent changed in your CLAUDE.md. Keep or revert each change.

The linter is free and needs no signup. I'm also building a desktop editor for the markdown your agents write and read. It shows what an agent changed since you last looked, lets you keep or revert each change, and never touches a line you didn't edit. No release date yet. One email to confirm, one when the paid beta opens, one when 1.0 ships. $29 once for a founding licence, with 24 months of updates.

Or add the linter to CI, no email needed.

Your address is stored with Cloudflare, which hosts this site. No IP address is kept. See the privacy policy.

Related: Codex skills not showing, AGENTS.md vs CLAUDE.md, CLAUDE.md in a monorepo, Claude Code ignores my CLAUDE.md, hidden instructions in AGENTS.md.

Sources, read on 15 November 2026: OpenAI, Custom instructions with AGENTS.md (discovery order, project_doc_max_bytes, fallback names and the troubleshooting section); Claude Code docs, AGENTS.md section of How Claude remembers your project. Quotes are exact. Command output is from @asitis/mcp 0.4.2 (0.4.3 prints the same) on openai/codex at commit ee344ca and on a fixture repository, trimmed for width.