Skip to content

fix: resolve 8+ char id prefixes in memory_forget and memory_update#955

Draft
gorkem2020 wants to merge 4 commits into
CortexReach:masterfrom
gorkem2020:fix/memory-id-prefix-resolution
Draft

fix: resolve 8+ char id prefixes in memory_forget and memory_update#955
gorkem2020 wants to merge 4 commits into
CortexReach:masterfrom
gorkem2020:fix/memory-id-prefix-resolution

Conversation

@gorkem2020

Copy link
Copy Markdown
Contributor

Problem

memory_update's parameter description has always promised "full UUID or 8+ char prefix", and agents naturally copy row ids out of injected context, where they are truncated (often with a trailing ellipsis, e.g. 407dec9c...). But the uuid detection regex accepted a bare 8-char prefix as a complete id, so a prefix-addressed forget or update went to the store as an exact-id lookup and always failed with "not found or access denied".

This was caught live: an agent asked to delete a specific memory called memory_forget with the truncated ids it could see, got "not found" twice, and honestly reported that the deletion did not go through while the fact kept surfacing from its context.

Fix

  • New scope-filtered store.findByIdPrefix(prefix, scopeFilter, limit): a LIKE lookup for hex-shaped 8-35 char prefixes, capped, with the same per-row scope accessibility check the other read paths use.
  • The shared resolveMemoryId resolver now strips a trailing ellipsis, passes full UUIDs through unchanged, resolves hex-shaped refs as id prefixes (a unique match wins, multiple matches list candidates, zero matches is an honest not-found), and falls back to semantic search for everything else.
  • memory_forget's direct-ID branch and memory_update's inline copy of the resolution logic both route through the shared resolver.

Tests

test/memory-id-prefix-resolution.test.mjs drives the real registered tools against a real temp LanceDB store: prefix delete, ellipsis tolerance, full-UUID unchanged, ambiguity lists candidates without resolving, unmatched prefix deletes nothing, and prefix-addressed update supersedes with the new text. Registered in the CI chain and manifest.

🤖 Generated with Claude Code

gorkem2020 and others added 3 commits July 18, 2026 18:53
…pdate

memory_update's contract has always said 'full UUID or 8+ char prefix',
and injected context shows agents truncated row ids, but the uuid
detection regex accepted a bare 8-char prefix as a complete id, so
prefix-addressed forget/update went to the store as an exact-id lookup
and always failed 'not found or access denied' (live-caught: an agent
honestly reported its own failed deletions). The shared resolver now
strips the trailing ellipsis agents copy from context, passes full UUIDs
through unchanged, resolves hex-shaped 8-35 char refs via the new
scope-filtered store.findByIdPrefix (unique match wins, multiple matches
list candidates, zero is an honest not-found), and falls back to
semantic search for everything else. memory_forget's direct-ID branch
and memory_update's inline copy both route through it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit 91b75f5)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@gorkem2020
gorkem2020 force-pushed the fix/memory-id-prefix-resolution branch from f1055d8 to d6b01a3 Compare July 18, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant