Expand description
§entelix-memory
Tier-3 cross-thread persistent knowledge. Defines Store<V>, Namespace
(mandatory tenant_id — invariant 11 / F2 mitigation), the Embedder /
Retriever / VectorStore traits, and the five LangChain-style
patterns: BufferMemory, SummaryMemory, EntityMemory,
SemanticMemory<E, V>, EpisodicMemory<V>. Concrete Embedder /
VectorStore / Retriever impls ship in companion crates
.
Structs§
- Buffer
Memory - Bounded conversation buffer.
- Consolidating
Buffer Memory - Layered memory: a
BufferMemoryfor recent turns, aSummaryMemoryfor the running summary, and aSummarizerthat bridges the two when the buffer’s policy fires. - Consolidation
Context - Inputs that a
ConsolidationPolicyconsults when deciding whether to consolidate. Carries the buffer plus optional signals (last-consolidated-at, current/available context tokens) so non-trivial policies — for example, “summarise once we use 80 % of the model’s context window” or “throttle consolidation to at most once per hour” — can express their decision without embedding their own clock or token counter. - Cost
Calculator Adapter - Adapter that bridges any
CostCalculator(ChatModelpricing source) into theEmbeddingCostCalculatorsurface. - Document
- One retrieved document with optional similarity score.
- EdgeId
- Stable, opaque edge identifier minted by the backend.
- Embedding
- One embedded text’s vector plus optional usage metadata.
- Embedding
Retriever - Adapter that combines an
Embedderand aVectorStore(scoped to oneNamespace) into aRetriever. - Embedding
Usage - Token-accounting metadata an
Embedderreports alongside the computed vector. Mirrors theChatModelUsageshape so cost meters can charge embedding calls with the same machinery they use for completions. - Entity
Memory - Map of
entity_name → EntityRecordkeyed by namespace. - Entity
Record - One entity’s recorded fact plus provenance metadata.
- Episode
- One time-stamped episode of operator-shaped payload.
- Episode
Id - Stable identifier for one episode. Backed by UUID v7 so two ids minted in order compare in the same order — the audit trail and external correlation paths stay consistent without a separate sequence column.
- Episodic
Memory - Time-ordered append-only episode store keyed by
Namespace. - Graph
Hop - One traversal hop produced by
GraphMemory::traverseorGraphMemory::find_path. - Identity
Reranker - No-op
Reranker: returns the firsttop_kcandidates in the order the underlyingVectorStoreproduced them, copying the retrieval score intoRerankedDocument::rerank_scoreso downstream consumers see a uniform shape. - InMemory
Graph Memory - In-process
GraphMemorybacked byBTreeMapadjacency lists, sharded per namespace. - InMemory
Store - In-process
Store<V>backed by aHashMapkeyed by(rendered_namespace, key). Cheap to clone — internal state isArc<Mutex<...>>-shared. - InMemory
Vector Store - In-process
VectorStorebacked by a per-namespaceVec<Slot>. - Metered
Embedder Embedderdecorator that emits OTel-compatible telemetry per call (and optional cost viaEmbeddingCostCalculator).- MmrReranker
- Maximal Marginal Relevance reranker.
- Namespace
- Hierarchical key prefix for memory operations.
- Namespace
Prefix - Hierarchical prefix used by
crate::Store::list_namespaces. - Never
Consolidate - Never trigger. Useful as a default when consolidation is wired but the operator wants to disable it temporarily without rebuilding the agent graph.
- NodeId
- Stable, opaque node identifier minted by the backend.
- OnMessage
Count - Trigger consolidation once the buffer reaches
max_messages. - OnToken
Budget - Trigger consolidation when the buffer’s total text length
(summed UTF-8 byte length of every
ContentPart::Text) exceedsmax_bytes. Approximates a token-budget gate without needing a tokenizer in the SDK. - Policy
Extras - Optional signals fed into
BufferMemory::should_consolidate_with. Operators that don’t track tokens or last-consolidated time can passSelf::defaultand the policy will see the buffer plus whatever the buffer itself tracks viaBufferMemory::mark_consolidated. - PutOptions
- Per-write knobs the operator may attach when calling
Store::put_with_options.Default::default()corresponds to the simpleStore::putpath: no TTL, no extra metadata. - Reranked
Document - One reranked document paired with the score the
Rerankerassigned. - Retrieval
Query - Declarative description of one retrieval call.
- Semantic
Memory Embedder + VectorStore + Namespacebundle.- Summary
Memory - Single-string summary keyed by
Namespace.
Enums§
- Direction
- Direction of edge traversal — outgoing edges leave a node,
incoming edges arrive at it.
Bothreturns the union. - Vector
Filter - Predicate against
Document::metadataused byVectorStore::search_filtered. Backends translate this into their native filter language (pgvectorWHERE, qdrantFilter, lancedbwhere); backends that cannot honour a given variant fall back to filterless search and emit aLossyEncode-style warning at the operator layer.
Traits§
- Consolidation
Policy - Decides whether the current buffered conversation should be consolidated.
- Embedder
- Text → vector encoder.
- Embedding
Cost Calculator - Compute a monetary cost for one embedder call.
- Graph
Memory - Generic graph-of-knowledge memory. Trait so backends (Neo4j,
ArangoDB, Postgres-with-recursive-CTE) can plug in without
touching the consumer code; reference in-process impl is
InMemoryGraphMemory. - Reranker
- Re-rank a candidate document set against the originating query.
- Retriever
- Returns documents ranked by relevance to a
RetrievalQuery. - Semantic
Memory Backend - Object-safe consumer trait — tier 3 of the semantic-memory
layering documented at the module level. Consumers (tools,
orchestration code, recipes) take
Arc<dyn SemanticMemoryBackend>to operate on a namespace-scoped embed-and-search surface without parameterising over the concrete embedder / vector-store types. - Store
- Persistent (or in-memory) key/value store, scoped by
Namespace. - Summarizer
- Reduces a buffer of conversation messages to a summary string.
- Vector
Store - Vector index keyed by
Namespace. Backed by qdrant, lancedb, pgvector, etc. in companion crates.
Functions§
- first_
non_ finite_ vector_ value - Return the first non-finite vector element, if any.
- validate_
vector_ shape - Validate vector dimension and finite values for vector-store calls.
Type Aliases§
- Document
Id - Stable identifier for an indexed document. Backends mint these
at insertion time; passing the same id to
VectorStore::updateorVectorStore::deleteis the canonical way to mutate or remove a previously-indexed document.