Gemini CLI compaction: /compress and compressionThreshold
Answer: The model.compressionThreshold setting is the fraction of context usage at which compression triggers. The /compress command replaces the entire chat context with a summary.
Automatic trigger
model.compressionThreshold is the fraction of context usage at which to trigger context compression (for example 0.2 or 0.3). The default is 0.5, and a change requires a restart.
Manual trigger
/compress replaces the entire chat context with a summary. This saves tokens for future tasks while retaining a high level summary of what has happened.
Related knob
model.summarizeToolOutput enables summarization of tool output with per-tool token budgets; currently only the run_shell_command tool supports summarization.
Artifacts
- Agent CLI compaction knobs (table)
- Agent CLI compaction knobs (markdown table)
- Compaction settings schema
- Topic packet: ao-compaction
See also
Claims
- id: C1 claim: compressionThreshold sets the trigger fraction. source: S1 evidence: "The fraction of context usage at which to trigger context compression (e.g. 0.2, 0.3)."
- id: C2 claim: /compress swaps the context for a summary. source: S2 evidence: "Replace the entire chat context with a summary."
- id: C3 claim: Compression keeps a high-level summary. source: S2 evidence: "while retaining a high level summary of what has happened."
- id: C4 claim: Only run_shell_command supports tool-output summarization. source: S1 evidence: "Currently only the run_shell_command tool supports summarization."
Sources
- [S1] Gemini CLI configuration. Google Gemini CLI docs (GitHub). https://github.com/google-gemini/gemini-cli/blob/main/docs/reference/configuration.md . License: Apache-2.0 (google-gemini/gemini-cli LICENSE). Accessed 2026-11-09.
- [S2] CLI commands. Google Gemini CLI docs (GitHub). https://github.com/google-gemini/gemini-cli/blob/main/docs/reference/commands.md . License: Apache-2.0 (google-gemini/gemini-cli LICENSE). Accessed 2026-11-09.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: GitHub repository docs under Apache License 2.0 (https://www.apache.org/licenses/LICENSE-2.0) or MIT License (https://opensource.org/licenses/MIT), as listed per source; copyright notices remain with the original authors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Google Gemini CLI docs (GitHub), Gemini CLI configuration, Apache-2.0 (google-gemini/gemini-cli LICENSE); Google Gemini CLI docs (GitHub), CLI commands, Apache-2.0 (google-gemini/gemini-cli LICENSE).
Cite this
iinventedlight. 2026. "Gemini CLI compaction: /compress and compressionThreshold." iinventedlight Library, iil:note:gjhhjyb0, version of 2026-11-09. https://iinventedlight.com/library/notes/ao-compaction-gemini-cli-compress/. License: CC-BY-4.0.
@misc{iil_note_gjhhjyb0,
author = {{iinventedlight}},
title = {{Gemini CLI compaction: /compress and compressionThreshold}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-09},
url = {https://iinventedlight.com/library/notes/ao-compaction-gemini-cli-compress/},
note = {Permanent ID iil:note:gjhhjyb0. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/ao-compaction-gemini-cli-compress.md.