Anatomy of context

1 min read
On trails:AGCTXstep 3/11

What an agent sees is not one thing. It splits into five types of context, and knowing which type a piece belongs to tells you how to manage it: whether to write it once, fetch it, truncate it or look it up.

TypeWhat it isExamplesLives
1 StaticFixed system promptsPersona, rules, tool schemasWritten once, same on every call
2 DynamicThe trigger contextUser query, API response, sensor readingThis turn
3 EpisodicShort-term memoryHistory of the current interaction, the last 10 messages (managed)This conversation
4 RetrievedKnowledge fetched just in time from outsideRAG documents, API calls, web searchFetched per step
5 StatefulLong-term memory from a permanent external sourceWhat is known about the user and their stateAcross conversations

Which ones grow

Static is the only type you write by hand; the rest are gathered at run time by the context assemblerThe context assemblerThe step that builds the prompt from scratch on every loop.Opens in a new tab. Episodic grows with every turn, and retrieved and dynamic content can be large, so those are where overflow managementContext overflowWhen the history outgrows the window: cut the oldest, or summarize them.Opens in a new tab, compressionContext compressionShrink what goes in, using a smaller model whose only job is to summarize.Opens in a new tab and rerankingContext rerankingModels read the middle of a long context worst, so put what matters at the edges.Opens in a new tab earn their keep. Stateful is where long-term memory enters the window, and it is the raw material of personalizationThe dynamic expert agentPersonalize with what the agent knows about the user, then assemble the right expert for the question.Opens in a new tab.

Two kinds of episodic

The word is used twice in this set. Here, episodic context is only the recent conversation: what is in the window right now. In agent memoryAgent memoryWhat an agent remembers: the thread it is in, and what it keeps across threads.Opens in a new tab, episodic is a kind of long-term memory, past events kept between conversations.


Sources