rig_memory_policy/lib.rs
1//! Backend-agnostic memory-policy primitives shared across Rig memory-store
2//! adapters (`rig-memvid` and future backends like SQLite, LanceDB, Qdrant,
3//! plain filesystem, etc.).
4//!
5//! Phase 1 surface (pure helpers, no trait design yet):
6//!
7//! - [`dedup`] — in-process content-hash dedup for hooks/compactors that must
8//! satisfy `rig::memory::{DemotionHook, Compactor}`'s idempotency contract.
9//! - [`metadata`] — typed envelope written into a backend's per-entry
10//! metadata so downstream tools (evals, inspectors, RAG pipelines) can
11//! reason about the lifecycle that produced each entry.
12//! - [`store`] — the minimal [`TextWriter`] + [`Committable`] capability
13//! traits backends impl so hooks and compactors can be generic over the
14//! storage engine.
15//! - [`error`] — neutral `PolicyError` for failures in the above helpers.
16//!
17//! This crate has **no** dependency on `memvid-core` or any specific storage
18//! engine. Backends are expected to wrap these primitives in their own
19//! adapter (e.g. `rig-memvid` adds `.mv2` framing on top).
20//!
21//! See the [`store`] module docs for the audit-driven rationale behind the
22//! deliberately narrow trait surface.
23
24#![deny(missing_docs)]
25#![deny(rustdoc::broken_intra_doc_links)]
26
27pub mod dedup;
28pub mod error;
29pub mod metadata;
30pub mod store;
31
32pub use error::PolicyError;
33pub use store::{Committable, TextWriter};