Problem
Memory consolidation currently uses rule based sentence deduplication. This misses semantic duplicates ("uses Rust" vs "prefers Rust for systems work") and cant intelligently decide whether a new fact should ADD a new memory, UPDATE an existing one, or DELETE an outdated one.
Proposed Solution
Use the existing LLM extraction pipeline for consolidation decisions:
Consolidation operations
- ADD — genuinely new information, store as new memory
- UPDATE — refines or supersedes an existing memory, merge them
- DELETE — explicitly contradicted or retracted, mark as invalid
- MERGE — two existing memories say the same thing differently, combine into one
Implementation
- When new memories are extracted, retrieve the top-K most similar existing memories
- Send the new + existing memories to the LLM with a consolidation prompt
- LLM returns the operation (ADD/UPDATE/DELETE/MERGE) with the resulting memory text
- Apply the operation to the graph
Constraints
- Consolidation should be async (dont block process_turn)
- Batch consolidation for efficiency (collect candidates, process in bulk)
- Keep an audit log of consolidation decisions for debugging
- Fallback to current rule based approach if LLM is unavailable
Why
Rule based dedup catches exact and near exact duplicates but misses everything else. LLM consolidation enables the memory system to reason about what it knows, producing a cleaner, more accurate memory graph over time.
Problem
Memory consolidation currently uses rule based sentence deduplication. This misses semantic duplicates ("uses Rust" vs "prefers Rust for systems work") and cant intelligently decide whether a new fact should ADD a new memory, UPDATE an existing one, or DELETE an outdated one.
Proposed Solution
Use the existing LLM extraction pipeline for consolidation decisions:
Consolidation operations
Implementation
Constraints
Why
Rule based dedup catches exact and near exact duplicates but misses everything else. LLM consolidation enables the memory system to reason about what it knows, producing a cleaner, more accurate memory graph over time.