Claude Rolling Context is a local proxy, installed as a Claude Code plugin, that compresses a long session's older messages in the background while keeping recent messages verbatim. It is an alternative to the built-in compact command, which replaces the whole conversation with a lossy summary and, after a few rounds, ends up summarizing earlier summaries.
Below a 100K-token trigger (measured from the real API token count) requests pass through unchanged. Above it, the proxy summarizes the older messages, keeps roughly the last 40K tokens as they are, and injects the compressed context on the next request, so compression never blocks a turn. Each cycle merges the new summary into the previous one, building a rolling record with the active goal, previous goals, a numbered timeline of changes and decisions, the current state, and key details. Claude Code's own transcript files are left unchanged.
By default the summary request clones the exact request Claude Code just sent (same model, system prompt, and tools), so it is served almost entirely from the prompt cache and counts as normal session traffic on Pro and Max subscriptions. Summarization can instead go to a separate Anthropic key or to any OpenAI-compatible endpoint, including local models through Ollama, LM Studio, or vLLM, and the proxy also chains to non-Anthropic Claude Code endpoints such as GLM or DeepSeek.
The cost argument is that every token held in context is re-billed on every turn at the cache-read rate, so an unmanaged session's input cost grows with the square of its length, while a capped prefix makes it grow linearly. A capped prefix also makes a cold-cache turn after a pause far cheaper than one at a near-full window.
| Built-in compact | Rolling Context | |
|---|---|---|
| What gets compressed | Everything | Only old messages |
| Recent context | Summarized | Kept verbatim |
| When it runs | Manually or near the limit | Automatically, in the background |
| Latency impact | Blocks until done | None |
| Input cost over a long session | Grows with the square of length | Grows linearly |
| Original transcript | Replaced | Preserved |
Features
- Rolling compression: older messages are summarized once the context passes a trigger, recent messages stay verbatim
- Background operation: summaries are computed asynchronously and applied on the next request
- Merged summaries: each cycle merges with the previous summary instead of summarizing a summary
- Structured summary: active goal, previous goals, timeline, current state, and key details
- Cache-native summarization: the summary request reuses Claude Code's own request shape and prompt cache
- Alternative summarizers: a separate Anthropic key or any OpenAI-compatible endpoint, including local models
- Third-party endpoints: chains to non-Anthropic Claude Code endpoints with a flattened fallback when a field is rejected
- Transcript preservation: Claude Code's full session logs are kept unchanged

