ToolsXpo
Workspace & BillingToolsXpo CodeGuides

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:>200k filter 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

contextcompactionlong tasks

Related