Dinesh Jinjala

08Personal project

Vektor: code context for AI agents

Author, open source

An open-source Rust MCP server I wrote. It indexes a codebase on your machine and gives AI coding agents the context they need within a token budget, using keyword and vector search together. A benchmark gate blocks any release that loses quality.

1.000
Recall@5 on my 20-query benchmark
0.975
MRR on the same benchmark
Local
your code stays on your machine

Rust / MCP / Vector search

Problem

AI coding agents waste tokens and miss context when they search a codebase. Existing context engines either return plain search results or need your code sent to a SaaS or a cloud vector database.

Approach

  • I wrote Vektor as a single Rust binary that serves index, search and context tools over MCP, and a setup command writes the config for Claude Code and Cursor.
  • Indexing respects .gitignore, skips secrets such as .env files and PEM blocks, and hashes files and chunks so a re-index only touches what changed.
  • Code is split into Tree-sitter syntax chunks for Python, TypeScript, JavaScript, Rust and Go, embedded locally with ONNX Runtime, and stored in LanceDB next to a Tantivy BM25 index.
  • Queries fuse keyword and vector results with Reciprocal Rank Fusion, then deduplicate and pack the context into a token budget.
  • Model changes must pass pre-registered benchmark gates on Recall@5, MRR and a rule that no query may lose its relevant hit.

Architecture

  1. Repo files
  2. Tree-sitter chunks
  3. Local embeddings + BM25
  4. RRF fusion
  5. Token budget
  6. MCP client

Outcome

On my 20-query benchmark Vektor scores Recall@5 1.000 and MRR 0.975. It indexed the full Django source, 33,336 chunks, with zero embedding failures, and a no-change re-index of Django takes 2.44 s. Your code does not have to leave your machine.

What I learnedAverages hide regressions. INT8 embeddings were 2.33× faster with the same aggregate Recall@5, but one query lost its relevant hit, so the pre-registered gate kept FP32 as the default.

Building something like this?

Tell me about it