Working the budget backwards

By Prof. Tom Yeh

Published: 2026-08-19

URL: https://www.byhand.ai/p/library-agents-context-sizing-the-window


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

Run the budgeting in reverse: decide how long a conversation must last, and the arithmetic tells you how big a window it needs. Then comes the part the arithmetic does not do for you. Windows come in sizes, and you take the smallest one that fits, so the number you calculated is a floor rather than an answer. Land a little over a size and the next one up is twice the window and twice the price, most of it unused.

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