agent-knowledge-graph
CLI + Python library for persistent graph-based memory for AI agents. Ingests sessions into Neo4j, extracts entities via LLM, embeds locally with sentence-transformers, and supports semantic/traversal/NL→Cypher queries via 4 agent adapters.
agent-knowledge-graph
Local-first, graph-native memory for AI agents — running entirely on your machine.
Your AI agent’s sessions — the conversations, tool calls, decisions, and outcomes — are trapped in flat transcript logs. You can scroll back manually, but you can’t ask “What did we decide about Redis deployment?” and get a structured answer.
agent-knowledge-graph solves this by ingesting sessions into a Neo4j property graph, extracting structured knowledge (entities, relations, decisions, tools) via LLM, augmenting nodes with local vector embeddings, and exposing natural-language query flows.
Quick Start
git clone https://github.com/vikasudasi/agent-knowledge-graph.git
cd agent-knowledge-graph
uv sync
docker compose up -d
uv run kg init
uv run kg build run all
uv run kg query ask "What do I know?"
Architecture
The four-phase pipeline framework makes it easy to add new data sources:
- Extract — Read raw records from a source (Hermes session DB, files, APIs)
- Resolve — Enrich records via LLM into typed
Resourcenodes - Embed — Generate 384-dimension vectors locally using
all-MiniLM-L6-v2 - Write — Upsert nodes + relationships to Neo4j with checkpoint tracking
Features
- Typed graph storage — 8 node types (session, person, project, tool, concept, file, task, artifact) with 8 relationship types
- Local embeddings —
sentence-transformerson-device, zero API costs, LRU-cached - 4 query modes — Semantic, traversal, hybrid, and NL→Cypher (LLM-generated Cypher)
- Modern Neo4j SEARCH clause — Native in-index vector filtering (Neo4j 2026.x)
- 4 agent adapters — Hermes plugin (4 MCP tools), MCP server, LangChain tools, CLI
- Incremental pipelines — Checkpoint-based idempotent runs
- 147 tests, 86% coverage