Late one night, two weeks deep into a project in Google AntiGravity 2.0, I asked my agent a completely ordinary question: "Remember how we handled that cross-border tax edge case last week? Apply the same fix here."

What followed felt like watching someone empty three filing cabinets onto the floor just to find a spare key.

The agent went straight into raw transcript.jsonl files, reading 800 lines at a time. Lines 1–800: nothing (+11k tokens). Lines 801–1600: still nothing (+12k tokens). Then a broad grep dragged in old tool logs and system wrappers. Within two minutes and ~48,000 burned tokens, the context bar hit 89%, auto-compaction kicked in, and the agent politely forgot half of the actual task we were working on.

Around the same time, a second quiet annoyance started adding up. In real agentic workflows, half the decisions aren't creative writing or coding at all — they're quick binary checks or routing forks. Does this diff leak an API key? Should this ticket go to the Postgres agent, docs search, or billing? Did my layout edit break text contrast on this screenshot? Calling a flagship generative model for that means waiting 5–10 seconds, burning main output quota, and hoping the JSON parser doesn't choke on an edge case.

I originally started building AntiGravity Features (Toolkit) as a small open-source side project for myself and my son — mostly for native UI localization and a calm context meter before compaction hits. Over the past month it grew way beyond that (over 500 people updated on day one of v3.9.1 across Windows, macOS, and Linux), so we decided to tackle both agent bottlenecks properly, locally, and without charging a cent.

Giving Agents a Local Brain Without Shipping Your History to the Cloud

My first hard rule was zero cloud ingestion. Your IDE chat history is full of private code, architecture trade-offs, and half-baked ideas — sending that off to a third-party vector DB just to remember yesterday's fix never felt right.

The second constraint was keeping the base install respectful. Bundling a 200 MB neural network inside a lightweight IDE toolkit punishes everyone who just wants fast keyword lookup or UI tweaks.

So we built the local MCP memory engine in layers on top of node:sqlite:

  1. Instant lexical base (~15 ms): SQLite FTS5 BM25+ is always on, handling stemming, stopwords, AND → OR soft fallback, workspace/recency boosting, and huge >32 MB chats without breaking a sweat.
  2. A 3 ms Conversation Relation Graph (memory_graph.js): Half the time you don't remember what you said, only which file you touched. This tiny ~1.2 MB local SQLite graph scans 2,000+ conversations in half a second and links threads by shared edited files, backticked code symbols, and conversation:// links.
  3. Opt-in 100% offline ONNX semantic search (memory_vectors.js): Zero megabytes by default. If you want true meaning and cross-lingual matching (say, searching in plain natural phrasing with zero shared keywords), flip one switch in the (i) → Search tab and download either Xenova/multilingual-e5-small (~130 MB) or onnx-community/embeddinggemma-300m-ONNX (~210 MB) into an isolated local folder. Results fuse via calibrated Hybrid RRF, run completely offline on CPU, and remove cleanly with one click.

4-Layer Local Agent Memory: SQLite FTS5, Relation Graph, Offline ONNX & Matryoshka Read
Raw 800-line log grep (48,400 tokens → auto-compact) vs. layered local MCP with progressive 4-turn recall (−98% tokens).

One subtle lesson we learned quickly: fast search alone isn't enough if the agent still dumps full transcripts into context. So the toolkit auto-syncs a short antigravity-memory skill that nudges agents into progressive "Matryoshka" reads — glance at compact snippets from search_conversations first (~38 ms), then call read_conversation_turns(aroundStep, limit: 4) to grab just four surgical turns (~900 tokens instead of 48,000). Humans get the exact same engine anytime via Ctrl+Shift+F / ⌘⇧F.

Instant Search Ctrl+Shift+F and Offline ONNX Setup in AntiGravity Features
Cross-lingual semantic recall with zero shared keywords, 3 ms conversation graph links, and opt-in offline ONNX indexing.

What Happens When an AI Model Refuses to Generate Text (gemini-decision-1)

Non-generative decision prism: one multimodal input branching instantaneously into structured decisions

For the second bottleneck, Google's non-generative gemini-decision-1 (Decisions API) turned out to be a revelation.

Unlike a standard LLM, it outputs zero text tokens. You hand it one shared payload — up to 256K tokens of text, code diffs, logs, PDFs, audio, or local PNG screenshots — and attach up to 1,000 independent typed questions (noul calibrated Yes/No probabilities, choice across 2–255 classes, or score along an ordered rubric). One forward prefill pass later (~150–250 ms), every calibrated answer comes back together. Google AI Studio's free tier gives 10,000 requests/day, and bundling 10 or 500 questions about one artifact counts as just 1 request.

Wiring gemini_decide into our local MCP server unlocked workflows that used to feel too slow or wasteful:

  • Deterministic agent routing (~250 ms): When building multi-agent flows, your dispatcher no longer gambles on generative JSON. One call returns route: postgres_sql (0.94), needs_auth: 0.98, and priority: 4.7/5, letting your code branch cleanly with confidence thresholds.
  • Single-pass PR or contract audits: Hand over one git diff or PDF and check leaked secrets, raw SQL concatenation, missing unit tests, breaking API changes, and clarity simultaneously in ~240 ms — spending zero main AntiGravity quota.
  • Visual QA without base64 bloat (+ Layer 4 Search Rerank): Pass { "type": "file", "path": "ui.png" } and our local MCP server reads the image directly from disk to verify contrast or overlapping elements. That same model can also optionally re-rank your top-12 chat search candidates in one call.

Because nobody should blindly paste API keys into an extension, byok_decisions.js keeps keys strictly on disk in .gitignore'd backups/byok-secrets.json (chmod 0600) — never in localStorage, cookies, UI plaintext, or agent prompts. It also tracks Pacific Time daily resets (00:00 PT) and supports a multi-key pool with automatic Failover or Round-robin on 429.

Three real-world gemini-decision-1 agent workflows in ~250 ms and disk-only BYOK vault
Deterministic routing, single-pass PR/PDF audits, disk-path visual QA without base64 bloat, and chmod 0600 BYOK Failover/Round-robin.

Everything Else Under One Roof

All of this sits neatly alongside the original quality-of-life tools inside four compact tabs (Chat · Search · AI · Info): 12 interface languages with OS auto-detection (9,270+ terms/locale), a <4 ms local Context X-Ray monitor, adjustable chat widths, message bookmarks, 1-click Markdown export, and silent Zero-CDP auto-updates.

MIT open source, zero telemetry, zero proxies, and a 1-click clean uninstall built right into the Info tab.

Windows (PowerShell):

irm https://raw.githubusercontent.com/WiseYaroslav28/antigravity-features-v2/main/install.ps1 | iex 

macOS & Linux (Bash):

curl -fsSL https://raw.githubusercontent.com/WiseYaroslav28/antigravity-features-v2/main/install.sh | bash 

Repo: https://github.com/WiseYaroslav28/antigravity-features-v2

Curious how others here handle long-term cross-session memory in coding agents — are you leaning toward pure lexical/SQLite, local ONNX vectors, or structured handoff files?