This repository has been archived on 2026-08-20. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
el-retired/engram/crates/engram-core/src/lib.rs
T
Will Anderson 1a609502c8 init: Engram v0.1 — native memory substrate for accumulating intelligence
Memory is not stored and retrieved — it is activated and propagated.
Implements the spreading activation model with salience decay, typed edges,
four memory tiers, and flat cosine vector search over a sled embedded store.
2026-04-27 15:37:42 -05:00

47 lines
1.4 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, RelationType};
/// 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 db;
pub mod error;
pub mod graph;
pub mod salience;
pub mod storage;
pub mod types;
pub mod vector;
// Re-export the public surface
pub use db::EngramDb;
pub use error::{EngramError, EngramResult};
pub use types::{
ActivatedNode, Edge, MemoryTier, Node, NodeType, RelationType, ScoredNode, now_ms,
};