What actually fills your AI CLI's context window
This guide explains how different types of input consume space in your session and what exactly fills the available memory.
What counts against the window
Every message you send, every file the tool reads, and every piece of text you paste remains in the context window. As your session continues, all of this accumulated context is transmitted again with every subsequent request. The system needs this complete history to understand references to earlier statements and maintain a coherent conversation. This means the available space for new instructions slowly decreases over time. Eventually, depending on the tool, the system might compress the conversation, abort the request, or require a session restart to free up space. What they have in common is that older parts of the conversation lose their weight in the process.
It is not only what you paste
- The previous messages of the ongoing conversation: Every prompt and response from the current session remains in memory.
- Files that the tool has read on your behalf: The content of any file inspected by the agent is added to the active history.
- The output of the commands that the tool has executed: Terminal logs from requested actions are fully included to allow the model to read them.
- The descriptions of the tools available to the model: The system prompt includes detailed instructions on what each available capability does.
- The pasted text: Any clipboard content you manually insert becomes part of your next message.
The share of these items differs depending on the specific tool, but the pasted text is the only component the user controls directly.
What a single paste costs
| Sample | Characters | Tokens when pasted | vs. a 19-token path | Share of a 200k window | Pastes until the window is full |
|---|---|---|---|---|---|
Terminal log, 400 lines (git log --stat) |
16,609 | 5,646 | 297x | 2.8 % | 35 |
| Swift source file, 2,348 lines | 169,223 | 40,324 | 2,122x | 20.2 % | 4 |
You can find the complete measurement on the detailed token costs page. That page includes all four measured examples, information on the specific tokenizer used, and the countercheck methodology.
Why logs are the most expensive thing you paste
Measurements show 2.94 characters per token for terminal logs, compared to 4.20 characters per token for source code. Terminal outputs contain hashes, paths, and numbers which are rarely merged into larger tokens by the tokenizer, making them more costly than standard source code. Human language and well formatted code consist of common words that map to single tokens. Hashes, paths, and number sequences do not appear in the training data in this exact form, so they break down into multiple short pieces instead of a single token. This fundamental difference causes technical logs to drain the available capacity much faster than regular text.
A file path costs 19 tokens
Providing a file path instead of the content costs a measured 19 tokens. This allows the AI tool to read the file only when needed, rather than carrying the entire content in the permanent conversation history. A simple file path remains inexpensive throughout the entire session because it is short. Whether and when a tool removes previously read content from the conversation depends on the tool and is not something to rely on. This approach preserves your window capacity for more complex reasoning tasks.
What this means for a working session
A few large pastes consume a significant portion of the context window. Keeping the window clear of large texts ensures consistent response quality over a longer period of time. Once the window fills up, the tool's behavior depends on its specific implementation: some summarize the conversation, some abort, and some require a new session. They all share the consequence that older parts of the conversation lose weight, which can lead to the agent forgetting initial constraints or losing track of the overarching goal. Managing your inputs carefully is the key to maintaining a highly effective working session.