A vector database stores embedding vectors for semantic retrieval. In AI coding assistance, it turns a repository into searchable context: files are chunked, embedded, indexed, and matched against an embedded user query. section 3.5.1
A typical context-retrieval pipeline follows these steps:
- Index source files, documentation, and configuration as meaningful chunks such as functions, classes, and Markdown sections. section 3.5.1
- Convert each chunk and the user request into numerical vectors, then run a similarity search. section 3.5.1
- Inject the highest-ranked chunks into the prompt before response generation, while treating semantic closeness as an assumption to validate rather than proof of relevance. section 3.5.1
Repository refactoring request
For “refactor the login service to use the new JWT library,” retrieval may surface the target function, library-usage examples, and relevant error-handling patterns. Embedding retrieval is not automatically superior: Claude Code, Cline, Windsurf, and Sourcegraph Amp use agentic search, while Cursor uses indexed retrieval, increasingly in hybrid form. section 3.5.1
Figure 3.7 Context-aware assistance flow. The developer's query is converted into an embedding, matched against the indexed codebase, and the most relevant chunks are injected into the prompt before the model generates its response.

Trace the query embedding, similarity match, context injection, and generated response as one retrieval flow. section 3.5.1

































