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//! Public surface:
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//! - [`inmem`] — a deterministic no-disk reference store for tests,
13//! examples, and offline modes.
14//! - [`store`] — the minimal [`TextWriter`] + [`Committable`] capability
15//! traits backends impl so hooks and compactors can be generic over the
16//! storage engine.
17//! - [`error`] — neutral `PolicyError` for failures in the above helpers.
18//!
19//! This crate has **no** dependency on `memvid-core` or any specific storage
20//! engine. Backends are expected to wrap these primitives in their own
21//! adapter (e.g. `rig-memvid` adds `.mv2` framing on top).
22//!
23//! See the [`store`] module docs for the audit-driven rationale behind the
24//! deliberately narrow trait surface.
25
26#![deny(missing_docs)]
27#![deny(rustdoc::broken_intra_doc_links)]
28
29pub mod dedup;
30pub mod error;
31pub mod inmem;
32pub mod metadata;
33pub mod store;
34
35pub use error::PolicyError;
36pub use inmem::{Episode, InMemoryHit, InMemoryStore};
37pub use store::{Committable, TextWriter};