AGY Auto Compact
tangxingpeng8installsAutomatically compacts Antigravity (AGY) context at a configurable token threshold with mid-turn brake-and-resume and end-of-turn fallback.
Automatically compacts Antigravity (AGY) sessions inside Paseo when context usage crosses a configurable token threshold, with safe mid-turn braking and automatic task resumption.
What it does
- Adds a composer threshold picker on Antigravity sessions to switch presets (
128K,200K,250K,272K,400K,512K) or pause auto-compact without leaving the chat. - Adds a Context limits settings screen (also reachable from the Command Center) for custom thresholds (
50Kto1M), trigger strategies, anti-loop cooldown, and custom/compactprompts. - Uses
272Ktokens as the default recommended threshold to preserve reasoning quality and response speed before long-context degradation sets in, rather than waiting for AGY's default near-1M compaction threshold. - Supports English (
en) and Simplified Chinese (zh-CN) interface translations that follow Paseo's app language.
How it works
Antigravity CLI's built-in auto-compaction triggers near the end of its 1M context window. This plugin coordinates two lightweight hooks so compaction happens earlier and cleanly without interrupting active tool calls:
- Mid-turn brake (
PreInvocationhook in AGY): Before each subsequent model call inside a turn (invocationNum >= 1), the bundled scriptscripts/agy-pre-invocation-brake.mjsinspects the tail (up to 256 KB) of the active AGY session transcript. It reads the latestPLANNER_RESPONSEtoken count (input_tokens + cache_read_tokens + output_tokens). When usage reaches the configured threshold inside a Paseo-managed foreground AGY session (PASEO_AGENT_IDset), the script writes a brake marker under~/.paseo/plugin-data/paseo-agy-auto-compact/brakes/and returnsterminationBehavior: "terminate"so AGY stops cleanly between steps. Standalone terminal or Desktop AGY sessions withoutPASEO_AGENT_IDare never affected. - Automatic
/compactand resume (agent.turn.afterhook in Paseo): When the stopped turn finishes and the agent becomesidle, Paseo's daemon hook detects the matching brake marker, sends/compact <resume prompt>usingactiveTurnBehavior: "queue"and a deterministicmessageId(retrying once on transient send error), records cooldown, and clears the marker. AGY compresses the conversation and immediately resumes the remaining work. - End-of-turn fallback and safeguards: If a normal turn finishes above the threshold without triggering a mid-turn brake (and was not already a
/compactturn), Paseo sends/compact(plus the optional end-of-turn prompt) to free context for the next turn. A per-session cooldown (default 90 seconds) prevents compaction loops. Disabling or stopping the plugin removes thebrake-hook-activemarker file so the external AGY hook immediately stops braking until the plugin runs again.
Setup
- Requires Antigravity CLI (
agy) configured as a provider in Paseo, Node.js on the daemon host, and Paseo 0.18.2 or later (macOS, Linux, or Windows). - End-of-turn compaction works immediately after installation.
- To enable mid-turn braking, open Settings > Plugins > AGY Auto Compact > Context limits and click Install hook. With your click, the plugin copies
scripts/agy-pre-invocation-brake.mjsinto~/.paseo/plugin-data/paseo-agy-auto-compact/and registers apaseo-agy-auto-compactPreInvocationcommand entry in~/.gemini/config/hooks.json(or$ANTIGRAVITY_GEMINI_DIR/config/hooks.json). Nothing is written tohooks.jsonunless you click Install hook.
Settings, data access, and limits
- Settings: Enable/disable switch, threshold presets and custom input (
50Kto1M), mid-turn brake toggle, end-of-turn fallback toggle, anti-loop cooldown (30sto5m), mid-turn resume prompt, and optional end-of-turn prompt. - Local files read and written: Reads the tail of the active AGY transcript file during
PreInvocation. Stores synchronized settings, active-state marker, brake markers, cooldown state, agent background flags, and hook logs under~/.paseo/plugin-data/paseo-agy-auto-compact/. Reads~/.gemini/config/hooks.jsonto detect installation status and updates it only when you click Install hook. - Data sent to providers: Sends
/compactand your configured compact prompt text to your Antigravity session through Paseo's daemon API. The plugin makes no external network requests and collects no telemetry. - Limits: Mid-turn braking skips background Paseo subagents by default to avoid premature completion signals. On repeated send failures (after one automatic retry), the brake marker remains on disk and you can resume the session manually.
Related plugins
Browse all plugins →Side Chat
@moyf
Side chats for agent sessions: /btw asks, /side works, /fork clones. Answers never touch the main session.
Bots
@oliexe
Personal bots for Paseo: instructions, a model, memory, routines, teams, skills, MCP tools and connected apps.
Usage Auto Resume
@babo-jeonguk
Continue Codex, Claude, Antigravity, and OpenCode agents automatically after their usage limit resets
Flowly
@jasprw
The agent-native workflow for Paseo: cards that move by themselves, with reminders, summaries, ideas and insights
Canvas
@supermomonga
Write, review and share Markdown documents with the agents in your Paseo workspace.
session-janitor
@sm1ee
Archive finished subagents and clean up archived sessions after a retention period.
