← Latest papers
🤖 machine learning

Why Does CLAUDE.md Keep Growing? Catastrophic Remembering in Agentic Coding

This paper identifies "catastrophic remembering" as the cause of unbounded growth in agentic coding prompts like CLAUDE.md, demonstrating that appending instructions is cheap while deleting them is computationally prohibitive, and proposes that embedding latent reasoning in prompt comments can effectively halt this divergence and significantly improve instruction-following performance.

Original authors: Kushal Chakrabarti

Published 2026-08-12
📖 6 min read🧠 Deep dive

Original authors: Kushal Chakrabarti

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are teaching a very smart, but slightly forgetful, robot assistant how to do a specific job, like writing blog posts or fixing code. You start by giving it a simple list of rules: "Use three paragraphs," "Don't use the word 'very'," and "Always end with a smile." This is called a prompt. In the world of artificial intelligence, these prompts are like the instruction manuals for robots.

Now, imagine the robot makes a mistake. You fix it by adding a new rule: "Okay, and make sure to use exactly five bullet points." The robot tries again, fails, and you add another rule: "And remember to capitalize the first letter of every sentence." Over time, this list of rules gets longer and longer. In computer science, there's a famous problem called catastrophic forgetting, where a robot learns something new and accidentally wipes its memory of the old stuff. But this paper talks about the opposite problem: catastrophic remembering. This is when a robot (or the human managing it) keeps adding rules but never deletes the old ones, even when they aren't needed anymore. The list becomes so huge and messy that the robot gets confused, slows down, and starts making mistakes again. The big question is: Why does this list keep growing forever, and how do we stop it?

The Mystery of the Never-Ending List

The author of this paper, Kushal Chakrabarti from South Park Commons, decided to investigate why these "agentic" instruction lists (files often named CLAUDE.md or AGENTS.md in software projects) seem to grow without bound. They looked at nearly 1,870 real-world software projects on GitHub and tracked the lives of over 247,000 individual instructions.

They found a strange pattern: these lists almost never shrink. Instead, they grow by an average of 4.9 new instructions for every single update to the file. Over the life of a file, the number of instructions more than triples, growing by 226%. The average file ends up with 39 instructions, but some have over 100.

The researchers asked: Why don't people just delete the old, useless rules?

They discovered the culprit isn't that the rules are "stale" (outdated) or that the bad rules die young. Instead, the problem is imperfect recall. Think of it like this: When you add a new rule to the list, you know why you added it. Maybe you added "Use three paragraphs" because the robot kept writing four. But that "why" is just a thought in your head. It's not written down.

As time passes and other people edit the file, or as the project changes, that original reason fades away. If you look at the list six months later, you see the rule "Use three paragraphs," but you have no idea why it's there. Was it because the robot was too chatty? Was it because the boss asked for it? Without that reason, deleting the rule feels risky. You're afraid that if you delete it, the robot will break again. So, you leave it there. Meanwhile, you keep adding new rules for new problems. The result is a bloated, confusing list of rules that nobody understands anymore. The author calls this catastrophic remembering: keeping everything you should have forgotten.

The "Bulldozer" Effect

The study also found something funny about how people try to fix these messy lists. They rarely delete just one or two bad rules. Instead, they tend to hit the "delete all" button. The data showed that 76.8% of all instruction deletions happen in one giant "rewrite" where someone deletes half or more of the file at once. It's like a gardener who can't decide which weeds to pull, so they just burn the whole garden down and start over.

But here's the kicker: even after this "burning," the garden grows back. The list starts growing again immediately, at the same fast pace as before. This is called the ratchet effect. The size drops, but the rate of growth doesn't change. The root cause—the fact that people can't remember why the rules were added in the first place—was never fixed, so the list just starts filling up again.

The Magic of "Comments"

So, how do we stop the list from growing forever? The paper suggests a solution that software engineers have used for decades: comments.

In regular computer code, programmers write little notes next to their code to explain why they wrote it that way. These notes are invisible to the computer but helpful for the next human who reads the code. The researchers tested if this same trick works for AI prompts.

They set up a simulation where "maintainers" (AI agents) had to build and fix a prompt. In one group, they had to write instructions without any notes. In the other group, they were allowed to add a comment next to each instruction explaining the reason. For example, next to "Use three paragraphs," the comment might say: "Added because the robot kept writing four paragraphs in round 3."

The results were dramatic.

  • Without comments: The prompt grew to be 211.3% larger than the perfect, minimal size needed to do the job.
  • With comments: The prompt stayed almost perfectly sized, growing only 1.4% larger than the minimum.

The comments acted like a time machine. They preserved the "latent reasoning" (the hidden reason) for each rule. When a maintainer looked at the list later, they could see the comment, understand that the rule was still needed, or realize it was no longer necessary, and delete it safely. The comments removed 99.3% of the excess, unnecessary instructions.

Does It Actually Work Better?

The researchers didn't just stop at making the lists shorter; they checked if the robots actually did a better job. They found that when prompts were bloated with useless, noisy instructions, the robots got confused and made more mistakes. By using comments to keep the list clean and focused, the robots' ability to follow instructions improved by up to 23.1%.

The study also showed that this works even when the instructions are complex and the "maintainers" are very smart AI agents. The more capable the AI, the more it tends to over-add rules, but the more it benefits from having those helpful comments to keep things in check.

The Big Takeaway

The paper concludes with a playful but serious question: "If English is the new code, why don't we have comments yet?"

Just like human programmers learned long ago that you need to explain why you wrote a line of code, the people (and AI agents) managing these AI prompts need to start writing down why they added a rule. Without that explanation, the rules pile up, the system gets confused, and performance drops. The solution isn't to stop adding rules; it's to write a little note next to each one so that the next person (or robot) knows exactly what to keep and what to throw away. It turns a chaotic, growing monster into a clean, efficient tool.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →