CodeRAG is a VS Code extension that gives you an AI chat assistant fully grounded in your own codebase — with zero data egress. It indexes your code locally using vector embeddings and retrieves the most relevant context before every answer.
Features
Local RAG — indexes your workspace into a local vector database (LanceDB); no code leaves your machine
Multi-provider LLM — works with Ollama (fully local), OpenAI, or Anthropic
Tree-sitter parsing — understands TypeScript, JavaScript, Python, Rust, Go, Java, C, and C++ at the AST level for precise chunk boundaries
Chat panel — sidebar chat with streaming responses and code highlighting (Cmd+Shift+A)
CodeLens — "Ask AI" button above every function and class
Ask about selection — right-click any selected code → Ask CodeRAG About Selection
Auto-reindex — watches for file changes and keeps the index up to date
Requirements
Choose one embedding + LLM backend:
Option A — Ollama (fully local, no API key needed)
Set coderag.embeddingProvider and coderag.llmProvider to openai
Option C — Anthropic
Set coderag.anthropicApiKey to your API key
Set coderag.llmProvider to anthropic
Embeddings still require Ollama or OpenAI
Quick Start
Open a workspace folder
Run CodeRAG: Index Workspace from the Command Palette (Cmd+Shift+P)
Wait for indexing to complete (status bar shows progress)
Press Cmd+Shift+A or click the CodeRAG icon in the activity bar to open chat
Configuration
Setting
Default
Description
coderag.embeddingProvider
ollama
ollama or openai
coderag.llmProvider
ollama
ollama, openai, or anthropic
coderag.ollamaUrl
http://localhost:11434
Ollama server URL
coderag.ollamaEmbeddingModel
nomic-embed-text
Ollama embedding model
coderag.ollamaLlmModel
llama3
Ollama chat model
coderag.openaiApiKey
(empty)
OpenAI API key
coderag.anthropicApiKey
(empty)
Anthropic API key
coderag.anthropicModel
claude-sonnet-4-6
Anthropic chat model
coderag.topK
8
Chunks retrieved per query
coderag.maxContextTokens
8000
Max tokens sent to LLM
coderag.enableCodeLens
true
Show "Ask AI" above functions
coderag.ignorePatterns
node_modules, dist, .git
Glob patterns excluded from indexing
coderag.maxFileSizeKB
512
Skip files larger than this
Commands
Command
Description
CodeRAG: Open Chat
Open the chat panel
CodeRAG: Index Workspace
Re-index the entire workspace
CodeRAG: Clear Index
Delete the vector index
CodeRAG: Show Index Status
Show file/chunk count
CodeRAG: Download Tree-sitter Grammars
Download WASM grammar files
Ask CodeRAG About Selection
Ask about selected code (editor context menu)
Privacy
All indexing and search runs entirely on your machine. Only the LLM call leaves your machine — and only when you choose OpenAI or Anthropic. With Ollama everything is 100% local.