Field notes
Local-first MCP memory with SQLite FTS5: why we skipped vector databases
How a zero-cloud SQLite FTS5 MCP server gives coding agents fast, deterministic, byte-budgeted memory across Claude Code, Codex, and Antigravity — without embedding drift or hosted infra.
When teams add persistent memory to an AI agent over the Model Context Protocol (MCP), the default blueprint is almost always the same: spin up a managed vector database, pay an embedding API on every write, and stuff top-k cosine-similarity chunks into the prompt.
For developer tooling and operational agents, that architecture creates three headaches fast:
- Silent precision loss on exact identifiers. Function names, error codes (
GS_409), migration numbers, and file paths do not behave like prose. Embeddings blur exact symbols together, returning plausible-looking paragraphs instead of the exact invariant that failed last week. - Context bloat. Unbounded semantic chunks quietly eat thousands of tokens per tool call, crowding out the actual source files the agent needs to edit.
- Cloud fragility and privacy friction. Sending proprietary architecture notes, post-mortems, and incident transcripts to a third-party hosted index is a non-starter for many engineering teams.
When I built the memory hub inside iron-stack, I went the opposite direction: zero cloud, one local SQLite file, FTS5 full-text search, and strict byte budgets on every MCP response.
Why SQLite FTS5 wins for engineering memory
Engineering knowledge is mostly structured decisions, exact error strings, module relationships, and verified fixes. SQLite FTS5 with BM25 ranking is built specifically for that shape of data:
- Exact symbol lookup works out of the box. Searching for a specific error code, table name, or crate boundary hits the exact record every time — no embedding model version drift, no re-indexing bill when a provider deprecates an API.
- Sub-millisecond local latency. The database lives on local disk in WAL mode. Queries return in milliseconds with zero network hops and work offline.
- Trivial backup and inspection. A memory store that is just a SQLite file can be inspected with standard SQL, backed up with a single file copy, and shared across multiple agent harnesses (Claude Code, Codex, and Antigravity) on the same workstation.
Byte-budgeted MCP responses
The highest-leverage feature in our MCP memory server is not ranking — it is bounded output.
Every memory_search call returns compact, scored summaries under a strict byte ceiling rather than dumping full documents into the agent’s context. Only when the agent confirms a hit is relevant does it call memory_get on the specific record ID or traverse memory_related edges in the system graph.
1. memory_search(query) ──▶ compact ranked index (strict byte cap)
2. memory_get(id) ──▶ full verified record only when needed
3. memory_related(id) ──▶ explicit links (bugs ↔ modules ↔ invariants)
That two-step pull pattern keeps idle context tiny while still giving the agent instant access to months of accumulated operational history.
Pairing MCP memory with deterministic browser verification
Memory tells an agent what broke before; live browser verification proves whether the fix actually holds.
Inside the same iron-stack ecosystem, iron-browser exposes a dual-viewport Chromium developer browser over MCP — giving agents structured access to console errors, network failures, screenshots, layout metrics, and WebGL/performance traces without brittle ad-hoc scripts.
Together, the loop closes cleanly:
- Retrieve prior architectural invariants from SQLite FTS5 before touching code.
- Enforce tool-call boundaries via claude-harness.
- Verify UI, network, and runtime behavior on a real browser surface over MCP.
- Record verified root causes back into local memory so the next session never repeats the same mistake.
When you actually do need vectors (and when you do not)
Vector search still makes sense for fuzzy, multi-language consumer knowledge bases where users never know the exact terminology. But for developer workflows, internal ops runbooks, incident history, and MCP tooling, SQLite FTS5 + explicit graph edges + strict response byte budgets is simpler, faster, cheaper, and dramatically more predictable.
The full stack is open source under MIT at github.com/arielonoriaga/iron-stack. If your team is designing or hardening an MCP server or agent memory layer, see my 5-day AI Agent & MCP Hardening Sprint.