All chapters
  1. Start hereA model knows only what it can see now
  2. Foundations · 1The context window: tokens, messages and order
  3. Foundations · 2Signals and authority: who is allowed to instruct the model
  4. Foundations · 3The context assembly pipeline: select, rank, deduplicate, pack
  5. Retrieval · 4Retrieval fundamentals: lexical search, embeddings, hybrid search, reranking
  6. Retrieval · 5RAG architecture: chunks, metadata, grounding, citations, freshness
  7. Budget · 6Context budgeting: truncation, dilution, token cost and caching
  8. Budget · 7Compression, summarization and compaction, with loss tests
  9. Agents · 8Coding-agent context: repository maps, instruction files, diffs and tool outputs
  10. Agents · 9Working context, durable memory and checkpoint state
  11. Agents · 10Dynamic context: just-in-time retrieval, selective tool disclosure, delegation
  12. Agents · 11Multi-agent context isolation and scoped handoffs
  13. Trust · 12Context security: injection, poisoning, access controls, tenant boundaries
  14. Trust · 13Measuring context quality: recall, utilization, grounding, ablation
  15. Practice · 14Frameworks and standards: what each one assembles for you
  16. Practice · 15Context in production: versions, drift, refresh, observability, incidents
  17. Practice · 16The insurance lab: one submission, every context decision
  18. ReferenceGlossary
  19. AboutAbout this site and its sources
About

About this site and its sources

What this site is, what it is not, where its ideas come from, how the facts were checked, and the sister sites of the series.

This is a knowledge site about choosing what a model can see. It starts from one model call and the block of text it receives, and climbs to retrieval, budgets, compaction, coding agents, memory, isolation between agents, security, measurement and production. At each step it asks three questions: what did the model see, what was left out, and can we prove why? It is written for engineers and architects who build agent systems, including backend engineers who are new to them.

One example runs through every page. An insurer receives a broker's request for a quote. An underwriting agent gathers evidence, retrieves the guidance and writes a recommendation. A human underwriter decides. The model recommends; a person decides.

What it is and is not#

It isIt is not
A ladder: one idea per step, each word in plain English with a tiny example before it is usedA standard, or the only way to organize context work
One running example, the shared cases UW-001 to UW-010 and this site's own UW-201 to UW-206A record of any real insurer. The cases, rules, fields, documents and provider are invented
A demonstration of mechanism: how a window is assembled, what a manifest records, what each stage removesA measurement of any model, retriever or product. No page reports how good a real system is
Code that was run: a small assembler in standard-library Python, with its real output and 36 unit testsA framework to install. It is short so that it can be read whole
Products described from their own documentation, by what context work each one does for youA ranking or a buying guide. No product is called best, and no price is quoted

What is original here and what is not#

Most of the ideas on this site were published by other people first. The conceptual starting point is Anthropic's article "Effective context engineering for AI agents" (September 2025). This site uses its ideas with attribution and none of its prose, examples or figures.

PartStatus
Context as a finite resource; context rot; just-in-time retrieval; compaction; notes outside the window; subagents with clean windowsFrom the Anthropic article, used with the same meaning
Lexical search (BM25), embeddings, cosine similarity, reciprocal rank fusion, reranking, recall, precision, MRRStandard information retrieval. The formulas appear with their assumptions on Retrieval and Measuring
Instruction versus data, and untrusted content having no authorityStated in provider documentation read for Signals and Security; the conflict order of the example is a design of this site
The context manifest, the fixed list of omission reasons, the context versionDesigns proposed on this site
The loss test for compaction, with probes for required factsA design proposed on this site
Working context, durable memory and checkpoint state as three storesAn arrangement proposed on this site, to keep three things apart
The cases, the policy fixture, the 20 documents, the 3,000 past decisions, the coding-agent repositoryWritten for this site. All synthetic
The example code, its tests, the labs and the diagramsWritten for this site

Where a page takes an idea from a source, the page says so. Where this site proposes something, it calls it a design.

How the facts were checked#

Kind of claimHow it was checked
A named product, protocol or standardRead on its own documentation on 2026-11-17 and logged with the address and the date in the repository's fact files (docs/facts/<page>.md). Where the documentation is silent, the page says so. Surprising facts (renames, deprecations, moved pages) were fetched a second time by a different agent before publication
An idea from a sourceThe source was opened and read on the day of writing and is listed below
The exampleRun. Every command shown from examples/uw-context/ was executed, and the output on the page is the output it printed
The labsThey read data that a script generates from the example. Their arithmetic is a second implementation of the Python functions, and a test compares the two on 2,231 results
NumbersSynthetic and illustrative unless a source is linked. Token counts come from a stand-in tokenizer
Other codeA block that was not run says so: "documented shape; not run here"
Links and structureA build step checks every internal link, diagram and glossary reference before publication

Documentation changes quickly in this field. Treat every statement about a product as true on the day it was read, and read the product's page again before you build on it.

What the example does not show#

The insurance example is an illustrative reconstruction for teaching. It follows the shape of a real project by the author, but the cases, the rules, the fields, the documents, the provider and every number are invented. Nothing here reports the quality of a real system or model. Example roof thresholds are synthetic, not insurance practice.

The agent here is a scripted stand-in, so these results show how the mechanism works, not how good any model is.

In the exampleWhat it really is
The underwriting agentA script that reads only its window with fixed patterns. No model is called; no network, no key
The tokenizerA stand-in rule (letters in pieces of four, digits in pieces of three). Not any provider's tokenizer
The embeddingA hand-written concept table hashed into 256 numbers. Not a neural model
The rerankerA script that counts covered concepts. Not a cross-encoder
The roof-data providerA stand-in that returns what the case file says
The coding agentA scripted session of tool calls over an invented repository
Variation between trials (UW-010)Produced by a fixed seed, so that every reader sees the same run

Sources and reading list#

Each link was opened on 2026-11-17. Publication dates are those given by the source.

Start here#

SourceWhy read it
Effective context engineering for AI agents, Anthropic, September 2025The conceptual starting point: context as a finite resource and the strategies for long-running agents
Introducing Contextual Retrieval, Anthropic, September 2024Why lexical and vector search complement each other, and context added to chunks before indexing

Provider documentation used on this site#

The complete list, claim by claim with dates, is in the fact files of the repository. Frameworks names the documentation of every library and SDK it describes in its own sections.

Sister sites#

This site is one of a series of guides on engineering agentic software. At each boundary a page says what a concept is not and links the site that owns it.

SiteOwns
Prompt EngineeringHow instructions are written, composed, ranked, versioned and defended
Memory EngineeringDurable information and saved execution state
Agent CommunicationMessages between agents; the A2A protocol
Observability EngineeringLogs, metrics, traces, audit events and replay
Guardrails EngineeringEnforceable checks around a probabilistic agent
Tools EngineeringTool schemas, execution and MCP tools
Structured Output EngineeringTyped contracts: shape, validation, repair, evolution
Agent OrchestrationThe control plane: what runs next, under which condition
Agent ReliabilityAcceptable outcomes despite failures and retries
Harness EngineeringThe runtime around a model call
Eval EngineeringGraders, golden sets, judges, trials and release gates
Diff to DeployShipping a change with coding agents

Written by Sam Muthu. Every case, rule, document and number in the example is synthetic.