feat(core,cli): finalize context compression with batched routing#4
Open
thetomzohar wants to merge 12 commits intomainfrom
Open
feat(core,cli): finalize context compression with batched routing#4thetomzohar wants to merge 12 commits intomainfrom
thetomzohar wants to merge 12 commits intomainfrom
Conversation
1ef9b2f to
b70725e
Compare
b70725e to
bad96cd
Compare
added 8 commits
March 18, 2026 20:16
1. Fix AbortSignal propagation in local/cloud compression to cancel requests properly. 2. Add proper tests and remove duplicated license header.
…xtCompressionService This commit standardizes the service and config names to reflect that it handles both local and cloud modes.
… telemetry handling This commit corrects a condition where compression breaks the functionCall/functionResponse adjacency invariant by gracefully ignoring edge-cases. It also cleans up temporary telemetry traces to prepare the code for branch PR submission.
- Restore chatCommand and logger compression checkpointing state logic - Reposition setCurrentPrompt block above pre-route compression invocations - Append pending mock logic hooks into unit test configurations - Remove dangling settings load statement whitespace in CLI layer
joshualitt
added a commit
to google-gemini/gemini-cli
that referenced
this pull request
Apr 1, 2026
* Upstreams the ContextCompressionService from: thetomzohar#4 * Some minor tidying.
joshualitt
added a commit
to google-gemini/gemini-cli
that referenced
this pull request
Apr 1, 2026
* Upstreams the ContextCompressionService from: thetomzohar#4 * Some minor tidying.
joshualitt
added a commit
to google-gemini/gemini-cli
that referenced
this pull request
Apr 2, 2026
* Upstreams the ContextCompressionService from: thetomzohar#4 * Some minor tidying. * Refactor: Rename ContextManager to MemoryContextManager * Settings: Add experimental.generalistProfile to safely default context management hyperparameters
joshualitt
added a commit
to google-gemini/gemini-cli
that referenced
this pull request
Apr 2, 2026
* Upstreams the ContextCompressionService from: thetomzohar#4 * Some minor tidying. * Refactor: Rename ContextManager to MemoryContextManager * Settings: Add experimental.generalistProfile to safely default context management hyperparameters
joshualitt
added a commit
to google-gemini/gemini-cli
that referenced
this pull request
Apr 2, 2026
* Upstreams the ContextCompressionService from: thetomzohar#4 * Some minor tidying. * Refactor: Rename ContextManager to MemoryContextManager * Settings: Add experimental.generalistProfile to safely default context management hyperparameters
joshualitt
added a commit
to google-gemini/gemini-cli
that referenced
this pull request
Apr 2, 2026
* Upstreams the ContextCompressionService from: thetomzohar#4 * Some minor tidying. * Refactor: Rename ContextManager to MemoryContextManager * Settings: Add experimental.generalistProfile to safely default context management hyperparameters
joshualitt
added a commit
to google-gemini/gemini-cli
that referenced
this pull request
Apr 2, 2026
* Upstreams the ContextCompressionService from: thetomzohar#4 * Some minor tidying. * Refactor: Rename ContextManager to MemoryContextManager * Settings: Add experimental.generalistProfile to safely default context management hyperparameters
joshualitt
added a commit
to google-gemini/gemini-cli
that referenced
this pull request
Apr 2, 2026
* Upstreams the ContextCompressionService from: thetomzohar#4 * Some minor tidying. * Refactor: Rename ContextManager to MemoryContextManager * Settings: Add experimental.generalistProfile to safely default context management hyperparameters
joshualitt
added a commit
to google-gemini/gemini-cli
that referenced
this pull request
Apr 2, 2026
* Upstreams the ContextCompressionService from: thetomzohar#4 * Some minor tidying. * Refactor: Rename ContextManager to MemoryContextManager * Settings: Add experimental.generalistProfile to safely default context management hyperparameters
joshualitt
added a commit
to google-gemini/gemini-cli
that referenced
this pull request
Apr 2, 2026
* Upstreams the ContextCompressionService from: thetomzohar#4 * Some minor tidying. * Refactor: Rename ContextManager to MemoryContextManager * Settings: Add experimental.generalistProfile to safely default context management hyperparameters
joshualitt
added a commit
to google-gemini/gemini-cli
that referenced
this pull request
Apr 2, 2026
* Upstreams the ContextCompressionService from: thetomzohar#4 * Some minor tidying. * Refactor: Rename ContextManager to MemoryContextManager * Settings: Add experimental.generalistProfile to safely default context management hyperparameters
joshualitt
added a commit
to google-gemini/gemini-cli
that referenced
this pull request
Apr 2, 2026
* Upstreams the ContextCompressionService from: thetomzohar#4 * Some minor tidying. * Refactor: Rename ContextManager to MemoryContextManager * Settings: Add experimental.generalistProfile to safely default context management hyperparameters
joshualitt
added a commit
to google-gemini/gemini-cli
that referenced
this pull request
Apr 2, 2026
* Upstreams the ContextCompressionService from: thetomzohar#4 * Some minor tidying. * Refactor: Rename ContextManager to MemoryContextManager * Settings: Add experimental.generalistProfile to safely default context management hyperparameters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add support for context compression configurations via new CLI flags:
--compress(cloud context routing using flash compressor) and--local-compress(local context routing using local ollama models). Thisimproves multi-turn tool performance by selectively compressing large file
payloads in history while retaining accuracy.
Details
--compressproxies file classification to Gemini cloud(
compressor-2.5-flash-lite);--local-compressproxies it to local modelsover HTTP (
getLocalContextCompressionModelUrl).LocalContextCompressionServiceand updatedGeminiClientto dynamically trigger compression before fetching chat turnsbased on the configured mode.
ContextCompressionServiceto use a 4-pass batched sequence, reducing LLM overhead by grouping multiple file relevance queries into a single call.experimental commits, ensuring clean integration with the trunk.
Related Issues
None.
How to Validate
npm run build--compress:node packages/cli/bin/gemini.js --compressread_fileonpackage-lock.json).transparently by checking the local
compression_state.jsonfile in yourGemini temp directory.
Pre-Merge Checklist