πŸ•ΈοΈ Graph Memory: Entity/Relationship Tracking

How Mem0-style systems extract structure from conversations

1. Raw Messages

AustinMar 1
"JG and I are working on a memory system project"
JGMar 2
"yeah, we're using Mem0 for the backend"
AustinMar 5
"met with Sarah from Huawei about the ACT-R paper"
JGMar 6
"Sarah mentioned her colleague Yaxiong wrote that survey"
⬇️ LLM extracts entities + relationships

2. Extracted Data

ENTITIES
IDTypeAttributes
austinpersongroup member
jgpersongroup member
sarahpersonorg: Huawei
yaxiongpersonorg: Huawei
mem0techmemory system
act-rpapermemory research
proj-1projectmemory system
RELATIONSHIPS
FromRelationToWhen
austincollaboratesjgMar 1
austinworks_onproj-1Mar 1
jgworks_onproj-1Mar 1
proj-1usesmem0Mar 2
austinmet_withsarahMar 5
sarahdiscussedact-rMar 5
sarahcolleague_ofyaxiongMar 6
yaxiongauthoredact-rMar 6

3. Knowledge Graph

graph LR
    subgraph People
        austin((Austin))
        jg((JG))
        sarah((Sarah))
        yaxiong((Yaxiong))
    end
    
    subgraph Work
        proj1[Memory Project]
        mem0[Mem0]
        actr[ACT-R Paper]
    end

    austin -->|collaborates| jg
    austin -->|works_on| proj1
    jg -->|works_on| proj1
    proj1 -->|uses| mem0
    
    austin -->|met_with| sarah
    sarah -->|discussed| actr
    sarah -->|colleague_of| yaxiong
    yaxiong -->|authored| actr
    
    style austin fill:#388bfd,stroke:#58a6ff,color:#fff
    style jg fill:#388bfd,stroke:#58a6ff,color:#fff
    style sarah fill:#388bfd,stroke:#58a6ff,color:#fff
    style yaxiong fill:#388bfd,stroke:#58a6ff,color:#fff
    style proj1 fill:#9e6a03,stroke:#d29922,color:#fff
    style mem0 fill:#6e40c9,stroke:#a371f7,color:#fff
    style actr fill:#238636,stroke:#3fb950,color:#fff
            

4. Query Examples

"Who does Sarah work with?"

MATCH (sarah)-[:colleague_of]->(person) RETURN person

β†’ Yaxiong (Huawei)

"How do I know about the ACT-R paper?"

MATCH path = (austin)-[*1..3]->(actr) RETURN path

β†’ Austin β†’ met_with β†’ Sarah β†’ discussed β†’ ACT-R

β†’ Austin β†’ met_with β†’ Sarah β†’ colleague_of β†’ Yaxiong β†’ authored β†’ ACT-R

"What's the project using?"

MATCH (p:project)-[:uses]->(tech) RETURN p, tech

β†’ Memory Project uses Mem0

5. Why Graph Beats Flat Search

❌ Flat Text Search

  • Search "Sarah" β†’ just messages with "Sarah"
  • No connection to Yaxiong or ACT-R
  • Can't answer relational questions
  • No temporal context

βœ… Graph Memory

  • Search "Sarah" β†’ full context (Huawei, Yaxiong, ACT-R)
  • Traverse relationships across messages
  • "Who authored things Sarah mentioned?"
  • Temporal: "What's new since last week?"

6. The Tradeoff

flowchart LR
    MSG[New Message] --> LLM[LLM Extraction]
    LLM --> ENT[Entities]
    LLM --> REL[Relationships]
    ENT --> DB[(Graph DB)]
    REL --> DB
    
    QUERY[User Query] --> SEARCH[Graph Traversal]
    DB --> SEARCH
    SEARCH --> RESULT[Rich Context]
    
    style LLM fill:#f85149,stroke:#da3633
    style DB fill:#238636,stroke:#3fb950
    
    linkStyle 0,1,2,3,4 stroke:#f85149
            

Red path = cost per message (LLM extraction)
Green = benefit (rich queryable context)