1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//! # Agent Memory System
//!
//! Provides persistent, hierarchical memory management for conversational agents.
//!
//! ## Memory Scopes
//!
//! - **Global**: `global::key` - Shared across all agents
//! - **Agent**: `agent::<agent_id>::key` - Agent-specific persistent memory
//! - **Session**: `session::<session_id>::key` - Session-scoped temporary memory
//!
//! ## Memory Types
//!
//! - **Conversation**: Chat message history with persistence
//! - **Working**: Temporary scratchpad for agent reasoning
//! - **Semantic**: Facts and knowledge storage
//! - **Episodic**: Summarized conversation history
//! - **Shared**: Cross-agent knowledge base
//!
//! ## Example
//!
//! ```rust,no_run
//! use rrag::agent::memory::{MemoryConfig, AgentMemoryManager};
//! use rrag::storage::InMemoryStorage;
//! use std::sync::Arc;
//!
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! let storage = Arc::new(InMemoryStorage::new());
//! let config = MemoryConfig::new(storage, "my-agent")
//! .with_persistence(true)
//! .with_working_memory(true)
//! .with_semantic_memory(true);
//!
//! let mut manager = AgentMemoryManager::new(config);
//!
//! // Use working memory (scratchpad)
//! manager.working().set("temp_result", 42i64).await?;
//!
//! // Use semantic memory (facts)
//! use rrag::agent::memory::Fact;
//! use rrag::storage::MemoryValue;
//! let fact = Fact::new("user:alice", "prefers", MemoryValue::from("dark_mode"));
//! manager.semantic().store_fact(fact).await?;
//!
//! // Use episodic memory (summaries)
//! use rrag::agent::memory::Episode;
//! let episode = Episode::new("User asked about Rust programming");
//! manager.episodic().store_episode(episode).await?;
//!
//! // Use shared knowledge base (cross-agent)
//! manager.shared().store("api_endpoint", MemoryValue::from("https://api.example.com")).await?;
//! # Ok(())
//! # }
//! ```
pub use ;
pub use MemoryConfig;
pub use ;
pub use ;
pub use AgentMemoryManager;
pub use ;
pub use ;
pub use WorkingMemory;
pub use ;