title: How the Companion keeps faith summary: Why HREEM's guide to the texts is retrieval with a fence around it, not a model trained on scripture — and what that makes impossible. date: 2026-09-22
The failure we designed against
Language models are fluent. Asked for a verse, a model will produce one whether or not it exists. For most uses that is a nuisance; for scripture it is a corruption. So the Shastra Companion was built on one refusal: it never generates a verse.
What it does instead
- A corpus, held verbatim. Every text lives in a database with its edition, source file and licence recorded. Sanskrit is stored as IAST from scholarly e-texts (GRETIL) with Devanagari rendered mechanically; English is held only where a public-domain translation exists and has been aligned verse by verse.
- Retrieval before reasoning. A question is first matched against the corpus — exact references directly, everything else through a full-text index with a small lexicon of Sanskrit terms, English synonyms and Hinglish spellings. Verses a reader can read in English are ranked first.
- A decision to speak. If the best match covers too little of the question, the Companion refuses. This is the same rule the automated evaluation uses, so the two cannot drift apart.
- The model inside a fence. When an answer engine is configured it sees only the retrieved verses, may quote only those, and must label anything it says in its own voice. For questions about the reader's own life it reflects and never commands.
- A verifier last. Every citation in an answer is compared, character by character after Unicode normalisation, with the corpus. Anything that does not match is stripped before the reader sees it, and the stripping is logged.
What this makes impossible
- Quoting a verse that does not exist.
- Attributing a translation to a translator who did not write it.
- Silently answering from outside the held texts.
What it does not make impossible
- Ranking a less relevant real verse above a more relevant one. Retrieval is lexical; a paraphrase in unusual words can miss.
- Thin coverage: most of the Library is Sanskrit only, and an English question cannot reach a verse that has no English.
- Ordinary error in a public-domain translation from 1886 or 1919. We show the translator's name so the reader can weigh it.
How we test it
Two sets are run before any change ships: an evaluation of known references, topical questions, refusals and deliberate fabrication traps (currently 39 items, zero fabricated citations permitted), and a probe of forty everyday questions as visitors actually type them, whose results are read by a person rather than asserted.