# XERJ

> A local, Elasticsearch-compatible search engine that auto-indexes any folder so coding agents query instead of grep

- Category: Retrieval & Knowledge (RAG) / Code Indexing & Search
- Language: Rust
- Licence: Apache-2.0
- Repository: https://github.com/xerj-org/xerj
- Website: https://xerj.org
- Canonical page: https://ai-tldr.dev/tools/xerj/
- Updated: 2026-09-21

## In short

XERJ is an open-source search engine written in Rust that ships as a single static binary. It sits in the Code Indexing & Search category of the Retrieval & Knowledge (RAG) tools and is open-source, written in Rust and licensed Apache-2.0. To get started: install the binary.

## Overview

XERJ is an open-source search engine written in Rust that ships as a single static binary. Its headline feature is autoindex: point `xerj autoindex` at a folder and it sniffs every file, works out what each one is, and creates one index per dataset it finds, with no schema to write and no pipeline to configure. Source code goes through tree-sitter, so it arrives with its symbols and line numbers rather than as flat text; CSV, JSON, YAML, SQLite, PDF, DOCX, HTML, mail and common log formats are handled too.

The project is aimed squarely at AI coding agents. Instead of an agent grepping and then reading whole files into its context, it queries XERJ and gets back ranked passages with file and line. The README's main use case is what it calls reference coding: the agent clones and indexes the open-source repositories closest to its task, then retrieves how they solved a problem before writing its own code. The project reports a controlled study in which this cut a coding agent's output tokens 2.7x compared with a grep-driven agent at the same solve rate, and notes the benefit is largest on private or niche code the model has not memorised.

Under the hood XERJ implements the Elasticsearch REST API — indices, documents, bulk, search, aggregations, mappings, kNN, scroll and the `_cat` endpoints — so existing Elasticsearch clients and Kibana can connect to it, and the project publishes an ES YAML conformance suite that runs on every commit. The same binary is also an MCP server, exposing search, semantic, vector and hybrid search plus durable agent memory (`/_memory/{namespace}`) and a second-brain link index as tools. It is licensed Apache-2.0.

## What it does

- `xerj autoindex <folder>` infers datasets and builds typed indices from code, docs, logs, PDFs, SQLite, CSV and more, with no schema
- Tree-sitter, AST-aware code indexing plus CLI commands such as `xerj search` (ranked passages with file:line) and `xerj def` (go-to-definition)
- Full-text BM25, vector kNN and hybrid search through Elasticsearch-compatible query syntax
- Speaks the Elasticsearch REST API, so official clients and Kibana connect unchanged
- Built-in MCP server (`xerj mcp`) with ten tools covering search, agent memory and a knowledge-graph link index
- Single static binary for Linux, macOS and Windows on x86-64 and arm64, with an offline default embedder and an opt-in neural one

## Getting started

XERJ installs as one binary. The quickstart below runs a local development node with TLS and auth turned off — the README stresses this is only for a single user on a dev machine, since every caller that can reach the port becomes a superuser. A fresh node binds 127.0.0.1 only.

1. Install the binary

   The install script picks the prebuilt binary for your platform (by default into ~/.local/bin). On Windows use the PowerShell installer: `irm https://xerj.org/get.ps1 | iex`.

```bash
curl -fsSL https://xerj.org/get | sh
```

2. Start a local node and index a folder

   Start the server, wait until http://localhost:9200 responds, then point autoindex at a project. XERJ creates one index per dataset it detects.

```bash
xerj --insecure --data-dir ./data &
xerj autoindex ~/my-project
```

3. Search from the CLI or any Elasticsearch client

   Use the built-in commands for ranked passages and definitions, or query the Elasticsearch API directly.

```bash
xerj search "how do we rotate the WAL segment"
xerj def "euler_to_rotationmatrix"

curl localhost:9200/_cat/indices
curl "localhost:9200/ax-*/_search?q=checkout+error"
```

4. Wire it into your coding agent

   `xerj init` sets XERJ up for Claude Code or Cursor (MCP plus a skill). For other MCP hosts, run `xerj mcp` as a stdio server and point it at the node with an absolute path to the binary.

```json
{
  "mcpServers": {
    "xerj": {
      "command": "/home/you/.local/bin/xerj",
      "args": ["mcp"],
      "env": { "XERJ_URL": "http://localhost:9200" }
    }
  }
}
```

5. Run with auth on for anything shared

   Without --insecure, auth is on and an admin key is minted on first boot. Pass it to autoindex via XERJ_API_KEY (it is not read from xerj.toml).

```bash
xerj --data-dir ./data &
export XERJ_API_KEY="$(cat ./data/admin.key)"
xerj autoindex ~/my-project
```

## When to use it

- Reach for it when a coding agent keeps reading whole files into context and you want it to retrieve the exact passage with file and line instead
- Reach for it for reference coding: index the open-source projects nearest your problem so the agent looks up how they solved it before writing code
- Reach for it to run a security audit or codebase Q&A across a large tree of mixed file types with one index command
- Reach for it when you want a lightweight, single-binary drop-in for Elasticsearch clients, logs and dashboards on a laptop or small host

## Version history

- 2026-09-21 v1.0.0-rc.77: Release candidate that wires the index segment path to the object-storage backend and fixes reader-capture validation during search.
