What a document costs the window

By Prof. Tom Yeh

Published: 2026-08-19

URL: https://www.byhand.ai/p/library-agents-context-chunking-a-document


Library › Context Problems

-

The Context Window

-

Window Occupancy

-

Growth per Turn

-

Remaining Space

-

Turn Budget

-

Retrieval Footprint

-

Retrieval per Turn

-

Search Rounds

-

Window Sizing

-

Truncation

-

Compaction

-

The Compaction Bill

-

Compacted Retrieval

-

The Compaction Threshold

-

Verbatim Tail

-

Stateless API

-

Retrieval Cost

-

Context Tax

-

Quadratic Cost

-

Cost Forecast

Retrieval does not add a document to the conversation, it adds the document to the window. Whatever comes back from the store competes for the same cells as the system prompt, the question, and the answer. A retrieved document is split into fixed chunks, and every chunk takes a cell whether the model needs it or not, so a generous retrieval is quietly the largest thing in the window. [[rag-chunks-in-the-budget]] asks the next question: what happens when the chunks do not fit.

Paid members: the worksheet and its printable PDF are below ↓