AI news story

Context Rot: Why Claude Code Sessions Decay, and How to Govern Them

Long sessions rot quietly, well before any token limit is reached. Here’s why, and how to govern your context in Cl…

  • LLMs
  • Source: Towards Data Science
  • Published: 2026-07-13

Editor's take

Claude's context window exhibits a phenomenon dubbed "context rot," where long-running code sessions degrade in performance and accuracy due to subtle information decay, independent of token limits. This impacts developers relying on Claude for complex coding tasks, potentially leading to subtle but significant errors in code generation or understanding that are difficult to detect.

This decay highlights a crucial challenge in LLM development: maintaining long-term state and coherence. Unlike stateless models, conversational agents need to retain and accurately recall information across extended interactions. The issue is particularly pertinent for code generation, where precise context is paramount for generating functional and secure code, and contrasts with the more predictable behavior of models like GPT-4 with its 128k token context.

Future efforts should focus on understanding the underlying mechanisms of this decay, perhaps through more granular analysis of Claude's internal state representation over time. Investigating whether similar phenomena affect other LLMs, like Meta's Llama 2 or Google's Gemini, will be critical to understanding the generalizability of this problem and developing robust solutions.