Context and compaction
Every model has a limit on how much it can hold. What happens as a task approaches it, and how to keep long sessions working.
Updated September 2, 2026
A model can only hold so much at once — its context window. A long agent session accumulates: your messages, its replies, every file read, every command's output.
Watching it
The task header shows how much of the window is used, and hovering breaks it down into input, output and cached tokens.
Auto-compact
As a task approaches the limit, ToolsXpo Code summarises older turns and continues. On by default, and worth leaving on: without it, long tasks fail outright. Compaction is not a way to spend less — it is what stops the task ending.
Settings → Agent → Auto compact.
Compacting deliberately
/compact (or /smol, or /newtask) condenses immediately. Useful when you are about to change direction: the exploration that got you here is no longer needed, and carrying it costs input tokens on every remaining turn.
What survives
Recent turns stay verbatim. Older ones become a summary that keeps decisions, constraints and what was learned, and drops the raw material — file contents already read, superseded output.
Compaction is lossy by design. If something matters and might be dropped, say it again after compacting, or put it in a rule.
Keeping sessions healthy
- Start a new task when the subject changes. A fresh window is cheaper and sharper than a compacted one full of unrelated history.
- Leave scouts on. They keep exploration out of the main context. See Subagents.
- Collapse terminal output. Build logs are long and rarely re-read. Settings → Chat.
- Prefer a large-context model for genuinely long work — the picker's
ctx:>200kfilter finds them.
Compaction and caching
Compacting rewrites the prefix, which invalidates the provider's prompt cache — the next request pays full price before the new prefix is cached again. Normal, and worth knowing if you compact repeatedly in quick succession.
See also
Related
Quickstart: your first task with ToolsXpo Code
Install the extension, sign in from your browser, and give the agent its first task — about five minutes end to end.
Choosing a model
What the model picker shows you, why some models are greyed out, and how to search a catalogue of hundreds with filters.
What an agent task costs
How a ToolsXpo Code request is priced, what makes one task cheaper than another, and where to see what you spent.
Agent and scout tiers
Two reserved names — toolsxpo-agent and toolsxpo-scout — that let your workspace decide which model runs, without pinning it into the extension.