Skip to content

feat: hotness blend scoring for retrieval pipeline#320

Merged
win4r merged 2 commits intoCortexReach:masterfrom
AliceLJY:feat/hotness-blend
Mar 23, 2026
Merged

feat: hotness blend scoring for retrieval pipeline#320
win4r merged 2 commits intoCortexReach:masterfrom
AliceLJY:feat/hotness-blend

Conversation

@AliceLJY
Copy link
Collaborator

Summary

  • Adds access-frequency hotness scoring that blends into retrieval ranking
  • Frequently and recently accessed memories naturally float higher in results
  • Formula: final = score * (1-alpha) + hotness * alpha where hotness = sigmoid(log1p(accessCount)) * exp(-decayRate * ageDays)
  • Inspired by OpenViking memory_lifecycle.py hotness scoring

Changes

  • src/access-tracker.ts: new computeHotnessScore() function
  • src/retriever.ts: new applyHotnessBlend() stage + hotnessWeight config (default: 0, 0.15 recommended)
  • test/hotness-blend.test.mjs: 7 tests

Config

{ "retrieval": { "hotnessWeight": 0.15 } }

Test plan

  • 7 unit tests for hotness scoring (frequency, recency, decay, bounds)
  • Manual test: verify frequently recalled memories rank higher

🤖 Generated with Claude Code

AliceLJY and others added 2 commits March 23, 2026 19:06
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>
@win4r win4r merged commit 4c390b7 into CortexReach:master Mar 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants