Souvenance GitHub

The model reads, the code proves

Useful AI where you cannot send everything to a large model, and cannot trust it blindly. A pattern drawn from the Souvenance lab’s memory engine, with the lab’s own measurements, their sources and their limits.

A synthesis of the lab’s work · every figure links to its source · no claim of scientific novelty

Two constraints, one pattern

Much of the useful data in a person’s life, a clinic, a law firm or a small company is the data you cannot ship wholesale to a large hosted model: for privacy, for cost, for lack of a connection, or because a rule says so. And a language model, large or small, will sometimes state things its sources do not say. In the lab’s own pilot, small open models running on a laptop wrote 5 to 20% of their memories with content a judge rated invented; the larger production model wrote none of 42 (source; five nights of private data, one judge from the same model family: a signal, not a result).

The answer this lab built for personal memory is a division of labour. A model reads, because reading language is what models are good at. Plain code proves: it checks every claim the model makes against the source, before anything is written, and it keeps a record nobody can quietly edit. The same split works wherever an AI has to write down facts that people will later rely on.

The parts

Record

An append-only log

Everything that arrives is an event, and a SQL trigger refuses any UPDATE or DELETE on the event table. Memories, embeddings and the graph are projections of that log. So refusing a doubtful memory loses nothing: the source stays, and a better model can reread it later. db/schema.sql

Proof

No claim without its quote

The model must quote, word for word, the excerpt each memory rests on. Code checks that the excerpt is in the deposit, then that every number and proper noun of the memory is there too. No excerpt, or one that is not found: refused. A detail that is missing: flagged. pensine/evidence.py

Readers

Small models for narrow questions

Who is the subject of this sentence? Does this excerpt say the same as this paraphrase? Two small open models answer, on CPU: GLiNER2 for people and roles, mDeBERTa-v3 for entailment, never trusted with a number. Code crosses their readings; the excerpt stays attached. pensine/readers.py

Escalation

A model reread, only when flagged

Only memories the code flags go back to a model, with one short question: do these excerpts support this? At most fifteen per batch, and only if a model is configured for it. Without a reread, a flagged memory is kept with its confidence capped, or refused in strict mode.

Identity

The same gate on “who is who”

“My sister” in one note, “Lena” in another: they are linked only by an excerpt that names both, linked, and the link can be withdrawn. This is the one part the lab claims as its own, and it has not been measured in isolation. pensine/identity.py

Retrieval

Find the proof again

A memory that cannot be found is no use. Vector search, a full-text list with a score threshold, the period the question names, then an optional local reranker on the best 30 candidates. pensine/retrieval.py

What it buys, measured

Every figure comes from the lab’s repository, with the link to its source. None of them has been reproduced outside the lab.

QuestionFindingSource and limits
Can a 4B open model on a 16 GB laptop do the nightly writing? 14 / 14 nights Qwen 3.5 4B, 4-bit, after the robustness fix (was 8 of 14: malformed output). Two-week development sample, lexical scorer, one run each. results
Does it invent once the code checks it? 0.00 Share of its memories rated invented, two runs on a sealed synthetic life (seed 4). Earlier version of the model judge; the judge is not validated (limits). results
Does it answer as well as a large model? 0.59 vs 0.83 No. Same system, same sealed life: questions answered by the 4B model against Claude Sonnet 5.5, scored in code. The gap is in the answering, not in what the code lets through. Details
Do small readers beat hand-written rules? 0.27 → 0.11 Attribution errors (memory pinned on the wrong person) on the same sealed life: hand-written rules (one run) versus GLiNER2 and mDeBERTa (mean of three). The rules had scored 0.03 on the data they were written on. One seed, Claude Sonnet 5.5 writing. results
Does a local reranker find the proof more often? R@5 0.58 → 0.75 Share of evidence turns in the top five, LoCoMo conversations never used for tuning (1,385 questions), bge-reranker-v2-m3 on CPU: about 3.9 s per query and 1.6 GB more RAM. Retrieval on raw turns, English only; not a memory system answering questions. table
And the whole system, against others? 0.91 · 0.52 · 0.72 Facts recalled by Souvenance, Mem0 and Graphiti on one sealed synthetic life, same model and embedder. One generator, written by the author; a judge not validated; one model family; on two other lives Mem0 answered as many questions. Benchmark

See it in two minutes

A short script runs the admission gate on synthetic deposits, offline, with the standard library only. A memory that cites nothing is refused; one that cites a sentence the deposit does not contain is refused; one that turns “ten kilometres” into “15 km” is flagged; one that quotes its deposit is admitted. Then the same gate on an identity link.

git clone https://github.com/Pensine/souvenance.me souvenance && cd souvenance
python3 examples/admission-demo/demo.py
   - Maya's sister Lena lives near the harbour.
     cites: ['Lena lives five minutes from the harbour']
     -> REFUSED  (excerpt not found in the deposit); the deposit stays in the log, nothing is lost

   - Maya started a new job at a ferry company.
     cites: ['Started the new job at the ferry company today']
     -> ADMITTED  (excerpt found, every detail in the deposit)

The demo and what it does not show →

Where it falls short

Credit where it is due

None of the parts is new. Checking a memory against its source before writing it is done by SodaMem and Eywa; append-only records are event sourcing; entailment models and rerankers are standard tools. What the lab adds is the assembly, run daily on its author’s own memory, the same gate applied to identity links, and the measurements, published where they lose too. Related work →

Questions

Is this pattern new?

No. Each part is known: checking a model's claim against its source (SodaMem and Eywa do it for memory), append-only records (event sourcing), small classifiers for narrow reading tasks, rerankers in retrieval. What this lab offers is one assembly of those parts, running daily, with measurements and their limits published, including where it does not win.

Does it need a GPU or a cloud model?

No. The engine runs on one machine with PostgreSQL. The measurements on this page include a 4-billion-parameter open model on a 16 GB laptop, and small readers and a reranker on CPU. A larger model, local or remote, answers questions better; the checks in code are the same whichever model is used.

What does the code actually prove?

That the words a model cites exist in the source, and that the numbers and proper nouns it states appear there; for identity, that the excerpt names both the role and the person, linked. It does not prove that the model's reading of those words is right: that part is left to small models and, for flagged cases only, a reread, all of which have error rates.

Nicolas Noguera · Souvenance · published 2026-11-24 · how we write