Repository navigation
perf(core): remember() no longer scans the namespace or holds the index lock for edge wiring - #1371
Conversation
…ex lock for edge wiring - Store::live_ids_in_namespace: one query over the candidate ids (json_each) instead of loading every id of the namespace per write; used by check_duplicate (dedup semantics unchanged) and auto_link_cosine - auto_link_cosine: fetch 4x candidates before the namespace filter so a small namespace in a big index keeps its own links; deprecated memories and chunk: keys are never link targets - remember: SQLite writes (insert, hash, timeline, wire_edges) run without the index write lock; the lock is taken only to mirror the vector; a poisoned lock becomes an honest warning instead of an error after the row was committed Refs #1368 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Benchmark gate (LongMemEval fast50, Modal, default strategy, 10 shards)Binaries built from exact SHAs: base = develop b1056e4, candidate = this branch 771ebb8 (before the develop merge; the merge only added unrelated graph/bench changes).
Per-question rankings are NOT bit-identical between runs: base vs base-control is identical for only 18/50 questions, candidate vs base-control 33/50, candidate vs base 23/50. So the difference between base and candidate is within the run-to-run noise of the harness (salience/recency boosts are wall-clock dependent), and every aggregate metric is unchanged. n=50, so this is a gate against regressions, not proof of equality. |
What
Hot path of
remember(#1368, epic #1345):Store::live_ids_in_namespace: one query over the candidate ids (json_each) replacesmemories_in_namespace(a scan +HashSetof every id in the namespace on every write; O(N²) on import). Used bycheck_duplicate(dedup semantics unchanged) andauto_link_cosine.auto_link_cosine: fetches 4× candidates before filtering by namespace, so a small namespace inside a large index keeps its own neighbours; memories that are deprecated andchunk:<id>document-chunk keys are never link targets.remember: the SQLite writes (insert, source hash, timeline,wire_edges) no longer run under the index write lock, which blocked every concurrent recall for their whole duration; the lock is taken only to mirror the vector (and not at all when there is no embedding). A poisoned lock now yields the honestembedding_written=false+ warning (remember: surface embedding write failure — no silent success when vector insert fails #1273) instead of an error after the row was committed.Why
Graph audit (epic #1345).
rememberis the path every user hits; the cost grew with namespace size and writers starved readers.Behaviour change
Only the auto-created
similar_to/possible_duplicateedges differ: more links in small namespaces of large indexes, none to deprecated memories. Defaultfusionrecall does not read edges; benchmark gate (LongMemEval fast50, default strategy, develop vs this branch on Modal) is run before merge — results below / in a comment. Not a CORE wire change, but recall-adjacent: noted in uteke-cloud#117 discussion if numbers move.Testing
live_ids_in_namespace, dedup scoped to namespace and ignoring deprecated.cargo fmt --check,cargo clippy --workspace --all-targetsclean;cargo test --workspacegreen (core 633, server 61); vecq-only core build green (630).Refs #1368
🤖 Generated with Claude Code