@@ -4,23 +4,27 @@ A Redis-powered memory server built for AI agents and applications. It manages b
44
55## Features
66
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
1010 - Client model-aware token limit management (adapts to the context window of the client's LLM)
1111 - Supports all major OpenAI and Anthropic models
12+ - Automatic promotion of structured memories to long-term storage
1213
1314- ** Long-Term Memory**
14- - Storage for long-term memories across sessions
15+ - Persistent storage for memories across sessions
1516 - Semantic search to retrieve memories with advanced filtering system
1617 - Filter by session, namespace, topics, entities, timestamps, and more
1718 - 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
1920 - Automatic Entity Recognition using BERT
21+ - Memory deduplication and compaction
2022
2123- ** Other Features**
22- - Namespace support for session and long-term memory isolation
24+ - Namespace support for session and working memory isolation
2325 - 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
2428
2529## System Diagram
2630![ System Diagram] ( diagram.png )
@@ -32,10 +36,10 @@ This project is under active development and is **pre-release** software. Think
3236
3337### Roadmap
3438- [x] Long-term memory deduplication and compaction
35- - [ ] Configurable strategy for moving session memory to long-term memory
36- - [ ] Authentication/authorization hooks
3739- [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
3943
4044## REST API Endpoints
4145
@@ -51,36 +55,64 @@ The following endpoints are available:
5155- ** GET /sessions/**
5256 Retrieves a paginated list of session IDs.
5357 _ 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 )
5660 - ` namespace ` (string, optional): Filter sessions by namespace.
5761
5862- ** 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 .
6165 _ Query Parameters:_
6266 - ` namespace ` (string, optional): The namespace to use for the session
6367 - ` window_size ` (int, optional): Number of messages to include in the response (default from config)
6468 - ` model_name ` (string, optional): The client's LLM model name to determine appropriate context window size
6569 - ` context_window_max ` (int, optional): Direct specification of max context window tokens (overrides model_name)
6670
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.
6974 _ Request Body Example:_
7075 ``` json
7176 {
7277 "messages" : [
7378 {"role" : " user" , "content" : " Hello" },
7479 {"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"
7691 }
7792 ```
7893
7994- ** 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+ ```
81113
82114- ** 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.
84116 _ Request Body Example:_
85117 ``` json
86118 {
@@ -97,7 +129,27 @@ The following endpoints are available:
97129 }
98130 ```
99131
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:_
101153 - Tag filters (session_id, namespace, topics, entities, user_id):
102154 - ` eq ` : Equals this value
103155 - ` ne ` : Not equals this value
0 commit comments