-
Notifications
You must be signed in to change notification settings - Fork 17
Description
Problem
When a user saves a fact like "Daniel likes tea" in one chat session, then opens a new chat and asks "what does Daniel like?", the system fails to find any relevant information because no Daniel entity exists to connect the fact to.
Reproduction
Session 1 — User says "Daniel likes tea". The AI calls memory_store (stored as preference):
// Request
{
"tool": "memory_store",
"arguments": {
"memory_type": "preference",
"content": "Daniel likes tea.",
"category": "beverage",
"subject": "Daniel",
"predicate": "likes",
"object_value": "tea"
}
}
// Response — stored successfully, no entity created
{
"stored": true,
"type": "preference",
"id": "f3e0f0c8-e69b-48c7-b8d6-aed29e17656c",
"category": "beverage"
}Session 2 (new chat) — User asks "What facts do you know about Daniel?" The AI calls entity_lookup:
// Request
{
"tool": "entity_lookup",
"arguments": {
"name": "Daniel"
}
}
// Response — entity not found
{
"found": false,
"name": "Daniel"
}The agent responds: "I don't have any specific facts about Daniel. If you want to share something about him, feel free to let me know!" — even though a preference was just stored in the previous session.
Neo4j verification — After Session 1, a MATCH (a) RETURN a query in the Neo4j browser returns only a single node in the entire database:
(:Preference {
id: "f3e0f0c8-e69b-48c7-b8d6-aed29e17656c",
preference: "Daniel likes tea.",
category: "beverage",
confidence: 1.0,
created_at: "2026-03-14T03:56:47.344Z",
embedding: [-0.016, 0.018, ...] // 1536-dim vector
})
No Entity node for "Daniel" exists. No Fact node exists (the AI chose preference type). The Preference node is completely isolated — no relationships to any other node. This confirms the root cause: memory_store creates the Preference node but never creates or links an Entity node for the subject "Daniel".
Note: The AI chose memory_type: "preference" rather than "fact", but the core bug applies to both — neither add_fact() nor add_preference() create or link Entity nodes. Additionally, the AI in Session 2 only tried entity_lookup and did not attempt memory_search (which might have found the preference via text similarity), highlighting a secondary issue with tool selection.
Expected Behavior
When a fact is stored with a subject (e.g., "Daniel"), the system should:
- Create or resolve an
Entitynode for "Daniel" (type:PERSON) - Link the
Factto theEntityvia a relationship (e.g.,ABOUTorRELATES_TO) - When a new session queries about "Daniel", the entity lookup finds "Daniel" and traverses to linked facts
Root Cause
-
No entity creation on store: Both
add_fact()andadd_preference()inLongTermMemorystore nodes without extracting or linking entities from the subject/object fields. Facts, preferences, and entities exist as disconnected islands in the graph. -
entity_lookuphas no path to facts/preferences: The MCPentity_lookuptool only searchesEntitynodes — it has no traversal path to discoverFactorPreferencenodes even when the subject matches. -
Tool selection gap: The MCP client AI doesn't fall back to
memory_searchwhenentity_lookupreturns nothing, missing data that could be found via text similarity search.
Proposed Solution
When storing a fact:
- Extract entity references from
subjectandobjectfields in bothadd_fact()andadd_preference() - Resolve against existing entities (or create new ones)
- Create relationships linking the
Fact/Preferencenode to the resolvedEntitynodes (e.g.,(Entity)-[:SUBJECT_OF]->(Fact),(Fact)-[:OBJECT_OF]->(Entity)) - Ensure
entity_lookupandget_context()traverseFactandPreferencerelationships when building context - Consider improving the
entity_lookupMCP tool description to hint the AI should fall back tomemory_searchwhen no entity is found