06. Sessions
Compact and rewind
Long sessions fill the model’s context window. You can compress early turns so later work still fits, or rewind to an earlier prompt and drop everything after it. Both keep you in the same local session.
Related commands: /compact [hint], /context, /rewind (alias /undo).
See how full the window is: `/context`
/contextRequires an active session. The view is instant (it is not queued behind the current turn).
You get a category breakdown — system prompt, messages, reasoning and overhead, free space — plus informational rows for tool definitions, the skills listing, and MCP announcements with estimated token cost.
Check /context before you compact, and again after. For a shorter ID / model / percentage line, use /session-info.
Compact: `/compact`
/compact
/compact keep the auth details/compact compresses conversation history so later turns have room. The optional words after the command are a hint (also called context, or compaction instructions): tell Matcha CLI what to preserve.
Examples:
/compact
/compact keep the auth implementation details
/compact keep the migration plan and the failing test namesThe command is session-scoped. With no hint, Matcha CLI chooses what to keep. With a hint, that note is queued as /compact … on the normal command pipeline.
Use compact when early messages no longer matter and you want to keep going in this session. Use rewind when a recent turn was a mistake and you want those later turns gone.
Auto-compact
Matcha CLI also compacts on its own when usage approaches the limit. The default threshold is **85%** of the context window. You will see a notification when that fires.
Tune it in config:
[session]
auto_compact_threshold_percent = 85Per-model overrides live on [model.<id>].auto_compact_threshold_percent. The model’s context_window is the denominator; the percent is when auto-compact starts.
Compacting a session that is in plan mode keeps plan mode on.
Rewind: `/rewind`
/rewind
/undo/undo is the same command.
Rewind rolls the conversation back to an earlier user prompt and discards later turns. File changes made after that turn stay on disk. Rewind does not restore files.
Open the picker
Any of these, while a session has messages:
/rewind/undo- **Esc Esc** within 800 ms, while idle, with an empty prompt (prompt or scrollback focused). The first Esc is silent.
You get a list of rewind points — one per user prompt. Pick the turn you want to return to. A running turn is offered for cancel first.
Confirm before rewind
**Confirm before rewind** is on by default (/settings, key confirm_before_rewind). Every pick then asks:
- **Yes**
- **Yes, and don't ask again** — runs this rewind and turns the setting off
- **No**
With the setting off, a pick runs immediately.
After rewind
The transcript ends at the turn you chose. Later prompts, replies, and tool results are gone from history. The files those later turns edited are not reverted.
A side question with /btw does not add a rewind point to the main turn.
What you should see
| You ran | Result |
|---|---|
/context | Token breakdown for this session |
/compact keep the API shape | History compressed; hint honored |
| Auto-compact toast | Window hit the threshold (default 85%) |
/rewind or /undo | Picker of user turns |
| Esc Esc (idle, empty prompt) | Same picker |
| Confirm **Yes** | Later turns dropped; files unchanged |