Recipes

Local cited-answer search engine for coding agents over a repo's code, docs and logs

Discovered from README cross-links · 2 days ago

Research & KnowledgeSoftware & DevOps

Index a repo locally and give AI agents cited search via MCP.

What they did

They wanted their coding agent to stop grepping blindly and re-reading whole files, so they stood up XERJ, a single local Rust binary that indexes a repository's code, docs, specs, logs and PDFs. They pointed it at the repo root, let the zero-config autoindex walk the tree, and got BM25 full-text, vector and hybrid search plus code search behind an Elasticsearch-compatible API. Then they registered the built-in MCP server with their agent client (Claude Code / Cursor style), so the agent could call search tools instead of shelling out to ripgrep and cat. They used the cited-answer path to have the agent pull specific chunks with file and line references, and leaned on agent memory to persist notes between sessions. Finally they compared token usage on a reference coding task against their previous grep-and-read workflow.

How it went

The agent answered repo questions with citations and pulled far fewer raw files into context, which the project's own case study frames as roughly 2.7x fewer tokens on reference coding. Setup was quick because autoindex needs no config, and the Elasticsearch-compatible surface meant existing query habits carried over. Polish is good for a local single-binary tool, though results depend heavily on what you index and how you chunk it.

Worth knowing

You need the Rust binary installed and a client that speaks MCP; the MCP wiring and any embedding model choice are the parts most likely to trip people up. Vector and hybrid search quality depends on the embedding backend you configure, and indexing large log or PDF sets costs disk and time. The token-savings figure comes from the project's own case study, not an independent benchmark, so treat it as directional.

Wiring

Install the XERJ Rust binary (release build or cargo install). From the repo root run the autoindex command so it walks code, docs, specs, logs, JSONL/CSV and PDFs into a local index. Start the server, which exposes an Elasticsearch-compatible HTTP API plus an MCP endpoint. In the agent client config (Claude Code or Cursor), add the XERJ MCP server entry pointing at the local binary/socket. Optionally configure an embedding backend for vector and hybrid search; BM25 works with no extra setup. The agent then calls search tools, receives ranked chunks with citations, and can write to agent memory for cross-session recall.

Try it yourself

Set up XERJ in this repo as a local search backend for my coding agent. Install the binary, run the zero-config autoindex over the code, docs and any logs, confirm BM25 and hybrid search return cited chunks with file and line refs, then register the MCP server with my agent client and show me one example query where the agent answers from XERJ instead of reading whole files.

Source

Tools in this stack