Repository navigation
fix(memory): turn recall no longer recalls the current session's turns - #468
Merged
Merged
Conversation
Each turn's recall searched every indexed session turn, including the session asking. Its earlier turns are already in the request, so they came back as "Past sessions" duplicates, and in a long session they crowded real past sessions out of session_top_k. The current session id now goes into recall and its turns are dropped before top_k is applied. bench_tokens.py --workload dev: turn-3 recall 817 -> 616 tokens. The session total moves within run-to-run recall noise. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
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.
Problem
Turn recall searched every indexed session turn, including the session that is asking. In
bench_tokens.py --workload dev, turn 3's<recalled-context>carried this session's own turn 2 and turn 1 under "Past sessions": text already in the request. In a long session those near-identical hits also push real past sessions out ofsession_top_k.Fix
recall_turn_context/build_recall_blocktake the current session id (CLI and TUI passsession.id).top_kis applied, so the slots go to other sessions.build_inject_blockand thememory searchcommand are unchanged (no current session).Effect
--workload dev(release, o200k): turn-3 recall block 817 → 616 tokens. The session total (248,340 → 249,499) moves within run-to-run noise: turn 2's code recall picked different chunks this run. This is mainly a duplicate-context and recall-quality fix, not a large token win.Checks
cargo test -p whycodes-memory --lib(89;session_turn_search_and_injectnow covers own-session skip and another session still recalled)cmd::helpers::(cli) andrun::persist::(tui) tests; clippy (memory, cli, tui); fmt; ratchets🤖 Generated with Claude Code