New research from Maximem. Agentic Context Management: Agent Memory is an architecture problem. Read the paper →

Context Eviction

TL;DR

Removing or deprioritizing old information from the AI's active context to make room for new data

Budgets are hard. Token limits are real. So when you've got a finite context window and new information keeps arriving, something's gotta go. Context eviction is the brutal act of deciding what gets kicked out. Unlike context management (which is holistic and strategic), eviction is tactical and reactive. It's the FIFO queue, the LRU cache, the garbage collector of your AI system. The naive approach: just drop the oldest stuff. Simple, cheap, obviously suboptimal. Better approaches assign eviction priorities: maybe system instructions stay forever, recent messages stay, and old background info gets dropped first. Some systems use weighted scoring. Others implement time-decay functions where relevance naturally diminishes over time. There's also the question of what 'eviction' really means. Do you permanently delete it? Archive it? Compress it into a summary? Replace it with metadata pointers? I've seen implementations that evict full messages but keep their semantic embeddings, so the model can still find them if explicitly retrieved. The cost-performance tradeoff is interesting. Aggressively evicting old context saves tokens and speeds inference (good for latency and cost), but sometimes that old context was actually important (bad for quality). Maximem Vity manages this intelligently, using temporal and semantic signals to keep memories you're likely to need while gracefully archiving older ones. Maximem Synap's infrastructure layer lets developers tune eviction strategies to match their specific application requirements and quality targets.

Why It Matters

Context eviction prevents your AI system from drowning in its own history. Without thoughtful eviction, either you waste tokens and money keeping everything around, or you lose valuable information. Getting it right means your conversations stay coherent, responsive, and cost-effective without sacrificing the memories that actually matter.

StrategyKeepsLosesBest for
RecencyThe most recent turnsAnything established earlyShort task-based sessions
RelevanceWhat scores against the current queryBackground the query does not nameQuestion answering
Summarise and replaceThe gistSpecifics and exact wordingLong advisory conversations
HierarchicalRecent turns in full, older ones summarisedMiddle detailLong-running agents

Example

You're having a 500-message conversation with an AI. By message 400, you're pushing against the context window limit. Eviction policies decide: do we keep all 400 messages? The last 100? Just summaries of the first 300? The right answer depends on your task, and good eviction means the model forgets the mundane discussion from message 50 while retaining the critical requirements from message 30.

Common questions

Context eviction is deciding what to drop when a context window fills. Every agent does it, whether or not the team chose a strategy, because something has to go once the budget is reached.

Hierarchical, in most production settings: keep recent turns verbatim, summarise older ones, and persist anything durable to long-term memory before evicting it. Pure recency is the default and it is the one that silently drops the thing a user said at the start.

Not if the system is built correctly. Eviction removes something from the current context; deletion removes it from the store. A system that conflates the two will lose facts nobody asked it to forget.

Go deeper

What a memory layer does that eviction cannot

Related Terms

Eviction decides what to drop. Synap decides what to keep and where, so leaving the window is not the same as being lost.