CodeLensa

Your repository. Your questions.

See how your
code connects.

Link a public GitHub repository. Ask in plain language. Open the exact source behind each answer.

Public repositories · Source-linked answers · No code execution

codelensa / ask
src/api
rag/search
indexing
auth
How does indexing work?
queue.ts:42–61
index.ts:18–39

Built for reading real code

Less searching. More understanding.

Explore, locate, understand, and verify.

Get oriented faster

Ask what a project does, how it is organized, and where to start. Bring the README and implementation into the same conversation.

“What are the main parts of this project?”

Find the implementation

Ask about a feature, function, or configuration. Retrieve relevant source passages from the repository you selected.

“Where are incoming requests validated?”

Follow the evidence

Open the cited files and line ranges to inspect the code behind an answer. Treat the explanation as a starting point you can verify.

“How does this project handle authentication?”

Keep your context current

Save a public repository, watch indexing progress, and reindex when its default branch changes. Your saved index survives a page refresh.

One repository snapshot. A reusable knowledge base.

Inside CodeLensa

Retrieve first. Answer with context.

RAG means retrieval-augmented generation: find relevant passages from your repository, then give those passages to a language model alongside your question. The model does not need to memorize or train on the entire project to help explain it.

01 / Build the index

  1. 1

    Public GitHub URL

    Validate the repository and resolve a commit on its default branch.

  2. 2

    Queued file batches

    Read supported source and documentation in small, resumable batches.

  3. 3

    Stored, searchable context

    Keep files in R2 and line-numbered, overlapping passages in D1.

The saved D1 index feeds retrieval in the question flow. R2 holds the source files used to verify citations.

02 / Ask and verify

  1. 1

    Your question

    Use the repository selected in your workspace.

  2. 2

    Retrieve evidence

    Search its D1 full-text index and assemble a bounded set of passages.

  3. 3

    Generate an answer

    Mistral answers; Gemini via LangChain is the fallback when needed.

  4. 4

    Check the sources

    Validate citations against stored files and open the relevant lines.

Repository RAG flow. When Gemini needs more evidence, its LangChain tool loop can return to repository search, within a three-round model limit. Search stays scoped to the selected repository.

Why split files?

Small, overlapping passages make it possible to retrieve relevant code without sending the entire repository to a model. Line numbers preserve a route back to the source.

Why a queue?

Indexing runs separately from page requests. Small batches keep ingestion manageable and let the workspace display progress while files are processed.

Why keep it simple?

The current question path uses lexical full-text retrieval, not embeddings or a dependency graph. It favors a straightforward, inspectable repository-to-answer workflow.

The building blocks

A web workspace. An edge-hosted backend.

Workspace

React · TypeScript · Tailwind CSS

Vinext serves the frontend on Cloudflare Pages. TanStack Query manages API data, and Firebase supports sign-in.

API & ingestion

Cloudflare Workers · Hono · Queues

The backend validates GitHub URLs, serves repository APIs, and processes indexing jobs independently of the interface.

Repository storage

Cloudflare D1 · R2

D1 stores repository metadata and searchable passages. R2 stores source files from the indexed commit.

Answer generation

Mistral · Gemini · LangChain

Mistral is the primary model provider. Gemini 3.5 Flash-Lite is the fallback, with LangChain messages and validated repository-search tools.

Explore the code behind CodeLensa.

Follow the implementation from the interface to ingestion, retrieval, and answer generation. Both repositories are available on GitHub.