Context Rot Is Killing Your AI Agent — Here's What the Research Actually Shows

Context Rot Is Killing Your AI Agent — Here's What the Research Actually Shows

Every production agent starts the same way. A clean prompt goes in, a precise tool call comes out, and the agent wins the first round.

Fifty decisions later, the same agent is drowning. Its context window holds every tool output, every intermediate observation, every self-reflection from every previous step. The model’s attention scatters across thousands of tokens of noise. By round sixty, the agent makes decisions that contradict what it established in round five. By round eighty, it costs more to run than a human doing the same work.

The research community now has a name for this: context rot. And the cure is not what most teams expect.

The AgenticSTS Paper: A Controlled Test of Context Decay

The AgenticSTS project, a collaboration between Alaya Lab and Shanghai Jiao Tong University, picked an unforgiving test bed for this problem: Slay the Spire 2. A single playthrough requires hundreds of decisions — card selection, route planning, combat tactics, resource management. Human players win 16 percent of games at the lowest difficulty. Frontier models in the AGI-Eval assessment lost every single game across five tested setups.

The researchers built an agent that does not carry a growing chat log. Instead, it reconstructs each decision from five clearly separated memory layers:

  • L1 — Fixed protocol instructions that never change.

  • L2 — State schemas describing currently valid actions.

  • L3 — Retrieved game rules, fetched on demand.

  • L4 — Summaries of previous runs (episodic memory).

  • L5 — Strategy skills triggered for specific situations (a learned skill library).

Anything the agent wants to carry from a prior decision must first be written into one of these five slots. The prompt stays short regardless of run length.

The results are striking. Without any memory layers, the agent wins 3 out of 10 games. With the L5 skill library enabled — storing tactical rules for recurring situations — the win rate doubles to 6 out of 10. When the agent keeps learning between runs, it reaches difficulty levels A6 through A8. Without that cross-run memory, it tops out at A2 through A4.

The Token Cost Gap Is the Real Story

The headline win rate matters, but the economics are what should make teams rethink their architecture. AgenticSTS keeps actual user text at roughly 5,000 tokens per decision, regardless of how long the game has been running.

Compare that to two public Slay the Spire 2 agents — STS2MCP and CharTyr — that follow the classic growing-transcript pattern. For every point those competitors score, they send 66 to 90 times as many tokens to the language model. A single model call near the end of a game in STS2MCP hit roughly 527,000 tokens because the entire game history is re-sent with every new decision.

The accumulating agents also take four times as long to reach the same result. According to the provider’s data, 96 percent of that time penalty comes from model latency — pure wall-clock wait for the language model’s response.

This is context rot in concrete, measurable terms. A prompt that was effective at step 1 with 2,000 tokens is degraded by step 80 with 200,000 tokens, because the signal-to-noise ratio has collapsed. The model is not reasoning worse. It is being asked to reason through a fog of accumulated history.

ACE: The Self-Improving Playbook

The AgenticSTS paper is not an isolated finding. The ACE framework (Agentic Context Engineering, presented at ICLR 2026) approaches the same problem from a different angle: instead of organizing memory into fixed layers, ACE gives the agent an evolving playbook.

The playbook is a list of structured JSON entries, each with an ID, helpful and harmful counters, and a short piece of content — a reusable strategy, a known failure mode, or a domain insight. After every run, an Evaluator scores which entries helped and which misled. A Reflector proposes delta updates. A Curator decides what actually changes.

The key design decision is that the Reflector and Curator run offline during training, not in production. In production, only the Generator runs — reading the playbook and producing output. The playbook is a read-only artifact at that point.

On the AppWorld benchmark — where agents complete real-world tasks like managing files, booking travel, and coordinating across apps — ACE improved task success rate by 17.1 percent over a baseline without a playbook. On financial reasoning benchmarks, the improvement was 8.6 percent.

The mechanism is simple: the agent gets better because it remembers what worked. No fine-tuning. No retraining. No gradient descent. Just a JSON file that grows more useful over time.

The Industry Is Looking in the Wrong Direction

The dominant response to context rot has been to build larger context windows. Two million tokens. Ten million tokens. The assumption is that if the window is big enough, the problem goes away.

The AgenticSTS numbers suggest the opposite. A 2-million-token window does not help an agent that loads 500,000 tokens of irrelevant history into every decision. Larger windows lower the cost of sloppy memory architecture — they do not fix it. The model still has to sort signal from noise across orders of magnitude more text, and the evidence shows it does not do that well.

What actually works is the harder engineering choice: designing a memory system that keeps the active context small and relevant, and moves everything else into structured, addressable storage.

Anthropic’s internal research points the same way. Their Memory Tool and Context Editing system automatically strips outdated tool results from the context and stores important information in external files. In their own tests, this cut token usage for a 100-round web search by 84 percent.

The Mastra framework condenses conversations into concise text notes outside the context window. The GAM framework from Chinese researchers splits archiving and retrieval across two specialized agents. Different implementations, same insight: context should not grow unbounded.

What This Means for Production Agents

The practical takeaway for anyone building agents today is straightforward.

First, measure your context growth per session. If a typical agent run produces 50 tool calls and your prompt grows from 2,000 tokens to 200,000 tokens, you are deep in context rot territory. Your agent’s performance at step 50 is almost certainly worse than at step 5, and you are paying for the privilege.

Second, design explicit memory layers, not a single growing log. Separate fixed instructions from session state from retrieved knowledge from learned patterns. Each layer should have its own budget, refresh policy, and eviction rule. The AgenticSTS five-layer architecture is not the only design that works, but it demonstrates the principle: organized memory beats accumulated memory.

Third, invest in cross-run learning as a separate capability. The most impressive results in the AgenticSTS paper come not from better in-run memory but from the L4 and L5 layers that persist across runs. The ACE paper confirms this: a system that learns from past failures compounds knowledge instead of resetting to zero. If your agent cannot get better between runs, you are leaving most of the value on the table.

Fourth, treat context engineering as an architecture decision, not a prompt fix. The instinct when an agent starts making bad decisions at step 60 is to tweak the system prompt. The data says the fix is structural: redesign how context flows through the system. A better prompt on a broken memory architecture still loses at step 80.

The agents that survive production in 2026 will not be the ones with the largest context windows. They will be the ones with the most disciplined context pipelines — systems that treat every token in the active window as a scarce resource and shunt everything else into structured memory where it can be found, but does not get in the way.

Keep reading