Models read and write tokens, which are chunks of text rather than whole words, and they can only attend to a fixed number of tokens at once, called the context window. Token counts drive cost, latency, and what an agent can hold in mind, and the context window is exactly where untrusted content and trusted instructions meet.
Read in this order
- OfficialContext windows (Claude Platform Docs)Start here: how the context window fills up across a multi-turn agent session.
- OfficialToken counting (Claude Platform Docs)Measure what you send before you send it, for cost and limit planning.
- OfficialPrompt caching (Claude Platform Docs)How reused prompt prefixes are cached, which affects cost and latency.