Developer Skips Pinecone: Searching 72,450 Code Chunks in 50 ms
The usual advice for searching your own files is a paid OpenAI API plus the Pinecone cloud database. A developer from Samara did without both: he split 18 projects into 72,450 fragments (chunks) and stored them in a single 110 MB SQLite file. Search on an ordinary CPU takes up to 50 milliseconds, and embeddings, the numeric "fingerprints" of text, cost 0 rubles. His conclusion: RAG is useful as a navigator for other people's repositories, while the current project is easier to read directly.
AI-processed from Habr AI; edited by Hamidun News
When you have many projects, an AI agent forgets where things live: the chat context falls apart, and you end up hunting for the right piece of code by hand. The standard advice online is to take LangChain, plug in the paid OpenAI API and keep vectors in the Pinecone cloud database. The author of a write-up on Habr, a 22-year-old AI/ML engineer and master's student at Samara University, did not want to pay for every query.
He split 18 of his projects into 72,450 chunks (small fragments of text or code that search runs over) and stored them in a single SQLite file, an ordinary embedded database with no separate server. The file weighs 110 MB, and search across all the fragments on an ordinary CPU takes up to 50 milliseconds, one twentieth of a second. For embeddings, the numeric "fingerprints" of meaning that the search relies on, the author pays 0 rubles.
The result is an honest engineering note on what breaks in such a system and what RAG is actually for in practice.
How it works
The idea is this: answer generation is handed to a subscription model in the IDE (Antigravity or Claude Code), while memory, search and storage stay local. Everything is connected through MCP, the protocol for plugging tools into agents. The transport is plain standard input/output streams (stdio), so there are no web servers and no open ports. The code is written in pure Python 3.12 without LangChain or LlamaIndex.
Search is hybrid. Dense vectors are computed with numpy and find texts that are close in meaning. The Okapi BM25 algorithm finds exact word matches. The two result lists are merged with Reciprocal Rank Fusion, which combines each document's positions in both rankings.
Vectors are stored in SQLite as binary BLOBs in float32 format. One chunk is 128 numbers, about 512 bytes. According to the author, the database uses no RAM when idle. 800 pytest tests check that it does not leak and that it withstands concurrent queries.
Three bugs worth knowing in advance
The first is a dimension mismatch. The documents were indexed with a local provider that produces 128 numbers per vector, while the fallback FastEmbed model returned 384 by default. The very first query crashed with an Embedding dimension mismatch error. The author did not re-index everything when switching models. Instead, he added an adapter: a query vector that is too long is truncated, and a short one is padded with zeros. There is a caveat, though: vectors from different models live in different spaces. The adapter removes the error but does not guarantee result quality. For serious work, it is safer to re-index the data with a single model.
The second is Windows paths. A LIKE '%Deckor%' query over paths with backslashes returned zero rows. The author attributes this to the fact that in some configurations the backslash is treated as an escape character. Replacing it with INSTR(LOWER(doc_id), LOWER(?)) > 0 helped: the function does not use escape sequences and, by the author's measurements, runs faster.
The third is "elephant repositories". The n8n repository added 38 thousand chunks of localizations and tests. Because of it, the top 8 for the query "каркас брус" (frame, timber beam) filled up with irrelevant fragments before the relevant Deckor project got its turn. The fix is to pass project_id directly in the SQL query. The database then returns only the 2,300 chunks of the right project in 2 ms, and the rest never even enter the cosine similarity calculation (a measure of how close two vectors are). The rule is useful to anyone building RAG over several sources: filter before computing similarity, not after.
What RAG is really for
The most practical takeaway concerns model behavior. The agent stubbornly read files directly through the terminal or grep and ignored the ready-made RAG. The author was annoyed at first, then came to agree with the model. If you need line 20 in CLAUDE.md, direct reading gives 100% accuracy in milliseconds. Vector search here adds only noise and the risk of getting a truncated piece of code without its imports.
So the author wrote a routing protocol for the agent. The current repository is read directly via read_file and grep. For external projects and archives with more than a hundred files, the agent goes through rag_search. This search works like a radar: it points out that the node-snapping logic lives in builder.py and custom.py. The agent then opens those files itself and takes the exact formulas and constants such as NODE_PX=11 and AXIS_PX=9. The combination of a RAG navigator and targeted reading works in about a second and saves tens of thousands of context tokens.
What to keep in mind
This is one developer's personal project, and all the figures (50 ms, 0 MB of memory when idle, token savings) come from the author himself. There are no independent measurements. Brute-force vector search in numpy works for tens of thousands of chunks; at millions, you would have to think about approximate indexes. Still, for a personal knowledge base, a team's internal documents or an agent's navigation through old repositories, the setup looks workable and cheap. The author has published the source code on GitHub in the antigravity-local-core repository.
- Nov 21, 2026Gemini 4 Neon shrank the TS Rust binary from 47.44 to 7.97 MB in under 10 hours
- Nov 21, 2026FDE job postings grew 4.6x in a year: what a forward deployed engineer actually does at the client's site
- Nov 21, 2026A swimming team captain handed ChatGPT three scheduled tasks and cut her routine work by a multiple
- Nov 21, 2026OpenAI GPT-6 Cyber Found About 35 Flaws in iPhone, Mac and Other Apple Devices
Key Questions Answered
How it works?
The idea is this: answer generation is handed to a subscription model in the IDE (Antigravity or Claude Code), while memory, search and storage stay local. Everything is connected through MCP, the protocol for plugging tools into agents. The transport is plain standard input/output streams (stdio), so there are no web servers and no open ports. The code is written in pure Python 3.12 without LangChain or LlamaIndex. Search is hybrid. Dense vectors are computed with numpy and find texts that are close in meaning.
What are the key details on Three bugs worth knowing in advance?
The first is a dimension mismatch. The documents were indexed with a local provider that produces 128 numbers per vector, while the fallback FastEmbed model returned 384 by default. The very first query crashed with an Embedding dimension mismatch error. The author did not re-index everything when switching models. Instead, he added an adapter: a query vector that is too long is truncated, and a short one is padded with zeros. There is a caveat, though: vectors from different models live in different spaces.
What RAG is really for?
The most practical takeaway concerns model behavior. The agent stubbornly read files directly through the terminal or grep and ignored the ready-made RAG. The author was annoyed at first, then came to agree with the model. If you need line 20 in CLAUDE.md, direct reading gives 100% accuracy in milliseconds. Vector search here adds only noise and the risk of getting a truncated piece of code without its imports. So the author wrote a routing protocol for the agent.
Test Frontier LLMs & Autonomous Agents in One Workspace
Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.
The AI world, distilled — once a week
Seven stories that actually mattered, hand-picked. No noise, no reposts, no press releases.
Done! Check your inbox for a confirmation.