store: Auto-edge creation on memory_store in MCP server

This commit is contained in:
Cal Corum 2026-02-28 22:12:39 -06:00
parent 35415172e9
commit 0eb4915cf9

View File

@ -0,0 +1,36 @@
---
id: ee85bf89-93f0-48e4-b911-7ddc18a735b5
type: decision
title: "Auto-edge creation on memory_store in MCP server"
tags: [cognitive-memory, edges, mcp, automation, architecture, mcp-server]
importance: 0.8
confidence: 0.8
created: "2026-03-01T04:12:39.570452+00:00"
updated: "2026-03-01T04:12:39.570452+00:00"
---
# Auto-edge Creation on memory_store in MCP Server
## Decision
Implemented auto-edge creation in `mcp_server.py` that runs after every `memory_store` call.
## Implementation
The `_auto_create_edges()` helper:
- Uses `client.recall(title + tags, limit=5, semantic=True)` to find related memories
- Applies type-pair heuristics from `AUTO_EDGE_HEURISTICS` table (subset of edge-proposer.py) to choose edge types: SOLVES, BUILDS_ON, RELATED_TO
- Calls `client.relate()` for up to 3 edges
- Returns `(edges_list, error_string_or_None)` tuple — never raises so store always succeeds
## Response Shape
Response includes `auto_edges` array and optional `auto_edge_error` key.
## Key Design Decisions
1. Same-type pairs excluded as too noisy
2. REQUIRES/FOLLOWS excluded as needing stronger signal
3. Keyword-only fallback requires tag overlap to prevent spurious edges
4. Similarity score passed as edge strength
5. Description arrow matches actual from/to direction (after direction resolution)