fix: filter distilled messages from temporal FTS search and purge worker boilerplate#261
Merged
Merged
Conversation
…ker boilerplate Temporal FTS search was hitting all 114K+ messages, but only ~14K undistilled ones are meaningful — the other 100K are already represented in distillation search results. Additionally, ~355 legacy worker boilerplate messages (curator/observer/reflector prompts averaging 100KB+ each, containing full conversation transcripts) were polluting keyword matches for virtually any domain query. Two fixes: 1. Add distilled=0 filter to search(), searchScored(), and searchLike() in temporal.ts — matches what vector search already does. Uses existing compound index for efficient filtering. 2. DB migration v20 purges legacy worker boilerplate messages that match known system prompt patterns (observer, curator, consolidation, reflector, eval).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AND m.distilled = 0filter to all temporal FTS search queries (search(),searchScored(),searchLike()) — matches what vector search already does, uses existing compound indexMotivation
Temporal FTS search was hitting all 114K+ messages, but only ~14K undistilled ones are meaningful for recall. The other 100K distilled messages are already represented in distillation search results, creating duplicate signal that dilutes results.
Additionally, ~355 legacy worker boilerplate messages (averaging 100KB+ each, with observer prompts up to 1.6MB containing full conversation transcripts) were polluting keyword matches for virtually any domain query. These came from older gateway/plugin worker calls that stored their full system prompts in temporal storage — a pattern that has since been fixed (no new boilerplate since May 9).
Combined with #260 (weighted RRF for vector search), this should significantly improve recall quality for multi-term semantic queries.