@@ -4,23 +4,27 @@ A Redis-powered memory server built for AI agents and applications. It manages b
4
4
5
5
## Features
6
6
7
- - ** Short-Term Memory**
8
- - Storage for messages, token count , context, and metadata for a session
9
- - Automatically and recursively summarizes conversations
7
+ - ** Working Memory**
8
+ - Session-scoped storage for messages, structured memories , context, and metadata
9
+ - Automatically summarizes conversations when they exceed the window size
10
10
- Client model-aware token limit management (adapts to the context window of the client's LLM)
11
11
- Supports all major OpenAI and Anthropic models
12
+ - Automatic promotion of structured memories to long-term storage
12
13
13
14
- ** Long-Term Memory**
14
- - Storage for long-term memories across sessions
15
+ - Persistent storage for memories across sessions
15
16
- Semantic search to retrieve memories with advanced filtering system
16
17
- Filter by session, namespace, topics, entities, timestamps, and more
17
18
- Supports both exact match and semantic similarity search
18
- - Automatic topic modeling for stored memories with BERTopic
19
+ - Automatic topic modeling for stored memories with BERTopic or configured LLM
19
20
- Automatic Entity Recognition using BERT
21
+ - Memory deduplication and compaction
20
22
21
23
- ** Other Features**
22
- - Namespace support for session and long-term memory isolation
24
+ - Namespace support for session and working memory isolation
23
25
- Both a REST interface and MCP server
26
+ - Background task processing for memory indexing and promotion
27
+ - Unified search across working memory and long-term memory
24
28
25
29
## System Diagram
26
30
![ System Diagram] ( diagram.png )
@@ -32,10 +36,10 @@ This project is under active development and is **pre-release** software. Think
32
36
33
37
### Roadmap
34
38
- [x] Long-term memory deduplication and compaction
35
- - [ ] Configurable strategy for moving session memory to long-term memory
36
- - [ ] Authentication/authorization hooks
37
39
- [x] Use a background task system instead of ` BackgroundTask `
38
- - [ ] Separate Redis connections for long-term and short-term memory
40
+ - [ ] Configurable strategy for moving working memory to long-term memory
41
+ - [ ] Authentication/authorization hooks
42
+ - [ ] Separate Redis connections for long-term and working memory
39
43
40
44
## REST API Endpoints
41
45
@@ -51,36 +55,64 @@ The following endpoints are available:
51
55
- ** GET /sessions/**
52
56
Retrieves a paginated list of session IDs.
53
57
_ Query Parameters:_
54
- - ` page ` (int): Page number (default: 1 )
55
- - ` size ` (int): Number of sessions per page (default: 10 )
58
+ - ` limit ` (int): Number of sessions per page (default: 10 )
59
+ - ` offset ` (int): Number of sessions to skip (default: 0 )
56
60
- ` namespace ` (string, optional): Filter sessions by namespace.
57
61
58
62
- ** GET /sessions/{session_id}/memory**
59
- Retrieves conversation memory for a session, including messages and
60
- summarized older messages .
63
+ Retrieves working memory for a session, including messages, structured memories,
64
+ context, and metadata .
61
65
_ Query Parameters:_
62
66
- ` namespace ` (string, optional): The namespace to use for the session
63
67
- ` window_size ` (int, optional): Number of messages to include in the response (default from config)
64
68
- ` model_name ` (string, optional): The client's LLM model name to determine appropriate context window size
65
69
- ` context_window_max ` (int, optional): Direct specification of max context window tokens (overrides model_name)
66
70
67
- - ** POST /sessions/{session_id}/memory**
68
- Adds messages (and optional context) to a session's memory.
71
+ - ** PUT /sessions/{session_id}/memory**
72
+ Sets working memory for a session, replacing any existing memory.
73
+ Automatically summarizes conversations that exceed the window size.
69
74
_ Request Body Example:_
70
75
``` json
71
76
{
72
77
"messages" : [
73
78
{"role" : " user" , "content" : " Hello" },
74
79
{"role" : " assistant" , "content" : " Hi there" }
75
- ]
80
+ ],
81
+ "memories" : [
82
+ {
83
+ "id" : " mem-123" ,
84
+ "text" : " User prefers direct communication" ,
85
+ "memory_type" : " semantic"
86
+ }
87
+ ],
88
+ "context" : " Previous conversation summary..." ,
89
+ "session_id" : " session-123" ,
90
+ "namespace" : " default"
76
91
}
77
92
```
78
93
79
94
- ** DELETE /sessions/{session_id}/memory**
80
- Deletes all stored memory (messages, context, token count) for a session.
95
+ Deletes all working memory (messages, context, structured memories, metadata) for a session.
96
+
97
+ - ** POST /long-term-memory**
98
+ Creates long-term memories directly, bypassing working memory.
99
+ _ Request Body Example:_
100
+ ``` json
101
+ {
102
+ "memories" : [
103
+ {
104
+ "id" : " mem-456" ,
105
+ "text" : " User is interested in AI and machine learning" ,
106
+ "memory_type" : " semantic" ,
107
+ "session_id" : " session-123" ,
108
+ "namespace" : " default"
109
+ }
110
+ ]
111
+ }
112
+ ```
81
113
82
114
- ** POST /long-term-memory/search**
83
- Performs semantic search on long-term memories with advanced filtering options.
115
+ Performs vector search on long-term memories with advanced filtering options.
84
116
_ Request Body Example:_
85
117
``` json
86
118
{
@@ -97,7 +129,27 @@ The following endpoints are available:
97
129
}
98
130
```
99
131
100
- _ Filter options:_
132
+ - ** POST /memory-prompt**
133
+ Generates prompts enriched with relevant memory context from both working
134
+ memory and long-term memory. Useful for retrieving context before answering questions.
135
+ _ Request Body Example:_
136
+ ``` json
137
+ {
138
+ "query" : " What did we discuss about AI?" ,
139
+ "session" : {
140
+ "session_id" : " session-123" ,
141
+ "namespace" : " default" ,
142
+ "window_size" : 10
143
+ },
144
+ "long_term_search" : {
145
+ "text" : " AI discussion" ,
146
+ "limit" : 5 ,
147
+ "namespace" : {"eq" : " default" }
148
+ }
149
+ }
150
+ ```
151
+
152
+ _ Filter options for search endpoints:_
101
153
- Tag filters (session_id, namespace, topics, entities, user_id):
102
154
- ` eq ` : Equals this value
103
155
- ` ne ` : Not equals this value
0 commit comments