Skip to main content

velesdb_memory/
lib.rs

1#![deny(unsafe_code)]
2//! # VelesDB-memory
3//!
4//! Local-first **memory** layer for AI agents, exposed through a single MCP
5//! server. This crate is the domain core: it maps five memory operations onto
6//! `VelesDB`'s in-core Agent Memory SDK.
7//!
8//! | Operation  | Meaning                                            |
9//! |------------|----------------------------------------------------|
10//! | `remember` | store a fact (+ optional links to other memories)  |
11//! | `recall`   | semantic retrieval of similar facts                |
12//! | `relate`   | create a typed edge between two memories           |
13//! | `forget`   | delete a memory                                    |
14//! | `why`      | recall + multi-hop graph traversal                 |
15//!
16//! ## License boundary (non-negotiable)
17//!
18//! This crate exposes **memory semantics only** (results), never raw database
19//! capabilities (`query(velesql)`, `create_collection`, `upsert(vectors)`,
20//! `traverse(graph)`). Exposing the raw engine would constitute a "Substantial
21//! Set" of the Software's features and breach the `VelesDB` Core License 1.0
22//! (§1, No Hosted or Managed Service). See `VISION.md` §5 and `PLAN.md` Phase 4A.
23
24pub mod embedder;
25pub mod error;
26pub mod extract;
27/// Content-addressed memory ids — internal; ids surface through the service API.
28pub(crate) mod id;
29/// Resource caps (DoS limits) shared by every adapter — the single source of
30/// truth for fact size, recall limit, and `why` hop depth.
31pub mod limits;
32/// The MCP server transport. Gated behind the default `mcp` feature so library
33/// consumers (e.g. the language bindings) can depend on the memory core without
34/// pulling the `rmcp`/`tokio` server stack.
35#[cfg(feature = "mcp")]
36pub mod mcp;
37/// The domain data model — the value types the memory layer exchanges
38/// (`Link`, `Recollection`, `ColumnFilter`, `Explanation`, …), separate from the
39/// service that computes them.
40pub mod model;
41pub mod service;
42
43/// Default embedding dimension — the single source of truth, taken from the
44/// SDK's own default so the server, library, and tests never restate the value.
45pub const DEFAULT_DIMENSION: usize = velesdb_core::agent::DEFAULT_DIMENSION;
46
47pub use embedder::{DynEmbedder, EmbedError, Embedder, HashEmbedder};
48#[cfg(feature = "ollama")]
49pub use embedder::{OllamaEmbedder, DEFAULT_OLLAMA_MODEL, DEFAULT_OLLAMA_URL};
50pub use error::{ErrorCategory, MemoryError};
51#[cfg(feature = "extract")]
52pub use extract::OllamaExtractor;
53pub use extract::{DynExtractor, ExtractError, ExtractedFact, Extractor};
54#[cfg(feature = "mcp")]
55pub use mcp::McpServer;
56pub use model::{ColumnFilter, ColumnOp, Explanation, Link, MemoryEdge, MemoryNode, Recollection};
57pub use service::{MemoryService, Metadata};