研究:AGENTS.md 过期指令让 Claude Code 多耗三分之一的工具调用
When Instruction Files Go Stale: Documentation Debt and Hidden Cost in Coding Agents
如果你在项目里维护 AGENTS.md 或 CLAUDE.md,这篇论文量化了文件过期后每次会话多花的真金白银,732 条轨迹的逐次调用分析很扎实。
arXiv 论文(编号 2611.09802)研究了 Claude Code 等编码智能体读取 AGENTS.md、CLAUDE.md 时的文档债务问题。作者从活跃开源仓库抽取 3 条真实过期指令(测试命令、代码位置、组件添加流程),让两个模型在 3 种指令版本下执行 22 个维护任务,共分析 732 条轨迹的逐次工具调用。结果显示,Claude Sonnet 5.5 在过期测试命令下每轮多花约 2 次工具调用,比使用修正后命令多三分之一;任务成功率无法反映这部分开销。智能体最终能从失败中恢复,但没有一个主动修复过期的指令文件。
When Instruction Files Go Stale: Documentation Debt and Hidden Cost in Coding Agents
LLM-based coding agents such as Claude Code are guided by repository instruction files (also called context files or agent configuration files) like AGENTS.md and CLAUDE.md, which are read in every agent session. As any documentation artifact, these files can fall behind the code and become stale (e.g., a test folder moves, but the file still points to the old one). In technical debt terms, such a stale instruction is documentation debt, and its interest is the cost it adds to every later agent session. Evaluations that check only task success can miss this cost, and the stale file can persist. In this study, we ask what leads agents to act on a stale instruction, how it affects their behavior and at what cost, and how they recover. We study three real-world stale instructions from active open-source repositories in depth, each a different kind of guidance: a test command, a code location, and a procedure for adding a component. Agents fix 22 maintenance tasks under three versions of each instruction (left stale, corrected to the current path, and removed), with the code and the task held fixed, and we analyze 732 trajectories of two models at the level of individual tool calls. We find that agents follow stale guidance when it is relevant to their tasks, sometimes even when correct information is available elsewhere. On the stale test command, Claude Sonnet 5.5 needed about two extra tool calls per run, a third more than with the corrected command; in the other cases, we could not detect a difference. Although agents generally recovered from the immediate failures, none repaired the underlying instruction file. Correcting the instructions eliminated operations on obsolete paths, while removing them prevented most. Our findings show that task success alone can hide the costs of documentation debt, highlighting the need to evaluate agent behavior beyond final outcomes.