After a replace-import, search returns memories that were just deleted and misses everything just imported, until a server restart.
mem::import with strategy: "replace" deletes existing data across every namespace in src/functions/export-import.ts: observations (L274), memories (L279), and the rest
- But the file never touches the search indices: no
getSearchIndex().remove(), vectorIndexRemove(), or rebuildIndex() anywhere
- After the wipe, BM25 and vector still hold the old entries
- The freshly imported data never gets indexed
smart-search returns ghosts of deleted records and misses the imported ones for the whole process lifetime; only a restart fixes it
Fix
- Call
rebuildIndex(kv) (exported from search.ts) at the end of import. It clears both indices and repopulates from KV, which is exactly the right post-import state
After a replace-import, search returns memories that were just deleted and misses everything just imported, until a server restart.
mem::importwithstrategy: "replace"deletes existing data across every namespace insrc/functions/export-import.ts: observations (L274), memories (L279), and the restgetSearchIndex().remove(),vectorIndexRemove(), orrebuildIndex()anywheresmart-searchreturns ghosts of deleted records and misses the imported ones for the whole process lifetime; only a restart fixes itFix
rebuildIndex(kv)(exported fromsearch.ts) at the end of import. It clears both indices and repopulates from KV, which is exactly the right post-import state