Developer tools#MCP#RAG#Coding agent

XERJ: local search that lets coding agents retrieve code before reading whole files

XERJ is a local Rust search engine: index code and docs once, then let agents retrieve passages by file and line. Elasticsearch API and MCP included.

Project facts

GitHub Ecosystem
Repositorygithub.com/xerj-org/xerj
License
Apache-2.0
Language
Rust
Stars
8,092
Data checked
2026-10-18

Snapshot figures reflect the check date and may change over time.

When a coding agent finds a line with grep, the next step is often reading the whole file into context. Private code, new APIs and niche libraries are also less likely to be in the model’s training data. XERJ is a local search service written in Rust and shipped as a single static binary: run xerj autoindex <folder> to index source code, docs, logs, PDFs or SQLite, then retrieve relevant passages with file and line references. It also implements the Elasticsearch REST API, so existing clients can point at it. The repository had 8,092 stars on October 18, 2026 and uses the Apache-2.0 license.

XERJ live demo: boot a local node, bulk-index events and query an aggregation next to the dashboard's matching view

Core features

  • Index once, retrieve passages on demand: xerj autoindex <folder> detects file types and creates datasets without a schema. Source code is parsed with tree-sitter, preserving symbols and line numbers. Agents can search code, docs, logs, PDFs, SQLite and CSV, then read the relevant passage instead of opening files one by one.
  • A measured token comparison, with a bounded sample: XERJ’s own case study ran 8 tasks across 4 languages, with 16 runs per approach, and recorded real claude -p usage. Its table reports 9,982 output tokens, $1.58 and 16/16 tasks solved for XERJ; grep-driven agents used 26,477 tokens and $3.27 for the same solve rate; a memory-only baseline used 260,916 tokens, $11.18 and solved 11/16. These are the project’s results on a small study, not a universal saving rate for every repository or model.
  • Elasticsearch-compatible endpoints: the service implements index, bulk, search, aggregation, mapping, kNN and _cat APIs, so official clients and Kibana can connect to it. Its own ES-YAML conformance suite currently passes 1,366 of 1,369 cases. The README lists behavioral boundaries too: XERJ is API-compatible, not an implementation of Elasticsearch internals.
  • MCP and durable agent memory in one binary: xerj init can configure MCP and the skill for Claude Code or Cursor. The /_memory/{namespace} API stores information across sessions, and xerj gain counts actual retrieval and savings.
  • A security switch with real consequences: authentication is on by default when the service starts normally. The quick-start --insecure flag disables both TLS and API-key authentication. A caller that can reach the port then has superuser access to every index. Fresh nodes bind to 127.0.0.1; do not copy the development command onto a shared or public host without enabling authentication.

Typical use cases

  • Questions about a private codebase: index internal source and have an agent retrieve file:line passages by function or question. The official case study’s advantage appears on code the model has not memorized; the README says popular public libraries the model already knows can bring little benefit or even add overhead.
  • Searching internal documents and logs: query PDFs, CSV, SQLite, logs and source through one local service when deploying a full Java search stack would be disproportionate for a developer workstation.
  • Sharing a retrieval backend across agents: connect through MCP or an Elasticsearch client, then use a namespace under /_memory if the project needs cross-session notes.

“Local” does not automatically mean secure: with --insecure, access to the service’s port grants broad index permissions. Compared with an agent platform such as agent-s, XERJ focuses on retrieval and memory; it is not a console for hosting or orchestrating agents.

Quick start

curl -fsSL https://xerj.org/get | sh
xerj --insecure --data-dir ./data &
xerj autoindex ~/my-project
xerj search "how do we rotate the WAL segment"
xerj gain

The --insecure example is for a single-user development machine only: it disables TLS and authentication, so keep the listener on loopback. For shared access, follow the official authentication guide. Run xerj init to configure Claude Code or Cursor; read the security model before changing the network bind or authentication settings.

Summary

XERJ is for developers working with private code, niche dependencies, internal docs, or other corpora a model may not know, and who want an agent to retrieve a focused passage instead of repeatedly loading full files. Its distinguishing combination is local indexing, Elasticsearch API compatibility, MCP and persistent memory. The evidence and operating boundaries matter: token savings mainly come from the project’s own case study and field reports, not an independent multi-model benchmark; and when auth is disabled, anyone reaching the service has broad privileges. The repository is Apache-2.0, written primarily in Rust, with 8,092 stars checked October 18, 2026.

See the official reference-coding case study, benchmark page and security model for methods, trade-offs and access controls.