memorix icon indicating copy to clipboard operation
memorix copied to clipboard

First memorix_session_start still takes 15-28s on 40k+ stores

Open RaviTharuma opened this issue 3 months ago • 2 comments

Description

After /health and MCP initialize are fast, the first memorix_session_start (and CLI memory store) still takes 15–28s on a 40k–52k observation store. That is initObservations → loadAll() + lexical hydrate for the tool, not a hang.

Subsequent search/detail on the same HTTP process are milliseconds. The first tool in a cold control plane still feels broken to agents (Cursor / Claude / OpenCode timeouts of 10–15s).

Steps to Reproduce

  1. Restart memorix background start on a 40k+ store.
  2. Confirm /health < 100ms and initialize < 200ms.
  3. Call memorix_session_start with a real projectRoot.
  4. Time the tool.

Expected Behavior

Session start returns a continuation card without loading the full corpus on the request path, or hydrate is chunked so a 10s client timeout still succeeds.

Actual Behavior

Measured 2026-08-17:

Host First session_start
MacBook 16 (~44k obs) 14.2s (E2E)
MacBook 13 (~52k obs) 27.6s (probe after restart)
Linux dev-001 E2E session_start passed (same order of magnitude)

Environment

  • Memorix 1.6.0 + #214 patches
  • Jina Omni embeddings configured (not used on this path if quality=fast)

Additional Context

This remains after #214. Do not "fix" it by setting formation=shadow or skipping session_start. Need a write/read path that does not loadAll() 40k rows on the first MCP tool.

Related: hook loadAll issue, #27, #198, #214.

RaviTharuma avatar Aug 17 '26 13:08 RaviTharuma

Implementation is in PR https://github.com/AVIDS2/memorix/pull/230 (not #214).

memorix_session_start is now bootstrap-safe: it binds the git project and returns a continuation card without awaiting loadAll() + lexical hydrate. Resume memories come from a bounded newest-first SQLite slice (limit: 64). Index hydration continues in the background so later search/store still get a full runtime, and /health / MCP initialize stay off that path.

Leaving this open until #230 merges.

RaviTharuma avatar Aug 17 '26 17:08 RaviTharuma

This is now released in v1.6.3. The first memorix_session_start reads a bounded newest-first slice and defers the rest of hydration. Verification included the full 2,888-test suite and the 40,000-record acceptance gate.

AVIDS2 avatar Aug 18 '26 12:08 AVIDS2