58 lines
1.9 KiB
Markdown
58 lines
1.9 KiB
Markdown
---
|
|
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:13:10.207790+00:00"
|
|
relations:
|
|
- target: ab3ffc18-1707-42ff-ad7e-bffb16f6fdef
|
|
type: RELATED_TO
|
|
direction: incoming
|
|
strength: 0.9
|
|
edge_id: 34ca4c9a-5f16-4e37-b333-5ac7921bdb1a
|
|
- target: 21be13ae-c01b-4bf1-917a-9e1ef18312a8
|
|
type: RELATED_TO
|
|
direction: incoming
|
|
strength: 0.7
|
|
edge_id: d48a8a66-5b89-435c-9e8b-1f41a10b8b13
|
|
- target: 9ea72015-0b85-4a42-9ae1-144866f8d86f
|
|
type: BUILDS_ON
|
|
direction: outgoing
|
|
strength: 0.85
|
|
edge_id: bc703713-c85f-478c-be2c-0f0cd35f53c7
|
|
- target: 9eb16f9f-c825-4233-b64f-d0acd140374a
|
|
type: FOLLOWS
|
|
direction: outgoing
|
|
strength: 0.7
|
|
edge_id: 54bd99d1-1d99-44e7-a226-98b8d50b7055
|
|
---
|
|
|
|
# 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)
|