This decision record removed Graphiti the library but explicitly kept Neo4j the database. Neo4j was subsequently removed entirely — see ADR-0053. The body below is preserved as the historical decision record (code names removed for this public edition). The "Why Not Store Embeddings in Neo4j?" section's argument was reversed by ADR-0053 — read both for the full lineage.
ADR-0029: Remove Graphiti — Direct Neo4j Driver
Note: Neo4j was fully removed in March 2026 and replaced by a knowledge graph held in PostgreSQL. This ADR describes the intermediate step of replacing Graphiti with direct Neo4j access.
Date: 2026-02-13 | Status: Accepted | Extends: ADR-006 (extends, does not contradict it)
Context
We adopted Graphiti, a graph RAG library, early in development to manage the knowledge graph (Hogan et al., 2021). Over time, we replaced Graphiti's entity extraction with our own deterministic pipeline (regex + typed nodes + frozen taxonomy). The only remaining uses were:
- Neo4j driver wrapper — all services accessed Neo4j through the library's internal driver
- Tier 2 semantic search — a fallback path requiring OpenAI embeddings
Problems
-
Embedding model mismatch: Graphiti hardcodes OpenAI
text-embedding-3-small(1536-dim). Our pipeline uses Ollama BGE-M3 (1024-dim). Incompatible embedding spaces. -
Unnecessary OpenAI dependency: Graphiti requires an OpenAI API key even though our embedding pipeline runs locally via Ollama (free).
-
Dead code path: With the medical-only graph setting (default since ADR-014), Graphiti's episode-ingestion function is never called. With golden-only mode (ADR-0028), scope narrows further.
-
Tier 2 search adds no value: Typed node queries + taxonomy alias resolution cover all structured queries. Tier 2 was reached rarely and returned nothing useful.
-
Abstraction leak: Services accessed Neo4j through the library's internals, two levels deep.
Decision
Remove the Graphiti library dependency entirely. Replace with the official asynchronous Neo4j driver, managed by a simplified service class.
Separation of Concerns
| Capability | PostgreSQL + pgvector | Neo4j |
|---|---|---|
| Vector similarity search | Mature HNSW, production-proven | Newer, less optimized |
| BM25 keyword search | Native full-text search | Not supported |
| Metadata filtering | Natural SQL | Requires complex Cypher |
| Relationship traversal | Expensive JOINs | Native, O(1) per hop |
| Path queries | Impractical beyond 2-3 JOINs | Core strength |
What Changed
- A wrapper service around the Graphiti library is replaced by a thin service around the official Neo4j driver.
- Neo4j is reached through a single level of access instead of the library's internals.
- The OpenAI embedder in the Graphiti initialisation is removed; there are no embeddings in Neo4j.
- Tier 2 semantic search is removed, because typed queries cover all cases.
- Graphiti's episode ingestion is removed as dead code.
Consequences
Positive
- Removes OpenAI API key requirement for graph features
- Eliminates embedding model mismatch
- Simplifies initialization
- Removes ~200 lines of dead code
- Direct Neo4j driver access
- One less library to maintain
Negative
- Loses the option of Graphiti's LLM-based entity extraction (our regex + taxonomy pipeline is more reliable)
- Loses the option of semantic search over graph nodes (typed node Cypher + taxonomy cover all cases)