Synaptic (rust-synaptic)
A production-grade AI agent memory system in Rust featuring intelligent memory management, knowledge graphs, and temporal tracking - a reference for what a serious, performance-focused memory engine looks like.
View source on GitHubKey takeaways
- 01
Knowledge-graph structure adds relations plain stores miss
- 02
Temporal tracking lets memories age and decay explicitly
- 03
Memory management is an engineering discipline, not a bolt-on
Flows built on this research
From the archive
Verbatim excerpts mined from our local archive of this repository — the prompts, schemas, and patterns worth stealing.
Why naive memory retrieval collapses at scale
Current problems: get_recent() calls list_keys() then retrieve() per entry - a full table scan. 10,000 entries: ~100ms to return 10. 100,000 entries: 1s+. Proposed indexes: - Access Time Index: BTreeMap<DateTime, HashSet<key>> - O(log n + k) for k most recent - Access Frequency Index: BinaryHeap<(count, key)> max-heap with lazy rebuild - O(1) top-k when clean - Tag Index: inverted index tag -> keys, O(1) lookup
The unglamorous truth of agent memory: recency and frequency queries need real index structures, or the memory system becomes the latency bottleneck.
docs/memory-retrieval-optimization-design.md