fix: relax autoRecall skip on first turn of fresh session#123
Open
sinskl wants to merge 2 commits intoCortexReach:mainfrom
Open
fix: relax autoRecall skip on first turn of fresh session#123sinskl wants to merge 2 commits intoCortexReach:mainfrom
sinskl wants to merge 2 commits intoCortexReach:mainfrom
Conversation
added 2 commits
March 9, 2026 04:12
On the very first user message after a session restart, users often send low-signal continuations (emoji, '?', '继续', etc.). The existing shouldSkipRetrieval() logic suppresses retrieval for these, causing an apparent 'amnesia' moment at exactly the point where continuity recovery matters most. This commit: - Adds shouldSkipRetrievalFirstTurn() which only skips for truly non-user messages (empty, slash commands, heartbeat/system) - Updates orchestrateDynamicRecall() to detect first-turn (turnCounter=1) and use the relaxed check instead of the standard one Subsequent turns continue using the existing adaptive retrieval logic unchanged. Fixes win4r#101
…kip logic 27 test cases covering: - shouldSkipRetrieval() existing behavior (emoji, short msgs, greetings, continuations, slash cmds, memory-related queries, metadata stripping) - shouldSkipRetrievalFirstTurn() relaxed behavior (allows weak signals, still skips system/command/heartbeat/empty) - Contrast table: same weak-signal inputs produce different results between standard and first-turn variants
Contributor
|
Thanks — the continuity goal makes sense: first-turn weak signals after I do see a conflict with a recent fix on our side: system/control prompts must never trigger memory recall injection (for either generic auto-recall or reflection recall). The current
but it does not appear to preserve the newer control-prompt exclusions such as:
So in its current form, this may reintroduce control-prompt recall pollution on fresh-session turn 1. My suggestion:
|
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
Fixes #101 — fresh-session continuity break when the first user message is a weak signal (emoji,
?,继续, etc.).Problem
After a session restart, users often send low-signal continuation messages like
🤔,?,嗯, or继续. The existingshouldSkipRetrieval()suppresses autoRecall for these, causing the assistant to appear to "forget" the previous conversation at exactly the moment when continuity matters most.Changes
src/adaptive-retrieval.tsshouldSkipRetrievalFirstTurn()— a relaxed variant that only skips retrieval for truly non-user messages:/...)src/recall-engine.tsorchestrateDynamicRecall()now detects whether the current turn is the first turn of a fresh session (turnCounter === 1).shouldSkipRetrievalFirstTurn()(relaxed)shouldSkipRetrieval()(unchanged behavior)Why this is safe
autoRecall: trueflow.Testing
Verified locally that:
🤔→ autoRecall now fires (previously skipped)/status→ still correctly skipped