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