feat: hotness blend scoring for retrieval pipeline#320
Merged
win4r merged 2 commits intoCortexReach:masterfrom Mar 23, 2026
Merged
feat: hotness blend scoring for retrieval pipeline#320win4r merged 2 commits intoCortexReach:masterfrom
win4r merged 2 commits intoCortexReach:masterfrom
Conversation
Adds access-frequency hotness scoring that blends into retrieval ranking. Frequently and recently accessed memories naturally float to the top. Formula: final = score * (1-alpha) + hotness * alpha where hotness = sigmoid(log1p(accessCount)) * exp(-decayRate * ageDays) Inspired by OpenViking memory_lifecycle.py hotness scoring. New: - computeHotnessScore() in access-tracker.ts - applyHotnessBlend() stage in retriever pipeline (after time decay, before noise filter) - hotnessWeight config (default: 0, 0.15 recommended) - 7 tests (all passing) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1. Wire applyHotnessBlend into ALL 3 retrieval paths (vectorOnly, bm25Only, hybrid) Previously only vectorOnly had it — hybrid users (the default) never saw the feature 2. Clamp hotnessWeight to [0,1] to prevent bad config from distorting scores Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.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.
Summary
final = score * (1-alpha) + hotness * alphawherehotness = sigmoid(log1p(accessCount)) * exp(-decayRate * ageDays)memory_lifecycle.pyhotness scoringChanges
src/access-tracker.ts: newcomputeHotnessScore()functionsrc/retriever.ts: newapplyHotnessBlend()stage +hotnessWeightconfig (default: 0, 0.15 recommended)test/hotness-blend.test.mjs: 7 testsConfig
{ "retrieval": { "hotnessWeight": 0.15 } }Test plan
🤖 Generated with Claude Code