mnemo_amp/lib.rs
1//! # mnemo-amp
2//!
3//! AMP / *memorywire* interop adapter for [mnemo](https://github.com/sattyamjjain/mnemo).
4//!
5//! AMP models an agent's memory surface as **5 operations**
6//! (`remember` / `recall` / `forget` / `merge` / `expire`) over **4
7//! memory types** (`episodic` / `semantic` / `procedural` /
8//! `working`), carried in a self-describing JSON envelope validated
9//! against a JSON-Schema 2020-12 document. This crate implements that
10//! wire format as a [`MemoryStore`]-conformant surface over a real
11//! [`MnemoEngine`](mnemo_core::query::MnemoEngine), so any AMP-speaking
12//! client can drive mnemo's embedded DuckDB backend unchanged.
13//!
14//! ## What maps where
15//!
16//! | AMP op | Engine call |
17//! |---|---|
18//! | `remember` | [`MnemoEngine::remember`](mnemo_core::query::MnemoEngine::remember) |
19//! | `recall` | [`MnemoEngine::recall`](mnemo_core::query::MnemoEngine::recall) (top-k, default 5) |
20//! | `forget` | [`MnemoEngine::forget`](mnemo_core::query::MnemoEngine::forget) |
21//! | `merge` | thin composition: `remember` (consolidated record) + `forget` (Consolidate) — **not** the branch-timeline `engine.merge` |
22//! | `expire` | thin composition: set `expires_at` + `run_ttl_sweep` — there is no `engine.expire` |
23//!
24//! ## Pieces
25//!
26//! - [`wire`] — the AMP envelope, result, and JSON-Schema 2020-12.
27//! - [`store`] — the [`MemoryStore`] trait + [`MnemoAmpStore`] engine impl.
28//! - [`router`] — the fan-out [`AmpRouter`] + RRF / max fusion.
29//! - [`approval`] — the HITL diff-and-approve hook ([`ApprovalHook`]),
30//! which gates long-term writes and records approvals in mnemo's
31//! hash-chained audit log.
32//!
33//! ## Honest scope
34//!
35//! This is a *wire-format + surface* adapter. AMP transport binding
36//! (HTTP / stdio framing, `.well-known` schema discovery) is left to
37//! the embedding application; the crate provides the schema document
38//! and the typed envelope so that binding is mechanical.
39
40pub mod approval;
41pub mod error;
42pub mod router;
43pub mod store;
44pub mod wire;
45
46pub use approval::{Approval, ApprovalHook, AutoApprove, ClosureApprove, WriteDiff};
47pub use error::AmpError;
48pub use router::{AmpRouter, max_fuse, rrf_fuse};
49pub use store::{DEFAULT_TOP_K, MemoryStore, MnemoAmpStore};
50pub use wire::{AmpEnvelope, AmpHit, AmpMemoryType, AmpOp, AmpResult, schema};