Coding agents follow stale CLAUDE.md files 90% of the time — one sentence flips it
First seen on X 23 hours ago@ai_database ♥ 3,8454 views
When a project's instruction file (CLAUDE.md or AGENTS.md) disagrees with the actual code, coding agents like Claude Code and Codex follow the outdated instructions nine times out of ten, a new study finds.
According to the paper "Stale Instruction Files Override the Code in Coding Agents: A One-Sentence Fix," posted to arXiv on Oct 22, researchers built 40 Python projects where the instruction file asked for one convention and the existing code used another, then had both agents add a feature in 320 runs. Without intervention, 90.1% of the agents' choices followed the stale file.
Claude Code noticed the conflict in 79 of 80 runs and still followed the file. Codex CLI rewrote existing code to match the file in 20 of 80 runs, and the project's own tests failed in 17 of those.
Adding one sentence to the user-level instruction file giving existing code precedence raised code-following choices from 4.2% to 91.4% and the test pass rate from 89.4% to 100%. The authors say the instruction file reaches the model as an instruction while code arrives as tool output, which models are trained to rank lower. Japanese paper account AIDB (@ai_database) suggested the wording "When the documentation and existing code conflict, follow the code's conventions, and list all inconsistencies in your final reply"; its post passed 3,800 likes.
“According to researchers, it is recommended to add the following sentence in advance to CLAUDE.md and AGENTS.md.”