Adversarial review residual: every grimoire_query/search re-reads all article markdown and recomputes IDF + sliding-window proximity with per-call RegExp construction. Fine at 18 articles; multi-MB IO + O(articles×terms×windows) at a few hundred. Fix direction: cache article text + precomputed term stats at startup (server already requires restart to pick up wiki changes, so caching is semantics-preserving).
Adversarial review residual: every grimoire_query/search re-reads all article markdown and recomputes IDF + sliding-window proximity with per-call RegExp construction. Fine at 18 articles; multi-MB IO + O(articles×terms×windows) at a few hundred. Fix direction: cache article text + precomputed term stats at startup (server already requires restart to pick up wiki changes, so caching is semantics-preserving).