store: Fix: Partial UUID prefix matching in cognitive memory client (git-style)
This commit is contained in:
parent
ab43330d67
commit
9d5e27db2e
@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
id: 89f32ef3-2d87-4b8c-aa6e-ce5a7f60566c
|
||||||
|
type: fix
|
||||||
|
title: "Fix: Partial UUID prefix matching in cognitive memory client (git-style)"
|
||||||
|
tags: [cognitive-memory, fix, uuid, mcp, client.py, claude-configs]
|
||||||
|
importance: 0.8
|
||||||
|
confidence: 0.8
|
||||||
|
created: "2026-02-28T06:03:13.780326+00:00"
|
||||||
|
updated: "2026-02-28T06:03:13.780326+00:00"
|
||||||
|
---
|
||||||
|
|
||||||
|
# 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.
|
||||||
Loading…
Reference in New Issue
Block a user