Compaction
Crystal does not reduce context. Crystal Code does, in two steps.
Microcompaction
Section titled “Microcompaction”Before each model call, old successful tool results can be replaced with Tool result omitted after compaction. This is off unless microCompaction is set. It does not call a model, and it does not change the screen or the saved archive.
| Field | Keeps |
|---|---|
protectTurns |
The latest user turns |
protectTokens |
The newest older successful results, after those turns |
minimumTokens |
Older results are replaced only when the removed text is larger than this |
/compact micro toggles it, or sets on or off. It writes config.json and does not summarize. It is refused while a turn or compaction is running. /status shows a Microcompaction row only while it is on.
Full compaction
Section titled “Full compaction”The host compacts when the estimated transcript, or the last model-round usage, crosses the lesser of compactionThreshold of the model window and the usable window (context minus reserved output).
- Clears old tool results outside a protected recent band, when that frees enough tokens.
- Asks for a structured summary of older turns, folding any previous summary, and keeps a recent tail verbatim.
- Stops if the summary cannot be produced and nothing else can be reduced. Compaction does not loop.
A summary that stops because it hit its output limit is not stored. The summary request reserves 16384 tokens, or the session model’s maxTokens when that is smaller, and never more than half the summary window. The verbatim tail is at most 32000 tokens.
CTX percent is the last model round, not the sum of rounds in a turn. The transcript prints compacting context... and the progress row shows Compacting. The frame keeps painting.
Commands
Section titled “Commands”/compact (alias /summarize) runs now and does not wait for the threshold. If the retained tail already holds every turn, it still summarizes everything before the latest user turn. A session with nothing before that turn prints Nothing earlier to compact. It is refused while a turn is running.
| Command | Effect |
|---|---|
/compact model |
Shows Compaction model Off or On <provider> <model>. Turns the switch on or off, or selects <model> or <provider> <model> and turns it on |
/compact thinking |
Cycles or sets that model’s gear |
/compact summary |
Toggles showCompactionSummary. Prints Compaction summary On or Off. on or off sets it |
/compact auto |
Same for showAutomaticCompactionSummary. Prints Automatic compaction summary. automatic is the same command |
/compact micro |
Toggles removal of old tool results |
model and thinking are refused during a turn or compaction. The display commands write config.json and do not summarize. Any other argument is rejected. Tab completes model, thinking, summary, auto, and micro, then on and off.
Which model writes the summary
Section titled “Which model writes the summary”When the switch is off, or compactionModel is omitted, summaries use the session model and the request omits reasoning. When it is on, summary requests use a separate client, including /compact and a summary a side question may take before it answers. The side answer still uses the session model. Changing the session model does not retarget an open compaction client.
The trigger, retained tail, and CTX percent stay on the session window. The summary must fit the smaller of the session window and the compaction model’s declared window. If it does not, the host keeps the existing path that writes no summary. /status adds a Compaction model row only while the switch is on.
A successful compact is written to the session file. The screen keeps the earlier lines. When showCompactionSummary is on (the default), a manual /compact prints the summary in a rounded panel titled Earlier context. Automatic compaction prints Compacted context and, when showAutomaticCompactionSummary is on, the same panel. That switch defaults off. /resume restores the full conversation. The model continues from the summary and tail, and only the live system prompt is refreshed.