// codebase intelligence, self-hosted
RepoLens clones a repo, chunks it into a searchable vector index, and builds a code graph of every symbol and import. Then it answers in plain language — streamed, with file:line citations and diagrams it draws itself.
// the problem
You inherit 80,000 lines and a README that lies. Onboarding is grep, guesswork, and interrupting the one person who remembers why.
// how it works
// 01 — index
Shallow-clones any GitHub repo, splits source into line-aware overlapping chunks, and embeds each one — 768-dim Gemini vectors, L2-normalised, persisted to SQLite or Postgres.
POST /api/ingest { "source": "https://github.com/…" }
→ 126 chunks · 92 symbols · 83 edges (1.4s)// 02 — graph
A regex-free-zone it is not — but it works: declared symbols with line numbers, plus resolved import edges between files, queryable in SQL.
GET /api/symbols?name=chunk → chunkDocument · services/chunker.js:28
// 03 — ask
Hybrid retrieval — cosine similarity re-ranked by path and symbol matches — feeds an LLM that must cite its sources or admit it can't.
// measured, not promised
Numbers from npm run eval — a golden-set harness that runs real questions through the real pipeline. Re-run it yourself.
retrieval hit-rate@5
citation accuracy
p50 answer latency
chunks · demo repo
// under the hood
Three runtime dependencies on the API. No vector database to operate — vectors persist as rows, search runs in memory. The whole pipeline is readable in an afternoon.