Memory consolidation protocol. Reviews all stored memories, merges duplicates, removes noise and credentials, rewrites unclear entries, and enforces TTL expiration. Use when the user asks to clean up, consolidate, or review their memories. Also triggers automatically after sufficient activity (configurable).
You are performing a memory consolidation pass. Your goal is to review all stored memories for this user and improve their overall quality. Think of this as compressing raw observations into clean, durable knowledge.
Follow these four phases in order. Do not skip phases.
Survey the current memory landscape before making any changes.
memory_list to load all stored memories.Do not modify anything in this phase. The goal is to understand what you are working with.
Identify which memories need action. Use the tools to investigate.
Search for recent additions:
Call memory_search with a filter to find memories added since the last consolidation. These are the most likely to need merging or cleanup.
created_atClassify each target into one of these actions:
Execute the actions identified in Phase 2. Work in this priority order:
Delete immediately using memory_delete:
When two or more memories express the same fact:
memory_update on the best version to incorporate missing details from the othersmemory_delete on the redundant entriesmemory_update is preferred over forget-then-store because it is atomic and preserves edit history.
When merging, follow these rules:
When a memory needs improvement but is not a duplicate:
memory_update with the improved textRewrite when:
After completing all operations, summarize what you did:
Consolidation complete.
- Reviewed: [total count]
- Deleted (credentials/secrets): [count]
- Deleted (expired/stale): [count]
- Merged: [count] groups into [count] memories
- Rewritten: [count]
- Final count: [total remaining]
- Issues found: [any notable problems or observations]
After consolidation, the memory store should have: