AI agents forget everything between sessions. GraphMemo gives them a long-term memory that is stored as a graph, not a flat list of text chunks.
GraphMemo is an MCP (Model Context Protocol) server backed by Relate, Neo4j's embedded graph database. It exposes five tools to any MCP host:
- remember — store a fact, event, or preference as a Memory node
- recall — find memories by text match, then follow stored relationships outward (bounded traversal, either direction), returning each connected memory with its hop distance and the exact path of relationships as evidence
- relate — draw a directed, labelled relationship between two memories
- forget — delete a memory and its relationships
- health — verify the database is live and whether storage is persistent
Why a graph matters: the most useful context often shares no words with the query. In the demo, the agent remembers "Mina is booking a team lunch." In a later session it is asked what Mina should look for. A text search alone finds only the booking. Because the booking was linked (Mina → member_of → Atlas → lunch_requirement → vegan options), recall traverses two hops and returns the team's dietary requirement — a memory whose text never mentions Mina or lunch — together with the relationship path that justifies it.
Relate runs embedded in the server process (no external database to deploy), persists to a single file that survives restarts, and answers the Cypher traversals in-process. The server is built on the official MCP TypeScript SDK over stdio.
Verification: store-layer tests (remember → recall → relate → changed recall, path evidence, depth-3 chains, literal-text safety) and an MCP stdio integration test (tool discovery, validation, persistent recall across server restarts) all pass. The scripted demo reopens the database in a second process to prove cross-session persistence.
AI-tool disclosure: OpenAI Codex was used to implement the server, tests, and demo and to write documentation, under human direction and verification.
Built With
- javascript
- mcp
- neo4j
- node.js
- relate
- zod