Graph Memory for Personal AI

Table of content

Vector databases find similar content. Knowledge graphs understand how things connect. If you’ve ever asked an AI “who told me about that tool?” and gotten useless results, you’ve hit the wall where vector similarity breaks down. Graph memory solves this by storing relationships, not just embeddings.

The Problem with Flat Memory

Standard RAG pipelines store chunks of text as embeddings and retrieve by similarity. This works for static documents. It fails for personal knowledge where:

ScenarioVector RetrievalGraph Retrieval
“What project did Sarah and I discuss last month?”Returns all mentions of “Sarah”Traverses Sarah → meetings → projects → time filter
“Has my opinion on TypeScript changed?”Can’t track temporal evolutionShows preference nodes over time
“Who introduced me to Kubernetes?”Finds Kubernetes contentFinds person-to-concept introduction edge

Vector search returns content. Graph search returns context.

How Graph Memory Works

Graph memory stores three types of elements:

ElementWhat it representsExample
Entity nodesPeople, projects, concepts, tools“Sarah”, “ProjectX”, “Kubernetes”
Temporal nodesEvents, sessions, decisions“Meeting on Jan 15”, “Architecture decision”
EdgesRelationships with timestamps“Sarah MENTIONED ProjectX AT 2026-01-15”

Retrieval becomes traversal. Instead of “find similar text,” you ask “follow these relationships.”

Zep’s Temporal Knowledge Graph

Zep’s Graphiti architecture stores episodic, semantic, and community subgraphs. Their January 2025 paper on arXiv (2501.13956) describes a dual-timestamp model that tracks both when events happened and when they were recorded.

Event time:     When Sarah mentioned ProjectX (Jan 15)
Ingestion time: When Claude stored this (Jan 15, 3:47 PM)

This distinction matters for correcting outdated information. If you learn on Jan 20 that the meeting actually happened on Jan 14, the graph can update event time while preserving ingestion time for audit trails.

Zep’s retrieval benchmarks show:

ApproachQuery SpeedTemporal Handling
Semantic RAGFast (ms)None
Microsoft GraphRAGSlow (seconds)Limited
ZepFast (ms)Full temporal tracking

The practical difference: Zep updates the graph as new data arrives. Microsoft’s GraphRAG and similar approaches require reprocessing the entire corpus when anything changes.

When to Choose Graph Over Vector

Not everything needs graph memory. Decision criteria:

Use Graph MemoryUse Vector Memory
Multi-hop questions (“who knows someone who…”)Single-hop similarity (“find similar code”)
Temporal reasoning (“how has X changed”)Static document retrieval
Entity relationships (“connections between…”)Content-based search
Contradiction detection (“conflicting information”)Semantic deduplication
Personal knowledge with evolving factsReference documentation

For personal AI, graph memory handles life complexity that vector stores miss. Your relationships with people change. Facts you learned last month get outdated. Context from session 12 matters in session 47.

Graph + Vector Hybrid

The best architectures combine both. Use vectors for initial candidate retrieval, graphs for relationship traversal:

Query: "What did Sarah say about the API migration?"

Step 1 (Vector): Find chunks mentioning API migration
Step 2 (Graph):  Filter to Sarah's statements
Step 3 (Graph):  Add temporal context (when, what project)
Step 4 (Graph):  Include related decisions

Zep calls this assembled context. The graph organizes what the vectors find.

Building Personal Graph Memory

For a personal AI OS, you need to define what goes in the graph.

Entity types: people (colleagues, contacts), projects, tools, concepts, and events like meetings or decisions.

Relationship types connect them: KNOWS links people, WORKS_ON links people to projects, USES links projects to tools, LEARNED_FROM tracks where you got knowledge, CONTRADICTS flags conflicting facts.

Temporal attributes matter most. Every node needs created_at (when added) and optionally valid_from/valid_until (when the fact was true). A confidence score helps when information is uncertain.

Implementation with Graphiti

Zep’s open-source Graphiti library (22k+ GitHub stars) provides the graph layer. Basic setup:

from graphiti import Graphiti

graph = Graphiti()

# Add an episode (conversation, session, event)
graph.add_episode(
    name="meeting_2026_01_15",
    content="Discussed API migration with Sarah. She prefers REST over GraphQL for this use case."
)

# Query with relationship awareness
results = graph.search(
    query="Sarah's API preferences",
    include_edges=True,
    temporal_filter={"after": "2026-01-01"}
)

Graphiti extracts entities and relationships from unstructured text automatically. Each new episode adds to the existing graph.

Memory Compression in Graphs

Graph structure is inherently compressed. Instead of storing full conversation text, you store:

Raw (400 tokens)Graph (50 tokens)
“In our meeting yesterday, Sarah mentioned that she’s been researching API approaches and thinks REST makes more sense than GraphQL for the current migration because…”Sarah --[PREFERS]--> REST Sarah --[CONTEXT]--> api_migration timestamp: 2026-01-14

See AI Memory Compression for compression strategies that work alongside graph storage.

Practical Applications

Cross-Session Continuity

# Session 1: Learn preference
graph.add_episode("Sarah prefers async communication over meetings")

# Session 47: Query that preference
results = graph.search("how should I contact Sarah?")
# Returns: Sarah --[PREFERS]--> async_communication

Contradiction Detection

# Old fact
graph.add_episode("API rate limit is 100/minute", timestamp="2025-12-01")

# New fact
graph.add_episode("API rate limit increased to 500/minute", timestamp="2026-01-15")

# Graph query
graph.search("API rate limit")
# Returns both with timestamps, flags temporal succession

Relationship Queries

# Multi-hop traversal
graph.query("""
    MATCH (me)-[:LEARNED_FROM]->(person)-[:EXPERT_IN]->(topic)
    WHERE topic.name = 'Kubernetes'
    RETURN person
""")
# Returns: the person who taught you about Kubernetes

Tradeoffs

Graph memory is not free:

AdvantageCost
Relationship awarenessSchema design required
Temporal reasoningMore storage overhead
Multi-hop queriesSlower than vector similarity
Contradiction detectionEntity resolution challenges

For personal AI with a few thousand facts about your life and work, these tradeoffs are worth it. For searching millions of documents by keyword, stick with vectors.

Tools and Frameworks

ToolTypeBest For
ZepCommercial + OSSProduction agent memory with temporal graphs
GraphitiOSSBuilding custom graph memory layers
Neo4jDatabaseSelf-hosted graph infrastructure
FalkorDBDatabaseRedis-compatible graph queries
LangGraphFrameworkAgentic workflows with state

For personal AI, start with Graphiti if you want to self-host, or Zep if you want managed infrastructure.


Next: Personal Search

Topics: memory knowledge-management architecture