# AI Context rot AI context rot is the gradual degradation of AI context quality over time. It occurs when the instructions, rules, memory, and knowledge that AI agents rely on become stale, inaccurate, or misaligned with the current state of a project, codebase, or workflow. It is the AI equivalent of [[Bit rot]], but applied to the contextual information that shapes AI behavior rather than to stored data. Just as [[Link rot]] breaks references on the Web, context rot breaks the assumptions AI operates under. ## How it happens AI context rot emerges naturally as projects evolve: - **Code changes, instructions don't**: CLAUDE.md files, system prompts, and [[AI Agent Skills]] reference functions, files, patterns, or conventions that no longer exist - **Memory drift**: AI memories (e.g., [[Claude Code Memory]]) accumulate entries that were true at one point but are now outdated or contradictory - **Convention shifts**: Team practices change but the context files still describe the old way of doing things - **Scope creep in rules**: Rules and instructions pile up without pruning, leading to contradictions and bloat that dilute the signal - **Tool and API evolution**: Referenced tools, endpoints, or integrations change or get deprecated This follows the [[Law of staleness]]; the value of context information declines as it ages unless actively maintained. ## Why it matters Context rot silently degrades AI output quality. The AI confidently follows outdated instructions, producing results that look correct but are subtly wrong. Unlike a compiler error, there's no clear signal that something is broken. The failure mode is insidious: things mostly work, but with increasing friction and decreasing relevance. This is a form of [[Technical debt]] specific to AI-augmented workflows. The more sophisticated the context setup (higher [[Levels of AI Context Management]]), the more surface area there is for rot to accumulate. ## Mitigation - **Periodic review**: Treat context files like code; they need maintenance, not just creation - **Version control**: Keep AI context in version-controlled files (CLAUDE.md, skills, memory) so changes are visible and reversible - **Freshness signals**: Timestamp context entries so staleness is detectable. This aligns with [[Context Engineering]] principle: stale information is worse than no information - **Pruning discipline**: Regularly remove outdated entries rather than just adding new ones - **Validation loops**: Use AI itself to flag inconsistencies between its context and the current state of the project - **Tight coupling with source of truth**: Keep context close to the code/knowledge it describes, reducing the gap between reality and instructions ## The tension There is a [[Natural tension between compression and context]] at play. Compressing context too aggressively loses nuance; keeping everything leads to bloat and contradictions. Context rot is what happens when this tension is left unmanaged. The [[AI context is finite with diminishing returns]], so rotting context actively wastes that finite budget. ## Context rot inside a single prompt The term has a second meaning, and it's the one most AI researchers mean today. In July 2025, Kelly Hong, Anton Troynikov and Jeff Huber at Chroma published *Context Rot: How Increasing Input Tokens Impacts LLM Performance*. Here the rot comes from length instead of time: same question, same answer hidden somewhere in the input, more tokens around it... and the model gets worse. They tested 18 models from the Claude, GPT, Gemini and Qwen families. What they found: - Performance drops as input grows, even on simple tasks, and it drops unevenly. Their summary: "models do not use their context uniformly". - The lower the semantic similarity between the question and the relevant passage (the "needle"), the faster performance falls with length. - Distractors (passages that look related but don't answer the question) hurt. A single one lowers performance, and four compound it. - The counterintuitive one: models did WORSE when the haystack was coherent text with a logical flow than when the same sentences were shuffled. It builds on *Lost in the Middle* (Liu et al., 2023), which showed that models use information at the beginning or end of a long context much better than information in the middle, even models built for long contexts. The practical lesson: a 1M-token context window tells you how much fits. It says nothing about how well the model will read it. ### How Jev designs around it [[Jev]] (TypeSafe AI) avoids the growing-prompt problem by construction. You send a state (the data) and a list of questions, and each question is evaluated in isolation against that state, in parallel, without seeing the other questions. TypeSafe's docs conclude that adding questions doesn't create context rot. That's [[Atomic Question Decomposition]] applied: many small, well-scoped questions instead of one giant prompt. The state itself is still exposed. The Jev 1.13 docs list "large state full of irrelevant detail" as a known failure mode: accuracy falls as the state fills with content unrelated to the decision, because that detail acts as a distractor. Their advice is to retrieve and filter in code first and send only the fields the question needs (or ask a Noul, Jev's yes/no question type, to filter passages for relevance). Same lesson as Chroma's study: send less, but relevant. ## References - [Context Rot: How Increasing Input Tokens Impacts LLM Performance (Chroma)](https://www.trychroma.com/research/context-rot) - [Lost in the Middle: How Language Models Use Long Contexts (arXiv:2307.03172)](https://arxiv.org/abs/2307.03172) - [Jev 1.13 jaggedness (TypeSafe docs)](https://docs.typesafe.ai/model-jaggedness/jev-1.13) ## Related - [[Bit rot]] - [[Link rot]] - [[Law of staleness]] - [[Technical debt]] - [[Context Engineering]] - [[Levels of AI Context Management]] - [[Types of Context for AI Agents]] - [[AI context is finite with diminishing returns]] - [[Natural tension between compression and context]] - [[Claude Code Memory]] - [[AI Agent Harness]] - [[AI Agent Skills]] - [[AI Agents]] - [[Progressive Disclosure]] - [[Prompt Lazy Loading AI Design Pattern (PLL)]] - [[Context Drift]] - [[Context Bloat]] - [[Context Hygiene]] - [[Knowledge Decay]] - [[Configuration Drift]] - [[Context Window]] - [[Context Anchoring]] - [[AI Instruction Drift]] - [[Context Poisoning]] - [[Context Distraction]] - [[Context Confusion]] - [[Harness Engineering]] - [[Personal Context Management (PCM)]] - [[AI Context Governance]] - [[Context-as-Code]] - [[Agentic Context Engineering]] - [[Obsidian Starter Kit - Tutorial - Managing AI sessions]] - Operational guidance to prevent context rot in OSK sessions - [[Jev]] - [[Atomic Question Decomposition]]