The claim that decides whether any of this matters is one number: 260,916 output tokens, $11.18, and 11 tasks solved out of 16 when a Claude Code agent was allowed to work from memory alone. Same tasks, same model, same tools — swap the memory arm for one that greps and you get 26,477 tokens, $3.27, 16/16. Swap the grep arm for XERJ and you get 9,982 tokens, $1.58, still 16/16.
That is 2.7x fewer output tokens than grep and 26x fewer than flailing. It is also, on its own, the least interesting number in the repository, because the author spent most of his effort proving where it stops being true.
xerj-org/xerj is at v1.0.0-rc.97, 12,798 stars, Apache-2.0, and it is not a wrapper. docs/ARCHITECTURE.md is explicit: “an independent implementation that shares no code and no architecture with Elasticsearch or Lucene.” Twenty-three megabytes of Rust across xerj-storage (WAL, sharded memtable, segments), xerj-fts (BM25, analyzers, postings), xerj-vector (HNSW k-NN), xerj-logs (columnar retention), xerj-compress (LZ4/Zstd), plus xerj-cluster with an embedded Raft for cluster metadata. No JVM, no Elasticsearch, no Python sidecar. One static binary, aarch64 and x86-64, Linux/macOS/Windows.
What it does that a classical engine does not
docs/WHY_XERJ.md opens by naming its own misreading — the file’s subtitle is “Or: why ‘Elasticsearch-compatible’ is the least interesting thing about this engine.” The thesis is that the primary user is an agent, and an agent handed unfamiliar data has three problems a dashboard-first engine doesn’t solve: onboarding (someone has to design mappings first), orientation (“what is in here?”), and continuity (durable memory recallable by meaning).
The answer to onboarding is xerj autoindex <folder>. I ran it. Cloning xerj’s own engine/crates/xerj-fts/src — six Rust files — and pointing the binary at it with no config, no schema, no pipeline:
done in 2.0s — 1 dataset, 487 records live, 0 duplicate aliases,
0 junk records, 0 junk/skipped files (239.6 docs/sec)
indexed: 487 documents live; this run submitted 487 source records from 6 files
ax-docs 487 docs
graph: 5 edges → .xerj-memory-src-edges
Two seconds, one command, and the tree-sitter pass gave me a schema rather than a text dump:
| field | type | cardinality | examples |
|---|---|---|---|
kind | keyword | 8 | struct, function, trait |
name | keyword | 419 | Token, new, CharFilter |
path | keyword | 6 | analyzer.rs, bm25.rs, index.rs |
line | long | 443 | 24, 36, 51 |
code | text | 449 | pub fn new(text: impl Into<String>, pos… |
Code arrives as symbols with line numbers, which is the whole point. xerj search "how does BM25 saturation compute idf" returned bm25.rs:48 with the constructor body and the IDF doc comment inline. xerj def Bm25Scorer returned five definitions with paths and lines — bm25.rs:37 [struct], bm25.rs:224 [function], search.rs:1603 [function] — and the CLI’s own footer reads “Cite path:line for anything you rely on.”
The wire compatibility is real, not aspirational. A raw Elasticsearch multi_match against the same node over curl:
{"query":{"multi_match":{"query":"postings list skip pointer","fields":["code","title"]}}}
took_ms=2 hits_total={'value': 2, 'relation': 'eq'}
score=6.770 lib.rs:60 kind=module name=postings
score=3.603 index.rs:2499 kind=function name=postings_reader
took_ms reported like Elasticsearch, eight-compatibility version 8.13.0, lucene_version: 9.10.0 in the root document. An existing ES client or dashboard pointed at port 9200 cannot tell the difference. That is the adoption bridge, and WHY_XERJ.md frames it correctly by analogy: “the way CockroachDB or Neon speak the Postgres protocol without being Postgres.”
The BM25 that Lucene gave away
The scoring code is worth reading because it is unfashionably faithful. From bm25.rs, verified on disk:
/// Uses the Lucene smoothed IDF formula:
/// `IDF = ln(1 + (N - n + 0.5) / (n + 0.5))`
/// This is always positive and never zero, even for very common terms.
#[inline]
pub fn idf(&self, doc_freq: u64) -> f32 {
let n = self.total_docs as f32;
let df = doc_freq as f32;
((1.0 + (n - df + 0.5) / (df + 0.5)).ln()).max(0.0)
}
with DEFAULT_K1: f32 = 1.2 and DEFAULT_B: f32 = 0.75 at lines 27 and 29. The .max(0.0) clamp is what keeps a term appearing in every document from producing a negative score and silently reordering results. tf_norm implements the matching (tf * (k1 + 1)) / (tf + k1 * (1 - b + b * dl/avgdl)) normalization. Nothing clever. That is the correct engineering decision for an engine whose entire pitch is that you can swap it in behind an existing client and not lose relevance — a house-tuned scoring function would be a regression disguised as a feature.
The write path is the more interesting half. A query matches both the in-memory ShardedFtsMemtable and the on-disk FtsIndexReader segments, then merges, so a document written thirty seconds ago is searchable immediately — no refresh interval to tune. ARCHITECTURE.md bounds materialization to the top from + size candidates for size > 0, and routes unfiltered top-level k-NN through the persisted HNSW graph with exact rescoring while every filtered shape falls back to the exact scan. That is the honest split: the graph accelerates the shape where it is provably correct, and correctness wins everywhere else.
Where it loses, in its own words
Here is why I picked this over the other twelve repos on the trending page. benchmarks/beir-hybrid/README.md reports nDCG@10 on the BEIR test splits, run on 2026-09-18 against v1.0.0-rc.74 with sentence-transformers/all-MiniLM-L6-v2, 384-dim, CPU:
| Arm | SciFact | NFCorpus |
|---|---|---|
BM25 (multi_match on title, text) | 0.6572 | 0.3016 |
MiniLM vectors only (semantic) | 0.6764 | 0.3291 |
| BM25 top-30 → reorder by MiniLM | 0.6855 | 0.3323 |
Hybrid RRF (hybrid, server-side) | 0.6993 | 0.3448 |
Against hosted rerankers on the same datasets: Jev 0.768 / 0.358, Voyage rerank-3 0.755 / 0.357, Cohere rerank-v3.5 0.745 / 0.340, XERJ’s free local hybrid 0.699 / 0.345. And the author refuses to call that a controlled comparison in either direction — “We did not run those systems. They rerank that project’s own first-stage shortlist, which is not ours.”
The same file then reports a failed gate. The local judge stage was supposed to beat hybrid by more than the three-run spread:
- SciFact: hybrid+judge 0.5967 vs hybrid 0.7045 — loses by 0.1077. FAIL
- NFCorpus: hybrid+judge 0.2924 vs hybrid 0.3419 — loses by 0.0495. FAIL
- Latency sub-gate: +0.7 / +0.5 / +0.6 ms added p50. PASS
Verdict: “The always-compiled judge is a lexical scorer with no semantic signal, and it loses to both first stages on all three datasets.” It stayed opt-in, unnamed by default, and “no quality claim ships with it.” Note also what that table implies for reranking generally — reordering a BM25 shortlist with the same bi-encoder scores worse than fusing with it, which is why xerj-rerank ships no “local MiniLM” provider: “it would be a regression with a good name.”
The stemming gate is a partial failure too, and more instructive. Target was NFCorpus zero-hit queries 25 → 10. Measured: 15. FAIL, because stemming repairs exactly the inflection class and ten of the twenty-five queries were single words — deafness, eggnog, Fosamax, Zoloft — that occur nowhere in the corpus. The companion BEIR sub-gates passed cleanly (+0.0160 SciFact, +0.0179 NFCorpus). The README’s own gloss on why the vector arm matters here is the sentence I keep returning to: no reorder of a BM25 shortlist can repair an empty list.
Other numbers the project declines to spin: neural indexing ran at 3–7 documents/second on CPU, so SciFact’s 5,183 abstracts took about 25 minutes, “the binding constraint on any ‘index your mail on a laptop’ story.” Hybrid and filtered-semantic queries cost 220–370 ms p50 on a 5k-document index against ~18 ms for BM25. And one figure is explicitly quarantined: “The first SciFact vector-arm p50 (0.4 ms) is a cache artefact — an earlier aborted run had already embedded those queries — and must not be quoted.”
The line where retrieval stops paying
The verdict table in docs/case-studies/reference-coding/CASE_STUDY.md is the actual contribution, and it is organized by what the model already knows rather than by task type:
| regime | bare | native | xerj | who wins |
|---|---|---|---|---|
| unrecallable contract — 7 domains, 21 runs | 1/21, $21.9 | 21/21, $4.26 | 21/21, $3.38 | xerj |
| unfamiliar but spec-recoverable (spool) | 2/2, $2.07 | 2/2, $0.36 | 2/2, $0.29 | xerj (native close) |
| memorised convention (quill varint) | 2/2, $0.33 | 2/2, $0.36 | 2/2, $0.31 | tie / bare |
| memorised bulk data (fieldnorm) | 3/3, $0.98 | 3/3, $0.60 | 3/3, $1.43 | native |
| memorised logic (kv) | 6/6, $1.49 | 6/6, $9.14 | 5/6, $4.40 | bare |
Read the last two rows before the first. On kv, retrieval lost a task (5/6 against 6/6) and cost nearly triple what the bare model spent. On fieldnorm, bare was more than half the price. The project states it flatly: “On memorised public code, retrieval is overhead.”
The honest boundary is lexical, and it is sharper than the marketing implies. The domains where xerj wins are ones carrying a contract the model cannot recall — a generational staleness rule, a banker’s-rounding tie-break, a lazy-refill token bucket, a Kirsch–Mitzenmacher seal. The compiler can leak an API name through rustc’s “did you mean” suggestion and the bare model occasionally recovers that way, at 15,075 output tokens against xerj’s 610 — twenty-five times the cost for a coin-flip. But a compiler cannot leak a runtime contract, which is why bare scores 1/21 on those seven domains and burns $21.9 discovering that.
The method is unusually careful in ways that should be the norm. Both compared arms are “byte-for-byte the same agent” — the xerj arm is the identical Claude Code with one retrieved passage injected and the corpus deliberately not mounted. An earlier design ran the xerj arm tool-free while native was fully agentic; it was discarded because the xerj agent copied tantivy’s internal types, failed to compile, and looped — “a harness artifact, not a fact about retrieval.” An earlier draft used --tools "" to disable tools, which does not disable tools; the model shelled out and vendored the dependency. Also discarded, because “it is exactly the leak that turns a null into a false positive.”
And the benchmark for Lucene itself — benchmarks/grep-vs-retrieval-lucene/ — is shipped with the results directory deliberately empty: “harness only. No results are published here yet.” There is a standing precedent for publishing losses; docs/research/wordpress-verification-and-xerj-vs-grep.md concluded the structured call graph was worse than grep for reachability, with silent false negatives.
What I hit when I ran it
Worth recording, since it is the kind of thing a README will never mention. My first attempt pointed autoindex at engine/crates — the whole engine tree, ~580 Rust files across the workspace. It ran past seven minutes. The server logged:
WARN xerj_engine::governor: RSS crossed the memory watermark —
engaging the parent memory circuit breaker (writes → 429)
rss_mb=3936 watermark_mb=3891
and the process was SIGKILLed at 614 seconds. On a 4-core box with 23 GB RAM, indexing a single crate tree is enough to find that ceiling. The follow-up run against xerj-fts/src — six files — finished in two seconds without complaint. The governor behaving correctly under a workload nobody benchmarked is a reasonable signal about production readiness, and a slightly less reasonable one about the ingest path’s memory profile on a modest machine.
Second thing: the autoindex CLI ends every run by advertising xerj feedback --submit, which opens a GitHub pull request adding a markdown file under user-feedback/16-agent-field-reports/, “with nothing else in the diff,” CLA-exempt, merging without a signature. The README is upfront that this is the membership model — “That report is the membership card, and it is the only thing the project asks in return for a free, Apache-2.0 binary” — and it explicitly invites agents to run it unprompted: "no need to ask the user." Whether an agent autonomously opening PRs against a repository on your behalf is a feature or a surprise depends entirely on your threat model. There is an opt-out — --disable-feedback or XERJ_DISABLE_FEEDBACK=true — but you should know it exists before you run the tool, not after.
Where this leaves me
The engineering is better than the pitch. A from-scratch Rust engine with Lucene-faithful BM25, a memtable-plus-segment merge path, HNSW for the one query shape where an approximate graph is provably right, and an Elasticsearch 8.x front end that answers raw multi_match in 2 ms — that is a real artifact, and 23 MB of Rust with a 720 KB changelog and a hundred commits in the last week does not read like vaporware.
What I cannot resolve is the ratio between the effort and the regime. The engineering win is real and sharp; it is also confined to code carrying contracts the model cannot recall, which after my own recent reading is a narrower slice of a real codebase than the headline 2.7x suggests. Meanwhile the neural path — the part that would actually close the memorization gap — runs at 3–7 docs/second on CPU, which is what keeps the current answer dependent on lexical fusion rather than semantics.
XERJ is at rc.97, not 1.0.0. Somewhere between here and the stable tag the judge gate presumably gets re-run, and the interesting question is whether it passes or whether it gets quietly deleted. The repository’s own evidence so far suggests the author will leave the failure in the README either way.
Comments
Powered by GitHub Discussions via Giscus. Sign in with GitHub to leave a comment.