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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
//! Long-term semantic memory service for agents.
//!
//! This module provides semantic search over past conversations, user facts, and documents.
//! Unlike the short-term context handled by `TaskManager`, the `MemoryService` persists
//! across sessions and enables semantic (meaning-based) retrieval.
//!
//! # Overview
//!
//! - [`MemoryService`]: Core trait for semantic memory operations
//! - [`OwnedHistory`]: Facade for accessing past conversations and user facts
//! - [`OwnedKnowledge`]: Facade for accessing documents and external sources
//! - [`Embedder`]: Trait for generating text embeddings (required by vector backends)
//!
//! # Architecture
//!
//! ```text
//! ┌─────────────────────────────────────────────────────────────┐
//! │ CONCEPTUAL LAYER │
//! │ ┌─────────────────┐ ┌─────────────────┐ │
//! │ │ OwnedHistory │ │ OwnedKnowledge │ │
//! │ │ recall() │ │ search() │ │
//! │ │ save_fact() │ │ │ │
//! │ └────────┬────────┘ └────────┬────────┘ │
//! │ └──────────┬──────────────┘ │
//! │ ▼ │
//! │ ┌───────────────┐ │
//! │ │ MemoryService │ Core trait │
//! │ └───────┬───────┘ │
//! │ │ │
//! │ ┌───────────────────┼───────────────────┐ │
//! │ ▼ ▼ ▼ │
//! │ InMemory Qdrant Custom │
//! │ (keyword) (vector) backends │
//! └─────────────────────────────────────────────────────────────┘
//! ```
//!
//! # Multi-tenancy
//!
//! All operations are namespaced by [`AuthContext`](crate::runtime::context::AuthContext),
//! ensuring data isolation between users and applications.
//!
//! # Examples
//!
//! ```ignore
//! use radkit::runtime::memory::{MemoryService, InMemoryMemoryService, SearchOptions};
//! use radkit::runtime::context::AuthContext;
//!
//! let memory = InMemoryMemoryService::new();
//! let auth = AuthContext {
//! app_name: "my-app".to_string(),
//! user_name: "alice".to_string(),
//! };
//!
//! // Search past conversations
//! let results = memory.search(&auth, "dark mode preferences", SearchOptions::history_only()).await?;
//! ```
pub use InMemoryMemoryService;
pub use Embedder;
pub use ;
pub use ;
pub use ;
use crate;
use crateAgentResult;
use crateAuthContext;
/// Long-term semantic memory store.
///
/// Provides semantic search over past conversations, user facts, and documents.
/// For current conversation context, use `TaskManager` instead.
///
/// # Multi-tenancy
///
/// All operations are namespaced by the [`AuthContext`], ensuring data isolation
/// between different users and applications.
///
/// # Implementations
///
/// - [`InMemoryMemoryService`]: Development backend using keyword matching (no embeddings)
/// - `QdrantMemoryService`: Production backend using vector search (requires `memory-qdrant` feature)