feat(memory): add task-relevance ranking with boost tags and min relevance filter#89
Merged
Merged
Conversation
…vance filter - Add BoostTags field to RecallRequest for tag-based relevance boosting - Add TaskContext field for source-matching relevance boost - Add MinRelevance field to filter low-scoring results - Relevance scores clamped to [0, 1] - 6 new tests: boost tags, min relevance, task context, clamping, no-op Closes #78 Co-authored-by: Ona <no-reply@ona.com>
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.
What
Adds task-aware relevance ranking to memory recall. Callers can now boost specific tags, provide task context for source matching, and filter out low-relevance results.
Why
As memory grows, the signal-to-noise ratio degrades. Returning everything that's semantically similar isn't enough — the agent needs context ranked by what matters for the current task, not just what exists.
Changes
New
RecallRequestfieldsboost_tags— tags that receive a +0.1 relevance boost during rankingtask_context— free-text task description; memories whose source matches get a +0.05 boostmin_relevance— filter threshold (0-1); memories below this score are excluded from resultsRanking formula
Tests
6 new tests: boost tags tipping ranking, min relevance filtering, zero min (no filter), task context source boost, relevance clamping, empty boost (no effect).
Usage
Closes #78