# Context rot

> Canonical: https://skillalmanac.com/glossary/context-rot | Last verified: 2026-11-25 | Index status: index-eligible

Context rot is the drop in a language model's accuracy and recall as the amount of text in its context window grows. Anthropic's documentation uses the term; there is no single agreed measurement.

Also called: context rot LLM, context degradation, long context degradation, context decay.

## In plain language

Context rot is what happens when you keep piling material into a conversation with an AI and its answers get less reliable. Think of a desk covered in papers: the one page you need is still there, but it is easier to miss or mix up with the others. The model does not run out of room first; it can get worse well before the limit. For a coding agent this means long sessions full of old file reads and tool output can produce more slips than a short, focused one. Curating relevant material, starting fresh or summarising can help on some tasks, but none guarantees a fix: removing needed evidence can also hurt. Test the model and workload you actually use.

## Technical definition

Anthropic's context window documentation says that as token count grows, accuracy and recall degrade, a phenomenon known as context rot, so curating what is in context matters as much as how much space is available. The Chroma technical report (July 2025) tested 18 models and reports that performance grows increasingly unreliable as input length grows, with lower question-to-answer similarity and added distractors making it worse; the authors say they do not explain the underlying mechanisms. An earlier paper, Lost in the Middle (Liu et al., arXiv 2307.03172), found that performance can be highest when relevant information is at the start or end of the input and lower when it sits in the middle. These are measurements on specific tasks and models, not a law.

## How it shows up when you use agents

In a long Claude Code, Codex or Cursor session, the [context window](/glossary/context-window) fills with your messages, file reads, command output and tool results. Accuracy and recall can decline with longer inputs in particular tasks and models. Session elapsed time alone does not establish this cause; applications may compact, summarize or drop earlier material, so the model need not still see everything. Typical signs are forgotten instructions, a file edited as if an older version were current, or an answer that ignores something stated earlier.

What breaks when this is misunderstood: people assume a larger window means the model uses all of it equally well, and keep one session running for days. The Chroma report found better results on focused prompts than on full conversations for one of its tasks, which fits this habit.

Next actions. Check how full the session is with `/context` in Claude Code. Start a fresh session for a new task. Use `/compact` with instructions naming what to keep. Load just the files the task needs; the [context window packer](/skills/skill-almanac/context-window-packer) skill is one way to decide. The wider practice is called [context engineering](/glossary/context-engineering). Storing notes outside the conversation is covered under [agent memory](/glossary/agent-memory).

## Common confusions

- **Context rot versus hitting the limit.** At the limit the API returns an error or stops generating. Context rot is a decline in quality that can appear well before that point.
- **Context rot versus hallucination.** A [hallucination](/glossary/hallucination) is unsupported output. Context rot is one condition under which more of it, or more missed details, can occur.
- **Lost in the middle versus context rot.** Lost in the middle is a finding about position: information in the middle of the input was used less well in that paper's tests. Context rot is the broader term for degradation with length.
- **Myth: it affects all models the same way.** The Chroma report describes differences between models and tasks, and says it does not explain the mechanisms. Test your own workload instead of relying on a general rule.

## Worked examples in this catalogue

### [context-window-packer](https://skillalmanac.com/skills/skill-almanac/context-window-packer)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: Chooses which files fit one prompt's token budget and records what was kept, shrunk or dropped, and why.

Why it exercises the concept: It is a deliberate way to curate context. Choosing what goes in, instead of pasting everything, is one way to curate context, which the documentation says matters.

### [What Is an LLM? The Facts Agent Users Need](https://skillalmanac.com/learn/what-is-an-llm-for-agent-users)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: A guide distinguishing model behavior from the surrounding application, with Transformer/BERT examples, context limits and service-specific usage considerations.

Why it exercises the concept: It explains runtime context versus learned parameters and saved application state. It does not establish that every application resends all history or that a shorter prompt guarantees better answers.

### [Claude Code](https://skillalmanac.com/tools/claude-code)

```
/context
```

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: Claude Code visualizes current context usage as a colored grid and shows optimization suggestions for context-heavy tools and memory bloat.

Why it exercises the concept: It makes the size of the context visible before a session gets long, which is when degradation becomes a concern.

## Related terms

- [Context window](https://skillalmanac.com/glossary/context-window.md)
- [Context engineering](https://skillalmanac.com/glossary/context-engineering.md)
- [Agent memory](https://skillalmanac.com/glossary/agent-memory.md)
- [Large language model (LLM)](https://skillalmanac.com/glossary/large-language-model.md)
- [Token](https://skillalmanac.com/glossary/token.md)
- [Prompt caching](https://skillalmanac.com/glossary/prompt-caching.md)

## Sources

- [Context windows](https://platform.claude.com/docs/en/build-with-claude/context-windows), Anthropic (Claude Docs) (accessed 2026-11-24)
- [Context Rot: How Increasing Input Tokens Impacts LLM Performance](https://www.trychroma.com/research/context-rot), Chroma (accessed 2026-11-24)
- [Lost in the Middle: How Language Models Use Long Contexts](https://arxiv.org/abs/2307.03172), arXiv (Liu et al.) (accessed 2026-11-24)
- [Commands](https://code.claude.com/docs/en/commands), Anthropic (Claude Code Docs) (accessed 2026-11-24)

Definitions are written by Skill Almanac from the sources above and checked against them on 2026-11-25. [Glossary index](https://skillalmanac.com/glossary.md).
