Skip to content

fix(memory): warm the store on session init so the first message enriches - #24

Merged
stretchcloud merged 1 commit into
mainfrom
fix/memory-warm-start
Jul 7, 2026
Merged

fix(memory): warm the store on session init so the first message enriches#24
stretchcloud merged 1 commit into
mainfrom
fix/memory-warm-start

Conversation

@stretchcloud

Copy link
Copy Markdown
Owner

Problem

Memory enrichment has a 250 ms budget and gracefully passes the original message through if it exceeds it (so chat never blocks). The very first enrichment query in a fresh server process pays the LanceDB connect + table-open cost (~230 ms measured), which tips over budget — so the first user message in a session was never enriched (no recalled-context chip), even though every subsequent message was.

Fix

When a session becomes ready, fire a reinforcement-free warm-up (opens the fragments + consolidated tables) off the hot path. Routed through the collective-intelligence layer to keep the ws-bridge↔store boundary clean, matching how enrichment is wired.

Result (measured)

  • warmMemory at session init: ~90 ms, off the hot path (fire-and-forget)
  • first enrichment after warm: ~24 ms (was ~238 ms cold) → first message now enriches within budget

Testing

  • 1634/1634 tests green (4 new: warm opens tables without throwing, warm does not reinforce, CI delegate + best-effort rejection); typecheck + build clean

…ches

Cold-start: the first enrichment query in a fresh process paid the LanceDB
connect+open cost (~230ms), tipping over the 250ms budget so the enrichment
hook gracefully passed the message through with no recalled context.

Warm the fragments/consolidated tables (reinforcement-free, fire-and-forget)
when a session becomes ready. Measured: first enrichment after warm ~24ms vs
~238ms cold, so the recalled-context chip now shows on the first message.
@stretchcloud
stretchcloud merged commit 5e3001b into main Jul 7, 2026
1 check passed
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.

1 participant