How can Cursor answer questions about an entire codebase without storing the code?
It doesn't search the code directly — it searches embeddings, numerical vectors that represent each code chunk's meaning. The server computes these vectors once during indexing, stores only the vectors (not the source), and discards the actual code and file names immediately after. A semantic search matches the query's embedding against stored vectors, and only if a specific matching chunk is actually needed does the server request that one piece of source from the client on demand.
Answered in
How Cursor Indexes Your Entire Codebase Without Ever Storing Your CodeCursor's semantic search runs on embeddings, not source. The server never persists a line, and a Merkle tree keeps the index in sync as you type.
Read the full analysisOther questions this article answers
- If embeddings are stored instead of source code, can the original code be reconstructed from them?
- Why does Cursor use a Merkle tree to keep the index synchronized instead of just re-scanning changed files?
- What happens when the server needs the actual source code, not just its embedding?
- Why encrypt code locally before sending it, if the connection to the server is already secure?
More how ai actually works questions
- How many new researchers can receive the next OpenAI grant?
- When do applications open?
- Does the classifier make a final decision about an image?
- Can any developer call the classifier?
- If embeddings are stored instead of source code, can the original code be reconstructed from them?
- Why does Cursor use a Merkle tree to keep the index synchronized instead of just re-scanning changed files?
- What happens when the server needs the actual source code, not just its embedding?
- Why encrypt code locally before sending it, if the connection to the server is already secure?
Every answer on Crashtech is written by the editor of the article it comes from — never auto-summarised. Browse all answers or the How AI Actually Works beat.