Stale Instruction Files Override the Code in Coding Agents: A One-Sentence Fix
Source
arxiv.org
Author
Xiaonan Xu, Wenjing Wu
Date
Why it matters
Stale CLAUDE.md or AGENTS.md conventions override the real codebase, and Claude Code flagged the conflict yet still followed the file. One sentence in your user-level instructions giving existing code precedence flipped the behavior.
Key takeaways · AI-distilled
The authors built 40 Python projects where the instruction file asks for one convention while the code uses another, such as print instead of logging, and had Claude Code and Codex CLI add a feature in 320 runs, with and without one precedence sentence.
Without that sentence, 90.1% of the agents' choices followed the stale file. Claude Code pointed out the conflict in 79 of 80 runs and still followed the file.
Codex CLI rewrote the existing code to match the file in 20 of 80 runs, and the project's own tests then failed in 17 of those runs.
Adding the sentence raised the share of choices that follow the code from 4.2% to 91.4%, stopped the rewrites, and raised the test pass rate from 89.4% to 100%.
The authors attribute the behavior to how agents receive the two sources: the instruction file reaches the model as an instruction, while the code arrives as tool output, which models are trained to rank lower.