Codex cuts your AGENTS.md at 32 KiB, silently before 0.168.0: overrides, fallbacks, fixes

How project_doc_max_bytes, AGENTS.override.md and fallback filenames decide what Codex actually reads

December 04, 2026 8 min read

If Codex is ignoring part of your AGENTS.md, measure the file before you rewrite it. Codex stops reading project instructions at 32 KiB by default, which is 32,768 bytes, and anything past that point never reaches the model. The fix is one line in ~/.codex/config.toml, or a smaller file.

Whether Codex tells you about the cut depends on your version. Up to CLI 0.167.0 it said nothing. From 0.168.0 it emits a warning. More on that below, because the word "silently" turned out to be half right.

A note on method. Codex is not installed on the machine this was written on, so nothing here is a hands-on test. Everything comes from OpenAI's AGENTS.md documentation and from reading the open source loader, agents_md.rs, at the 0.172.0 release tag, the latest stable release as of late November 2026.

Codex AGENTS.md not working? Measure it first

Run this from the directory where you start Codex:

wc -c AGENTS.md
find "$(git rev-parse --show-toplevel)" \( -name AGENTS.md -o -name AGENTS.override.md \) -not -path '*/node_modules/*' -exec wc -c {} +

The first number is the file in front of you. The second list is every instruction file in the repository. Only the ones on the straight path from the repository root down to your current directory count, and their sizes add up against one budget.

If that sum is over 32,768, you have found the problem.

The docs put it this way: Codex "stops adding files once the combined size reaches the limit defined by project_doc_max_bytes (32 KiB by default)".

Is Codex ignoring AGENTS.md silently? It depends on your version

This is where the docs and the code tell slightly different stories, and the code is more useful.

In the 0.167.0 source, an oversized file is cut with data.truncate(remaining) and the only trace is a tracing::warn! line, "project doc exceeds remaining budget; truncating". That goes to a log file, not to your screen. So for most of 2026, truncation really was silent.

On 4 November 2026 a commit titled "Warn when project instructions exceed the configured byte budget" landed. Its description says it out loud: "Project instructions could be truncated or skipped when the byte budget ran out without a user-facing warning."

We checked the release tags. The warning code is absent at 0.167.0, published 6 November, and present at 0.168.0, published 13 November. From that version on, Codex emits a warning that reads like this:

Loaded only 32768 of 51200 bytes from `/repo/AGENTS.md` in environment `local` under the 32768-byte project instruction budget. Trim your project instructions to fit the budget. If you need to keep them all, increase `project_doc_max_bytes`.

The numbers, path and environment name in that sample are ours, filled into the format string from the source. A second message, starting "Skipped project instructions", covers files that were never opened because the budget was already spent.

So check codex --version. Below 0.168.0, you get no warning at all. We did not confirm how the desktop app or the IDE extension display the warning, so do not assume you would have seen it there.

How the 32 KiB cut actually works

OpenAI describes this limit three different ways. The AGENTS.md guide says the limit applies to "the combined size". The advanced config page says project_doc_max_bytes controls "how much to read from each AGENTS.md file". The config reference says "Maximum bytes read from AGENTS.md". Those are not the same rule.

The source settles it. There is one budget, shared by every project instruction file on the path. Codex reads them from the repository root downward and subtracts each file's size from what remains.

Three consequences follow, and none of them is obvious from the docs.

The cut lands in the middle of the file that crosses the line. Codex does not skip the whole file. It keeps the first bytes that fit and drops the rest, at a byte offset. That can be mid sentence. It can be halfway through your list of rules, with the "never do this" section on the wrong side.

The most specific file loses first. Files are read root first, and the docs say files closer to your working directory "override earlier guidance because they appear later in the combined prompt". Later also means last in line for the budget. A fat root AGENTS.md can starve the nested file that was supposed to win.

Your global file does not count. The newer warning text says the total "includes global and thread instructions" but "the limit applies only to project files". So ~/.codex/AGENTS.md is not cut by this setting, whatever the phrase "combined size" suggests.

AGENTS.override.md: one file per directory, and it replaces

AGENTS.override.md is the second thing to check when Codex is ignoring AGENTS.md, because it is designed to make that happen.

In each directory Codex looks for AGENTS.override.md first, then AGENTS.md, then any fallback names. The docs are exact: "Codex includes at most one file per directory." If the override exists, the regular file next to it is not merged in. It is skipped. The docs' own sample tree labels it "Ignored because an override exists".

The same rule applies in your Codex home directory. Codex reads ~/.codex/AGENTS.override.md if it exists and otherwise ~/.codex/AGENTS.md, using "only the first non-empty file at this level". OpenAI suggests the override for "a temporary global override". Temporary files get forgotten. If your global rules stopped applying one day, look for an old override before anything else:

ls -la ~/.codex/AGENTS*.md

Overrides in other directories do stack. A root AGENTS.md plus a services/payments/AGENTS.override.md both load when you start Codex inside services/payments. The override only replaces its sibling.

project_doc_fallback_filenames: names only, never paths

If your repository already keeps its guidance under another name, you can tell Codex to accept it:

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

With that config, each directory is checked in this order: AGENTS.override.md, AGENTS.md, TEAM_GUIDE.md, .agents.md. A fallback is only used when the earlier names are missing in that directory.

Here is the trap. An entry like docs/AGENTS.md or .github/instructions.md looks reasonable and does nothing. The source drops any fallback entry that contains a path separator, and the only notice is a log line: "ignoring project_doc_fallback_filenames entry that is not a filename". This one is still silent in 0.172.0. Fallbacks are file names looked up in each directory on the path. They are not paths.

Two cases where Codex loads no project instructions at all

Before blaming project_doc_max_bytes, rule these out.

The project is not trusted. The loader returns nothing when the active project is untrusted. No AGENTS.md, no override, no fallback. That check was added in August 2026 in a commit titled "Ignore project instructions for untrusted projects". The troubleshooting section of the AGENTS.md guide does not mention it.

The cap is set to zero. project_doc_max_bytes = 0 switches project instructions off entirely in the same line of code.

Two smaller ones from the docs. Empty files are skipped. And if Codex cannot find a project root, which by default means a .git marker, "it only checks the current directory", so a parent AGENTS.md is never seen.

Fixes, in the order we would try them

Raise the cap if you need everything. Set project_doc_max_bytes = 65536 in ~/.codex/config.toml, the value OpenAI uses in its own example, then start a new session. Codex builds the instruction chain "once per run", so a running session will not pick up the change.

Split the file if the repository is large. Move service specific rules into nested AGENTS.md files so each session only loads the path it is working in. This is what the docs recommend when you hit the cap.

Cut it down if you can. This is our preference. OpenAI's pricing page lists "Reduce the size of your AGENTS.md" among its tips for making usage limits last longer. A file near 32 KiB costs you on every session, even when nothing is truncated. If yours grew by accretion, it is often faster to generate a lean AGENTS.md for your stack and paste back only the rules that are specific to your project. Our guide to structuring instruction files for large projects covers the splitting side.

Then verify. OpenAI's suggested check is:

codex --ask-for-approval never "Summarize the current instructions."

Put a distinctive rule at the very bottom of your longest file and ask Codex to repeat it. If it cannot, the tail is not loading. For a file by file audit, the docs point to codex -c log_dir=./.codex-log and the resulting codex-tui.log.

Summary for anyone searching "codex agents.md not working"

The default budget is 32 KiB across all project instruction files from the repository root to your working directory. Past that, content is cut mid file, and before CLI 0.168.0 nothing told you. AGENTS.override.md replaces the AGENTS.md beside it. Fallback names cannot be paths. Untrusted projects load nothing.

And if you are also sorting out which tool reads which file, we have a comparison of AGENTS.md and CLAUDE.md. A short file avoids most of the problems on this page.

Doing this across a whole company? contextarch for teams shows which AI tool loads which instructions in every repo you have, and stops a pull request from breaking them.
contextarch.ai·Context Doctor·Setup check·Generator·Templates·Blog·Newsletter