Stale Instruction Files Override the Code in Coding Agents: A One-Sentence Fix
A stale CLAUDE.md or AGENTS.md line made agents override working code 90% of the time, even when they spotted the conflict.
A new study tested Claude Code and Codex CLI across 40 Python projects where the project's instruction file (CLAUDE.md/AGENTS.md) specified a different convention than the existing code. Without guidance, agents followed the stale instruction file in 90.1% of choices, and Codex CLI's rewrites to match the file broke tests in 17 of 20 cases. Adding a single sentence telling the agent to prioritize the existing code over the instruction file reversed this, bringing code-following choices to 91.4% and test pass rate to 100%.
Why it matters
Instruction files like CLAUDE.md and AGENTS.md are now a standard part of agentic coding workflows, and this research shows they can silently override correct, working code even when the agent recognizes the contradiction. That's a previously undocumented failure mode with a cheap, concrete mitigation, which is unusually actionable for a research paper.
What is verified
In a study of 40 Python projects and 320 runs, Claude Code and Codex CLI followed a stale instruction file over the existing code's convention in 90.1% of choices when no precedence rule was given. [1]
Claude Code identified the conflict between the instruction file and the code in 79 of 80 runs but still followed the instruction file anyway. [1]
Codex CLI rewrote existing working code to match the stale instruction file in 20 of 80 runs, breaking the project's own tests in 17 of those cases. [1]
Adding one sentence to the user-level instruction file giving the existing code precedence raised the share of agent choices that followed the code from 4.2% to 91.4%, stopped the harmful rewrites, and raised the test pass rate from 89.4% to 100%. [1]
The authors attribute the behavior to agents receiving instruction files as an instruction and code as tool output, with models trained to rank instructions higher than tool output. [1]
What is not
- The paper is a preprint submitted to SN Computer Science and has not undergone peer review.
- Testing was limited to 40 Python projects and two agents (Claude Code and Codex CLI); results may not generalize to other languages, frameworks, or agents like Cursor.
- The study does not report how commonly real-world CLAUDE.md/AGENTS.md files actually go stale relative to the codebase, only that the effect is large when they do.
- No independent replication of the findings is cited.
Sources
- 1arXiv cs.CRarxiv.org · Primary source
Original source published 22 October 2026 at 03:00.
An AI-assisted briefing by Coding Partners. We link the evidence behind the reporting so you can explore the original work and assess the claims. How CP Signal works.