khive_pack_memory/lib.rs
1//! Memory pack — `memory.remember` and `memory.recall` verbs with decay-aware ranking.
2
3pub(crate) mod ann;
4pub mod config;
5pub mod handlers;
6mod pack;
7pub(crate) mod query_cache;
8pub mod recall_feedback;
9pub mod rerank;
10pub mod scoring;
11#[doc(hidden)]
12pub mod text_gather;
13pub mod tunable;
14
15pub use pack::MemoryPack;
16
17/// Increment and return the durable ANN corpus epoch after snapshot invalidation.
18///
19/// Returns a runtime error when the database update fails. Warm daemons observe the
20/// epoch asynchronously and schedule a rebuild. See `crates/khive-pack-memory/docs/api/ann-lifecycle.md`.
21pub async fn bump_memory_ann_epoch(
22 rt: &khive_runtime::KhiveRuntime,
23) -> Result<u64, khive_runtime::RuntimeError> {
24 ann::bump_durable_epoch(rt).await
25}
26
27/// Create the durable ANN epoch table if it does not exist.
28///
29/// The operation is idempotent and returns a runtime error on schema failure. Raw-runtime
30/// reindex callers must invoke it before their first epoch bump. See `crates/khive-pack-memory/docs/api/ann-lifecycle.md`.
31pub async fn ensure_ann_epoch_schema(
32 rt: &khive_runtime::KhiveRuntime,
33) -> Result<(), khive_runtime::RuntimeError> {
34 ann::ensure_epoch_schema(rt).await
35}