Skip to main content

Module multi_memory

Module multi_memory 

Source
Expand description

§Multi-Memory System

Hierarchical memory system with short-term, long-term, and entity memory.

Inspired by CrewAI’s memory architecture.

§Memory Types

  • Short-term Memory: Recent conversation context, auto-expires
  • Long-term Memory: Persistent facts and learnings, vector-searchable
  • Entity Memory: Knowledge about specific entities (people, places, concepts)

§Example

use cortex::multi_memory::{MultiMemory, MemoryConfig};

let memory = MultiMemory::new(MemoryConfig::default());

// Store in short-term (recent context)
memory.short_term.add("User asked about Rust").await?;

// Store in long-term (persistent knowledge)
memory.long_term.store("Rust is a systems programming language", embedding).await?;

// Store entity information
memory.entity.update("Rust", "category", "programming_language").await?;
memory.entity.update("Rust", "creator", "Mozilla").await?;

// Query across all memory types
let context = memory.recall("Tell me about Rust", query_embedding).await?;

Structs§

Entity
An entity with attributes
EntityMemory
Entity memory for tracking knowledge about specific entities
LongTermEntry
Entry in long-term memory with embedding
LongTermMemory
Long-term memory with semantic search
MemoryConfig
Configuration for the multi-memory system
MemoryItem
A memory item with metadata
MemoryStats
Memory statistics
MultiMemory
Unified multi-memory system combining all memory types
RecallResult
Result of a memory recall
ShortTermMemory
Short-term memory for recent conversation context

Enums§

MemorySource
Source of a memory