Search mail with a full-text index

Search used to scan every stored message with LIKE, and the app only
matched what its list had loaded: senders, subjects and snippets, never
the full text. The store now keeps an SQLite FTS5 index of each
message's sender, recipients, subject and text. Upgrading the database
fills it from the mail already stored, and triggers keep it in step.
Words match the start of words, ignoring case and accents ("invo" finds
"Invoice", "cafe" finds "Café"), "quoted words" must appear together,
and every word has to be there. Results stay newest first.

The search field and smart folders ask the index through a new
search_messages command and use its answer for their free text; from:,
has:attachment, is:unread and date:today still filter in the UI. Until
the index answers, and in the demo, they match the loaded messages as
before. The agents' search_messages tool uses the index too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
a98e138349Michael Rodriguez committed on 10/23/2026, 9:27:53 PMparent2729a4e
12 files changedLine totals unavailable