claude-memory/graph/fixes/fix-partial-uuid-prefix-matching-in-cognitive-memory-client-89f32e.md
2026-02-28 00:03:31 -06:00

1.9 KiB

id type title tags importance confidence created updated relations
89f32ef3-2d87-4b8c-aa6e-ce5a7f60566c fix Fix: Partial UUID prefix matching in cognitive memory client (git-style)
cognitive-memory
fix
uuid
mcp
client.py
claude-configs
0.8 0.8 2026-02-28T06:03:13.780326+00:00 2026-02-28T06:03:31.564486+00:00
target type direction strength edge_id
9ea72015-0b85-4a42-9ae1-144866f8d86f BUILDS_ON outgoing 0.8 6100de8d-c1dc-4ec9-8981-5c65a396da0e
target type direction strength edge_id
59268a95-4712-48b4-bccb-6171c7885301 RELATED_TO outgoing 0.7 28b233ae-7bb5-441d-8a95-44617fb82618
target type direction strength edge_id
30537b21-e088-483f-8327-bcd42eeaa3fb RELATED_TO outgoing 0.7 82a79f99-a136-4aa0-b3cf-d0834fe17446

Partial UUID Prefix Matching in CognitiveMemoryClient

Problem

Users had to type full UUIDs when referencing memories or edges via the client. This was inconvenient — git-style short prefix matching was missing.

Solution

Added a _resolve_prefix() static method to CognitiveMemoryClient that resolves partial UUID prefixes to full IDs.

Resolution logic:

  1. Check for an exact match first (pass-through if full UUID provided)
  2. Scan all IDs with startswith(prefix) for partial matches
  3. Single match → returns the full ID
  4. Multiple matches → raises ValueError with the list of candidate IDs
  5. No matches → returns None (falls through to existing behavior)

Applied to 4 functions:

  • _resolve_memory_path
  • _resolve_edge_path
  • edge_search (both from_id and to_id params)
  • related()

Commit & Issue

  • Committed as 471d870 on cal/claude-configs main branch
  • Closes cal/claude-memory#3

Important Note

The MCP server process must be restarted to pick up changes since it is long-running and does not hot-reload source files.