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,968 declared tests, 404 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

25 376indexed documents
1 824 420vectorized chunks
1 968declared tests
0hallucinations allowed by the gate

The code

Private repository — walkthrough over a call

Capabilities engaged

Related projects

Your data cannot leave the building?

Describe the use case, the data involved and the available hardware. I answer personally within 48 business hours.