Non-invasive MCP accelerator plugin for Google Antigravity (CLI/Desktop/IDE): cuts LLM turns (-34%), token quota (-31%), and upload traffic (-40%) without affecting native UI or diffs.
TypeScript ai-agentai-codingantigravityantigravity-cliantigravity-ideantigravity-pluginscoding-agentcontext-optimizationdeveloper-productivitydeveloper-toolsgeminigoogle-antigravitylatency-optimizationmcpmcp-pluginmcp-servermodel-context-protocolperformanceplugintoken-optimization
agy-fast Tool Routing & Latency Hygiene Rules
Built-in read_file is locally allowlisted by agy_tool_safety (0 cloud review, 7ms, 46 KB / 800 lines), while MCP tools, 1.1–1.5s; verified on Antigravity Desktop v2.34–v2.36 / CLI v1.5.x). Batching N ops into 1 edit_file, write_file, and shell commands escalate to serial cloud sir_flash_lite review (agy-fast_fast call cuts latency and review count to 1/N.
| Task | Preferred Tool |
|---|---|
1–2 unknown files <=800 lines OR any known ranges (even 4–8 scattered) |
Built-in read_file (parallel, StartLine/EndLine <=200 lines/call) |
Single unknown file >800 lines OR >=3 unknown >300-line files (max 40; TS/JS/HTML/Vue/Svelte/CSS/Py/GDScript/Go/Rust/Java/MD/JSON/YAML) |
quick_outline (read_slices only to piggyback 1–2 tiny <=120-line slices) |
>=2 text/regex/glob/fuzzy/read-only git queries (cross-repo via path) |
batch_search (pack ALL same-turn queries in 1 call; <=8.8 KB) |
>=2 hunks in one file, >=2 files, OR any edit + inline verify |
apply_edits (bestEffort: true for >=3 files; omit bounds on unique blocks) |
>=2 non-interactive shell commands (or 1 command emitting >10 KB noisy logs) |
run_checks (outputMode: "compact" default; single short cmds stay on run_command) |
Rules
- Direct call,
toolSummary&cwd: Callmcp_agy-fast_fast_*directly when eager (orcall_mcp_toolwithServerName: "agy-fast_fast"when lazy—never readmcp/agy-fast_fast/*.json). Always pass a concise, plaintoolSummaryunder eager loading (host-required; avoids errors and safety escalations), pass explicitcwd(especially Desktop 2.0/Hub), keep commands scoped tocwd, and avoid 2 parallel calls to the sameagy-fast_fasttool in one turn. - Avoid wasteful reads &
batch=1calls: Read theSessionStartsnapshot beforels/git status. Never useread_slicesfor>150lines or 1-filequick_outline<=800lines; fetch ranges via parallelread_file. Keep single short commands onrun_command; pack>=2queries intobatch_search(prefer a zero-check built-in search tool for 1 query if available; avoid rawrgshell pipelines that trigger safety checks and spill). Start broadbatch_searchwith"files_with_matches"/"count"and--stat/path-scopedgit diff/show. When a truncated MCP output includes aFull output saved:spill path, inspect it withread_file(StartLine, EndLine)orbatch_search. - Smart image hygiene (>150k TTFT): Direct image reads are fine in <150k-token sessions** for **1–2 UI/design-spec screenshots** needing pixel-accurate judgment (suggest
/compactbefore transitioning into long coding). In **>150k-token sessions or bulk screenshot/QA/OCR audits, loading.png/.jpg/.webpinto the main session invalidates prompt cache and triggers a 3–7x TTFT cliff (40–97s/turn)—delegate those to a subagent returning text-only findings. - Context, cache & SSE hygiene: Keep subagent reports concise; delegate noisy exploration to read-only subagents. Keep
apply_edits(verify)/run_checksto fast targeted checks (<=45s; no >60s servers/watchers; defer >60s suites to phase end), useoutputMode: "full"only for exit-0 warnings (rerun truncated failures viarun_commandor narrower filter), avoid mid-session model/effort/Plan-Mode toggling (Desktop v2.35–v2.36 cache reset), and never emit soloupdate_steps/update_focusturns. For<=10srun_command, setWaitMsBeforeAsync(5000–10000; 10000 on Windows). Split large writes (~3–5 large files / ~4k–6k output tokens/turn) to stay under 120s SSE drops. Past ~150k–250k tokens (or ~15+ turns), suggest/compactor a fresh session instead of drifting to ~500k auto-compaction. - Safe batched edits: Never call
apply_edits(or write-siderun_checks) in read-only Plan Mode; writes stay insidecwdby default. Useapply_edits/batch_searchacross workspace dirs (code, Vue/HTML/CSS, docs, scripts)—never split multi-edits back into serialedit_filecalls. OmitstartLine/endLineon unique code blocks (pass bounds only to disambiguate duplicates; unique drifts<=50lines auto-recover). PassbestEffort: truefor>=3files (3–5 large or 6–8 small files/batch). On nested-arg corruption (boolean/nullor emptyedits), do NOT retry—fall back immediately to paralleledit_file/write_file. - Swarm worker briefs: Antigravity does not mount MCP/rules/
SessionStartinto swarm workers. Always brief codebase/QA workers with: (a) Rule 3>150k/bulk image delegation, (b) parallel rangedread_file(<=200lines), and (c) direct CLI commands via the plugin path in this rule's header (node "<plugin>/dist/mcp-server.mjs" --cli ...;--cli --helpfor all flags; modifiers precede their query):--cli check --compact "c1" "c2",--cli search --path src --text "foo" --git "status --short",--cli outline a.ts b.ts, and--cli edit --best-effort --from-file <edits.json>(or--file <json>/--stdin <<'EOF').
Quick Schemas (ServerName: "agy-fast_fast")
batch_search:{ cwd?, queries: [{ type: "text"|"regex"|"glob"|"fuzzy"|"git", pattern, path?, glob?, fileType?, multiline?, outputMode?: "content"|"files_with_matches"|"count", sortBy?: "path"|"mtime", caseSensitive?, contextLines?: 0..10, maxResults?: 1..200 }], maxChars?: 500..8800 }(1–20;patternrequired, e.g."*"forglob;*/{a,b}, no|; read-only git)apply_edits:{ cwd?, edits: [{ path, hunks?: [{ target, replacement, startLine?, endLine?, replaceAll? }], create?: string, overwrite?: boolean }], dryRun?, bestEffort?, diff?, verify?: string, verifyTimeoutSec?, maxVerifyChars?: 300..7500 }(1–50;createXORhunks; lazy mode accepts JSON stringedits—follow[agy-fast compat]notice)quick_outline:{ cwd?, paths: string[], maxChars?: 1000..8800 }(max 40)read_slices:{ cwd?, outlines?: string[], slices?: [{ path, ranges: [[startLine, endLine], ...] }], lineRanges?: string[], maxChars?: 1000..8800 }(outlinesmax 40;slices/lineRangesmax 30;lineRanges:"path:s-e,s2-e2")run_checks:{ cwd?, commands: [{ name?, command, cwd?, timeoutSec? }], concurrency?: 1..8, timeoutSec?, outputMode?: "compact"|"full", maxChars?: 500..8800 }(1–12)
Tip: Add personal overrides in
rules/AGENTS.local.mdwith---\ntrigger: always_on\n---frontmatter (gitignored, preserved on updates).