Agent Context Explained

Agent Context Explained

What goes into the window, and how an agent remembers beyond it.

An interactive guide to what goes into an agent's context window, retrieval and memory, with every number measured on a real corpus.

BM250.985 @50.785 @1Dense0.950 @50.705 @1RRF0.980 @50.810 @1RRF + rerank0.995 @50.890 @1
Recall at 1 and at 5 for each stage, over all 200 questions (recursive 256-token chunks). Computed by the engine at build time.

How this is checkedEvery retrieval number is measured on 200 SQuAD questions with real MiniLM embeddings and recorded reranker scores, and the TypeScript engine in your browser reproduces the Python reference exactly, with no tolerance. How it is tested →

What you'll learn

A model knows only what is in its context window. Context engineering decides what goes in: which chunks of which documents, found how, cut where, packed in what order, what to drop or summarise when the window fills, and what to remember between sessions. Every claim here is measured, not asserted: on 6 articles of SQuAD and 200 of their questions, each with its answer's exact place in the text, so a retriever either finds the chunk that holds the answer or does not.

The animations are driven by Agent_Loop_Sim's context module. A small embedding model and a cross-encoder ran once, offline; their outputs ship with the site (int8 vectors and recorded scores), and the engine recomputes every chunk boundary, score, ranking and metric from them, identically in Python and in your browser. On this corpus BM25 finds the answer's chunk first 79% of the time, dense retrieval 71%, the two fused 81%, and fused then reranked 89%. No language model runs anywhere.

Reading order for the Agents track

Six sites, one engine. Each builds on the ones before it, but each also stands alone: start anywhere and follow the links back.

  1. 1Harnesses: the loop, tools, context budget, prompt cache and permissions around one model; assumes nothing.
  2. 2Protocols: how tools and other agents are reached on the wire (MCP, A2A); assumes the loop.
  3. 3Context (this site): what goes into the window: retrieval, packing, compaction, memory; assumes the context budget.
  4. 4Orchestration: many steps and many agents as a graph: state, checkpoints, durable runs, fan-out.
  5. 5Evals: is the agent good, and how sure are you: pass@k, intervals, graders, the harness effect.
  6. 6Security: defences by design: trust labels, least privilege, sandboxes, approvals; reads best last.

New to the Agents track? Start here: the six sites in reading order, what you need first, and a glossary of the terms they define.

Part of a family of sixteen companion sites in four tracks, all in the site menu above: Foundations (Decoder, Training), Hardware (Kernels, Systolic, Accelerators, Racks), Inference (Serving, Architectures, Numerics, Trade-offs) and Agents (Harnesses, Protocols, Context, Orchestration, Evals, Security). It is the third of the six agent sites. How this one was built, and how to check it: about.