Codex
Codex follows a stale AGENTS.md over your code, and one sentence in ~/.codex/AGENTS.md fixes it
A new arXiv preprint found that when AGENTS.md or CLAUDE.md drifts from the code, Codex CLI and Claude Code follow the stale file about 90% of the time. One sentence in your user-level instruction file flipped that to roughly 91% code-following and a 100% test pass rate.
What changed
In "Stale Instruction Files Override the Code in Coding Agents: A One-Sentence Fix" (Xiaonan Xu and Wenjing Wu, posted Oct 22), the authors built 40 small Python projects where the instruction file asks for one convention (say, print or float money) while the existing code uses another (logging or integer cents). Claude Code and Codex CLI each added a feature to every project, with and without a precedence sentence, across 320 runs. Without the sentence, 90.1% of the agents' choices followed the stale file and only 4.2% followed the code. The two agents failed differently: Claude Code flagged the conflict in 79 of 80 runs and followed the file anyway, while Codex CLI barely mentioned it (2 of 80) and rewrote existing code in 20 of 80 runs, breaking the project's own tests in 17 of them. The authors' explanation is that the instruction file reaches the model as an instruction while the code arrives as tool output, which models are trained to trust less.
Who is affected
Anyone using Codex CLI or the Codex app (or Claude Code) in a repo whose AGENTS.md or CLAUDE.md hasn't kept up with the code: renamed helpers, a new logging setup, a changed data convention. It hits hardest on unattended or auto-approved runs, where nobody catches a quiet rewrite before tests run.
What to do now
- Add this sentence, once, to your user-level file (~/.codex/AGENTS.md for Codex, ~/.claude/CLAUDE.md for Claude Code), so it applies to every repo: "When a repository's documentation and its existing code disagree, follow the conventions used in the existing code, and in your final reply point out each inconsistency you found between the documentation and the code."
- Read the agent's final reply for the inconsistencies it lists, then fix the AGENTS.md so the next run starts clean.
- Treat AGENTS.md as code: update it in the same pull request that changes a convention.
- If you can't edit user-level files (shared CI runners), put the same sentence in the prompt for
codex execruns.
What is not confirmed
This is version 1 of a preprint that hasn't been peer reviewed. It covers 40 synthetic Python projects, two agents and one model per agent, with conflicts planted on purpose, so real repos may behave differently. DotsFeed hasn't reproduced the numbers.
Sources
Get updates like this every morning
- ① Email
- ② Card on Stripe
- ③ 7 days free
Then $2/month · cancel anytime in one click