# Context window

Concept · [Building with AI](https://ecosystem.samcarlton.com/ai)

Also called: context, context length, context limit, memory

How much text an [LLM](https://ecosystem.samcarlton.com/llm) can take into account at one time. That includes your [prompt](https://ecosystem.samcarlton.com/prompt), any documents you give it and the [conversation](https://ecosystem.samcarlton.com/session) so far.

**For example:** You paste in a very long contract and the AI tool seems to forget the first pages. The contract was larger than its context window.

## Connects to (23)

- [Token](https://ecosystem.samcarlton.com/token): In AI, a small chunk of text, roughly a word or a piece of a word, that an LLM reads and writes.
- [Prompt](https://ecosystem.samcarlton.com/prompt): The instructions or question you give an AI tool in everyday words.
- [RAG](https://ecosystem.samcarlton.com/rag): Retrieval-augmented generation.
- [Attention](https://ecosystem.samcarlton.com/attention): The part of a language model that decides, for each token, how much every other token in the input should shape its meaning.
- [Context engineering](https://ecosystem.samcarlton.com/context-engineering): Deciding what information, instructions, examples and tools to put in front of an AI model for each task, and what to leave out.
- [Session](https://ecosystem.samcarlton.com/session): One stretch of work with an AI agent, from a blank start until it is cleared, closed or compacted.
- [Compaction](https://ecosystem.samcarlton.com/compaction): Shrinking a long session by replacing its history with a summary and carrying on from that summary in a fresh context window.
- [Harness](https://ecosystem.samcarlton.com/harness): The software wrapped around an AI model that turns it into a working agent.
- [Input tokens](https://ecosystem.samcarlton.com/input-tokens): The tokens an AI product sends to the model on each request: the instructions, the conversation so far, files and tool results.
- [Tool result](https://ecosystem.samcarlton.com/tool-result): What comes back to the model after it uses a tool: a file's contents, the output of a command, a search result or an error.
- [Attention relationship](https://ecosystem.samcarlton.com/attention-relationship): The link between two tokens in the input, measured by how much one shapes the model's reading of the other.
- [Attention budget](https://ecosystem.samcarlton.com/attention-budget): A way of picturing attention as a fixed amount each token can spread across everything else in the input.
- [Attention degradation](https://ecosystem.samcarlton.com/attention-degradation): The drop in an agent's sharpness as a session gets long.
- [Smart zone](https://ecosystem.samcarlton.com/smart-zone): A name for the early part of a session, when an agent is focused and accurate.
- [Contextual knowledge](https://ecosystem.samcarlton.com/contextual-knowledge): Facts the model can read directly in front of it right now, such as documents you pasted, files the agent opened or search results.
- [Autocompact](https://ecosystem.samcarlton.com/autocompact): Compaction that the agent's software starts on its own when the context window is nearly full.
- [Clearing](https://ecosystem.samcarlton.com/clearing): Ending a session and starting a completely empty one.
- [Primary source](https://ecosystem.samcarlton.com/primary-source): The original material itself, such as the code, a full transcript or the raw data.
- [Context pointer](https://ecosystem.samcarlton.com/context-pointer): A short mention in one document that tells an agent where to find more, such as 'deployment steps are in the deploy guide'.
- [Progressive disclosure](https://ecosystem.samcarlton.com/progressive-disclosure): Giving an agent only what it needs right now, with pointers to the rest, instead of loading everything at the start.
- [Subagent](https://ecosystem.samcarlton.com/subagent): A second agent that the main agent starts to handle one piece of a job in its own separate session.
- [Chunking](https://ecosystem.samcarlton.com/chunking): Splitting long documents into smaller passages before creating embeddings, so a search can return just the relevant part instead of a…
- [Tokenizer](https://ecosystem.samcarlton.com/tokenizer): The step that splits text into tokens, the small pieces a model actually reads, and turns each one into a number.

Map view: https://ecosystem.samcarlton.com/context-window
