Context AI
A VS Code extension that indexes your workspace with tree-sitter
and semantic embeddings, then lets you search and explain your codebase from a chat
sidebar. It can also enrich a prompt with relevant code context to paste into any AI
assistant.
Features
- Semantic code search – ask questions about your code and get the most relevant
functions and snippets, with file paths and line numbers.
- Prompt enhancement – turn a short request into a context-rich prompt using
snippets pulled from your indexed code.
- Incremental indexing – only changed files are re-embedded; file changes are
picked up automatically.
- Pluggable providers – embeddings and prompt generation via Google Gemini or
OpenRouter.
- Local-first vector store – uses Qdrant for vector search.
- Secure key storage – API keys are kept in VS Code Secret Storage, not in settings.
Requirements
- A running Qdrant instance. The quickest way is Docker:
docker run -p 6333:6333 -p 6334:6334 qdrant/qdrant
The default URL is http://localhost:6333 (configurable).
- An API key for your chosen embedding provider (Gemini or OpenRouter).
Getting started
- Install the extension and open the Context AI view from the activity bar.
- Open the settings panel (gear icon) and:
- choose your embedding/prompt provider,
- set the provider API key (stored securely),
- confirm the Qdrant host/port.
- Run Context AI: Index Workspace (command palette) or use the Index
button in the sidebar.
- Ask a question in the chat, or switch to Enhance prompt mode.
Commands
| Command |
Description |
Context AI: Ask Question |
Ask a question about your code. |
Context AI: Index Workspace |
Build/refresh the index for a workspace folder. |
Context AI: New Chat |
Start a new chat session. |
Configuration
Key settings (prefix codeContextAi.):
| Setting |
Description |
codeIndex.embedderProvider |
gemini or openrouter. |
codeIndex.modelId |
Optional embedding model override. |
codeIndex.modelDimension |
Optional embedding dimensionality override. |
prompt.provider / prompt.modelId |
Provider/model for prompt enhancement. |
openrouter.baseUrl |
OpenRouter API base URL. |
qdrant.host / qdrant.port / qdrantUrl |
Qdrant connection. |
qdrantCollection |
Qdrant collection name. |
API keys (Gemini, OpenRouter, Qdrant) are set through the sidebar settings panel and
stored in VS Code Secret Storage.
Privacy & data handling
This extension processes your source code. Here is exactly where it goes.
Stays on your machine
- Parsing and chunking your code (tree-sitter) happens locally.
- The vector index is stored in your Qdrant instance — local by default
(
http://localhost:6333). Nothing is indexed to a server you don't control.
- API keys are stored in VS Code Secret Storage, never in plaintext settings.
Sent to the embedding/prompt provider you configure (Google Gemini or OpenRouter)
- During indexing: chunks of your source code are sent to the embedding provider to
generate vectors.
- During search: your query text is sent to the embedding provider.
- In Ask / Enhance Prompt mode: your query plus the relevant code snippets retrieved
from the index are sent to the prompt provider to generate a response.
- OpenRouter requests include
HTTP-Referer (this project's repo URL) and X-Title
(Context AI) headers that identify the app, per OpenRouter's API conventions.
Code is only transmitted when you index or query. Files excluded by your ignore
configuration are not indexed or sent — exclude sensitive paths to keep them local. Once
data reaches a provider, it is governed by that provider's own terms:
Google Gemini API ·
OpenRouter Privacy.
The extension itself collects no telemetry, analytics, or usage data, and sends
nothing to the author or any third party other than the provider you choose and your
Qdrant instance.
Development
npm install # install dependencies
npm run watch # bundle in watch mode (esbuild)
npm run check-types # type-check with tsc
npm run lint # run ESLint
npm test # run the unit tests (vitest)
Press F5 to launch an Extension Development Host.
Building / packaging
npm run package # type-check, lint, and produce a production bundle in dist/
npx vsce package # create the .vsix (uses .vscodeignore)
The extension is bundled into dist/extension.js, and the tree-sitter wasm runtime and
language grammars are copied into dist/wasm/. Only dist/ and media/ are shipped in
the .vsix.
Acknowledgements
The tree-sitter integration and language queries (src/engine/tree-sitter,
src/core/ignore) are adapted from the Roo-Code /
Kilo-Code projects, licensed under Apache-2.0.
License
MIT. See the LICENSE file for third-party attribution notes.