85 agentic tools audited for security incidents · Talk to the lab →
MotionticBook a call
Glossary

What is context rot?

Context rot is the decline in a model's recall and accuracy as its context window fills, so information in a long prompt is used less reliably than the same information in a short one.

Context windows have grown to around a million tokens on several current models. That does not mean every token is used equally well. As the window fills with tool output, history and documents, the model attends less reliably to any one piece of it.

For agents this shows up late in long runs: steps get skipped, earlier decisions are forgotten, or the agent wraps up before the work is done. The fix is less about a bigger window and more about what is allowed into it.

Why it matters for agents

Anthropic's "Effective context engineering for AI agents" (September 2025) describes context as a finite attention budget: every token spends some of it, so context should hold the smallest set of high-signal tokens that does the job. Its later work on long-running builds reports that agents lose coherence as context fills, and some models start wrapping up early as they sense the limit.

Google's ADK 2.0 post describes a related problem, execution derailment, where a model-driven loop skips steps or wanders as context grows.

Techniques that manage it

  • Just-in-time loading

    Keep lightweight references in context and load full content only when needed.

  • Tool result clearing

    Remove stale tool outputs once they have been used.

  • Compaction

    Summarise older context into a shorter form and continue.

  • Context resets

    Start a fresh window with a structured handoff file, which Anthropic found worked better than compaction for long builds.

  • Subagents

    Give a side task its own clean context and return only a condensed result.

  • Code execution for tools

    Let the agent filter large tool results in a sandbox instead of reading them in full. Anthropic's example dropped from about 150,000 tokens to about 2,000.

How Motiontic's engineers apply it

Motiontic's engineers measure context per step in long runs and look for the point where eval scores fall. Tool outputs are paginated and truncated by default, history is compacted or reset at planned points, and large data stays outside the prompt behind a reference.

Common questions

What causes context rot?

A model has a limited capacity to attend across its context. As more tokens are added, each one gets less of that capacity, so recall and accuracy decline even when the window is not full.

Does a larger context window fix context rot?

No. A larger window raises how much can fit, but lab guidance still treats context as a finite budget and recommends keeping only high-signal tokens in view.

How do agents avoid context rot on long tasks?

By loading information just in time, clearing stale tool results, compacting or resetting context with a handoff file, and giving side tasks to subagents that return short summaries.

Running agents that have to hold up?

Describe the agent, the systems it touches and what it must never get wrong. The first call is with a lab engineer, who will say plainly whether it is ready for production, and whether Motiontic is the right team.