Add a persistent sqlite knowledge-vault backend#238
Merged
Conversation
A third VaultBackend implementation backed by the standard-library sqlite3 module — no extra dependencies, so it runs in CI (unlike the embedded-vector backend, whose optional deps are absent there). It conforms to the existing VaultBackend protocol and the frozen vault entry shape, and mirrors the in-memory backend's keyword retrieval byte-for-byte (LIKE prefilter, ranking done in Python) so results are deterministic and identical across environments. Storage is a single table with a forward-only versioned schema recorded in a small meta table; all SQL is parameterized. Keyword retrieval only, no embeddings. Wired into the backend factory behind a new "sqlite" option; the existing options are untouched. Tests mirror the in-memory contract plus persistence across reopening the same file. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the two dynamically-built statements (the upsert and the query prefilter) with static literals: a fixed-column INSERT ... ON CONFLICT, and a SELECT that reads the table (optionally narrowed by entry_type) with the scoring done in Python as before. Every value is still a bound parameter; this clears the shared gate's SQL-construction lint and is simpler — the keyword ranking still mirrors the in-memory backend. Declare the new test file in the file-budget ledger so it does not draw against the frozen tests/unit package total (the established pattern for new test coverage). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…backend # Conflicts: # file-budget.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A third
VaultBackendimplementation backed by the standard-librarysqlite3module — no new dependencies, so it runs in CI (unlike the embedded-vector backend, whose optional deps are absent there).VaultBackendprotocol and the frozen vault-entry shape."sqlite"option; existingmemory/lancedb/ fallback paths untouched.Tests
tests/unit/test_sqlite_vault.py— mirrors the in-memory contract (store → exists → query → get_by_source, round-trip fidelity, dedup-by-content-hash, upsert, limit, entry_type filter) plus persistence across reopening the same file path, idempotent schema on reopen, and factory wiring.Local sanity:
ruff check+ruff format --checkclean, protocol-doc citations 0 drift, vault tests green.🤖 Generated with Claude Code