SQLite as a Graph Database: Recursive CTEs, Semantic Search, and Why We Ditched Neo4j
Knowledge graphs are having a moment. Every AI agent framework wants one. The typical stack looks like this: Neo4j for graph storage, OpenAI for extraction, Docker to run it all. Three moving parts...

Source: DEV Community
Knowledge graphs are having a moment. Every AI agent framework wants one. The typical stack looks like this: Neo4j for graph storage, OpenAI for extraction, Docker to run it all. Three moving parts, two network dependencies, one docker-compose.yml you'll fight with for an hour. We built ctxgraph to see how far you can get with just SQLite. The answer: surprisingly far. 0.800 combined F1 on extraction benchmarks, zero API calls, ~2 seconds for 50 episodes, single binary. No Docker. No API keys. No Neo4j. This post walks through the actual implementation: the schema, the recursive CTEs that make SQLite behave like a graph database, and the 3-mode search fusion that ties it together. The Problem: Too Much Infrastructure for a Knowledge Graph If you want a knowledge graph for your dev team today, the minimum viable stack is: Neo4j -- requires Docker or a managed instance An LLM API -- OpenAI, Anthropic, etc. for entity/relation extraction An embedding service -- for semantic search A vecto