Expand description
Context memory contract shared by every runtime tier.
Historically this lived in aria-agent-memo as MemoStore (local/embedded).
The contract is lifted into agent-core so the cloud can ship a
Postgres + pgvector implementation (see
crates/aria-agent-cloud/src/context/pg.rs) while the on-device SDK keeps
the aria memo implementation (aria-agent-memo). The two share:
ContextStore— the storage contract (memorize/recall/compact/get_by_key),ContextFragment/FragmentKind/RecallQuery— the data shapes,embed— the zero-dependency local embedder used for semantic recall,score_fragment/rank— the keyword + vector blending rules.
See docs/adr/0010-context-storage-pgvector.md.
Modules§
- embed
- Local lightweight embedding + cosine similarity for vector recall.
Structs§
- Composite
Context Store - The
bothbackend: a local (aria memo) store plus a cloud store. - Context
Fragment - A single unit of remembered context.
- Memory
Context Store - In-process
ContextStoreused by tests and by the SDK default. - Recall
Query - Query used by
ContextStore::recall.
Enums§
- Context
Error - Fragment
Kind - Kinds of context fragments a store can hold.
- Memory
Backend - Where a memory context lives.
Constants§
- EMBED_
DIM - Dimension of the dense embedding produced by
embed::LocalEmbedder.
Traits§
- Context
Store - The unified context-memory contract. Everything that needs conversational or long-term context goes through this trait.
Functions§
- ensure_
embedding - Embed a fragment’s content when it carries no vector yet. Shared by every backend so stored vectors stay comparable.
- keyword_
score - Keyword relevance of
fragagainstquery_text: - merge_
fragments - Merge results from two backends: a fragment is a duplicate when either
its
idor itskeywas already seen; the freshest copy wins. - now_ms
- rank
- Score, sort (descending) and truncate candidates to
top_k. Fragments that score0.0are dropped — an empty query therefore recalls nothing. - score_
fragment - Blend semantic (vector) similarity with the keyword score:
0.7 * cosine + 0.3 * keyword. Pure keyword when a vector is missing on either side.