plugmem_core/lib.rs
1//! The crate README is included below as module documentation, which makes
2//! every Rust example in it a doctest: a README that drifts from the API stops
3//! compiling instead of quietly lying.
4#![doc = include_str!("../README.md")]
5//! plugmem engine core.
6//!
7//! The `no_std + alloc`, single-threaded memory engine on top of
8//! [`plugmem_arena`]: the data model (facts, entities, edges,
9//! bitemporality), the indexes (BM25, temporal, graph, vectors), hybrid
10//! recall, and the snapshot/journal machinery. The core owns no I/O, no
11//! clock and no threads — timestamps arrive as parameters, bytes leave
12//! through the `Storage` trait.
13//!
14//! Design: `..05`. Implementation lands in stages 2-4; modules
15//! appear here in dependency order as those stages complete.
16
17#![no_std]
18// The engine holds zero `unsafe`: every byte-reinterpretation lives in
19// `plugmem_arena`, behind its single audited `unsafe`. Forbidding it here turns
20// "the core is UB-free" into a compile-time guarantee — which is why the MIRI
21// audit covers only the arena, not this crate's (necessarily safe) code.
22#![forbid(unsafe_code)]
23
24extern crate alloc;
25
26pub mod config;
27pub mod error;
28pub mod id;
29pub mod index;
30pub mod journal;
31pub mod memory;
32pub(crate) mod metadata;
33pub mod model;
34pub mod snapshot;
35pub mod storage;
36pub mod tokenizer;
37
38pub use config::{Config, MAX_HNSW_DEGREE, MAX_SHARDS};
39pub use error::Error;
40pub use id::{EdgeId, EntityId, FactId, NONE_U32};
41pub use memory::{
42 FactFault, FactView, LinkInput, MaintainReport, MaintenanceMode, MaintenanceOptions, Memory,
43 OpenReport, RecallQuery, RecallResult, RecallScratch, RecalledEdge, RecalledFact,
44 RememberInput, RememberOutcome, ShardLayout, Similar, SimilarReason, Stats, UnlinkInput,
45};
46pub use model::{
47 EdgeSlot, EntityByName, EntityRecord, FactAux, FactRecord, TemporalSlot, VALID_TO_OPEN,
48 fact_flags,
49};
50pub use storage::{MemScratch, MemStorage, Scratch, Storage};
51// The arena-layer ids that appear in model records are part of this
52// crate's public surface too.
53pub use plugmem_arena::{BlobId, TermId};
54// The arena's own error appears inside `Error::Arena`, so anything matching on
55// it needs the type without depending on the arena crate directly.
56pub use plugmem_arena::Error as ArenaError;