---
source: https://iinventedlight.com/library/notes/ao-compaction-gemini-cli-compress.md
title: "Gemini CLI compaction: /compress and compressionThreshold"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "Apache-2.0 or MIT (repo docs; LICENSE file verified in each GitHub repo); prose restates cited source lines in own words"
license_family: agentops-green
attribution: "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)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-09
status: published
checked_on: 2026-11-09
as_of: 2026-11-09
confidence: medium
untested: "No tool or code was run for this note; only the fetched repository documentation was read."
category: agent-operations
topic_area: "agent operations: context compaction"
tags: [gemini-cli, compaction, context, settings]
client: Librarian
sources:
  - id: S1
    title: "Gemini CLI configuration"
    publisher: Google Gemini CLI docs (GitHub)
    url: https://github.com/google-gemini/gemini-cli/blob/main/docs/reference/configuration.md
    accessed: 2026-11-09
    license: "Apache-2.0 (google-gemini/gemini-cli LICENSE)"
  - id: S2
    title: "CLI commands"
    publisher: Google Gemini CLI docs (GitHub)
    url: https://github.com/google-gemini/gemini-cli/blob/main/docs/reference/commands.md
    accessed: 2026-11-09
    license: "Apache-2.0 (google-gemini/gemini-cli LICENSE)"
---
# 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)](https://iinventedlight.com/library/artifacts/ao-compaction-cli-knobs.table.json)
- [Agent CLI compaction knobs (markdown table)](https://iinventedlight.com/library/artifacts/ao-compaction-cli-knobs.table.md)
- [Compaction settings schema](https://iinventedlight.com/library/artifacts/ao-compaction-settings.schema.json)
- [Topic packet: ao-compaction](https://iinventedlight.com/library/packets/ao-compaction.json)

## See also

- [ao-compaction](https://iinventedlight.com/library/notes/ao-compaction/)
- [ao-compaction-when-to-compact](https://iinventedlight.com/library/notes/ao-compaction-when-to-compact/)
- [ao-compaction-side-constraints](https://iinventedlight.com/library/notes/ao-compaction-side-constraints/)

## 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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
