Spokes.wiki Search About
Defined Term updated Tue Jul 14 2026 00:00:00 GMT+0000 (Coordinated Universal Time)

Context rot

The degradation of an agent’s output as its context grows long or accumulates cruft — the failure mode the spoke’s whole token-budget corner exists to fight. It was already named inside tokenmining (“context rot and lost-in-the-middle mean extra context actively degrades output”); two 2026-07 practitioner pieces (governed-context-claude-code, cca-f-lost-in-the-middle) make it a first-class concept with a clean split.

Two kinds

  • Intrinsic rot — set by the architecture, below the user’s control. Softmax attention has a fixed budget, so irrelevant tokens never contribute zero attention; as context grows, “the margin between the token that matters and the diffuse mass of everything else” erodes (signal-to-noise falls). Retrieval accuracy also follows a U-curve by position — the middle of a long context is recalled worst (“lost in the middle”, Liu et al.), which cca-f-lost-in-the-middle dramatizes: “everything important was in the middle, so Claude forgot it.” This is the mechanism layer that seams to ../llm-inference-wiki (attention cost) and to research-wiki’s long-context-vs-chunking (the retrieval-side twin: a longer window loses to cheaper segmentation).
  • Content rot — the half that’s yours: stale, contradictory, or wrong material (failed approaches, tangential tool calls, superseded assumptions) piling up in the session and getting reprocessed every turn, bending later outputs. governed-context-claude-code borrows Drew Breunig’s four failure modesconfusion (too many tools/skills → bad selection), clash (early wrong diagnosis the model won’t abandon), distraction (broad searches pulling in look-alike code), poisoning (stale notes persisting after the correction scrolls out of the window).

The sharp, load-bearing point both stress: models rarely signal the degradation — they build on the error rather than flagging it, so a session looks healthy until the output breaks. That’s why this is the spoke’s verification-is-the-bottleneck thread from the context side.

The response — governed context / context engineering

If intrinsic rot sets a floor, content rot is governable, and the discipline is tending your half: curate what’s always loaded (minimal high-signal CLAUDE.md; push domain knowledge into skills and rules into hooks; name specific files over “related” ones), keep the session clean during work (restate goals at milestones to fight the U-curve, offload verbose runs to subagents and keep only conclusions, externalize durable state to notes files, inject real project state via shell rather than recalled state), and reset over recover when it turns (a two-correction threshold, snapshot-and-clear rather than trusting the model to summarize a rotten context, hand off a distilled brief not a transcript). See governed-context-claude-code for the full playbook (its “session as a git tree” framing) and cca-f-lost-in-the-middle for the API-level version (rolling history + pinned facts + two-stage retrieval, driven by the Messages API being stateless).

Two mechanisms from writing-a-good-claude-md (HumanLayer) sharpen why curating the always-loaded CLAUDE.md is content-rot control and not tidiness: Claude Code’s system prompt tells the model to disregard context it judges irrelevant, so non-universal instructions load but get silently skipped; and frontier models reliably follow only ~150–200 instructions, with adherence degrading uniformly as the count grows — so every extra line taxes obedience to the rest. Minimizing the base context is therefore a compliance move, not just a token-budget one.

Relationship to the token-budget levers

Context rot is the why under the corner the spoke tracked as cost: tokenmining (route/compact), headroom (compress), pxpipe (modality-arbitrage), safe-prompt-pruning (prune). Those are framed as token cost savings, but context rot reframes them as quality moves — removing tokens isn’t only cheaper, it raises output quality by lifting signal-to-noise. Pruning/compaction/subagent-offload are content-rot mitigations first, cost savings second.

Packaged as defaults

claude-code-development-kit is the first artifact here that ships context-rot mitigation as a product default rather than advice: a small always-loaded floor with depth opt-in behind /prime tiers (~4–6k tokens base), doc sync that filters trivial diffs, verbose review pushed to parallel subagents. It is governed-context-claude-code‘s playbook turned into an installer. It also reports no evaluation, so what it demonstrates is that the doctrine has hardened into defaults — not that the defaults work.

governed-context-claude-code · claude-code-development-kit · cca-f-lost-in-the-middle · writing-a-good-claude-md · claude-md · tokenmining · safe-prompt-pruning · headroom · agent-memory · loop-engineering · effort-level · long-context-vs-chunking