Automatic
When estimated usage passes 70% of the model’s context window, 9p compacts before the next request:Manual
/usage shows the current estimate:
What survives
The summary is written by a real model call — cheap and toolless — and asked to keep, in order:- What you’re trying to achieve, in your words
- Decisions and constraints, especially anything you corrected or rejected
- Files changed, with paths and what changed
- Commands run and what they revealed
- What’s in progress and the next step
- Anything broken, blocked, or deferred
A mechanical truncation would be cheaper, but it discards exactly the decisions
and constraints that make the rest of the session coherent. Paying for one small
summarisation call is worth not re-explaining your project.
/compact vs /clear
/clear is cheaper and gives a genuinely clean slate — but it also resets the
provider’s prompt cache, so don’t reach for it mid-task. See
Credits.
Keeping sessions cheap
- Use
/clearbetween unrelated tasks so unrelated history never accumulates - Prefer sub-agents for wide searches — they return findings, not file dumps, so the main context stays small
- Keep
9P.mdtight; it’s re-sent every turn
Limits
- Token counts are estimates (~4 chars per token), not a real tokenizer. They drive a threshold, so erring high just compacts slightly early.
- If no safe cut point exists, 9p leaves history untouched rather than risk a malformed request.
- A failed or empty summary aborts compaction — history is never destroyed on a bad response.

