Expand description
The SQLite implementation of the crate::stores contract: facts with
privacy and channel provenance, episodes, the claim graph, structured
personal memory, people and learned habits.
SqliteMemory works on a pool the host opens, so memory can share one
database file (and its encryption) with the host’s other tables.
Structs§
- Conflict
Candidate - An active fact as the numeric-conflict planner sees it.
- Exact
Channel Ids - Exact channel-id comparison, no channel derived from session ids.
- Export
File - One file of a readable export.
- Fold
Candidate - An active fact as the fold planner sees it.
- Memory
Claim Record - Memory
Retention - One pass of retention over a database holding the memory tables.
- Memory
Retention Policy - How long each kind of memory is kept, in days. Zero keeps it forever.
- Memory
Retention Stats - Rows removed by one pass.
- Numeric
Conflict - Two active facts that look like one attribute with two values.
- Planned
Fold - One fact to retire into the fact that keeps its knowledge.
- Sqlite
Memory - Long-term memory in SQLite.
Enums§
- Conflict
Verdict - What to do with one conflicting pair.
- Fold
Rule - Which rule found a fold.
- Fold
Scope - Who can see a fact, as far as merging copies of it goes. Two facts in one class are visible to exactly the same audiences, so one can stand in for the other without hiding or widening anything.
Constants§
- NUMERIC_
CONFLICT_ MIN_ SIMILARITY - Whole-fact similarity at which two facts whose numbers differ are taken
as one attribute holding two values (
db_probe --fact-conflict-auditmeasured it on a live store). - ONE_
VALUE_ MIN_ SIMILARITY - Full-fact similarity at which a value of two or more words, identical under another key, is the same fact. Measured on a live store of 4,747 facts: from here up pairs are reworded keys for one value; below it different things start to share a value (two sites on one platform).
- ONE_
WORD_ VALUE_ MIN_ SIMILARITY - The same for a one-word value (
ddev,Rust), which also needs a key word in common: one word is shared by many unrelated attributes. - OWNER_
QUOTED_ SOURCE - Source of a per-turn fact the owner asserted, with a verbatim quote from their own message checked against it. Not owner-authored (the quote proves the words, not that the value follows from them, nor who wrote pasted text), but above anything a background extractor inferred.
Traits§
- Channel
Ids - How the host’s channel identifiers relate. The defaults suit a host whose ids are stable and carry no channel in the session id.
Functions§
- build_
fact_ embedding_ text - Build a natural-language embedding text for a fact.
- detect_
overlaps - Identify active facts that look like conceptual duplicates or overlaps of another active fact so the Memory UI can highlight them for review without mutating or losing distinct constraints automatically.
- detect_
overlaps_ excluding detect_overlaps, never pairing two facts indistinct(pairs inoverlap_pairform a reviewer judged distinct). A fact whose only match was such a pair is checked against the next representative, so a verdict on one pair never hides a different duplicate.- fact_
category_ is_ personal - Categories whose keys name a person or their attributes, where a key that differs by an entity token must stay separate even at high similarity.
- fact_
source_ rank - How close a fact’s source is to the owner’s own words: 2 stated explicitly, 1 quoted from the owner’s message, 0 inferred. A write may replace a different value only at equal or higher rank, and a restatement never lowers a row’s rank.
- facts_
are_ restatements - Whether two active facts in one category are the same knowledge.
- facts_
hold_ one_ value - Whether two active facts hold one piece of knowledge under different
keys: the same normalized value, similar enough as whole facts, and, when
either is about a person, keys naming the same attribute (
pet_nameanddaughter_nameare bothMia,birth_placeandhometownone city). - fold_
scope_ key - The visibility class of a fact stored with
privacyandchannel_id. Every merge of facts (fold, write-time restatement, numeric conflict) compares this, never the raw columns: an owner DM’sprivatefact and the same fact from an app conversation are one audience, while a group channel never merges with either. - is_
owner_ app_ channel - Whether a stored channel id is one of the owner’s app conversations.
- is_
owner_ authored_ fact_ source - Sources that record the owner’s own words. Background extractors can never overwrite these, only restate or add beside them.
- keys_
name_ same_ attribute - Whether two keys name one attribute (
editor/preferred_editor,oauth_expiry/oauth_expiration), as opposed to two attributes that share a word (dog_name_old/dog_name_new,age/child_age). - migrate
- Create or upgrade the memory tables in
pool. - numeric_
conflict_ retirements - The retirements the resolved conflicts call for, as
(retired, kept): most similar pair first, each fact retired at most once, and no fact both kept and retired in one pass, so nothing is retired into a row that is itself going away (a chain resolves over later passes). - overlap_
pair - The canonical form of an unordered fact pair:
(smaller id, larger id). - parse_
fact_ timestamp - A stored fact timestamp (
first_seen_at,updated_at) asConflictCandidate::seenreads it: RFC 3339, or SQLite’sdatetime('now')form. - plan_
folds - Plan every fold in
candidates. - plan_
numeric_ conflicts - Every pair of
candidatesthat may be one attribute with two values: onefold_scope_keyclass, notbehavior(left to--retire-inferred-behavior), different numbers, and whole-fact similarity of at leastNUMERIC_CONFLICT_MIN_SIMILARITY. - project_
message_ span - Index a user message from the host’s log as a searchable span. The host
passes only messages memory may learn from.
channelsderives the span’s channel from its session. - rebuild_
memory_ fts_ projections - Recreate the memory search indexes from their authoritative source tables.
- value_
numbers - The tokens of a value that carry a digit (
0.9.10,8080,2026), lowercased: the part of a value an embedding barely sees.