claude-memory/graph/decisions/auto-edge-creation-on-memory-store-in-mcp-server-ee85bf.md
2026-02-28 22:13:10 -06:00

1.9 KiB

id type title tags importance confidence created updated relations
ee85bf89-93f0-48e4-b911-7ddc18a735b5 decision Auto-edge creation on memory_store in MCP server
cognitive-memory
edges
mcp
automation
architecture
mcp-server
0.8 0.8 2026-03-01T04:12:39.570452+00:00 2026-03-01T04:13:10.207790+00:00
target type direction strength edge_id
ab3ffc18-1707-42ff-ad7e-bffb16f6fdef RELATED_TO incoming 0.9 34ca4c9a-5f16-4e37-b333-5ac7921bdb1a
target type direction strength edge_id
21be13ae-c01b-4bf1-917a-9e1ef18312a8 RELATED_TO incoming 0.7 d48a8a66-5b89-435c-9e8b-1f41a10b8b13
target type direction strength edge_id
9ea72015-0b85-4a42-9ae1-144866f8d86f BUILDS_ON outgoing 0.85 bc703713-c85f-478c-be2c-0f0cd35f53c7
target type direction strength edge_id
9eb16f9f-c825-4233-b64f-d0acd140374a FOLLOWS outgoing 0.7 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)