Skip to main content

Crate titans_memory

Crate titans_memory 

Source
Expand description

§Titans Memory

Neural-inspired memory system for AIngle AI agents.

§Architecture

Titans Memory implements a dual-memory architecture inspired by cognitive neuroscience and modern AI memory systems:

┌─────────────────────────────────────────────────────────────┐
│                    Titans Memory System                      │
├─────────────────────────────────────────────────────────────┤
│                                                              │
│  ┌──────────────────┐     ┌──────────────────────────────┐ │
│  │  Short-Term      │     │  Long-Term Memory (LTM)      │ │
│  │  Memory (STM)    │     │                              │ │
│  │                  │     │  ┌────────────────────────┐  │ │
│  │  • Fast access   │ ──► │  │   Knowledge Graph      │  │ │
│  │  • Attention     │     │  │                        │  │ │
│  │  • Decay         │     │  │  Entities ──Links──►   │  │ │
│  │  • Bounded       │     │  │                        │  │ │
│  └──────────────────┘     │  └────────────────────────┘  │ │
│                           │                              │ │
│  ┌──────────────────┐     │  ┌────────────────────────┐  │ │
│  │  Consolidation   │     │  │   Semantic Index       │  │ │
│  │                  │     │  │                        │  │ │
│  │  • Importance    │     │  │  Embeddings + Search   │  │ │
│  │  • Similarity    │     │  │                        │  │ │
│  │  • Compression   │     │  └────────────────────────┘  │ │
│  └──────────────────┘     └──────────────────────────────┘ │
│                                                              │
└─────────────────────────────────────────────────────────────┘

§Usage

use titans_memory::{TitansMemory, MemoryConfig, MemoryEntry};

// Create memory system
let mut memory = TitansMemory::new(MemoryConfig::default());

// Store in short-term memory
let entry = MemoryEntry::new("sensor_data", json!({"temp": 23.5}));
memory.remember(entry)?;

// Query with semantic search
let results = memory.recall("temperature readings")?;

// Important memories consolidate to long-term
memory.consolidate()?;

§Features

  • Short-Term Memory (STM): Fast, volatile storage with attention-based weighting
  • Long-Term Memory (LTM): Persistent knowledge graph with semantic indexing
  • Consolidation: Automatic transfer of important memories from STM to LTM
  • Semantic Search: Query memories by meaning, not just keywords
  • IoT Optimized: Configurable memory limits for embedded devices

Re-exports§

pub use config::ConsolidationConfig;
pub use config::LtmConfig;
pub use config::MemoryConfig;
pub use config::StmConfig;
pub use consolidation::Consolidator;
pub use error::Error;
pub use error::Result;
pub use ltm::KnowledgeGraph;
pub use ltm::LongTermMemory;
pub use stm::ShortTermMemory;
pub use types::Embedding;
pub use types::Entity;
pub use types::EntityId;
pub use types::LinkType;
pub use types::MemoryEntry;
pub use types::MemoryId;
pub use types::MemoryMetadata;
pub use types::MemoryQuery;
pub use types::MemoryResult;
pub use types::Relation;
pub use types::SemanticTag;

Modules§

config
Configuration for the Titans Memory system.
consolidation
Memory Consolidation: STM → LTM Transfer
error
Error types for the Titans Memory system.
ltm
Long-Term Memory (LTM) with a Knowledge Graph.
stm
Short-Term Memory (STM) with attention-based weighting.
types
Core data types for the Titans Memory system.

Structs§

MemoryStats
Provides statistics about the state of the TitansMemory system.
TitansMemory
The main interface for the Titans Memory system.