Make recall tuning knobs configurable (dedup threshold, RRF k)
Author: SK-DEV-AICreated Sep 11, 2026Updated Sep 16, 2026
Labelsenhancementtriage: needs-decisionautonomous: no
Make three hardcoded recall constants tunable
Three constants shape recall and dedup that operators will want to tune per deployment:
STORAGE_DEDUP_THRESHOLD = 0.85in memory.rs:394. The cosine gate at ingest, when a new memory is checked against what exists. Denser or sparser stores want different gates. Today changing it needs a patch.DUPLICATE_THRESHOLD = 0.90in memory_agent.rs:1031. The extraction time gate the sidecar duplicate check uses when auto extracted memories are compared against existing ones. Separate layer from the first: ingest dedups at 0.85, the extraction path at 0.90, and the two can drift silently.- RRF
k = 60in memory.rs:712. The rank fusion constant shaping BM25 vs dense balance.
My suggestion: agents.memory_dedup_threshold (default 0.85), agents.memory_extraction_dedup_threshold (default 0.90), and agents.memory_rrf_k (default 60), each with env overrides and fingerprint entries, following the existing reranking enabled pattern. Thresholds validated in (0, 1), k >= 1. No behavior change at defaults, no migration.
If two dedup gates feel like too much surface, the minimum useful version is RRF k plus one dedup knob that sets both. But the two layer split is the honest model of what the code does today.
No branch yet. Small follow up, happy to build it in the rerank config shape if wanted.
Source: 1jehuang/jcode