[Feature Request] Native programmatic context compaction trigger in Lifecycle Hooks (hooks.json) & Plugin/Sidecar API
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 15/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- json, python, typescript
Direzione di ricerca
This is a design request, not a scoped edit: read how hooks.json lifecycle hooks (PreInvocation, PostInvocation, Stop) currently emit systemMessage, userMessage, errorMessage and terminationBehavior, and compare with the Python SDK's CompactionConfig(token_threshold=...) on LocalAgentConfig. Then trace where the interactive /compact slash command reaches the host CHECKPOINT compaction engine, so a hook-level or Sidecar RPC trigger could reuse that path. Done means a maintainer has picked one of the three proposals and written down the config/RPC surface; the issue itself only sketches options and no code location is named.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
In the Antigravity Python SDK, developers can configure automatic context compaction thresholds programmatically via CompactionConfig(token_threshold=...) on LocalAgentConfig.
However, in Antigravity Desktop (Antigravity 2.0), CLI, and the Customization / Plugin ecosystem (hooks.json, Sidecars, MCP Apps):
/compactis strictly a frontend UI slash command intercepted by the interactive input prompt.- Lifecycle hooks (
PreInvocation,PostInvocation,Stopinhooks.json) can only injectsystemMessage,userMessage, orerrorMessagesteps, or setterminationBehavior("terminate"|"force_continue"). Injecting{"userMessage": "/compact"}passes the literal string"/compact"to the model instead of invoking the host compaction (CHECKPOINT) engine. - There is no user/workspace setting or sanctioned Sidecar / LanguageServer RPC to configure per-model compaction thresholds or trigger background compaction for a
conversationIdwithout UI interaction.
Real-World Motivation & Current Workaround
We built an open-source native Antigravity plugin — Context & Cache Monitor (antigravity-context-monitor) — combining a Left-Sidebar MCP App, a Sidecar dashboard, and a PreInvocation hook to observe Gemini context occupancy, prefix cache hit rates, and CHECKPOINT compactions.
Because prefix cache drops and cold recomputations frequently happen before the built-in default CHECKPOINT ceiling is reached, users want dynamic per-model compaction thresholds (e.g., compacting cleanly at ~180K–210K tokens once a turn becomes idle).
Today, the only way for a plugin to execute /compact automatically is to wait for the session and OS keyboard/mouse input to go idle and dispatch /compact via OS window automation, which requires foreground window focus.
Proposed Solutions (Any or All)
1. Lifecycle Hook Compaction Action (hooks.json)
Allow PreInvocation, PostInvocation, or especially the Stop hook (when fullyIdle: true and terminationReason: "NO_TOOL_CALL") to request an internal host compaction cleanly between turns:
{
"decision": "allow",
"compactionBehavior": "compact"
}
(or "terminationBehavior": "compact_and_continue" in PreInvocation / PostInvocation)
This would let a lightweight hooks.json script trigger a native CHECKPOINT compaction 100% silently in the background without touching the UI or stealing window focus.
2. Expose compactionConfig.tokenThreshold in Desktop / CLI Settings
Mirror the Python SDK's CompactionConfig(token_threshold=...) in user/workspace configuration (with optional per-model overrides), so users can tune when native CHECKPOINT compaction fires.
3. Sanctioned Sidecar SDK / Local RPC Method
Expose a documented method (e.g., CompactConversation({ conversationId })) in the Sidecar SDK / local LanguageServer service so authorized plugins and MCP Apps can trigger background compaction for an idle conversation directly.
- Lingua principale
- TypeScript
- Stelle
- 109k
- Fork
- 15k
- Merge medio
- 1g 24m
- PR unite (30g)
- 91
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di google-gemini/gemini-cli
-
npm ci fails with EALLOWREMOTE on npm 12Forse già presa @landry-kapgnep l’ha presa oggi. Apertastatus/need-triage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
google-gemini/gemini-cli#30525 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
hooks migrate preserves regex SessionStart alternatives that native exact trigger matching never runsForse già presa @ayam04 l’ha presa oggi. Apertastatus/need-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
google-gemini/gemini-cli#30514 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
CLI reference documents unsupported bulk skills enable and disable commandsForse già presa @jadelike-wine l’ha presa 1 giorno fa. Apertastatus/need-triage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
google-gemini/gemini-cli#30505 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Footer ignores custom model displayName and drops Vertex AI model info despite hideModelInfo=falseForse già presa @bitwizard25 l’ha presa 2 giorni fa. Apertastatus/need-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
google-gemini/gemini-cli#30482 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
fix(extensions): allowUnsafeConfigPaths missing in GIT_EXTENSION_OPTIONS causes `extensions update` failureForse già presa @kccrcodes l’ha presa 4 giorni fa. Apertastatus/need-triage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
google-gemini/gemini-cli#30416 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di google-gemini/gemini-cli
Issue simili
-
enhancement from-app needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
nightly-labs/openbot#19162 ·
I maintainer di solito rispondono entro 1 giorno
-
triage:in-progress
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Cotal-AI/Cotal#11229 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
omdsh-dev/DSH-better-sidebar#1290 ·
I maintainer di solito rispondono entro 1 giorno
-
Suggest a wallet: WalletChanForse già presa @apoorvlathey l’ha presa oggi. Apertaawaiting changes needs triage 📥
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
ethereum/ethereum-org-website#20000 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno