> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qoder.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Context compression

The AI uses a context window—its short-term memory—to keep track of your conversation. It processes your latest message along with previous ones that fit within this window, which has a fixed size measured in tokens. The longer the chat, the more tokens each message uses.

## How it Works

Qoder’s **Smart Context Control** gives you visibility and control over your conversation’s context window to help you balance detail, performance, and cost.

The system continuously monitors your token usage. When your conversation reaches a threshold (typically >40% of the maximum context window), Qoder surfaces two intelligent actions:

### Compact Chat

* **Summarizes** the entire conversation into a concise, dense context that preserves essential logic, decisions, and code.
* **Reduces future token consumption** significantly.
* **Note**: This is a *lossy compression*—minor details may be generalized or omitted for efficiency.

### New Chat

* **Starts a fresh chat** with an empty context window.
* **Ideal** when switching to a completely unrelated task. Prevents irrelevant history from inflating token usage or confusing the model.

> **Smart Context Control is disabled in two scenarios to protect quality**:
>
> * Early in a conversation (when token savings would be negligible).
> * While the AI is generating a response (to avoid interrupting or corrupting output).
