fix: include memory IDs in output for deletion support #5
Reference in New Issue
Block a user
Delete Branch "fix/include-memory-ids-in-output"
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?
Summary
The LLM could never delete memories because
memory_idwas stripped from all tool responses, making themem0_deletetool unusable.Changes
mem0_list_all: Added[id]prefix before each memory textmem0_search: Addedidfield to each result item_format_search_results(prefetch context): Added[id]prefix in injected<mem0_context>mem0_searchto filter out empty-text results (consistent withmem0_list_all)✅ No issues found — changes look consistent with the stated intent.
The changes correctly implement the described logic:
_format_search_results: Correctly iterates to prepend[id]when available, falling back to text-only if ID is missing. The empty-text filtering logic is preserved.mem0_list_all: Correctly adds[id]prefix to memory texts in the output list.mem0_search: Correctly adds theidfield to the result items and filters out empty-text results. The added checkif not itemsafter filtering is a safe guard against returning an empty list when the initialresultscheck passed but all items were filtered out (consistent with the "filter out empty-text results" intent).