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.

gemini16embeddingssqlite-vecsemantic-searchpython25antigravity418

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 $10 for lifetime access
View Membership →

Related Articles

Integrations2026-05-05
Building a RAG App with Supabase Vector (pgvector) and Antigravity
Learn how to build a Retrieval-Augmented Generation (RAG) app using Supabase's pgvector extension and Antigravity. Covers embedding generation, similarity search, and Gemini API integration with practical code examples.
Integrations2026-04-23
Observing Antigravity AI Agents with Langfuse — A Practical Setup Before You Ship
Before you push an Antigravity AI agent to production, wire up Langfuse so you can actually see traces, token spend, and cost. A hands-on guide with real Python code and lessons from the field.
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.
📚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
See all →