fix: engram search latency — pin embed model, cache query embeddings, bound activate BFS #105

Closed
will.anderson wants to merge 1 commits from worktree-agent-a7e7a591a07291058 into dev
Owner

Preserving uncommitted work found in an open worktree during a worktree audit. Pins the Ollama embed model resident (keep_alive:-1) to avoid multi-second cold reloads (measured up to ~2.2s cold vs ~0.02-0.05s warm). Adds a direct-mapped query-embedding cache (FNV-1a keyed) so repeated queries cost zero Ollama round-trips. Replaces engram_activate's unbounded FIFO frontier BFS with a beam-capped, level-synchronous BFS (default 128, tunable via ENGRAM_ACTIVATE_BEAM) to bound hub-node explosion at depth 2-3. Applied from the worktree's own '.latency-deliverables/latency-fix.promotable.diff' — deliberately excludes an inert engram_prune_telemetry build-enabler stub the author noted was only needed to link this checkout, not part of the fix.

Preserving uncommitted work found in an open worktree during a worktree audit. Pins the Ollama embed model resident (keep_alive:-1) to avoid multi-second cold reloads (measured up to ~2.2s cold vs ~0.02-0.05s warm). Adds a direct-mapped query-embedding cache (FNV-1a keyed) so repeated queries cost zero Ollama round-trips. Replaces engram_activate's unbounded FIFO frontier BFS with a beam-capped, level-synchronous BFS (default 128, tunable via ENGRAM_ACTIVATE_BEAM) to bound hub-node explosion at depth 2-3. Applied from the worktree's own '.latency-deliverables/latency-fix.promotable.diff' — deliberately excludes an inert engram_prune_telemetry build-enabler stub the author noted was only needed to link this checkout, not part of the fix.
will.anderson added 1 commit 2026-08-15 19:25:27 +00:00
Fix engram search latency: pin embed model, cache query embeddings, bound activate BFS
El SDK CI - dev / build-and-test (pull_request) Failing after 10m1s
1dc49b1923
Pins the Ollama embed model resident (keep_alive:-1) to avoid multi-second
cold reloads whenever a larger generation model evicts it under unified-
memory pressure (measured cold reload up to ~2.2s vs ~0.02-0.05s warm).

Adds a direct-mapped query-embedding cache (FNV-1a keyed, full strcmp to
reject collisions) so a repeated query costs zero Ollama round-trips —
directly serves the curiosity loop, which reseeds the same query terms
repeatedly.

Replaces engram_activate's unbounded FIFO frontier BFS with a beam-capped,
level-synchronous BFS (default beam 128, tunable via
ENGRAM_ACTIVATE_BEAM) to bound per-hop hub-node explosion that could
previously reach multi-second/crash territory at depth 2-3.

Excludes an inert engram_prune_telemetry build-enabler stub that was only
needed to link this checkout against a newer integration branch — not part
of the fix.
will.anderson closed this pull request 2026-08-15 22:07:38 +00:00

Pull request closed

Please reopen this pull request to perform a merge.
Sign in to join this conversation.