Agent Memory Consolidation
Definition
Memory consolidation is a mechanism by which an agent periodically processes the contents of short-term memory (e.g., dialogue history or action results) and extracts important facts, generalizations, and lessons for storage in long-term memory.
Stages of Consolidation
- Collection: accumulation of records from short-term memory.
- Analysis: identification of key events, facts, and patterns.
- Generalization: creation of compressed representations.
- Structuring: organization into searchable entries.
- Storage: recording in long-term storage.
| Memory Type | Content | Period |
|---|---|---|
| Short-term | Current context, recent actions | Session |
| Working | Intermediate results | Task |
| Long-term | Facts, preferences, lessons | Permanently |
Implementation
def consolidate(short_term_memory, llm):
facts = extract_facts(short_term_memory, llm)
summaries = summarize_episodes(short_term_memory, llm)
long_term_memory.add(facts)
long_term_memory.add(summaries)
short_term_memory.clear()