Context degradation: what rewriting an agent's history costs over hours
Context degradation is the loss of facts an agent once had, caused by rewriting its history to keep the prompt small. Summarising, compacting and truncating all do it. The loss is lossy, the agent can't undo it, and it c
Context degradation is the loss of facts an agent once had, caused by rewriting its history to keep the prompt small. Summarising, compacting and truncating all do it. The loss is lossy, the agent can't undo it, and it compounds with every pass.
It's easy to mix up with context rot, which is about models getting worse as a prompt gets longer. Context degradation is about what your own code does to the history before the model ever sees it. You can have one without the other.
Here is a made-up version of how it plays out. At hour 1 the owner tells the agent a sourdough loaf costs $6.50. At hour 3 the price goes to $7.20. At hour 5 a standing discount is revoked. A summary written at hour 6 says "prices were updated several times and a discount was removed." The agent still knows something changed. It no longer knows what the price is now, or which discount went away.
I wanted to see how much this shows up in practice, so I ran one simulated 12-hour shift through five stacks and logged every model call. I build Argentic, an engine that keeps AI agents right for hours while prompt size is bounded. It's one of the five, and it didn't win on score.
What I ran
The shift is a bakery's operations desk. Over 12 simulated hours it has about 1,400 events: orders, price changes, stock counts, owner messages, standing instructions that get amended or revoked, and updates that contradict earlier ones. A fixed program with no model in the loop grades 663 questions about it. Every stack got the same seed, the same questions, the same grader and Claude Haiku 5.5, and each run had a spend cap.
- LangChain 1.6.7, a plain agent loop at its defaults.
- LangChain Deep Agents 1.17.1, as shipped.
- The Claude Agent SDK with its default auto-compaction.
- Letta with its memory and background tools on.
- Argentic 0.104.1.
I ran the JavaScript packages on 25 November 2026 and tuned nothing.
| Stack | Spend | Where it stopped | Score, hours 1 to 8 |
|---|---|---|---|
| Argentic 0.104.1 | $0.75 | finished 12 hours | 0.87 (four runs: 0.86 to 0.89) |
| LangChain Deep Agents 1.17.1 | $9.46 | finished 12 hours | 0.92 |
| Claude Agent SDK | $8.02 | $8 cap, hour 9 | 0.92 |
| Letta | $8.02 | $8 cap, hour 10 | 0.89 |
| LangChain 1.6.7, plain loop | $5.09 | $5 cap, hour 6 | none, stopped early |
Spend is token usage at list prices, not an invoice.
What it showed
The stack that kept the most history scored highest. Deep Agents never summarised anything: its trigger sits at 85% of the context window, LangChain's profile for Haiku 5.5 says that window is 1M tokens, and the run never got near 850K. Its prompt grew from 5.7K tokens to 279K, and it finished at 0.92 for $9.46. That's about 12.6 times what Argentic spent.
Argentic cost less and scored lower. Over hours 1 to 8 the Agent SDK and Deep Agents both scored above Argentic's whole range, by about 4.6 points over its mean. Letta sits at the top edge of that range. Running counts were Argentic's weakest kind of question: 0.86 against 0.96 for the Agent SDK.
What it didn't show
I can't point at this benchmark and say "there's context degradation." The Agent SDK does compact its history by default, and it scored 0.92 over hours 1 to 8, the same as the stack that kept everything. On this shift, in those hours, the compaction didn't cost it points I could measure.
So the claim I'm making is narrower. Rewriting history is a way to lose facts. Whether you lose enough to matter depends on the agent, the task, and how many passes it goes through. Eight hours of one bakery shift didn't separate them, and I haven't run a longer one. It's also one seed, the rivals ran once each so their scores carry noise I haven't measured, and I haven't measured the Python versions.
Test your own agent for it
You don't need my benchmark. Plant facts early, change some of them, and ask about them at the end:
- Give the agent 20 facts in the first hour: prices, limits, names, standing rules.
- Amend or revoke ten of them over the next hours, mixed in with ordinary work.
- At the end, ask for the current value of every fact.
- Score each answer as current, stale (the old value) or missing.
Stale answers are the worrying ones. A missing fact, an agent can say it doesn't know. A stale one gets acted on. Run it once with your summarising step on and once with it off, and compare.
Data
The raw files for every run are on the head-to-head page with a SHA-256 for each: the settings, the summary, every graded question, the log of every action the agent took, and every model call. https://getargentic.com/research/head-to-head/
The benchmark, the scorer, a validator that reproduces each grade from its log, and the commands to rerun every arm are at https://github.com/open-haul/open-haul-bench (start with REPRODUCE.md). If you get different numbers, open an issue there. I'd like to see them.
More on the engine is at https://getargentic.com.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.