Repository navigation
feat(#352): salience + recency dual-axis recall ranking - #387
Merged
Merged
Conversation
Add two orthogonal, opt-in boost axes for recall: salience (mattering)
and recency (freshness). Both are computed from existing memory fields —
zero LLM.
Core (uteke-core):
- New salience_recency.rs module:
- salience_score(): 0..=1 blend of access_count, importance, pinned
- recency_score(): per-type exponential decay (exp(-age/half_life))
- type_half_life_days(): Decision/Preference 365d, Fact/Reference 180d,
Insight 240d, Event 30d, default 90d
- apply_boosts(): additive fusion of base score + salience + recency
- SalienceRecencyConfig with sanitized() clamp + is_noop() check
- Uteke::set_salience_recency_config() for per-query overrides
- Boosts applied AFTER recall cache lookup so cache stays time-independent
CLI (uteke-cli):
- --salience / --recency flags on 'recall'
- [recall] config: salience_weight (0.15), recency_weight (0.15)
Tests (+12 new):
- salience: zero access, pinned bonus, high access climbs, clamped to 1
- recency: brand new ~1, decays with age, per-type half-life ordering
- type_half_life: known types + unknown fallback
- apply_boosts: noop when weights zero, raises score when active
- config: sanitized() clamps, is_noop()
Closes #352
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-cli · BYOK · MIT |
CodeCora #387: set_salience_recency_config() mutates shared state on Uteke instance. In server / MCP mode where one Uteke instance serves multiple requests, a --salience / --recency override would leak into later recalls that didn't request those flags. Fix: add Uteke::reset_salience_recency_config() and call it after each recall_hybrid / recall_related / recall_at_time returns. The CLI recall command now resets the boost config as soon as the results are fetched, before any post-processing.
| } | ||
| }; | ||
|
|
||
| // #352: dual-axis salience/recency boost. Opt-in per query via |
CodeCora #387 noted: the recency formula uses exp(-age_days / half_life), which yields ~0.37 (1/e) at age_days == half_life. A true half-life yields 0.5 at that point. The math was intentional (exponential time constant), but the terminology was wrong. Fix: rename doc comments to 'time constant (τ)' and clarify that a true half-life would require multiplying by ln(2) ≈ 0.693. Function names unchanged for backward compat.
CodeCora #387: set_salience_recency_config() was called before the recall closure, but reset only ran on the success path. Early returns from parse_from_rfc3339 or '--at and --related' conflict left the boost config active on the shared Uteke instance. Fix: wrap recall logic in an IIFE closure that returns Result. The closure captures all ? early-return paths, then reset runs unconditionally before unwrapping the result. Also: CHANGELOG updated to use 'time constant (τ)' instead of 'half-life' for the recency decay formula.
ajianaz
added a commit
that referenced
this pull request
Aug 13, 2026
* feat(#352): salience + recency dual-axis recall ranking Add two orthogonal, opt-in boost axes for recall: salience (mattering) and recency (freshness). Both are computed from existing memory fields — zero LLM. Core (uteke-core): - New salience_recency.rs module: - salience_score(): 0..=1 blend of access_count, importance, pinned - recency_score(): per-type exponential decay (exp(-age/half_life)) - type_half_life_days(): Decision/Preference 365d, Fact/Reference 180d, Insight 240d, Event 30d, default 90d - apply_boosts(): additive fusion of base score + salience + recency - SalienceRecencyConfig with sanitized() clamp + is_noop() check - Uteke::set_salience_recency_config() for per-query overrides - Boosts applied AFTER recall cache lookup so cache stays time-independent CLI (uteke-cli): - --salience / --recency flags on 'recall' - [recall] config: salience_weight (0.15), recency_weight (0.15) Tests (+12 new): - salience: zero access, pinned bonus, high access climbs, clamped to 1 - recency: brand new ~1, decays with age, per-type half-life ordering - type_half_life: known types + unknown fallback - apply_boosts: noop when weights zero, raises score when active - config: sanitized() clamps, is_noop() Closes #352 * fix(#352): reset salience/recency config after each recall CodeCora #387: set_salience_recency_config() mutates shared state on Uteke instance. In server / MCP mode where one Uteke instance serves multiple requests, a --salience / --recency override would leak into later recalls that didn't request those flags. Fix: add Uteke::reset_salience_recency_config() and call it after each recall_hybrid / recall_related / recall_at_time returns. The CLI recall command now resets the boost config as soon as the results are fetched, before any post-processing. * docs(#352): clarify 'half-life' terminology (it's actually τ) CodeCora #387 noted: the recency formula uses exp(-age_days / half_life), which yields ~0.37 (1/e) at age_days == half_life. A true half-life yields 0.5 at that point. The math was intentional (exponential time constant), but the terminology was wrong. Fix: rename doc comments to 'time constant (τ)' and clarify that a true half-life would require multiplying by ln(2) ≈ 0.693. Function names unchanged for backward compat. * fix(#352): prevent boost config leak on recall error paths CodeCora #387: set_salience_recency_config() was called before the recall closure, but reset only ran on the success path. Early returns from parse_from_rfc3339 or '--at and --related' conflict left the boost config active on the shared Uteke instance. Fix: wrap recall logic in an IIFE closure that returns Result. The closure captures all ? early-return paths, then reset runs unconditionally before unwrapping the result. Also: CHANGELOG updated to use 'time constant (τ)' instead of 'half-life' for the recency decay formula.
This was referenced Nov 13, 2026
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.
Closes #352. See CHANGELOG entry for full details. All tests pass, clippy + fmt clean.