conversation-rag
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
conversation-rag (gbrain + Cross-Conversation Hybrid RAG)
A zero-VRAM, single-SQLite, zero-daemon dual-tier persistent memory engine and stdio MCP server for AI coding agents (Antigravity, Claude Code, Cursor, or any MCP client).
No Docker, no Neo4j, no Postgres, no SurrealDB, no Ollama required — just Python + 3 runtime packages (numpy, onnxruntime, tokenizers) and one WAL SQLite database (rag.sqlite).
Architecture
flowchart TB
A["Coding Agent (MCP stdio / CLI / Hooks)"] -->|"PreInvocation (<15 ms, stdlib SQLite)"| B["Above the Line: gbrain Living Memory"]
A -->|"Stop Hook (non-blocking incremental sync)"| C["Below the Line: Hybrid RAG Archive"]
A -->|"12 MCP Tools (read + write)"| D["conv_rag/mcp_server.py"]
subgraph SQLite["Single WAL SQLite DB (rag.sqlite — 0 MB GPU VRAM)"]
B["gbrain_entities + gbrain_facts (ONNX + FTS5)<br/>gbrain_links (multi-hop graph)<br/>gbrain_fact_history (append-only audit log)"]
C["conversations + chunks (turns, artifacts, checkpoints, scratch)<br/>FTS5 BM25 + CPU ONNX MiniLM + Reciprocal Rank Fusion"]
end
S["Write-Time Secret Guard (conv_rag/security.py)"] --> B
J["Git-Diffable JSONL Canon (export / validate / import)"] <--> B
D --> B
D --> C
D -.->|"Optional rag_ask synthesis"| L["Any OpenAI-Compatible Local/Remote LLM"]
U["Optional Read-Only Local Graph Explorer (conv-rag ui)"] --> SQLiteWhy Dual-Tier?
Above the Line (
gbrain): Current, conflict-free living truth per(entity, key)— decisions, verified benchmarks, repo paths, architectures, preferences, pitfalls — backed by:Append-only temporal history (
gbrain_fact_history): Every update or soft-forget archives the prior value withvalid_from/valid_totimestamps and reason. Nothing is silently overwritten.Trust-tier ranking:
user_stated>verified>agent_inferred.Write-time secret-leak guard (
conv_rag/security.py): Automatically blocks API keys, private keys, URL credentials, high-entropy opaque tokens, and optionalsecret-deny.txtliterals before anything touches SQLite.Multi-hop entity graph (
gbrain_links): Traverse 1–3 hop neighborhoods (gbrain_neighbors/conv-rag neighbors) directly in SQLite — no graph database server needed.Git-diffable JSONL canon (
conv_rag/canon.py): Export, schema+secret validate, and idempotently import living memory as plain UTF-8 JSONL (entities.jsonl,facts.jsonl,links.jsonl).Model-aware embedding fingerprints (
embedding_sha): Storessha256(model_id + "\n" + text)so swapping ONNX embedders re-embeds only stale rows viaconv-rag reembed.
Below the Line (Hybrid RAG): Automatic incremental indexing of past agent sessions (turns, markdown artifacts, compaction checkpoints, scratch files) searched via CPU ONNX
all-MiniLM-L6-v2+ SQLite FTS5 BM25 + Reciprocal Rank Fusion (1/(60+rank)).Strict Token-Budgeted
gbrain_context_pack: Packs Above-the-Line current truth first and Below-the-Line supporting excerpts second inside a configurable token cap (~20 ms,0 MBVRAM).
Related MCP server: Multi-Agent Memory MCP
Quickstart (30 seconds)
1. Install
git clone https://github.com/batteryphil/conversation-rag.git
cd conversation-rag
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"2. Try the included demo knowledge graph (no transcripts or GPU required)
# Validate schema, entity references, and secret-leak gates
conv-rag validate examples/demo_canon
# Import the demo canon into your local SQLite DB
conv-rag import examples/demo_canon
# Inspect living entities, multi-hop neighbors, and context pack
conv-rag entity
conv-rag entity orbital-cache
conv-rag neighbors edge-gateway --depth 2
conv-rag pack "SQLite WAL checkpoint pitfall" --facts-only
# Optional: launch the read-only localhost graph explorer (never auto-opens a browser)
conv-rag ui --port 83213. Enable CPU ONNX Semantic Embeddings (optional, 0 MB VRAM)
FTS5 BM25 works out of the box with zero downloads. To enable hybrid semantic + BM25 search on CPU (all-MiniLM-L6-v2, ~90 MB ONNX):
pip install -e ".[onnx-export]"
python scripts/export_minilm_onnx.py --download
conv-rag reembedOnce exported, torch and transformers are never imported at runtime — the MCP server and hooks run strictly on onnxruntime CPU + tokenizers + numpy.
12 MCP Tools (Stdio JSON-RPC 2.0)
Tool | Tier | Description |
| Above + Below | Compact, strict token-budgeted living truth + supporting RAG excerpts ( |
| Above | Record or supersede a living fact (write-time secret guard + automatic history archive) |
| Above | Soft-deprecate an outdated fact while keeping its Below-the-Line audit entry |
| Above | Inspect a compiled living entity card, links, and history (or list all entities) |
| Above | Connect two entities with a directional relationship |
| Above | Multi-hop SQLite BFS graph traversal ( |
| Below | CPU hybrid (ONNX semantic + FTS5 BM25 + RRF) search across indexed sessions |
| Above + Below | Grounded Q&A synthesized via any OpenAI-compatible LLM ( |
| Below | Drill into a session's overview, step range, markdown artifact, or indexed chunks |
| Below | Chronological catalog & filter across indexed sessions |
| Below | Lock-guarded incremental (or |
| System | Combined RAG + |
Connecting to Your Coding Agent
Generic MCP (Claude Code, Cursor, Windsurf, etc.)
Generate a ready-to-paste mcpServers block pointing at your virtualenv:
python scripts/install_plugin.py --print-mcp-jsonExample:
{
"mcpServers": {
"conversation-rag": {
"command": "/path/to/.venv/bin/python",
"args": ["-m", "conv_rag.mcp_server"],
"env": {
"HIP_VISIBLE_DEVICES": "",
"CUDA_VISIBLE_DEVICES": "",
"TOKENIZERS_PARALLELISM": "false",
"CONV_RAG_ONNX_THREADS": "8"
}
}
}
}Antigravity Plugin + Auto-Recall / Auto-Sync Hooks
Install the bundled portable plugin (includes <15 ms PreInvocation living-truth auto-recall and non-blocking Stop incremental sync):
python scripts/install_plugin.pyOptional LLM Synthesis (rag_ask)
rag_ask works with any OpenAI-compatible /v1/chat/completions server (local or remote) using stdlib urllib only. If unreachable, it gracefully falls back to returning structured cited excerpts.
Backend |
|
|
Ollama |
|
|
llama.cpp / vLLM / LM Studio |
| your served model ID |
PRIME-Quant |
|
|
OpenAI-compatible cloud API |
| set |
CLI Reference
# Living Memory (Above the Line)
conv-rag remember <entity> <key> "<content>" [--category decision] [--trust-tier verified]
conv-rag forget --entity <entity> --key <key> --reason "superseded"
conv-rag entity [name] [--no-history] [--json]
conv-rag link <source> <relationship> <target> [--note "..."]
conv-rag neighbors <entity> [--depth 2] [--json]
conv-rag pack "<query>" [--budget 600] [--facts-only]
conv-rag delta 2026-12-01
# Git-Diffable JSONL Canon & Maintenance
conv-rag export ./my-canon [--include-history]
conv-rag validate ./my-canon [--deny-file ~/.config/secret-deny.txt]
conv-rag import ./my-canon [--dry-run]
conv-rag reembed
# Cross-Conversation RAG (Below the Line)
conv-rag sync [--force] [--conversation-id <id>]
conv-rag search "<query>" [-k 8] [--mode hybrid|semantic|keyword]
conv-rag ask "<question>"
conv-rag list [-q "<filter>"]
conv-rag show <conversation_id> [--section overview|steps|artifact|chunks]
conv-rag stats
# Optional Read-Only Local Graph Explorer (127.0.0.1 only, never auto-opens browser)
conv-rag ui [--host 127.0.0.1] [--port 8321]Environment Variables
CONV_RAG_DATA_DIR— directory forrag.sqlite, ONNX model, andsecret-deny.txt(default:~/.gemini/antigravity/plugin_data/conversation-rag)CONV_RAG_ROOTS—os.pathsep-delimited list of conversation root directories to auto-indexCONV_RAG_EMBED_MODEL_ID— model identifier hashed intoembedding_sha(default:sentence-transformers/all-MiniLM-L6-v2)CONV_RAG_ONNX_THREADS— CPU threads for ONNXRuntime (default:8)CONV_RAG_SECRET_GUARD— set to0to disable write-time secret scanning (default:1)CONV_RAG_SECRET_DENY_FILE— path to optional line-delimited literal secret deny-list (never commit!)CONV_RAG_LLM_URL/CONV_RAG_LLM_MODEL/CONV_RAG_LLM_API_KEY— optional OpenAI-compatible synthesizer
Running Tests
HIP_VISIBLE_DEVICES="" CUDA_VISIBLE_DEVICES="" pytest -vAll tests run 100% offline on CPU in ~1 second (no Docker, no GPU, no external databases).
Credits & License
Licensed under the MIT License — see LICENSE.
The write-time secret-leak scanner (
conv_rag/security.py), git-diffable JSONL canon validation workflow (conv_rag/canon.py), model-awareembedding_shainvalidation (conv_rag/embedder.py), and stdlib-only read-only local graph explorer (conv_rag/ui_server.py) were inspired by Keutonim/Synapse (MIT License), re-engineered natively for zero-daemon SQLite.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
Related MCP Connectors
Persistent memory, hybrid search and a goal graph for AI agents, over stdio or remote HTTP.
Persistent memory for AI agents across Claude, ChatGPT and any MCP client.
Persistent memory for AI agents, for code, research and everyday life. Stale facts retire.
Persistent, inspectable memory for AI agents with lineage, correction, and a hosted MCP endpoint.
Related MCP Servers
- AlicenseAqualityBmaintenancePersistent long-term memory for AI coding assistants. Local SQLite, no cloud - 16 MCP tools to store, search, relate, and consolidate typed memories with a confidence lifecycle, hybrid BM25 + semantic search, namespaces, a knowledge graph, and a built-in OS keychain credential vault.248MIT
- AlicenseNot gradedqualityBmaintenanceProvides local-first persistent memory with a typed knowledge graph and bounded multi-hop retrieval via MCP, letting coding agents and local LLM systems store, search, and recall facts across sessions without hosted services or model dependencies.MIT
- FlicenseNot gradedqualityBmaintenanceEnables agents to store conversational turns in a single SQLite store and recall relevant context through lexical, entity, dense, and recent views without an LLM in the recall loop. It exposes MCP tools for remembering, bulk ingest, recall, stats, and session deletion, with persistent indexes and zero-token maintenance.-
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to store and recall durable facts, decisions, and lessons over MCP using hybrid semantic and keyword search, typed memories, graph relations, sessions, and time-travel queries. Runs locally with no server process or API key, persisting everything to files that both agents and a CLI can share.14 npmMIT