◉ANTIGRAVITY LABJP
Articles/Integrations
⬡ Integrations/2026-07-06Advanced

Semantic Search Over Your Own Codebase with Gemini Embeddings and sqlite-vec: An Incremental Index Keyed on Git Blob Hashes

A build log for semantic search scoped to your own repository, using Gemini embeddings and sqlite-vec. Covers an incremental pipeline that skips re-embedding unchanged files via git blob hashes, with measured index size and query latency.

gemini20embeddingssqlite-vecsemantic-searchpython26antigravity459

✦ Premium Article

One night I could not remember where I had written the thumbnail cache eviction in an old wallpaper app. I ran grep three different ways and came up empty, because the function was named evictThumbnail while my head kept reaching for "the code that clears the cache."

String search returns nothing when your vocabulary does not match the author's. Semantic search is what closes that gap. It also matters when you point an Antigravity agent at a large repository: how fast it can narrow down the relevant code changes how many round trips the whole task takes.

In this log I build a lightweight semantic search scoped to one repository, using Gemini embeddings and sqlite-vec. As an indie developer I keep code that has sat untouched for years, so I made the pipeline incremental: only the git diff gets re-indexed. I also share the measured index size and query latency.

Where string search cannot reach

grep and IDE search assume token matches. They are fast and precise, but they stay silent when your query does not line up with the identifiers in the code. You think "extend the auth token expiry," but the code says refreshSession.

Semantic search converts both the code and the query into vectors and returns the closest ones. Because it retrieves by "meaning is near" rather than exact match, it is forgiving of half-remembered questions.

That said, I do not want to hand an external service my entire source tree. In my case the targets are apps shipping on the App Store and Google Play. So I keep the index in a local SQLite file and delegate only the embedding math to the Gemini API.

Three parts, kept separate

The whole thing decomposes into three parts. Keeping the roles separate makes each swappable later.

PartRoleTool
ChunkerSplit source into functions and classesPython ast
EmbedderTurn chunks and queries into vectorsgemini-embedding-001
IndexStore vectors and do nearest-neighbor searchsqlite-vec

The payoff is that swapping the embedding model leaves the chunker and index untouched, and changing how you chunk leaves the storage layer as is.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦An incremental index that uses git blob hashes to skip re-embedding unchanged files, avoiding 92% of the work on a typical day
✦Real numbers: 1,850 chunks fit into a ~1.2MB sqlite-vec index using gemini-embedding-001 at output_dimensionality=768
✦Latency broken down (query embedding vs vec search) so you know which delay actually shapes the feel
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Antigravity Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $15 for lifetime access
View Membership →

Related Articles

⬡ Integrations2026-09-05
Pointing GOOGLE_GEMINI_BASE_URL at Your Own Gateway Does Not Change Who Holds the Key
I pointed the Antigravity CLI at a gateway of my own and recorded exactly which credentials travelled with it. Authorization is dropped across a cross-origin redirect, but the API key header survives every hop. Here is the measurement, and how I moved the key off my laptop.
⬡ Integrations2026-04-22
Three Safeguards Every Antigravity Python API Deployment Needs Before Production
Retries, timeouts, and circuit breakers — the three production safeguards you need around your Antigravity Python API calls, with working code for each.
⬡ Integrations2026-10-07
The Image Model Shuts Down on October 29 — Find Every Call in Your Agent Setup and Cut Over with a Way Back
The Gemini API deprecations table lists a shutdown date of October 29 for the image model gemini-3.1-flash-image. Here is how I locate every call scattered across configs and code, match them to a ledger, and fix a cutover date and a fallback in advance — with scripts that run.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links