A universal, long-term project memory tool utilizing a local SQLite graph structure for AI agents.
Project description
Epistemic Graph Memory
A local SQLite graph database designed to track long-term state and structural context for AI coding agents.
Exposed via the Model Context Protocol (MCP), allowing agents (Claude Desktop, Cursor, Codex, OpenHands, Local Ollama agents, etc.) to query and update project blueprints synchronously.
Features
- AST Parsing (
ingest-code): Uses Tree-sitter to map local codebases into a node-edge graph hierarchy. Supports Python, TypeScript, JavaScript, Go, and Rust. - REST Summary Pipeline (
summarize-mocs): Auto-generates high-level module summaries via LLM APIs. - Trust-Weighted Graph: Employs trust scoring (
--trust) to segment deterministic facts from AI-generated assumptions. - Visualizations: Generates local HTML exports for inspecting graph state.
- SQLite FTS5: Backed by a standard
.agents/graph_memory.sqlitefile using FTS5 for query execution.
Installation
pip install epistemic-graph-memory[all]
Note: The [all] extra installs polyglot Tree-sitter AST bindings.
MCP Server Configuration
Standard MCP integration. Add the following to your AI framework's configuration:
{
"mcpServers": {
"graph-memory": {
"command": "graph-memory-mcp"
}
}
}
Quickstart
Initialize a codebase:
# 1. Map repository AST
graph-memory ingest-code ./src
# 2. Generate module summaries (Requires GEMINI_API_KEY)
export GEMINI_API_KEY="your_api_key_here"
graph-memory summarize-mocs
CLI Reference
The graph-memory CLI accesses the local database at .agents/graph_memory.sqlite.
# Ingest Code & Auto-Summarize
graph-memory ingest-code .
graph-memory summarize-mocs
# Add Entity / Relation
graph-memory add_node "Postgres_DB" "Database" '{"observations": ["Found in docker-compose."]}'
graph-memory add_relation "Server_VM" "HAS_DB" "Postgres_DB"
# Query
graph-memory get_node "Postgres_DB"
graph-memory search "Assumed based on backend"
# Maintenance & Export
graph-memory sweep
graph-memory export_html my_graph.html
To override the default database location:
export GRAPH_MEMORY_DB_PATH="/path/to/database.sqlite"
Advanced Schema (Agent Protocols)
Graph-Memory's --trust flag is augmented by enforcing a strict JSON metadata schema within the [attributes_json] field. When autonomous agents (Claude, Codex, Antigravity) log nodes and relations, they must standardize three core paradigms:
-
Multi-Agent Provenance & Tool Sourcing: Record who created the knowledge and where it came from.
{"created_by": "Claude", "source": "AST", "verified_by": "Human"}
-
Expanded Trust Protocol: Rather than just passing a flat
--trustfloat, agents inject deeper confidence metrics.{"confidence": 0.8, "verification_source": "pytest", "last_verified": "2026-07-20"}
-
Node Distinctions & Execution Workflows: Nodes must adhere to strict type ontologies to separate deterministic structure from history:
Fact_Node: Deterministic ground-truth (AST, Git, filesystem).Knowledge_Node: Architecture, Design decisions, LLM summaries.Episode_Node: Execution workflows, completed task sequences ("How was this bug fixed?"). Agents linkEpisode_Nodesteps usingFOLLOWED_BYedges.
Inspiration & Lineage
Graph-Memory was heavily inspired by the Open Knowledge Format (OKF).
What we adopted from OKF:
- The philosophy of a universal, vendor-neutral knowledge format for AI agents.
- The emphasis on explicit, graph-shaped relationships between concepts (rather than flat text).
Where we diverged:
- Storage: Instead of static Markdown files (which agents struggle to mutate safely), we use a true local SQLite graph database with FTS5 indexing.
- Ingestion: Instead of blind LLM extraction, we use deterministic AST parsing (Tree-sitter) to mathematically guarantee code structural accuracy.
- Verification: We implement explicit
--trustscoring in the SQL schema to isolate and quarantine AI hallucinations.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file epistemic_graph_memory-1.6.8.tar.gz.
File metadata
- Download URL: epistemic_graph_memory-1.6.8.tar.gz
- Upload date:
- Size: 19.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d74d26e0f2dbde04d6a45ba4b7fa5adfe70f3fb2e650daa205a4e55b011e71e
|
|
| MD5 |
f4a567118b0ccacb599f8f6ac77d4eaf
|
|
| BLAKE2b-256 |
c80476faa8e9bb9b9fa82bbb6da6218dc71936d52c0ba2d1c8bd0719c6a93c32
|
File details
Details for the file epistemic_graph_memory-1.6.8-py3-none-any.whl.
File metadata
- Download URL: epistemic_graph_memory-1.6.8-py3-none-any.whl
- Upload date:
- Size: 22.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32cd36b92c4a8b5dc2b579503ae554ef5e65c1827ca11475f58803733b8fcc94
|
|
| MD5 |
2586e04c33d64c416e15c7a981dc6c57
|
|
| BLAKE2b-256 |
369d698337f7bdd74ba5a0ec157512421a5ead9bd3cf842f8bc5d06c61e2d2b7
|