Skip to content

fix: relax autoRecall skip on first turn of fresh session#123

Open
sinskl wants to merge 2 commits intoCortexReach:mainfrom
sinskl:fix/fresh-session-continuity-recall
Open

fix: relax autoRecall skip on first turn of fresh session#123
sinskl wants to merge 2 commits intoCortexReach:mainfrom
sinskl:fix/fresh-session-continuity-recall

Conversation

@sinskl
Copy link

@sinskl sinskl commented Mar 8, 2026

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 existing shouldSkipRetrieval() 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.ts

  • Added shouldSkipRetrievalFirstTurn() — a relaxed variant that only skips retrieval for truly non-user messages:
    • Empty / whitespace-only
    • Slash commands (/...)
    • Heartbeat / system messages
  • All other messages (including short text, pure emoji, affirmations) are allowed through on the first turn.

src/recall-engine.ts

  • orchestrateDynamicRecall() now detects whether the current turn is the first turn of a fresh session (turnCounter === 1).
  • First turn → uses shouldSkipRetrievalFirstTurn() (relaxed)
  • Subsequent turns → uses shouldSkipRetrieval() (unchanged behavior)

Why this is safe

  • The relaxed logic only applies to turn 1 of a fresh session. All subsequent turns use the existing adaptive retrieval logic unchanged.
  • The only messages skipped on first turn are system/infrastructure messages that would never need continuity recovery.
  • No new config options needed — this is a behavioral improvement within the existing autoRecall: true flow.

Testing

Verified locally that:

  1. Fresh session + 🤔 → autoRecall now fires (previously skipped)
  2. Fresh session + /status → still correctly skipped
  3. Turn 2+ with weak messages → still uses standard skip logic (no behavior change)

Yuezl 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
@furedericca-lab
Copy link
Contributor

Thanks — the continuity goal makes sense: first-turn weak signals after /new or /reset should not make the assistant feel like it forgot everything.

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 shouldSkipRetrievalFirstTurn() looks too permissive because it only skips:

  • empty input
  • slash commands
  • heartbeat
  • [System]...

but it does not appear to preserve the newer control-prompt exclusions such as:

  • session-start boilerplate (A new session was started via /new or /reset)
  • Execute your Session Startup sequence now
  • wrapped /note handoff/control prompts

So in its current form, this may reintroduce control-prompt recall pollution on fresh-session turn 1.

My suggestion:

  1. keep the first-turn relaxation for genuine weak user signals (🤔, ?, 继续, , etc.)
  2. factor system/control exclusions into a shared skip gate that both standard and first-turn paths must respect
  3. add integration tests proving the same control prompt is skipped by both generic auto-recall and reflection recall
  4. add first-turn tests proving weak user signals are allowed without allowing startup/control wrappers through
  5. ensure the new tests are actually included in the main test command / CI path

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.

Fresh-session continuity break: weak first message (e.g. 🤔) skips autoRecall after restart

2 participants