Expand description
Adaptive Memory System
A spreading activation memory system with decay-based relationship strength.
§Example
use adaptive_memory::{MemoryStore, MemoryError, SearchParams};
fn main() -> Result<(), MemoryError> {
let mut store = MemoryStore::open_in_memory()?;
// Add memories
store.add("First memory about cats", Some("test"))?;
store.add("Second memory about dogs", None)?;
// Search with default params
let results = store.search("cats", &SearchParams::default())?;
for mem in results.memories {
println!("{}: {} (energy: {:.2})", mem.memory.id, mem.memory.text, mem.energy);
}
// Strengthen relationships
store.strengthen(&[1, 2])?;
Ok(())
}Re-exports§
pub use db::default_db_path;pub use error::MemoryError;pub use memory::AddMemoryResult;pub use memory::AmendResult;pub use memory::GraphStats;pub use memory::Memory;pub use memory::Stats;pub use relationship::ConnectResult;pub use relationship::Relationship;pub use relationship::RelationshipEvent;pub use relationship::StrengthenResult;pub use search::ActivatedMemory;pub use search::SearchResult;pub use store::MemoryStore;
Modules§
- db
- Database initialization and low-level helpers.
- error
- Custom error types for the adaptive memory system.
- memory
- Memory data structures.
- relationship
- Relationship management and decay calculations.
- search
- Search functionality with spreading activation.
- store
- MemoryStore - the main API for the adaptive memory system.
Structs§
- Search
Params - Runtime search parameters.
Constants§
- DEFAULT_
LIMIT - Default number of results to return from search.
- ENERGY_
THRESHOLD - Minimum energy threshold to continue propagation. At 0.01 (1% of initial seed energy), with energy_decay=0.5, this allows ~7 hops depth.
- MAX_
SPREADING_ ITERATIONS - Maximum iterations for spreading activation (prevents runaway on dense graphs). With delta propagation, typical searches use 50-300 iterations. This is a safety cap. If hit, highest-energy paths are still processed (max-heap ordering).
- MAX_
STRENGTHEN_ SET - Maximum number of memories that can be strengthened at once.