Manuscript Offprint

arXiv:2611.09802

When Instruction Files Go Stale: Documentation Debt and Hidden Cost in Coding Agents

Tural Mehtiyev, Biruk Tadesse, Lawrence Arkoh, Wesley Assunção

Tural Mehtiyev, Biruk Tadesse, Lawrence Arkoh, Wesley Assunção

North Carolina State University

{tmehtiy, batadess, larkoh, gwquezas}@ncsu.edu

Abstract—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 (e.g., additional tool calls to correct stale instruction). Evaluations that check only task success can miss this cost and the stale file can persist in the repository. 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. Following stale instructions can lead to wasted tool calls and increased effort without affecting task success. 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.

Index Terms—documentation debt, technical debt, coding agents, LLM agents, repository instructions, AGENTS.md, CLAUDE.md, context files, stale documentation, agent trajectories, software maintenance, controlled evaluation

I. INTRODUCTION

Developers steer coding agents through instruction files such as AGENTS.md or CLAUDE.md. These files, usually stored at the root of a repository, tell the agent which commands build and test the project, where its parts live, and which instructions to follow [3], [4]. Agents read these files at the start of their sessions and follow their guidance closely [3]. However, documentation tends to fall behind the code it describes: developers name outdated content among the documentation problems they encounter [5], and practitioners report causes and effects of such documentation debt [6]. Instruction files are no exception. Some are never updated after they are created [7], updates to others mostly add lines rather than remove them [8], and Treude and Baltes flag potentially stale code references in the instruction files of 23.0% of 356 repositories [9]. Consequently, agents may follow outdated guidance, such as commands or paths that are no longer valid; in constructed conflicts between an instruction and the code, agents follow the instruction [10], [11]. We refer to an instruction that remains in the file after becoming outdated as a stale instruction.

Fig. 1 illustrates how such instruction can affect an agent's work. The example comes from the static-analysis framework pyflow [1], whose AGENTS.md lists pytest tests/ifds as the command for running its IFDS tests. This command was valid until July 2026, when the tests moved to tests/analysis/ifds. However, the instruction remained unchanged through two subsequent edits of the file. To examine its effect, we introduced a small bug by negating a condition, causing one test to fail. We then asked the same agent to fix the bug under three conditions: with the stale instruction, with the instruction corrected, and with it removed. In all three runs, the agent located and fixed the bug using the same sequence of actions: a search, a read, and an edit (see Fig. 1). The difference appeared during verification. With the stale instruction, the agent ran the documented command, but the referenced directory no longer existed, so pytest executed no tests. Because the agent piped the output through tail, the shell reported a successful exit status. Although the output indicated that no tests had run, the agent needed two further test attempts before successfully verifying the fix. With the corrected instruction, verification took one call, while removing the instruction required two. All three runs fixed the bug and passed the final check on the original tests, making them indistinguishable to a success-only evaluation.

By observing this phenomenon through the lens of technical debt [12], the outdated or stale instruction is a documentation debt item, and the example shows both parts of that debt. The principal, the cost of repaying it, is a one-line edit. The interest is what each run pays while the line stays stale: here, two extra tool calls, half again the work of the corrected run, spent on a verification step whose failure looked like success. For one run this interest is small, but it is not paid once. The instruction file is loaded in every agent session, and the agent recovered without repairing the line, so every later task that reaches the line must pay again; if each pays a similar amount, the interest

Preprint.

Figure

Fig. 1. The stale test command in pyflow [1], one of the three stale instructions we study: three runs of Claude Sonnet 5.5 on the same seeded bug (a negated condition), one per version of the line. Every tool call is shown (commands shortened), and (+n) counts calls beyond the corrected run. All three runs find and fix the bug the same way and differ only in checking the fix: one call with the corrected line, two without the line, and three with the stale line, whose documented command runs no tests while the pipe through tail reports success. All three pass our final check on the original tests. The two errors come from a test folder that needs a third-party module missing from the environment, unrelated to the bug. We chose the task whose runs varied least across repeats, and the repeat in which each run took its condition's median number of calls; the transcripts are in the replication package [2].

grows with the number of agent runs while the principal stays one line. Nothing in the outcome signals the debt, so it can stay: the bug is fixed, the tests pass, and the maintainer may learn nothing.

Existing research does not measure this kind of cost. Treude and Baltes detect stale references in instruction files and call for controlled experiments on how they affect agents, but they do not run agents themselves [9]. Studies that do run agents compare runs with an instruction file against runs without one, and assume that the file's content is correct [3], [4]. Work on stale instructions builds conflicts over coding conventions, for example a file that demands one style while the existing code uses another, and judge the outcome by the code the agent produces [10], [11]. In that setting, following the stale rule produces worse code, so checking the code reveals the harm. A stale path or command works differently: the repository itself contradicts it, so the agent hits an error, recovers, and still delivers a correct fix.

To investigate the consequences of stale instructions, our study is guided by three research questions (RQs):

RQ1. What leads an agent to act on a stale instruction?

RQ2. How does a stale instruction affect the agent's behavior, and at what cost?

RQ3. How does the agent recover, and does it surface or repair the underlying stale instruction?

To answer these questions, we study three real-world stale instructions in depth, each a different kind of guidance: a test command in pyflow [1], a code location in cog [13], and a procedure for adding a component in aghub [14]. Each was written by the maintainers of an active repository, was correct until a documented code change made it outdated, and survived every later edit of its file (2, 13, and 4 edits; Fig. 3). Our experiment asked the agents to fix the same bugs with the stale, corrected, and removed version of each instruction, on identical code and under the same setup: 22 tasks, three versions, five to seven repeats, and two models give 732 runs (Section III). We measure task success, operations on the stale path, tool calls, and tokens, and rather than measuring many

instructions shallowly, we follow every run tool call by tool call, which lets us explain why agents act as they do: how they came to take the stale path, what happened there, and how they recovered.

Agents took the stale path in two of the three cases: the test command in 78 of its 80 stale runs, the procedure in about two thirds, and the code location never. The Location case is a deliberate contrast: its tasks work right beside the stale path but never need it. Whether agents used a stale line thus depended on the task more than on the line itself. Agents used it when the task required what the line names, such as running the tests or finding the code the procedure names, and offered no other starting point. They then followed it silently from the loaded file, sometimes even when the bug report named the correct location. At the stale path, the failure often looked like a success: the test command found no tests, but agents piped its output through tail, so the call was reported as successful, and in 19 of Sonnet's 40 stale runs the first check of the fix ran no tests. Per case, we detected extra effort only for Claude Sonnet 5.5 on the test command (about two tool calls per run, a third more than with the corrected line); in the other cases, we detected no difference in tool calls or tokens. Task success hid all of this, since agents fixed the bug in nearly every run under every version. Agents worked around the stale path within a few calls, mostly by searching the repository, told the user mainly when the failure hit the check of their own fix, and never repaired the instruction file, even when they noticed other outdated parts of it. Correcting the instruction removed the wasted work. Deleting it removed most of it but not all: agents still guessed the old folder, and as Fig. 1 shows, Sonnet needed as many tool calls without the test command as with the stale one, because it had to work out how to run the tests itself.

This paper makes three contributions. First, it compares stale, corrected, and removed versions of real-world stale instructions under controlled conditions and shows that a stale instruction can make agents waste work, including checks that test nothing, while task success stays the same. Second, it shows that this cost depends on whether the task leads the agent through the stale line, and that correcting a stale line works better than deleting it. Third, from the agents' trajectories, it explains why the debt stays hidden: agents meet the line where their workflow needs it, the failed check is reported as a success, and agents that notice a problem work around it without repairing the file. From this, we draw practical lessons: evaluations of instruction files should report what agents do, not only whether they succeed, and harnesses and agents can guard against stale paths and silent test failures.

References (30)