Skip to content

[Feature Request] SQLite FTS5 search index for SQLiteMemoryStore #616

Description

@cagdasyurekli

Motivation

Currently, SQLiteMemoryStore.list() retrieves memories with a flat SELECT * FROM memories WHERE workspace = ?. As users accumulate memories over weeks of work, injecting all memory summaries into every prompt risks diluting model attention and consuming unnecessary context window tokens.

Proposed Solution

Leverage SQLite's built-in FTS5 (Full-Text Search) extension:

  1. Create a companion virtual table:
    CREATE VIRTUAL TABLE IF NOT EXISTS memories_fts USING fts5(content, summary, content=memories, content_rowid=id);
  2. Add a search(query: str, limit: int = 5) method to SQLiteMemoryStore using MATCH ? ORDER BY rank.
  3. Expose a memory_search(query: str) tool to the agent so it can query relevant facts on demand rather than loading all facts upfront.

Implementation Scope & Alignment

  • Scope: ~90–130 lines in coworker/memory/sqlite_store.py and coworker/memory/tools.py.
  • Zero New Dependencies: FTS5 is built into Python's standard library sqlite3.
  • Alignment: Keeps memory 100% local, performant, and lightweight without requiring external vector databases or heavyweight embedding services.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions