Graphiti + Memobase: Building a Knowledge Graph for Your AI
Every LLM conversation starts with amnesia. The model has no idea who you are, what you discussed yesterday, or how your projects connect. RAG fixes the document retrieval problem. It doesn't fix the memory problem. We've been running two open-source memory layers on our DGX Spark for three months. Here's what works, what doesn't, and how to build it.
The Memory Problem
RAG retrieves documents. It doesn't remember people, relationships, or how facts change over time. When you ask an AI agent "what did we decide about the Valencia project last week?", RAG returns the top-k most similar document chunks. None of them know that "the Valencia project" was renamed to "Project Alboraya" on Tuesday, or that the client's CTO resigned on Thursday.
There are two distinct memory gaps:
- Entity memory: who people are, how they relate to each other, what organizations they belong to, and how those relationships change over time.
- User memory: what a specific user prefers, their communication style, their role, their history with your system.
RAG addresses neither. Vector search finds similar text. It doesn't track that "Jacobo" is the founder of J4SGON, that J4SGON operates VORLUX AI, or that VORLUX AI moved from evaluation to production last month.
Graphiti: Temporal Knowledge Graphs
Graphiti is an open-source library by the Zep team that builds temporal knowledge graphs for AI agents. It represents entities as nodes, relationships as edges, and tracks when those facts were true. Apache 2.0 licensed, 30,000+ GitHub stars.
How it works
Graphiti extracts entities and relationships from text using an LLM, stores them in a graph database (Neo4j), and timestamps every fact. When a relationship changes, the old edge is marked with an invalid_at timestamp and a new edge is created. This means you can query "who was the CTO of Acme Corp in January?" and get a different answer than "who is the CTO of Acme Corp now?"
The key operations:
add_memory: ingest text, extract entities/relations, store with timestampssearch_nodes: find entities by name or semantic similaritysearch_memory_facts: query relationships, filtered by time rangeget_episodes: retrieve the raw text episodes that were ingested
Running it locally
Graphiti runs as an MCP (Model Context Protocol) server. In our stack, it's registered as the graphiti MCP server in OpenClaw, accessible at :8005/mcp/. Any agent that speaks MCP can call its tools.
# Example: adding a fact to the graph
from graphiti import Graphiti
graphiti = Graphiti(
base_url="http://localhost:8005",
api_key="your-key"
)
await graphiti.add_memory(
text="Jacobo met with Acme Corp's CTO on 2026-08-20 to discuss sovereign AI deployment. "
"Acme Corp is evaluating VORLUX AI's consulting services for their Valencia office.",
group_id="j4sgon"
)
Graphiti extracts:
- Entities: Jacobo (person), Acme Corp (organization), VORLUX AI (organization), Valencia (location)
- Relations: Jacobo → met_with → Acme Corp CTO, Acme Corp → evaluating → VORLUX AI, Acme Corp → has_office_in → Valencia
- Temporal data: meeting date 2026-08-20, evaluation status as of that date
What Graphiti is good at
- Relationship tracking: understanding how entities connect and how those connections evolve
- Temporal queries: "what was true on date X?" with proper bi-temporal modeling
- Entity resolution: recognizing that "Jacobo" and "J. González Jaspe" might be the same person
- Cross-reference: connecting facts across different conversations and documents
What Graphiti struggles with
- Cold start: an empty graph is useless. You need meaningful ingestion before queries return value
- LLM dependency: entity extraction quality depends on the model. Small models miss nuance
- Setup complexity: requires Neo4j (or FalkorDB) as the graph backend. Another service to run
- No user preferences: it tracks facts, not "Jacobo prefers concise answers without code comments"
Memobase: User Profile Memory
Memobase is an open-source memory layer that builds structured user profiles from conversations. Apache 2.0, 2,800+ GitHub stars. Written in Go with a Python client library.
How it works
Memobase watches chat interactions and incrementally builds a profile for each user. The profile contains structured fields (name, role, preferences, skills, interests) that update over time as new information arrives. It integrates as a drop-in OpenAI-compatible endpoint: add a user_id to your chat completion call, and Memobase handles the rest.
# Memobase sits between your app and the LLM
import openai
client = openai.OpenAI(
base_url="http://localhost:8019/v1", # Memobase proxy
api_key="your-memobase-token"
)
response = client.chat.completions.create(
model="qwen3.6",
messages=[{"role": "user", "content": "I prefer Spanish for technical docs"}],
user="jacobo_001" # Memobase uses this to build/update the profile
)
# Next time Jacobo chats, Memobase injects his profile as context:
# "User prefers Spanish for technical documentation, works as CEO of J4SGON SL,
# technical background in Docebo support..."
What Memobase is good at
- User preferences: communication style, language, technical level, what they care about
- Zero-config integration: if your app already uses the OpenAI API, just add
user_id - Incremental updates: profiles get richer over time without manual intervention
- Multi-user isolation: each user has their own profile, properly isolated
What Memobase struggles with
- No relationships: it knows Jacobo likes Spanish, not that Jacobo works with Acme Corp
- No temporal queries: you can't ask "what did Jacobo prefer in June?"
- Profile drift: if a user's preferences change, old data can persist unless explicitly updated
- Token overhead: injecting a full profile into every call adds tokens to every request
How We Use Them Together
In our stack, Graphiti and Memobase serve different memory layers:
| Layer | Tool | What it stores | Query type |
|---|---|---|---|
| User profile | Memobase | Preferences, role, communication style | "Who is this user?" |
| Knowledge graph | Graphiti | Entities, relationships, temporal facts | "What do we know about X?" |
| Document retrieval | R2R + Qdrant | Raw document chunks with embeddings | "Find documents about Y" |
| Raw vectors | Qdrant | 7 collections, custom embeddings | Direct vector operations |
Architecture
User Input
│
▼
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Memobase │ │ Graphiti │ │ R2R/Qdrant │
│ :8019 │ │ :8005/mcp │ │ :7272 │
│ │ │ │ │ │
│ User prefs │ │ Entity graph│ │ Doc chunks │
│ & profile │ │ & relations │ │ & embeddings│
└──────┬──────┘ └──────┬──────┘ └──────┬──────┘
│ │ │
└──────────┬───────┴───────────────┘
▼
┌──────────────┐
│ LiteLLM │
│ :4000 │
│ (qwen3.6) │
└──────────────┘
The agent queries all three layers in parallel:
- Memobase returns the user's profile (preferences, history, role)
- Graphiti returns relevant entities and relationships (temporal)
- R2R returns relevant document chunks (semantic)
The combined context goes into the LLM prompt. The result: an agent that knows who it's talking to, what has happened, and what documents are relevant, without stuffing everything into a single vector store.
Real example
When someone asks our agent "what's the status of the Acme Corp project?":
- Memobase injects: "User is Jacobo, CEO of J4SGON, prefers direct technical answers in Spanish or English"
- Graphiti returns: "Acme Corp (organization), evaluating VORLUX AI consulting since 2026-08-20, CTO was María García (resigned 2026-08-22), new CTO is Carlos Ruiz (appointed 2026-08-25)"
- R2R returns: Acme Corp's original discovery document, the proposal PDF, and the latest status update
The agent produces an answer that uses the right tone, references the correct people, and cites the right documents, all from local infrastructure.
Setup: Running It Yourself
Prerequisites
- A machine with at least 16GB RAM (we run on a DGX Spark with 128GB)
- Docker and Docker Compose
- An LLM endpoint (we use LiteLLM at
:4000routing to Qwen 3.6)
Memobase
# Clone and run
git clone https://github.com/memodb-io/memobase.git
cd memobase
# Configure
cp .env.example .env
# Set: MEMOBASE_TOKEN=your-secure-token
# Set: LLM_API_BASE=http://localhost:4000/v1 # Point at LiteLLM
# Set: LLM_API_KEY=your-litellm-key
# Set: LLM_MODEL=qwen3.6
docker compose up -d
# Verify
curl http://localhost:8019/api/v1/health \
-H "Authorization: Bearer your-secure-token"
Graphiti
Graphiti needs a graph database backend. We use FalkorDB (lighter than Neo4j, Redis-based):
# FalkorDB as graph backend
docker run -d --name falkordb \
-p 6379:6379 \
falkordb/falkordb:latest
# Graphiti MCP server
pip install graphiti-core
python -m graphiti.server --port 8005 \
--graph-url bolt://localhost:7687 \
--llm-base-url http://localhost:4000/v1 \
--llm-api-key your-litellm-key \
--llm-model qwen3.6
Register Graphiti as an MCP server in your agent framework (OpenClaw, Claude Desktop, or any MCP-compatible client):
{
"mcpServers": {
"graphiti": {
"url": "http://localhost:8005/mcp/",
"transport": "http"
}
}
}
Integration
Wire Memobase as a proxy in front of your LLM:
# Before: direct LLM call
client = openai.OpenAI(base_url="http://localhost:4000/v1", ...)
# After: Memobase proxy adds user memory
client = openai.OpenAI(base_url="http://localhost:8019/v1", ...)
# Just add user="user_id" to chat calls
For Graphiti, call the MCP tools from your agent:
- After each conversation, call
add_memorywith the conversation summary - Before answering, call
search_nodesandsearch_memory_factswith relevant entities
Lessons From Three Months in Production
What worked
- User profiles improve fast. After 5-10 conversations, Memobase has a useful profile. Tone and language preferences are captured within the first interaction.
- Graphiti shines with structured data. Feeding it CRM data, meeting notes, and project updates produces a queryable graph that answers questions RAG can't.
- Parallel queries are fast. Three memory layers queried simultaneously add <200ms to response time. The context quality improvement dwarfs the latency cost.
- Local models handle extraction. Qwen 3.6 at 35B parameters extracts entities well enough for production use. You don't need GPT-4 for entity extraction.
What surprised us
- Memobase profiles need pruning. After three months, some profiles grew to 800+ tokens. We added a monthly truncation job that keeps the top 10 most recent facts per category.
- Graphiti's temporal queries are underused. We thought we'd query history often. In practice, we mostly need current state. But when we do need temporal queries, nothing else can do it.
- Cold start is real. For the first two weeks, Graphiti returned empty results for most queries. You need consistent ingestion before the graph becomes useful.
- The two tools don't overlap. We initially worried about redundancy. They serve different memory needs with zero overlap in practice.
What we'd do differently
- Start with Memobase, add Graphiti later. User profile memory has immediate value. Knowledge graphs need accumulated data before they pay off.
- Batch Graphiti ingestion. We started with real-time ingestion (add_memory after every conversation). Batching nightly ingestions is more reliable and doesn't block the conversation loop.
- Monitor token overhead. Injecting three memory layers into every prompt adds 500-1500 tokens. Track this in Langfuse and set limits.
The Bigger Picture
Most AI agent frameworks treat memory as an afterthought: a vector store bolted on to retrieve documents. This works for "find me information about X" but fails for "what do we know about the Acme Corp situation?"
The combination of user profiles (Memobase) and temporal knowledge graphs (Graphiti) gives agents something closer to actual memory: they know who they're talking to, what has happened, and how things have changed. All running on local infrastructure, with no data leaving your network.
For organizations operating under the EU AI Act, where you need to demonstrate traceability and human oversight, a temporal record of what your AI knew and when it knew it is an audit trail.
This post reflects our real infrastructure running on a DGX Spark (ARM64, 128GB RAM). All tools mentioned are open source (Apache 2.0). No cloud APIs, no external dependencies.
If you run this for a company and need it hardened, that's VORLUX AI: https://vorluxai.com/