This repository was archived by the owner on Jan 2, 2026. It is now read-only.
feat: memory retrieval performance improvements (SPEC-2025-12-27-002)#35
Draft
feat: memory retrieval performance improvements (SPEC-2025-12-27-002)#35
Conversation
Add comprehensive specification for improving memory retrieval accuracy from 65% to 90%+ through hybrid search, entity indexing, temporal indexing, and LLM-powered query expansion. Key documents: - REQUIREMENTS.md: 4 P0, 4 P1, 3 P2 requirements - ARCHITECTURE.md: 5 new components, schema v5 - IMPLEMENTATION_PLAN.md: 5 phases, 21 tasks - DECISIONS.md: 10 ADRs including RRF, FTS5 BM25, spaCy 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Phase 1 - Foundation complete: Schema v5 Migration: - Add entities table for named entity storage - Add memory_entities junction table for entity-memory mapping - Add temporal_refs table for date references - Update migration logic to run on new databases RRF Fusion Engine (src/git_notes_memory/index/rrf_fusion.py): - Implement Reciprocal Rank Fusion algorithm (k=60 default) - Support configurable source weights - Track source contributions per result - 28 unit tests for edge cases and score calculations HybridSearchConfig (src/git_notes_memory/retrieval/config.py): - Frozen dataclass with all hybrid search settings - Environment variable loading with sensible defaults - Integration with RRFConfig for weight extraction - 23 unit tests for config loading Retrieval Module Scaffold: - New retrieval/ module with lazy imports - Factory function for config singleton Tests: 141 passing (90 index + 28 RRF + 23 config) Part of SPEC-2025-12-27-002: Memory Retrieval Performance Improvements Target: Improve benchmark accuracy from 65% to 90%+ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix B007 in rrf_fusion.py: rename unused loop variable to _source_name - Fix mypy type narrowing in config.py: explicit SearchMode cast 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Phase 2 implementation of memory retrieval improvements: - Task 2.1: HybridSearchEngine with parallel vector + BM25 search - Reciprocal Rank Fusion combining multiple strategies - Mode selection: hybrid, vector, bm25 - Configurable weights and RRF k parameter - Observability integration with metrics and tracing - Task 2.2: Extend SearchEngine with ranking methods - search_vector_ranked() returns (memory, rank, distance) - search_text_ranked() returns (memory, rank, bm25_score) - Ranks are 1-indexed for RRF compatibility - Task 2.3: Extend RecallService with hybrid parameters - search_hybrid() method for RRF-fused search - Lazy-initialized HybridSearchEngine - Thread-safe initialization with double-checked locking Tests: 74 passing (21 hybrid, 28 RRF, 25 config) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Improve memory retrieval accuracy from 65% (13/20) to 90%+ (18/20) through:
Implementation Plan
Total: 21 tasks, 10 ADRs
Test Plan
Related
docs/spec/active/2025-12-27-memory-retrieval-improvements/🤖 Generated with Claude Code