LLM Digest
Subscribe

Agent Builder Foundations

Evidence-tiered mechanisms for agent builders

View as JSON

Agent foundations

Why does CLAUDE.md (or AGENTS.md) only ever grow, never shrink?

Concept·Memory and context·math intuition·4 sources·updated 2026-11-11

If your CLAUDE.md, AGENTS.md, or system prompt only gains rules, trying harder to prune will not fix it. Once nobody remembers why a rule was added, proving it safe to remove becomes a combinatorial check nobody runs. The rules that survive then go stale, and agents follow them anyway while task success hides the cost. Write the why with each rule, and test that the file still matches the code.

What's new in the evidence
Short answer

Appending an instruction costs one line. Safely deleting one requires proving it will not reintroduce the failure it was added to prevent. Once that reason is forgotten, the proof means reasoning about how the instruction interacts with every other instruction in the file, a cost that grows exponentially with file size. Nobody pays it, so the file only grows. Writing the rationale as a comment next to each rule is the one intervention shown to reverse this. Surviving rules also rot: agents act on a stale path or command and never fix the file.

Builder model

Model an instruction file as an append-only log with hidden debt, not a document you tidy now and then. Every rule added without its *why* is a future deletion decision that gets more expensive as the file grows. "Clean sweep" rewrites reset the size but not the asymmetry, so growth resumes on the next commit. The fix has to change the cost of deletion, not the current size.

Mechanism

Append is cheap; verified delete is exponential. Adding instruction |D|+1 is O(1). Removing an old instruction whose purpose is lost means checking whether any subset of the other instructions depends on it, which is O(2^|D|) in the worst case. The rational default becomes "leave it in."

Real repositories show the signature. The catastrophic-remembering study tracked 247,694 instruction lifetimes and found files growing +226% over their lifetime, adding a net +4.9 instructions per commit. The older an instruction is, the less likely anyone removes it.

The bottleneck is the missing rationale, not the count. A comment stating what an instruction guards against turns "why is this here" from a reconstruction-by-testing problem into a fact you can read and re-check. In the paper's controlled test, rationale comments cut excess instructions from +211.3% to +1.4% over the known-optimal set and improved real-world instruction-following by up to 23.1%. The comments change whether the agent follows instructions correctly, not just file size.

Kept rules go stale, and agents obey them. In a 732-trajectory study, agents followed a stale instruction whenever it was relevant to the task, sometimes even with the correct path visible elsewhere. They usually recovered from the immediate failure, so the task still passed, but none repaired the file. A stale test command cost about a third more tool calls on every run.

It generalizes beyond CLAUDE.md. Any accreting instruction surface an agent or team treats as authoritative, such as system prompts, runbooks, or review checklists, has the same asymmetry.

Math intuition

"Safe to delete" means checking instruction A's effect across every combination of the other instructions still present, because instruction B might only matter *because* A exists. A set of size n has 2^n subsets, so the check grows exponentially:

  • 10 instructions: 1,024 combinations.
  • 30 instructions: over a billion.

Neither a person nor an agent can run that check without a stated reason for each instruction. A rationale comment replaces the exponential search over hidden interactions with a linear read of stated dependencies: for each rule, is the reason it was added still true?

How to apply
  • Write the why next to every new rule in CLAUDE.md, AGENTS.md, or a system prompt: the failure it prevents or the constraint it enforces. Brevity and better organization were not the measured fix; rationale comments were.
  • Delete rules whose stated reason is stale first. A documented rationale turns a combinatorial guess into one fact-check.
  • Track net instructions added per commit on any file agents read as instructions. Steady upward drift with no deletions is the growth signature.
  • Treat old, undocumented rules as your highest-risk debt. Deletion likelihood falls with age, so the longer an unexplained rule survives, the less likely it is ever reconsidered.
  • Check instruction files against the code in CI. Assert that every path and command the file names still exists or runs; a stale rule costs every later session.
  • Delete a stale rule you cannot fix right away. Removal prevented most obsolete-path operations; only correction prevented all.
Failure modes
  • Deleting an old, undocumented rule on a hunch, triggering the regression it silently prevented and making the team afraid to delete anything again.
  • Fixing for shorter instructions instead of documented reasons.
  • Judging an instruction file by task success, which hides the extra tool calls a stale rule adds.
  • Expecting the agent to repair a stale rule it tripped over; none did.
  • Citing the 99.3% bloat reduction or 23.1% gain as replicated results rather than one preprint's figures.
  • Confusing this with session context bloat: this is a persistent file growing across commits, not a conversation growing turn by turn.
Related

See agent memory for how agents retain and lose information, and context compaction for shrinking context without losing what matters. agent-context-lifecycle covers the sibling problem of a single session's context cost growing quadratically.

Evidence · 4 sources
newest first
  1. BenchmarkWhen Instruction Files Go Stale: Documentation Debt and Hidden Cost in Coding Agentsbenchmark/result-backed · in the feed

    Three real stale AGENTS.md/CLAUDE.md instructions (a test command, a code location, an add-a-component procedure), each left stale, corrected, or removed, over 22 maintenance tasks and 732 trajectories from two models. Agents followed stale guidance when it was task-relevant, sometimes despite correct information elsewhere. The stale test command cost Claude Sonnet 5.5 about two extra tool calls per run, a third more; other cases showed no detectable difference. No agent repaired the file. Correcting removed all obsolete-path operations; removing prevented most.

  2. TheoryWhy Does CLAUDE.md Keep Growing? Catastrophic Remembering in Agentic Codingtheory/paper-backed

    Names 'catastrophic remembering', the inverse of catastrophic forgetting, and traces it to a cost asymmetry. Appending an instruction to a prompt of |D| instructions is O(1). Once the rationale is lost, proving a deletion causes no regression costs O(2^|D|) in the worst case, because the instruction can interact with any subset of the others. Single-author preprint (submitted 2026-08-11), not yet independently replicated.

  3. BenchmarkWhy Does CLAUDE.md Keep Growing? Catastrophic Remembering in Agentic Codingbenchmark/result-backed · in the feed

    Tracks 247,694 instruction lifetimes in 1,867 repositories: instruction files grow +226% over their lifetime, +4.9 net instructions per commit, and deletion hazard falls with age (log-hazard -0.032/commit). In synthetic 'verifiable worlds' built by inverting IFEval, rationale comments cut excess instructions from +211.3% to +1.4% (a 99.3% reduction) and improved WildIFEval instruction-following by up to 23.1%. Single-author preprint; numbers not yet independently replicated.

  4. EditorialSingle-paper caveat and relation to session context growtheditorial inference

    Editorial synthesis: the cost-asymmetry mechanism and the direction of the fix are worth acting on before replication; treat the exact percentages as one paper's figures. This differs from agent-context-lifecycle, which covers a live session's context cost growing turn by turn. Here a persistent instruction file grows across commit history because deletions become unverifiable once a rule's reason is lost.