Archived
d1ec384b27
- crates/ → engrams/ (Rust engrams live here) - bindings/ → receptors/ (cross-language access points into the graph) - Cargo.toml workspace paths updated
58 lines
1.8 KiB
Rust
58 lines
1.8 KiB
Rust
/// Engram — a local-first memory substrate for accumulating intelligence.
|
|
///
|
|
/// An engram is the physical trace of a memory in the brain — the actual encoded
|
|
/// substrate. This crate provides the storage and retrieval primitives that model
|
|
/// how biological memory works: not as query-and-retrieve, but as
|
|
/// activation-and-propagation.
|
|
///
|
|
/// # Quick Start
|
|
///
|
|
/// ```rust,no_run
|
|
/// use engram_core::{EngramDb, Node, Edge, NodeType, MemoryTier, EDGE_SUPERSEDES};
|
|
/// use std::path::Path;
|
|
///
|
|
/// let db = EngramDb::open(Path::new("/tmp/my-engram")).unwrap();
|
|
///
|
|
/// let node = Node::new(
|
|
/// NodeType::Memory,
|
|
/// vec![0.9, 0.1, 0.3, 0.7],
|
|
/// b"The spreading activation model of memory".to_vec(),
|
|
/// MemoryTier::Semantic,
|
|
/// 0.9,
|
|
/// );
|
|
/// let id = db.put_node(node).unwrap();
|
|
///
|
|
/// // Retrieve by spreading activation from a seed
|
|
/// let results = db.activate(&[id], &[0.8, 0.2, 0.3, 0.6], 3, 10).unwrap();
|
|
/// for r in results {
|
|
/// println!("{:.4} hops={} {:?}", r.activation_strength, r.hops,
|
|
/// String::from_utf8_lossy(&r.node.content));
|
|
/// }
|
|
/// ```
|
|
pub mod activation;
|
|
pub mod consolidation;
|
|
pub mod db;
|
|
#[cfg(not(feature = "wasm"))]
|
|
pub mod edge_type;
|
|
pub mod error;
|
|
pub mod graph;
|
|
pub mod salience;
|
|
#[cfg(not(feature = "wasm"))]
|
|
pub mod storage;
|
|
#[cfg(feature = "wasm")]
|
|
pub mod mem_storage;
|
|
pub mod types;
|
|
pub mod vector;
|
|
#[cfg(feature = "migration")]
|
|
pub mod migration;
|
|
|
|
// Re-export the public surface
|
|
pub use db::EngramDb;
|
|
pub use error::{EngramError, EngramResult};
|
|
pub use types::{
|
|
ActivatedNode, Edge, EdgeTypeDef, MemoryTier, Node, NodeType, ScoredNode, now_ms,
|
|
EDGE_ACTIVATES, EDGE_CAUSES, EDGE_CONTAINS, EDGE_CONTRADICTS, EDGE_EXEMPLIFIES,
|
|
EDGE_REFERENCES, EDGE_SUPERSEDES, EDGE_TEMPORALLY_PRECEDES,
|
|
};
|
|
pub use consolidation::{ConsolidationConfig, ConsolidationReport};
|