GraphMemo
# GraphMemo
GraphMemo gives MCP agents persistent memory across sessions. A text search
finds starting memories, and Relate follows relationships to retrieve context
that can contain entirely different words.
## Setup and run
Use Node.js 20 or newer on a platform supported by the native Relate SDK.
```sh
npm install --cache /tmp/npm-cache-relate
npm run demo
npm test
npm run test:mcp
npm start
```
The server uses the official MCP TypeScript SDK and communicates over stdio.
Configure your MCP host to launch the entry point directly. Replace the paths
in this example with absolute paths on your machine.
```json
{
"mcpServers": {
"graphmemo": {
"command": "node",
"args": ["/absolute/path/to/graphmemo/src/server.js"],
"env": {
"GRAPHMEMO_DB_PATH": "/absolute/path/to/data/graphmemo.rl"
}
}
}
}
```
The default database is `data/graphmemo.rl` relative to the process working
directory. Set `GRAPHMEMO_DB_PATH=:memory:` for a disposable session. Use one
server process per persistent database path and reuse the path across
sequential sessions. The server checkpoints persistent writes.
## Tools
| Tool | Arguments | Result |
| --- | --- | --- |
| `remember` | `text` (1–8,000 characters), optional `kind` (`fact`, `event`, or `preference`, defaults to `fact`) | Stored memory with UUID and creation time |
| `recall` | `query` (1–1,000 characters), optional `depth` (0–3, defaults to 2) and `limit` (1–50, defaults to 10) | Ordered `matches` with hop distance and path evidence for connected memories |
| `relate` | `fromId`, `toId`, and `kind` (1–80 characters) | Directed relationship between two existing memories. Repeating the same triple reuses the edge |
| `forget` | `id` | Whether the memory was deleted, along with its incident relationships |
| `health` | None | Whether a live database query succeeded, the backend, and whether storage is persistent |
The embedded database stores `Memory` nodes and directed `RELATED` edges.
The edge's `kind` property carries the supplied relationship label. Recall
starts with a case-insensitive substring search and expands from direct matches
using a bounded Cypher traversal in either direction. It returns direct
matches first, newest first, then each connected memory once by shortest hop
distance. Each expanded result includes `path.ids` in traversal order and
`path.kinds` in the corresponding edge order. Set `depth: 0` for text-only
recall.
## Demo and tests
`npm run demo` runs a scripted conversation against a temporary Relate database
using the same storage operations as the MCP tools. In the first process,
recall for “Mina” finds only the lunch booking. Two links connect that booking
to the Atlas team and its dietary requirement. A second process reopens the
database and recalls both connected memories, supporting the scripted answer
that Mina should look for a downtown venue with vegan options.
`npm test` verifies the Relate operations in memory. `npm run test:mcp` uses an
official MCP client over stdio and exercises tool discovery, validation, and
persistent recall across server restarts. See [REPORT.md](REPORT.md) for the
verification results from this workspace.
## License and AI-tool disclosure
GraphMemo is MIT licensed. Its embedded Relate dependency is Apache-2.0
licensed. [Relate license](https://github.com/relatedb/relate/blob/main/LICENSE)
OpenAI Codex was used to implement the server, tests, and demo, write the
documentation, and run local verification.
TDQS
Scored across 5 tools
Each tool has a clearly distinct purpose: remember stores, recall searches/traverses, relate connects memories, forget deletes, and health reports storage status. There is no meaningful overlap between the tools.
Four tools use consistent single-verb names (remember, recall, relate, forget), which are readable and predictable. The health tool is a noun rather than a verb, a minor deviation from the otherwise consistent pattern.
Five tools are well-scoped for a memory graph server, covering storage, retrieval, relationships, deletion, and health. Each tool earns its place without unnecessary surface area.
The set covers the core lifecycle: create, search/traverse, relate, and delete memories, plus health. A dedicated update/edit operation for existing memories is missing, but most workflows can be handled through the existing tools.