AI Agent memory search using SQLite FTS5. 90%+ token reduction (10x+) compared to reading full files. Use when the agent needs to search through markdown mem...
FTS5-based memory search for AI Agents. Index markdown files once, search with 90%+ token savings.
python3 scripts/build-index.py <memory_dir> <db_path>
Example:
python3 scripts/build-index.py ./memory ./memory.db
This creates a SQLite database with FTS5 full-text index of all .md files in the directory (recursive).
python3 scripts/search.py <query> [limit] [db_path]
Example:
python3 scripts/search.py "Physical AI roadmap" 5
python3 scripts/search.py "project timeline" 10 ./memory.db
Default limit: 10. Default db_path: ./memory.db
Output: matching snippets with file paths and relevance scores.
Run build-index.py again. It rebuilds the index from scratch (fast, <1 second for typical workspaces).
FTS5 is keyword-based. Improve results by:
"Physical AI"Run benchmarks yourself:
python3 scripts/benchmark-recall.py # Recall@5, Recall@10
python3 scripts/benchmark-cache.py # Warm vs cold cache
CREATE VIRTUAL TABLE memory_fts USING fts5(path, content);
Direct SQL access:
sqlite3 memory.db "SELECT path, snippet(memory_fts, 1, '<b>', '</b>', '...', 32) FROM memory_fts WHERE memory_fts MATCH 'query' ORDER BY rank LIMIT 5;"
ZIP package — ready to use