FIFO Context Eviction

Drop the oldest short-term messages first when the window fills — simple, but often deletes the purpose-setting turns that matter most.

FIFO (first in, first out) evicts the earliest short-term memory to external storage when context is full. Many APIs and frameworks implement "retain last N messages/tokens" this way. It assumes early messages matter less.

That assumption can be fatally wrong: opening turns often state the conversation's purpose and carry the densest instructions. Blind FIFO is easy to ship and easy to break agent coherence. Prefer pairing or replacing it with memory summarization that preserves goals, entities, and constraints under memory management. A stronger variant is memory pressure eviction: warn the model before flush so self-directed memory management can rescue important queue contents, then summarize what leaves.


Sources

  • AI Engineering (Chip Huyen), ch. 6
  • MemGPT (Packer et al.), §2.2