Skip to content

Commit ead73d4

Browse files
docs: tighten language in memory-lifecycle.md
- Remove unnecessary reinforcement about client control limitations - Focus on positive descriptions of how the system works - Clean up leftover editing comments ('Correct method name') - Address review feedback for cleaner, more direct language Co-authored-by: Andrew Brookins <[email protected]>
1 parent aab8d86 commit ead73d4

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

docs/memory-lifecycle.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Memory lifecycle in the system follows these stages:
1515

1616
## Key Architectural Principle
1717

18-
**⚠️ Important**: Memory forgetting is controlled entirely by the **server**, not the client. Clients cannot directly trigger forgetting operations or set forgetting policies. All memory cleanup happens automatically through background processes based on server configuration.
18+
Memory forgetting operates through **server-controlled background processes**. The system automatically manages memory cleanup based on server configuration, ensuring consistent resource management and optimal performance.
1919

2020
## Memory Creation Patterns
2121

@@ -103,7 +103,7 @@ await client.create_long_term_memories([
103103

104104
### How Forgetting Works
105105

106-
Memory forgetting is an **automatic background process** running on the server. Clients have no direct control over when or how memories are deleted. The system uses a background task scheduler (Docket) that periodically evaluates and deletes memories based on server configuration.
106+
Memory forgetting operates as an **automatic background process** using Docket (a Redis-based task scheduler). The system periodically evaluates and deletes memories based on server configuration thresholds and policies.
107107

108108
### Server Configuration
109109

@@ -128,7 +128,7 @@ FORGETTING_BUDGET_KEEP_TOP_N=10000
128128

129129
### Forgetting Policies
130130

131-
The server supports these forgetting strategies:
131+
The system supports these automated forgetting strategies:
132132

133133
#### 1. Age-Based Deletion
134134
Memories older than `FORGETTING_MAX_AGE_DAYS` are eligible for deletion.
@@ -144,7 +144,7 @@ When `FORGETTING_BUDGET_KEEP_TOP_N` is set, only the most recently accessed N me
144144

145145
### Client Capabilities
146146

147-
While clients cannot control forgetting policies, they can:
147+
Clients can perform direct memory management operations:
148148

149149
#### Delete Specific Memories
150150
```python
@@ -211,11 +211,11 @@ async def monitor_memory_usage():
211211
pass
212212
```
213213

214-
**Note**: Clients cannot directly monitor or control background forgetting processes. This is by design to maintain server autonomy over resource management.
214+
**Note**: Background forgetting processes operate independently to maintain consistent server resource management.
215215

216216
## Client-Side Memory Management
217217

218-
While clients cannot control automatic forgetting, they can perform manual cleanup operations:
218+
Clients can perform manual memory management operations alongside automatic background processes:
219219

220220
### Bulk Memory Deletion
221221

@@ -239,7 +239,7 @@ async def cleanup_old_sessions(client: MemoryAPIClient, days_old: int = 30):
239239

240240
for i in range(0, len(memory_ids), batch_size):
241241
batch_ids = memory_ids[i:i + batch_size]
242-
await client.delete_long_term_memories(batch_ids) # Correct method name
242+
await client.delete_long_term_memories(batch_ids)
243243
print(f"Deleted batch {i//batch_size + 1}")
244244
```
245245

@@ -261,7 +261,7 @@ async def cleanup_by_topic(client: MemoryAPIClient,
261261
# Delete them
262262
memory_ids = [mem.id for mem in topic_memories.memories]
263263
if memory_ids:
264-
await client.delete_long_term_memories(memory_ids) # Correct method name
264+
await client.delete_long_term_memories(memory_ids)
265265
print(f"Deleted {len(memory_ids)} memories with topic '{topic}'")
266266
```
267267

@@ -274,7 +274,7 @@ Working memory has automatic TTL (1 hour by default) but can be manually managed
274274
await client.delete_working_memory("session-123")
275275
```
276276

277-
**Note**: Unlike the old documentation, there are no APIs for listing active sessions or batch working memory cleanup. Working memory cleanup is primarily handled by Redis TTL.
277+
**Note**: Working memory cleanup is primarily handled by Redis TTL with configurable session timeouts.
278278

279279
## Memory Compaction
280280

@@ -293,7 +293,7 @@ Compaction frequency is controlled by the server configuration:
293293
COMPACTION_EVERY_MINUTES=10 # Default: every 10 minutes
294294
```
295295

296-
**Important**: Clients cannot directly trigger compaction operations. This is handled automatically by background tasks.
296+
Compaction runs automatically through background tasks, ensuring optimal storage and search performance.
297297

298298
## Server Administration
299299

@@ -376,7 +376,7 @@ async def get_user_preference(client, user_id: str, preference_key: str):
376376
return get_default_preference(preference_key)
377377

378378
# Bad: Assuming specific memories will always exist
379-
# user_pref_memory = await client.get_memory_by_id("pref-123") # May fail
379+
# Hypothetical: get_memory_by_id() does not exist in the real API
380380
```
381381

382382
#### Explicit Cleanup
@@ -403,10 +403,10 @@ async def handle_user_data_deletion(client: MemoryAPIClient, user_id: str):
403403

404404
## Summary
405405

406-
The key architectural principle is **server autonomy**: the server controls when and how memories are forgotten through background processes. Clients can only:
406+
The system provides **automated memory lifecycle management** through server-controlled background processes. Clients can:
407407

408408
1. **Delete specific memories** by ID using `delete_long_term_memories()`
409409
2. **Delete working memory sessions** using `delete_working_memory()`
410410
3. **Search and identify** memories for manual cleanup
411411

412-
All automatic lifecycle management (forgetting, compaction, optimization) happens server-side based on configuration and background task scheduling. This design ensures consistent resource management and prevents clients from interfering with server performance optimization.
412+
Automatic lifecycle management (forgetting, compaction, optimization) operates server-side based on configuration and background task scheduling. This design ensures consistent resource management and optimal server performance.

0 commit comments

Comments
 (0)