wren memory index is full-rebuild only; blocks concurrent memory fetch/recall (no incremental/background mode)
Summary
wren memory index performs a full rebuild of the LanceDB embedding index every run, and there is no incremental or background mode. While a rebuild is running, memory fetch / memory recall — which read the same LanceDB files under .wren/memory/ — degrade drastically (observed 140s+ waits, effectively queued). This makes the CLI unusable for querying while indexing runs.
Environment
- wrenai CLI:
0.13.3(pip, with thememoryextra) - Backend:
lancedb - Project scale:
2730models,44439schema_itemsrows,.wren/memory/~120 MB
Evidence
wren memory index --help shows no incremental / background option:
Usage: wren memory index [OPTIONS]
Options:
--mdl -m <str> Path to MDL JSON file.
--path -p <str> LanceDB storage directory.
--instructions --no-instructions Also index user instructions ...
--no-seed Skip generating seed NL-SQL examples.
--no-queries Skip auto-loading project queries.yml.
wren memory status:
Backend: lancedb
query_history: 4846 rows
schema_items: 44439 rows
wren memory fetch --help notes large schemas use embedding search (i.e. depend on the same index being ready):
Small schemas are returned as full plain text. Large schemas use
embedding search with optional --type and --model filters.
Impact
- On large projects (thousands of models), every
memory indexre-embeds allschema_itemseven when only a few rules / MDL column descriptions changed. - Cannot run
fetch/recallconcurrently withindex, so the edit → index → query workflow must be strictly serial, blocking agent workflows for minutes per change. - Frequent small edits become impractical because each triggers a multi-minute full rebuild.
Suggested improvements
- Incremental indexing — only re-embed changed models/rules/cubes (track a hash/mtime per
schema_item+ knowledge file) and skip unchanged rows. - Non-blocking / atomic-swap indexing — build into a new LanceDB table/directory and atomically swap on completion, so readers continue against the previous index until the new one is ready (read isolation during rebuild).
- At minimum, document that
memory indexis a full rebuild that blocksfetch/recall, so users sequence operations accordingly.
Any of these would significantly improve the UX of the memory extra on large projects.
Hi, I'd like to take a shot at this. The contributing guide says to talk before larger changes, so here's what I have in mind: make 'wren memory index' incremental by tracking a hash per schema item, re-embedding only what changed and dropping rows for models that no longer exist. Does that direction work for you, or would you also want a background mode so fetch and recall stay responsive while it runs? Happy to start once I know which way you prefer.