tonydzi

Sqlite Graph Memory — AI skill for Claude Code

AI community

Graph RAG on SQLite for AI agents: vector retrieval + hand-curated wikilink graph + cross-encoder rerank, with a zero-token per-turn memory ledger.

How to install Sqlite Graph Memory

This entry records only its repository, not the path inside it, so there is no exact command to give. Open tonydzi/sqlite-graph-memory and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Sqlite Graph Memory does

Graph RAG on SQLite for AI agents: vector retrieval + hand-curated wikilink graph + cross-encoder rerank, with a zero-token per-turn memory ledger. Working pilot.

Alternatives in AI

  • Surface — Show ranked attack surface for a target from its recon manifest + hunt memory 3.8k ★
  • Nocturne Memory — A lightweight, rollbackable, and visual Long-Term Memory Server for MCP Agents 1.3k ★
  • Memory Lancedb Pro — Production-grade long-term memory system (v1.1.0-beta.8) for OpenClaw AI agents 222 ★

README

sqlite-graph-memory

**Graph RAG on SQLite for AI agents — a working pilot, not a framework.**

The extracted memory layer of a personal "second brain" agent setup: three small Python scripts — `index_notes.py`, `brain_ask.py`, `turnstate_hook.py` — that give an LLM agent *associative* recall over a folder of markdown notes. SQLite is the only database ([`schema.sql`](schema.sql)) and `[[wikilinks]]` are the graph.

Status: **pilot**, and the word is load-bearing: it runs daily in one real setup (a ~100k-note Obsidian vault driven by Claude Code), but it is deliberately minimal, has no tests, and makes no attempt to be general — see [What's intentionally missing](#whats-intentionally-missing). Published as the companion code for an upcoming write-up on lightweight Graph RAG for agents; the one design note that is already written is [`docs/bitemporal.md`](docs/bitemporal.md).

Why

Most Graph RAG stacks assume a graph database, an ETL pipeline, and an entity-extraction pass — HippoRAG ([arXiv:2405.14831](https://arxiv.org/abs/2405.14831)) derives its KG that way, and Graphiti/Zep maintain a temporal one. For a single-user agent over a markdown knowledge base, all three are overkill:

  • The graph already exists — Obsidian/Logseq/plain-markdown users hand-curate their edges as [[wikilinks]], and brain_ask.py just parses them. No extraction pass, and edge quality beats anything a model would mine.
  • SQLite is enough — the only things worth persisting are derived state (a per-turn ledger) and telemetry, and both are defined in `schema.sql`. One file, stdlib driver, zero ops.
  • The expensive part of RAG quality is a reranker, not graph infrastructure — see the rerank step in brain_ask.py.

So the pilot's bet: *vector retrieval for entry points, hand-curated wikilinks for association, a cross-encoder to keep serendipity honest, SQLite for everything that must persist.* All four steps live in one file, `brain_ask.py`, in that o