fix: include memory IDs in output for deletion support #5

Merged
Pakobbix merged 1 commits from fix/include-memory-ids-in-output into main 2026-05-12 17:00:31 +00:00
Owner

Summary

The LLM could never delete memories because memory_id was stripped from all tool responses, making the mem0_delete tool unusable.

Changes

  • mem0_list_all: Added [id] prefix before each memory text
  • mem0_search: Added id field to each result item
  • _format_search_results (prefetch context): Added [id] prefix in injected <mem0_context>
  • Fixed mem0_search to filter out empty-text results (consistent with mem0_list_all)
## Summary The LLM could never delete memories because `memory_id` was stripped from all tool responses, making the `mem0_delete` tool unusable. ## Changes - **`mem0_list_all`**: Added `[id]` prefix before each memory text - **`mem0_search`**: Added `id` field to each result item - **`_format_search_results`** (prefetch context): Added `[id]` prefix in injected `<mem0_context>` - Fixed `mem0_search` to filter out empty-text results (consistent with `mem0_list_all`)
ARIA added 1 commit 2026-05-12 16:59:36 +00:00
The LLM could not delete memories because IDs were stripped from tool
responses. Now all three output paths include memory IDs:

- mem0_list_all: [id] prefix before each memory text
- mem0_search: id field in each result item
- prefetch context: [id] prefix in injected <mem0_context>
Collaborator

No issues found — changes look consistent with the stated intent.

The changes correctly implement the described logic:

  1. _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.
  2. mem0_list_all: Correctly adds [id] prefix to memory texts in the output list.
  3. mem0_search: Correctly adds the id field to the result items and filters out empty-text results. The added check if not items after filtering is a safe guard against returning an empty list when the initial results check passed but all items were filtered out (consistent with the "filter out empty-text results" intent).
✅ No issues found — changes look consistent with the stated intent. The changes correctly implement the described logic: 1. **`_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. 2. **`mem0_list_all`**: Correctly adds `[id]` prefix to memory texts in the output list. 3. **`mem0_search`**: Correctly adds the `id` field to the result items and filters out empty-text results. The added check `if not items` after filtering is a safe guard against returning an empty list when the initial `results` check passed but all items were filtered out (consistent with the "filter out empty-text results" intent).
Pakobbix merged commit b69efe9482 into main 2026-05-12 17:00:31 +00:00
Pakobbix deleted branch fix/include-memory-ids-in-output 2026-05-12 17:00:31 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ARIA/mem0-local-hermes-plugin#5