https://github.com/rangzen/mem0-graph
Visualise mem0 memories as an interactive entity graph extracted with spaCy.
https://github.com/rangzen/mem0-graph
d3 flask mem0
Last synced: 1 day ago
JSON representation
Visualise mem0 memories as an interactive entity graph extracted with spaCy.
- Host: GitHub
- URL: https://github.com/rangzen/mem0-graph
- Owner: rangzen
- Created: 2026-02-20T10:15:38.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2026-02-20T10:27:08.000Z (5 months ago)
- Last Synced: 2026-05-15T21:18:57.460Z (about 2 months ago)
- Topics: d3, flask, mem0
- Language: HTML
- Homepage:
- Size: 180 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Agents: AGENTS.md
Awesome Lists containing this project
README
# mem0 Graph
Interactive entity graph for [mem0](https://mem0.ai) memories.

Fetches memories from the mem0 API, extracts named entities and relations with spaCy, and renders a force-directed graph in the browser.
## Disclaimer
This project is an independent community tool and is **not affiliated with, endorsed by, or related to mem0** in any way.
[mem0](https://mem0.ai) is a great product — if you find it useful, consider supporting them with a paid plan.
If you are looking for graph-native memory solutions, also check out [Zep](https://www.getzep.com) and their open-source [Graphiti](https://www.getzep.com) knowledge graph engine.
## Setup
```bash
cp .env.example .env
# Edit .env: set MEM0_API_KEY and (optionally) MEM0_DEFAULT_USER
uv venv --python 3.12
uv pip install -r requirements.txt
# Install the large spaCy model (recommended — better NER + noun chunk coverage)
uv pip install "en-core-web-lg @ https://github.com/explosion/spacy-models/releases/download/en_core_web_lg-3.8.0/en_core_web_lg-3.8.0-py3-none-any.whl"
# Or the small model if disk space is a concern
# uv pip install "en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.8.0/en_core_web_sm-3.8.0-py3-none-any.whl"
```
> Python 3.12 is required — spaCy is not yet compatible with 3.13+.
## Usage
```bash
# Fetch memories and extract entities → graph.json
uv run main.py fetch
# Filter to a specific user
uv run main.py fetch --user pipecat-demo-user
# Serve the graph at http://localhost:8080
uv run main.py serve
# Custom port
uv run main.py serve --port 9090
```
Re-run `fetch` whenever your mem0 memories change, then refresh the browser.
## How it works
1. **Fetch** — pulls entities from `GET /v1/entities/` and memories from `POST /v2/memories/`
2. **Extract** — three spaCy passes per memory:
- NER → named entities (PERSON, ORG, GPE, LOC, PRODUCT, EVENT…)
- Noun chunks → concepts not caught by NER (father, car, Cajun fries…)
- Adjectival complements → descriptors (sad, happy…)
- Dependency parsing → SVO relations between extracted nodes; co-occurrence fallback
3. **Save** — writes `graph.json`
4. **Serve** — Flask serves `graph.html` (D3.js force graph) at `/` and data at `/api/graph`
## Node types
| Colour | Label | Example |
|--------|-------|---------|
| Purple | Mem0 user / agent | pipecat-demo-user |
| Green | Person | Miss Donuts |
| Red | Organization | ORG |
| Amber | Location / GPE | Paris |
| Blue | Product / Event | — |
| Teal | Proper noun chunk | Five Guys |
| Dark blue | Concept (noun chunk) | father, car, nightmare |
| Light purple | Attribute (adjective) | sad |
| Grey | Memory category | health, food |
## Graph interaction
| Action | Effect |
|--------|--------|
| Drag node | Pins it in place |
| Double-click pinned node | Releases it back into the simulation |
| Scroll / trackpad pinch | Zoom |
| Drag background | Pan |
| Hover node or edge | Tooltip with details |