100% local RAG

Library Brain

In prod SQLite FTS5sqlite-vecbge-m3

What it is

Answers sourced only from the books (zero hallucination). 24,799 books, 1.68 million chunks, a 21 GB database, cross-encoder reranking, cross-lingual.

The architect's call

Embeddings moved to an in-process backend, validated by cos = 1.0000 measured on the real corpus → zero vector re-encoding. The arbiter is a regression gate: coverage, refusal rate, 0 hallucination — a score under baseline fails the night. 1,619 tests, 350 commits.

What went wrong

Ranking by raw hit count. It made doorstop novels beat the actual manuals: a 900-page book mechanically contains more occurrences of any term than a dense 120-page reference, without being more relevant. Ranking is now by distinct-term coverage. Same corpus, same query, results unrelated to the previous ones.

Flaky tests, and the temptation to disable them. Several suites failed intermittently. The cause was not randomness but resource leaks — vector and full-text indexes left open between cases. A flaky test marked "skip" is a bug you decide to stop seeing.

A migration that would have cost days for nothing. Before moving 1.7 million vectors to a different embedding backend, I measured cosine similarity between old and new on the real corpus: cos = 1.0000. Zero re-encoding needed. Without that measurement, it was several days of compute spent out of caution.

The figures

24 799books indexed
1 699 549vectorized chunks
1 619tests
0hallucinations allowed by the gate

The code

Private repository — walkthrough over a call

Capabilities engaged

Related projects

Your data cannot leave the building?

That is precisely the problem I solve. A 30-minute call is enough to scope an audit.