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

1 Commits

Author SHA1 Message Date
bigmerge 1dc49b1923 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
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.
2026-08-15 14:25:12 -05:00