store
store
¶
Persistent stores for automatically extracted long-term memory facts.
A fact is a short, durable statement worth remembering about the user
(e.g. "Prefers concise answers"). Facts are produced by the memory
service's background extractor and persisted here so they survive across
sessions. The store is intentionally small and self-contained: it dedupes,
caps the total number of facts, and is safe to call from multiple threads.
Classes¶
Fact
dataclass
¶
A single durable memory entry.
FactStore
¶
LocalFactStore
¶
Bases: FactStore
Append-only JSONL fact store on the local filesystem.
Facts are kept human-readable (one JSON object per line) so they can be
inspected or edited by hand. Writes are atomic (temp file + rename) and
guarded by a lock, so concurrent add calls from the extraction worker
and list/clear from the CLI never corrupt the file.
Source code in src/diapason/memory/store.py
SearchableFactStore
¶
SearchableFactStore(journal: FactStore, backend: Any)
Bases: FactStore
Écrit chaque fait DEUX fois : dans le journal, et là où on le relira.
Constaté le 22 août 2026. Le service d'extraction rangeait ses faits dans
memory_facts.jsonl ; l'injection de contexte, elle, interrogeait le
magasin vectoriel de memory.db. Deux magasins qui ne se croisaient
jamais : Diapason extrayait correctement « le projet Olala doit être publié
sur l'App Store avant fin septembre », le rangeait, et ne le retrouvait
plus jamais. La mémoire automatique écrivait dans le vide.
Le journal reste : il est append-only, lisible et modifiable à la main, survit à une base corrompue, et c'est LUI qui dédoublonne. Seul un fait réellement nouveau part à l'indexation — réindexer un doublon coûterait un calcul d'embedding pour rien et polluerait les résultats.
Une panne du magasin de recherche ne fait pas perdre le fait : le journal a déjà écrit, et l'échec est journalisé plutôt qu'avalé.
Source code in src/diapason/memory/store.py
Functions:¶
create_fact_store
¶
create_fact_store(
backend: str = "local",
*,
path: str | Path | None = None,
max_facts: int = 1000,
) -> FactStore
Construct a fact store for the configured backend.
Only the "local" (on-disk JSONL) backend is supported today; the
registry-backed constructor exists so additional backends can be added
without changing the service or CLI wiring.