Skip to content

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.

6.4 KB
Raw Blame

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, edit_file, write_file, and shell commands escalate to serial cloud sir_flash_lite review (1.1–1.5s; verified on Antigravity Desktop v2.34–v2.36 / CLI v1.5.x). Batching N ops into 1 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

  1. Direct call, toolSummary & cwd: Call mcp_agy-fast_fast_* directly when eager (or call_mcp_tool with ServerName: "agy-fast_fast" when lazy—never read mcp/agy-fast_fast/*.json). Always pass a concise, plain toolSummary under eager loading (host-required; avoids errors and safety escalations), pass explicit cwd (especially Desktop 2.0/Hub), keep commands scoped to cwd, and avoid 2 parallel calls to the same agy-fast_fast tool in one turn.
  2. Avoid wasteful reads & batch=1 calls: Read the SessionStart snapshot before ls/git status. Never use read_slices for >150 lines or 1-file quick_outline <=800 lines; fetch ranges via parallel read_file. Keep single short commands on run_command; pack >=2 queries into batch_search (prefer a zero-check built-in search tool for 1 query if available; avoid raw rg shell pipelines that trigger safety checks and spill). Start broad batch_search with "files_with_matches"/"count" and --stat/path-scoped git diff/show. When a truncated MCP output includes a Full output saved: spill path, inspect it with read_file(StartLine, EndLine) or batch_search.
  3. 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 /compact before transitioning into long coding). In **>150k-token sessions or bulk screenshot/QA/OCR audits, loading .png/.jpg/.webp into 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.
  4. Context, cache & SSE hygiene: Keep subagent reports concise; delegate noisy exploration to read-only subagents. Keep apply_edits(verify) / run_checks to fast targeted checks (<=45s; no >60s servers/watchers; defer >60s suites to phase end), use outputMode: "full" only for exit-0 warnings (rerun truncated failures via run_command or narrower filter), avoid mid-session model/effort/Plan-Mode toggling (Desktop v2.35–v2.36 cache reset), and never emit solo update_steps/update_focus turns. For <=10s run_command, set WaitMsBeforeAsync (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 /compact or a fresh session instead of drifting to ~500k auto-compaction.
  5. Safe batched edits: Never call apply_edits (or write-side run_checks) in read-only Plan Mode; writes stay inside cwd by default. Use apply_edits / batch_search across workspace dirs (code, Vue/HTML/CSS, docs, scripts)—never split multi-edits back into serial edit_file calls. Omit startLine/endLine on unique code blocks (pass bounds only to disambiguate duplicates; unique drifts <=50 lines auto-recover). Pass bestEffort: true for >=3 files (3–5 large or 6–8 small files/batch). On nested-arg corruption (boolean/null or empty edits), do NOT retry—fall back immediately to parallel edit_file/write_file.
  6. Swarm worker briefs: Antigravity does not mount MCP/rules/SessionStart into swarm workers. Always brief codebase/QA workers with: (a) Rule 3 >150k/bulk image delegation, (b) parallel ranged read_file (<=200 lines), and (c) direct CLI commands via the plugin path in this rule's header (node "<plugin>/dist/mcp-server.mjs" --cli ...; --cli --help for 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; pattern required, e.g. "*" for glob; */{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; create XOR hunks; lazy mode accepts JSON string edits—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 } (outlines max 40; slices/lineRanges max 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.md with ---\ntrigger: always_on\n--- frontmatter (gitignored, preserved on updates).