Manage context compaction
Compaction replaces older conversation detail with one summary while retaining recent turns. It changes the conversation representation used by later requests; it does not save the content as durable Memory.
Configure automatic compaction
Before changing settings, open an existing conversation and hover over Context usage, the percentage indicator beside the model controls in the composer. Keep the pointer over it to read the panel; clicking does not pin it open. The panel shows the usage percentage and used/maximum tokens. When available, it also shows input, output, reasoning, cached usage, and Output reserve. Not every model response supplies every breakdown.
Output reserve is space reserved for a response, not output already generated. Will compact before next request, when shown, describes a pending action—not a completed summary. Opening this panel does not run compaction. If the control is absent, Ghast does not currently have context-usage data to display; do not interpret that as unlimited space.
Open Settings → Chat behavior → Auto-compact:
| Control | Meaning |
|---|---|
| Enable auto-compact | Attempts a summary as the context approaches its limits. |
| Trigger threshold | Starts at the selected context-usage share; lower values compact earlier. |
| Keep recent messages | Retains recent user-turn boundaries, not a literal count of message bubbles. |
Ghast also tries to preserve at least about 16% of the recent token tail, so the retained detail can exceed the configured turn count.
Click Save after changing these controls; toggling the switch only changes the draft until then. Saving configures later compaction, not an immediate run. Ranges, defaults, and a real settings screenshot are in Chat behavior.
More than one trigger
Automatic compaction can start when either condition is true:
- estimated or provider-reported context usage reaches the threshold;
- the next request cannot reserve the model's maximum output space, even below the threshold.
A conversation can therefore compact before the percentage shown by the slider. Context usage remains the practical warning surface, but the final decision also includes the model window, system instructions, tool and skill descriptions, attachments, and output reserve.
Run it manually
Send this as the entire message in Chat or Coding:
/compact
Send the command by itself, without instructions after it: /compact keep all code does not invoke manual compaction. Use an existing conversation with history; an empty conversation is not a useful starting point.
Ghast attempts to compact the current conversation and clears the command from the composer. A successful run refreshes messages and context usage. There is no separate success notification. If no older content is eligible or the summary would not save enough space, processing can end without a visible change.
If an error says Not enough messages to compact, continue the conversation before trying again; repeating the command cannot create more history. A missing or disabled summarization provider requires correcting the model/provider configuration first. Manual compaction can run even when automatic compaction is disabled.
Use manual compaction when:
- one phase is complete and another is beginning;
- long tool output is no longer needed in full;
- the objective is changing but decisions should remain;
- context usage is already high.
What the summary keeps
The summary aims to retain:
- current goal, explicit constraints, and acceptance criteria;
- decisions already made;
- important file, command, and external-object identifiers;
- completed work, failures, and remaining steps;
- recent user turns;
- the active task contract.
It is not a verbatim archive. Logs, repeated process detail, full tool output, and early wording may survive only as conclusions. Put material that must remain exact in a file or attach it again after compaction.
Verify immediately afterward
A useful next message is:
Restate the current goal, prohibited actions, completed work, remaining work, and next step.
If any key file, account, or acceptance criterion is missing, stop and identify it.
Before continuing, check the objective, permissions, paths, branches, account and environment, verified versus pending claims, and whether the next step would repeat an external action.
Failure and cooldown
When automatic summarization fails, Ghast keeps the original context and enters an approximately 60-second cooldown instead of retrying on every request. The automatic failure may not show a UI error. If usage remains high without a summary change, wait a minute and try /compact.
If the manual attempt fails:
- Preserve the error text before retrying.
- Check that the conversation has a model selected and that its provider is enabled and correctly configured. See Configure the model provider.
- If the error names a missing or disabled summary provider, include that exact error in your support report. The auto-compact settings card does not offer a summary-model selector; changing an unrelated background-task model is not a documented fix.
- For a network or service error, restore the connection or resolve the provider error before retrying. Avoid repeatedly sending the command while the cause is unchanged.
Coding uses the same Chat compaction path. Team also prepares history through its own projections and work-thread boundaries, so Keep recent messages is not a complete Team history rule.
Compaction versus Memory
| Goal | Use |
|---|---|
| Continue the current long conversation | Compaction |
| Reuse a stable fact in later conversations | Memory |
| Preserve full logs or audit evidence | A file, original messages, or destination-system records |
Do not use Memory as current-task state, and do not treat a compaction summary as a complete audit log.