55 lines
1.9 KiB
Markdown
55 lines
1.9 KiB
Markdown
---
|
|
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:31.564486+00:00"
|
|
relations:
|
|
- target: 9ea72015-0b85-4a42-9ae1-144866f8d86f
|
|
type: BUILDS_ON
|
|
direction: outgoing
|
|
strength: 0.8
|
|
edge_id: 6100de8d-c1dc-4ec9-8981-5c65a396da0e
|
|
- target: 59268a95-4712-48b4-bccb-6171c7885301
|
|
type: RELATED_TO
|
|
direction: outgoing
|
|
strength: 0.7
|
|
edge_id: 28b233ae-7bb5-441d-8a95-44617fb82618
|
|
- target: 30537b21-e088-483f-8327-bcd42eeaa3fb
|
|
type: RELATED_TO
|
|
direction: outgoing
|
|
strength: 0.7
|
|
edge_id: 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.
|