Skip to main content

Crate kyma_memory

Crate kyma_memory 

Source
Expand description

Agentic Memory substrate for Kyma.

Memory is stored as ordinary Kyma columnar tables (memory_nodes / memory_edges) registered as the memory graph, so it is first-class queryable (run_sql/run_kql/Discover) and renders in the unified GraphView. Embeddings are a FixedSizeList<Float32> column searched via the platform cosine_distance UDF. Storage is append-only; mutations write a new version and recall dedups to the latest by updated_at.

See docs/superpowers/specs/2026-05-31-agentic-memory-design.md (M1).

Re-exports§

pub use embed::build_embedding_backend;
pub use embed::shared_embedding;
pub use error::MemoryError;
pub use error::Result;
pub use types::CreateMemory;
pub use types::MemoryStatus;
pub use types::MemoryType;
pub use types::RecallFilter;

Modules§

embed
Embedding-backend construction. Memory is the first server-side consumer of kyma-embed; the backend (an ONNX model for fastembed) is built once and shared process-wide via a OnceCell so the model loads at most once.
error
Error type for the memory layer.
rows
Build JSON rows for the columnar memory tables. Rows are serialized to NDJSON and coerced to Arrow by kyma_ingest_core::parse_ndjson, so the embedding value is a plain JSON array of floats.
schema
Arrow schemas for the columnar memory tables.
sql
SQL builders for memory recall / listing. The queries run server-side (where KymaTable + the cosine_distance UDF live) against the columnar memory tables. Each query first dedups to the latest version per node id (row_number() ... ORDER BY updated_at DESC), matching the append-only “latest-wins” model.
types
Memory domain types.

Structs§

MemoryWriter
Writes memory data and provisions the memory database/tables/graph on demand.

Constants§

DEFAULT_DATABASE
Dedicated database that holds the memory tables.
DEFAULT_REALM
Default per-item realm when none is supplied.
EDGE_DERIVED_FROM
EDGE_INVALIDATES
EDGE_MERGED_INTO
EDGE_REFERENCES
Canonical memory edge-relationship types.
EDGE_RELATES_TO
EDGE_RESOLVES_TO
EDGE_TABLE
GLOBAL_REALM
Shared realm for cross-project facts; recall unions project ∪ global.
GRAPH_NAME
Registered graph name for memory.
HALF_LIFE_DAYS
Half-life (days) for recency decay exp(-ln2 * age_days / HALF_LIFE_DAYS).
IMPORTANCE_WEIGHT
NODE_TABLE
RELEVANCE_WEIGHT
Recall re-rank blend: score = RELEVANCE_WEIGHT*(1-distance) + IMPORTANCE_WEIGHT*importance.
RRF_K
Reciprocal-rank-fusion constant in 1/(RRF_K + rank).
W_GRAPH
W_IMPORTANCE
W_KEYWORD
W_RECENCY
W_RRF
Graph-aware hybrid recall blend. The final score fuses reciprocal-rank fusion (RRF) of the vector + keyword candidate lists with semantic similarity, keyword match, graph proximity, importance, and recency (see the memory_retrieve orchestrator). Tunable; sane defaults below.
W_SEMANTIC