TopGit
GitHub Repo Review

XERJ: Local AI Search Engine for AI Agents

xerj-org/xerj
XTopGit review image for xerj-org/xerj
Review by Topgit.dev for xerj-org/xerj, with GitHub repository stats and README context.
Quick verdict

XERJ is a local AI search engine that lets coding agents pull exact passages instead of reading whole files token by token. In a controlled study it achieved the same solve rate as grep while using 2.7x fewer output tokens, and real users report closer to 5x in everyday work. The tradeoff is that you run a self-hosted service and handle its operations yourself. If you are paying for context-window retries on large codebases, that tradeoff is worth making.

Stars
โ˜… 15.6k
Forks
โ‘‚ 1.1k
Contributors
๐Ÿ‘ฅ 30
Language
Rust
License
Apache-2.0
Topic
โ€”
Updated
Oct 2026

What is XERJ?

XERJ is a self-hosted search engine that indexes code, docs, logs, and PDFs, and exposes them via the Elasticsearch REST API. It supports full-text, semantic, and vector search, handles autoindexing without schema configuration, and includes an MCP server so desktop AI assistants can call it as a tool. The primary pitch is token efficiency: agents retrieve passages rather than reading files.

The Token Waste Problem for AI Agents

WordPress core comes in at roughly 5.2M tokens, representing about 26 full context windows, which makes it impractical for an agent to simply read through. XERJ indexes the corpus ahead of time and serves the passage instead, replacing a token-hungry file read with a kilobyte query.

Core Capabilities

  • โœ“Autoindexing without schema configuration: XERJ sniffs file types and creates typed indices automatically, handling code via tree-sitter, structured formats like CSV and SQLite, and documents including PDF and DOCX
  • โœ“Token-efficient retrieval: agents query a passage instead of loading whole files, which the README measures as 2.7x fewer output tokens than grep at equivalent solve rates
  • โœ“Full Elasticsearch API compatibility: existing clients, Kibana, and official libraries connect without modification; the conformance suite passes 1366 of 1369 cases
  • โœ“MCP server built into the binary: 13 tools exposed over stdio so desktop assistants and function-calling hosts can wire XERJ in as a tool without separate compilation
  • โœ“Hybrid and vector search in one query: full-text, semantic, and kNN retrieval without a separate vector database
  • โœ“Single static binary, no JVM: linux macos and windows all have prebuilt binaries for x86 64 and arm64
How this repository's GitHub stars have grown over time. Source: star-history.com.View the star history โ†—

Practical Applications

  • โ€ขReference coding: index similar open-source repos, retrieve how they solved a problem before writing your own code, then cite what you use
  • โ€ขCodebase Q&A: index a repo and answer questions about mechanisms with file:line citations instead of directory listings
  • โ€ขWith security audits, you can point to a target tree and search for dangerous calls, sink patterns, and secrets across all file types simultaneously.
  • โ€ขAgent memory: use the /_memory/{namespace} API to store what an agent learns and recall it by meaning in the next session
  • โ€ขMixed formats become typed indices with aggregations for log and incident analysis, treating log analysis the same way as code search

Getting Started with XERJ

Run the installer script: `curl -fsSL https://xerj.org/get | sh` Windows: `irm https://xerj.org/get.ps1 | iex` The binary lands in ~/.local/bin by default. Add it to your PATH if needed. For air-gapped deployments, follow the air-gapped deployment recipe in the docs.

Strengths

  • โœ“Token savings are measured, not estimated: the README cites a controlled study with 8 tasks, 4 languages, and 16 runs per arm using real token counts from `claude -p`
  • โœ“Single binary with no JVM, no external dependencies, and prebuilt for the major desktop and server OSes and architectures
  • โœ“Autoindexing handles a wide range of file types without manual schema definition, including code via tree-sitter parsing for accurate symbol extraction
  • โœ“Elasticsearch API compatibility means existing tooling, dashboards, and client libraries work without modification
  • โœ“Built-in MCP server exposes 13 tools over stdio so desktop AI assistants can use XERJ as a native tool
  • โœ“Local reranking via the /_decide endpoint uses your own labeled examples without sending data to external servers

Important Considerations

  • โ–ณSelf-hosted only: you operate and maintain the service with no managed option or SLA, and neural embedding mode requires staging three model files locally before first use
  • โ–ณElasticsearch compatibility has gaps: 3 of 1369 conformance cases fail, and scroll has a hard result-set cap that returns a 400 error if exceeded
  • โ–ณReranking with Jev is optional but sends result text to TypeSafe's servers when enabled; it is off by default but worth knowing about before turning it on
  • โ–ณp99 read latency degrades under concurrent write flood, the only consistent loss against Elasticsearch 8.13.4 in the published benchmarks
  • โ–ณThe --insecure flag disables TLS and all auth, making every caller a superuser; it is a dev-machine flag, not a production configuration

XERJ vs. Elasticsearch

Elasticsearch: the hosted and self-hosted standard, with managed options, dedicated support, and a larger ecosystem, but significantly heavier operational overheadOpenSearch: the Apache-2.0 fork of Elasticsearch with similar capabilities and no vendor lock-in from AmazonMeilisearch: a lightweight full-text search engine with a simpler operational model, but narrower feature set than XERJ's vector and hybrid searchTypesense: an open-source search engine that supports vector and hybrid search, with a focus on simplicity and self-hosting

Who Benefits from XERJ?

Developers running AI coding assistants who are watching token costs add up from context-window retries and file reads. Security teams auditing codebases where an agent needs to query patterns across a large tree without loading every file. Teams replacing a self-hosted Elasticsearch cluster where the operational overhead outweighs the benefit. Skip it if your codebase is a popular public library that your model already has in context; the token savings are gated by memorization.

Frequently Asked Questions

What is XERJ's license?

XERJ is Apache-2.0 licensed with no usage restrictions or CLA required for normal use. The field-report contribution process is CLA-exempt.

How does XERJ reduce token usage for AI agents?

XERJ indexes codebases into passages. Instead of loading whole files into context, an agent queries the index and receives the exact passage it needs. The README cites 2.7x fewer output tokens than grep in a controlled study, with real users reporting closer to 5x savings in practice.

What is 'reference coding' with XERJ?

Reference coding means indexing similar open-source projects, then retrieving how they solved a problem before writing your own code. The agent cites what it uses. The README reports a 16/16 solve rate in testing with this approach.

Is XERJ compatible with Elasticsearch clients and tools?

Yes. XERJ implements the Elasticsearch REST API including indices, documents, bulk, search, aggregations, mappings, kNN, scroll, reindex, and _cat endpoints. The README says 1366 of 1369 conformance cases pass.

Does XERJ send my data to external services for reranking?

Only if you enable Jev reranking. That setting sends top results to TypeSafe's servers for scoring. XERJ has a local decision mode that uses your own labeled examples without any external data transfer.

What types of files and data can XERJ autoindex?

XERJ autoindexes code via tree-sitter, structured formats like CSV, JSON, JSONL, XML, YAML, and SQLite, plus PDF, DOCX, PPTX, XLSX, EPUB, Jupyter notebooks, man pages, HTML, email, and common log formats. Unity projects get first-class treatment with GameObject-level records.

Related repositories

Source & attribution

Repository: xerj-org/xerj (https://github.com/xerj-org/xerj)

GitHub data ยท last synced Oct 16, 2026Reviewed by Henry
โ† Back to TopGit

Is xerj worth your time?

ChatGPT, Claude and Perplexity can all read this page. Ask one of them what it makes of xerj.

GitHub