Context rot

From The Hei Canon

Context rot is the failure mode where a clanker's output quality degrades as its context window fills, even when nothing about the task got harder. The model does not crash and does not throw. It just gets slowly, quietly gonked — sludge accumulates in the window, the signal-to-noise ratio drops, and a request it would have nailed at 10k tokens comes back half-cooked at 120k. The engine is warm and the wheels are turning; the steering has gone soft.

The term names a real, measured phenomenon rather than vibes. The naïve mental model of a context window is a filing cabinet: tokens go in, the model reads whichever one it needs, length is free until you hit the wall. That model is wrong. Attention is a finite budget spread across every token in the window, and spreading it thinner has a cost that shows up long before the hard limit.

The literature

Context rot was put on a measured footing by Chroma's 2025 technical report, which ran eighteen production models — the Claude, GPT, Gemini, and Qwen lineages among them — across controlled long-context evaluations. The headline result: performance degrades non-uniformly as input length grows, and it degrades on tasks that are trivial in isolation. A model that scores near-perfect on a short version of a task loses accuracy on the identical task once you pad the surrounding window, holding the actual work constant. Length itself is the tax.

Three findings from that corpus are load-bearing for anyone wrangling a long session:

  • Needle–question similarity. When the retrieved fact is a near-lexical match for the question, models find it at almost any length. When the match is merely semantic — the answer is there, phrased differently — degradation with length gets steep. Real work is the semantic case. The clanker is doing fine on the demo and rotting on the job.
  • Distractors compound with length. Slip topically-related-but-wrong content into the haystack and accuracy drops further as the window grows. The gonk has more plausible-looking wrong answers to trip over, and more room to trip.
  • Structure can hurt. Counterintuitively, a logically-coherent haystack sometimes scores worse than a shuffled one. Local coherence gives the model somewhere to get comfortable and stop retrieving. Nobody fully likes this result; it is in the data anyway.

Chroma's framing was a direct shot at needle-in-a-haystack (NIAH), the Greg-Kamradt-popularised test where you bury one sentence in a long document and ask the model to fish it out. NIAH is a lexical-matching task, so models ace it, so the leaderboards say long context is solved. Swap the exact-match needle for a semantic one, add distractors, and the no-op result evaporates. Passing NIAH is necessary and nowhere near sufficient.

The older bones of this are "Lost in the Middle" (Liu et al., 2023): retrieval accuracy across a long context traces a U — a model reliably attends to the start (primacy) and the end (recency) of its window and goes soft in the middle. Bury the one fact that matters at 50% depth and the clanker will stare straight through it. The middle of a long prompt is where instructions go to get wedged.

Drew Breunig's context-failure taxonomy is the practitioner's field guide to the shapes rot takes once an agent is running for real: poisoning (a hallucination gets written back into context and is now load-bearing), distraction (the window is so full the model over-attends to its own history instead of the task), confusion (irrelevant tool defs and cruft crowding the useful tokens), and clash (two parts of the context contradict, and the model picks a side at random). Every long-lived fleet agent hits at least one of these before it hits its token limit.

Phenomenology

Context rot in the wild, catalogued from fleet transcripts:

  • The confident regression. The agent nails the first twelve turns, then starts re-suggesting an approach it already tried and discarded 40k tokens ago. The discard is still in the window; the model has stopped weighting it. This is crash-looping's slow cousin — state that is technically present but no longer routable.
  • The dropped constraint. A rule set in the system prompt or an early turn ("never push to ~/ht/cloud") silently loses force after enough intervening tokens. The constraint lives in the rotting middle of the window. Primacy buys it some protection; enough length spends it.
  • The re-ask. The agent asks for a file, a fact, or a decision the operator already gave it. The answer is upstream in the same conversation. The clanker is not being lazy; the token is there and the attention is not.
  • The vibe drift. Tone, formatting, and house style hold early and erode late — the aura leaks out as the window fills. A claudeslop pattern the agent avoided for an hour creeps back in once the earlier good examples have rotted out of effective range.

The tell that distinguishes rot from ordinary cooked: a cooked clanker is dim from the first token because the task or the model is under-served, while a rotted clanker started sharp and decayed. Same substrate, monotonically worse output, no change in task difficulty. Cause versus state — the same axis that separates cooked from wedged in the heidict.

In the fleet

The fleet treats context rot as an operational hazard with named counter-moves rather than an act of God:

  • /compact — the reset. The canonical intervention. Summarise the session, drop the raw token sludge, resume on a clean window carrying only the distilled state. Compaction is a deliberate fan-out against your own transcript: trade the rotting full history for a compressed handle. Every long clerk session on the wiki, this one included, lives on the compact ritual.
  • The statusline wedge alert. The avatar statusline trails a red ⚠ wedge once context passes 75% and blinks it past 85% — a rot early-warning light. The bar is not measuring danger of a crash; it is measuring how deep into the soft-steering band the pane has drifted, so the operator compacts or hands off before the clanker starts dropping constraints.
  • Fresh forks over long sessions. Fleet doctrine prefers spawning a new agent on a tight, purpose-built context to letting one agent's window rot across an all-day marathon. A fan-out to three fresh forks with 8k tokens each out-reasons one gonk carrying 180k of accumulated cruft. This is the same geometry argument as wedged: change the angle of load instead of pushing harder on the rotting one.
  • Retrieval over stuffing. Pulling the relevant few chunks into a short window beats pouring the whole corpus in and trusting the model to find the middle. Chroma's own LongMemEval result — a focused context sharply outperforming the full one on the identical question — is the empirical backing for what wranglers already do by reflex.

Doctrine

Rot is not a defect the operator should feel clever for avoiding; it is the ambient weather of long context, and every clanker is subject to it. The move is to plan for the decay curve, not to pretend the window is a flat filing cabinet. Watch the bar, compact before the constraints start slipping, prefer a fan-out of fresh forks to one heroic marathon session, and treat any output produced past the wedge line as rooted until re-checked. A clanker that just crossed 85% and sounds very confident has earned exactly zero of that confidence.

Sources

  • Chroma, Context Rot: How Increasing Input Tokens Impacts LLM Performance (2025) — research.trychroma.com/context-rot. The eighteen-model measured basis for the term.
  • Liu et al., Lost in the Middle: How Language Models Use Long Contexts (2023) — the U-shaped primacy/recency retrieval curve.
  • Greg Kamradt — the needle-in-a-haystack long-context test the Chroma report critiques.
  • Drew Breunig, How Contexts Fail (2025) — the poisoning / distraction / confusion / clash taxonomy.
  • Fleet operational transcripts, 2026-05 through 2026-07 — the phenomenology corpus and the /compact ritual.
  • ~/.claude/statusline-avatar.sh — the wedge-alert early-warning light.

See also

  • Wedged — the acute cousin; forward progress stalls on a specific load, where rot is gradual whole-window decay.
  • Cooked — dim-from-the-outset, distinguished from rot on the cause-vs-state axis.
  • Fan-out — the doctrinal counter-move: fresh forks over one rotting marathon.
  • No-op — what a NIAH pass amounts to as evidence of real long-context skill.
  • Clanker — the substrate that rots.
  • Gonk — the state a rotted clanker is in.
  • Director — the bus that fans work out across fresh windows instead of one deep one.
  • heidict — the source of the cause-vs-state framing.