Skip to content

Evaluate sqlite-vec as a vector index behind the existing search API #22

Description

@himanshu231204

Problem

Every search scores every row. That's exact — no recall loss from approximate indexing — and deliberate. But it's linear, and a shared or long-lived memory store will eventually find the ceiling.

Blocked on #21. Don't start here until the benchmarks exist. If embedding time dominates scoring time, an index buys nothing and this issue should be closed as unnecessary.

What to investigate

sqlite-vec is the natural candidate: it's a SQLite extension, so it holds the one-file property that makes this project what it is. A separate vector database is an explicit non-goal.

Acceptance criteria

  • Benchmarks from Build a benchmark harness for store and search at 1k / 10k / 100k memories #21 showing scoring time actually dominates — otherwise close this
  • Index sits behind the existing MemoryStore.search() signature. The public API must not change to accommodate a storage strategy
  • Recall measured against the current exact scan, not assumed. Report how often top-5 results differ
  • Graceful fallback when the extension isn't available — a pip install that can't load it must still work, exactly as FTS5 already degrades to pure vector search
  • The hybrid keyword bonus still applies; this changes candidate generation, not scoring semantics
  • Migration path for existing databases — vectors are already stored, so this should be index construction, not re-embedding
  • Install footprint measured. Install-to-working under 30 seconds is a project goal

Why this needs discussion first

Three things could make this the wrong call:

  1. Recall loss. For memory, a missed result isn't a slightly worse search — it's the agent confidently saying it doesn't know something it was told.
  2. Install weight. A platform-specific binary extension complicates the "pip install and it works" story on every OS the CI matrix covers.
  3. Complexity. An index needs maintaining, rebuilding, and invalidating on model change. The current design has none of that.

Please comment with findings before writing much code.

Pointers

  • src/localmem_mcp/store.pysearch() and _keyword_hits(); the FTS5 try/except fallback is the pattern to copy for optional-extension handling
  • ROADMAP.md — 0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds discussionDirection isn't settled — comment before buildingperformanceSpeed, memory use, scalingv0.3: scaleBenchmarks, vector index, batch embedding

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions