π SQLite FTS5 β Full-Text Search
FTS5 (Full-Text Search version 5) is a SQLite module that turns the database into a full-text search engine. Zero configuration, zero servers, zero cost β just SQLite with supercharged search.
π Memory Schema
π‘ Why not embeddings + vector DB?
Vector databases are more accurate for semantic search, but add complexity and cost (embedding model + separate database). For a personal assistant with a consistent vocabulary, FTS5 + BM25 delivers excellent performance with zero complexity.
π BM25 β Relevance Ranking
BM25 (Best Match 25) is the ranking algorithm that SQLite FTS5 uses by default. It's the same algorithm used by Elasticsearch and Solr. Results in memories ranked by actual relevance, not by creation date.
π Query with BM25
π Two-Layer Memory System
The memory architecture solves the problem of context window: you can't put all the memory in the system prompt. The solution is 2 layers with distinct purposes.
π Layer 1: MEMORY.md
Static bootstrap facts. Always in the system prompt. Example: user name, tech stack, company, time zone.
π Layer 2: memory.db
Dynamic facts and history. Retrieved by relevance when needed. Can grow indefinitelyβonly the top 5 relevant items go into the context.
π· Memory Categories
Each entry in memory.db has a category that enables more precise searches. When Jarvis needs context, it filters by the category most relevant to the current question.
Facts About the User and the World
Preferences, settings, project information. E.g.: "User uses PostgreSQL 16 in production"
Important Conversation Excerpts
Decisions made and context for projects discussed. E.g.: "In 2026-04, we decided to use Redis for sessions"
Solutions That Worked
How problems were solved. Jarvis checks this before suggesting solutions. Example: "Slow Docker build β adding .dockerignore fixed it"
π Automatic Deduplication
Without deduplication, memory accumulates variations of the same fact. The store.py implements intelligent upsert: before saving, searches for similar facts and updates the existing one if the similarity is high.
π Deduplication Algorithm
π Automatic Compaction
Memory that grows without limits becomes slow to search. Automatic compaction periodically summarizes old entries into denser facts, preserving relevance without consuming space uncontrollably.
β What to Compact
- βConversations older than 30 days
- βRedundant facts about the same topic
- βHistory of old decisions
β What to Preserve
- βSolutions That Worked (High Value)
- βFundamental user preferences
- βFrequently accessed facts
β Module 2.3 Summary
Next Learning Path:
Track 3 β Zero-Trust Security: the most important track in the course