feat(memory.search): optional minScore RRF threshold
Closes the long-standing backlog item from abfa5463. memory.search now accepts an optional `minScore` parameter (Zod range 0..1) that drops hits below the given Reciprocal Rank Fusion score. Default behavior is unchanged — when minScore is unset, every fused result is returned, same as today. The original design memo suggested defaulting to 0.020, but that would exclude valid pure-semantic matches (one ranker at rank 1 = 1/61 ≈ 0.0164). Real-world Phase 2 testing surfaced exactly that case (the "expose TLS" → HAProxy memory hit). Shipping unfiltered-by-default and exposing the knob lets specific callers opt into stricter filtering (e.g. ~0.025 to require two rankers to fire at rank 1) without penalising legitimate semantic-only hits for the rest. Tool description updated; per-source rank breakdown remains the primary confidence signal for the model. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -90,6 +90,15 @@ export const MemorySearchInput = z.object({
|
||||
scope: MemoryScope.optional(),
|
||||
tags: z.array(z.string()).optional(),
|
||||
limit: z.number().int().min(1).max(50).default(10),
|
||||
/**
|
||||
* Minimum Reciprocal Rank Fusion score a result must clear to be
|
||||
* returned. Useful for stricter "high-confidence only" filtering — set
|
||||
* higher than 1/(60+1)≈0.0164 to exclude single-ranker-rank-1 matches
|
||||
* (semantic-only hits with no FTS/tag corroboration), or to ~0.03 to
|
||||
* require at least two rankers to fire at rank 1. Omit / set 0 for the
|
||||
* unfiltered default.
|
||||
*/
|
||||
minScore: z.number().min(0).max(1).optional(),
|
||||
});
|
||||
export type MemorySearchInput = z.infer<typeof MemorySearchInput>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user