Check Which AGENTS.md Files Codex Loaded Before Adding Rules
Before a model can follow a rule, the rule has to be in its context. Chapter 21 treats that context as a budget assembled from parts; for Codex, the instruction part is built by a documented walk. So when Codex ignores the eval rule in eval/AGENTS.md ("never overwrite results/; write a new timestamped folder"), the first question is whether the rule was assembled in at all. Adding another rule elsewhere can make the conflict harder to see.
OpenAI's documentation gives the order. The global file in ~/.codex comes first. Then, from the project root down to the working directory, Codex includes at most one file per directory, checking AGENTS.override.md before AGENTS.md. Files nearer the working directory come later in the prompt and take precedence. The walk stops adding files once the total passes project_doc_max_bytes, 32 KiB by default.
That gives three mechanical reasons a rule can be absent:
- The task started from a directory above
eval/, so the walk never reached it. - The files above it used up the 32 KiB budget first.
wc -con each file in the path gives you the total. - An override replaced the file.
AGENTS.override.mdtakes the place of its folder'sAGENTS.mdrather than adding to it, and~/.codex/AGENTS.override.mddoes the same globally.
The third is the one that lingers. Suppose that during a deadline week someone adds eval/AGENTS.override.md saying "run only the smoke eval." A month later Codex still follows it, and a 40-task benchmark table reports 12 tasks under a heading that still says 40. When you add an override, write the reason and the removal condition into it, such as "remove after the October 3 submission," and read its git log before you delete it.
Ask, then confirm. From the directory where the task will run:
find . -name AGENTS.override.md; ls ~/.codex/AGENTS.override.md
codex --cd eval --sandbox read-only --ask-for-approval never \
"List the instruction sources you loaded, in order."--sandbox read-only is what keeps the run from changing files; --ask-for-approval never only stops Codex from pausing to ask. The model's list is a lead, not proof. For a record that does not depend on its answer, start Codex with -c log_dir=./.codex-log and read codex-tui.log.
The check. In a scratch repository, put one harmless formatting rule at the root and a different one in a nested folder, then run the command from both places. As documented, the nested run lists the nested file last. Add an AGENTS.override.md beside the nested file and run again: the listing should show the override in place of the nested AGENTS.md, not next to it.
An instruction is not a guard. What would have caught the stale override is a test: keep a manifest of benchmark task ids and make the report step fail when the results table has fewer.
comm -23 <(sort tasks.txt) <(cut -f1 results.tsv | sort -u) | tee missing.txt
test ! -s missing.txtWhat was checked: --cd, --sandbox, --ask-for-approval and -c appear in the help output of codex-cli 0.155.1, run on September 20 and 21, 2026. The discovery order, the override rule, the size cap and the log option come from OpenAI's documentation, reread on September 30, 2026. None of the commands or the exercise were run against a live model for this note, so the listings above are the documented behavior to test for, not observed output.
If the right files load and a rule still slips, the problem has moved from assembly to attention: test whether a shorter file helps.
Updated . Added the read-only command, the documented loading order and three causes to rule out.