search-is-resilient-across-index-states
IN derived (depth 1)
Search operates correctly regardless of FTS5 index availability: the index is derived (rebuilt from scratch on every save) so stale indexes are self-healing, and search falls back to substring matching when FTS tables don't exist or error
Summary
The search feature is designed to work no matter what state the full-text search index is in. Since the index is completely rebuilt every time data is saved, a corrupted or outdated index fixes itself automatically. If the index is missing entirely or throws an error, search gracefully degrades to simple substring matching, so users always get results.
Justifications
SL — A derived (rebuildable) index plus a substring fallback provides index-state-independent search
Antecedents (all must be IN):
- storage-fts-is-derived-index — The FTS5 full-text search index is rebuilt from scratch during every `save()`; it is a derived index, never the source of truth.
- search-falls-back-to-substring — `api.search()` tries FTS5 full-text search first, then falls back to substring matching if FTS5 tables don't exist or error; it always produces results if substring matches exist.
Dependents
These beliefs depend on this one:
- all-query-operations-degrade-gracefully — All query operations degrade gracefully through multiple independent fallback tiers: ask cascades from LLM synthesis through bounded tool loops to raw FTS5 results on any failure, while search self-heals via index rebuilds on every save and falls back to substring matching on FTS5 unavailability — ensuring queries always return useful results regardless of LLM availability or index state.
- all-read-paths-are-deterministic-and-resilient — Every read-path operation produces deterministic output resilient to environmental variation: search handles missing FTS5 indexes via self-healing derived indexes and substring fallback, staleness checking produces sorted uniformly-structured CI-pipeline-ready results, and compact generates predictable bounded output from a pure function with fixed priority ordering.