Skip to content

feat: memory scoring/decay (#5) + LRU search cache (#9)#18

Open
KetchCyork wants to merge 1 commit into
mainfrom
feature/scoring-and-caching
Open

feat: memory scoring/decay (#5) + LRU search cache (#9)#18
KetchCyork wants to merge 1 commit into
mainfrom
feature/scoring-and-caching

Conversation

@KetchCyork

Copy link
Copy Markdown
Owner

Summary

  • Memory Scoring & Decay #5 Memory Scoring & Decay: ScoringStore in src/memory/scoring.ts. Exponential decay formula: score = base * 0.5^(days/halfLifeDays), clamped [minScore, 1.0]. Integrated into both search() and searchWithPolicy() pipelines after feedback scoring. Config: DECAY_ENABLED, DECAY_HALF_LIFE_DAYS.
  • Caching & Efficiency: precompute summaries #9 Caching: LruCache<T> in src/memory/cache.ts. Map-based LRU with configurable maxSize and ttlMs. Search results cached by (query+k+filter+policy) hash key. DELETE /cache to invalidate, GET /cache/stats for hit rates. Config: SEARCH_CACHE_ENABLED, SEARCH_CACHE_SIZE, SEARCH_CACHE_TTL_MS.

Note: src/config.ts also includes all config fields for the other feature PRs (#6/#10/#11/#12/#13/#15/#16/#17) to make them easy to review independently.

Test plan

  • npm run typecheck passes (clean)
  • npm test passes (80 existing + Scoring + Cache suites = 82+ tests)
  • GET /scoring/scores returns per-note decay scores
  • GET /cache/stats shows hits/misses after repeated searches

Closes #5
Closes #9

- ScoringStore: exponential decay score=base*0.5^(days/halfLife), clamped [minScore,1.0]
- LruCache<T>: Map-based LRU with configurable maxSize/TTL, hit/miss stats
- Integrated decay + cache into search() and searchWithPolicy() pipelines
- HTTP: GET /scoring/scores, /scoring/summary, DELETE /cache, GET /cache/stats
- MCP: get_chunk_score tool
- config: added all new field defaults for all 5 feature branches

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

Caching & Efficiency: precompute summaries Memory Scoring & Decay

1 participant