[P1] Add Memory Links Cleanup #11
Labels
No labels
audit-2025-12-03
component/api
component/commands
component/llm
component/memory
component/tick-loop
component/tools
priority
high
priority
low
status
in-progress
status
needs-info
status
needs-triage
status
on-hold
type
bug
type
documentation
type
enhancement
type
feature
type
refactor
type
test
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
blightbow/evennia_ai#11
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
memory_linksdictionary grows indefinitelyconsolidated_entry_idsset only grows, orphaned IDs never prunedSuggested Fix
Prune orphaned links when Mem0 entries are deleted.
Priority
P1 — High Priority
Source
Architecture Audit 2025-12-03, Section 2: Memory Leak Potential
Resolution Summary
Implemented two cleanup mechanisms to prevent unbounded growth of memory links and consolidated entry IDs during the dreaming phase:
1. Orphaned Memory Links Cleanup (
rag_memory.py)Added
prune_orphaned_memory_links()function that:memory_client.get_all()memory_linksentries whose keys reference deleted memorieslinked_toarrays by removing references to deleted memoriesrun_dreaming_tick()2. Consolidated Entry IDs Cleanup (
helpers.py)Enhanced
prune_low_importance_entries()to:consolidated_entry_idssetTests Added
11 new tests in
test_memory_link_cleanup.py:Commit:
b412b8156