Rebuild spec — follow docs/planning/specs/rebuild_theme_template_spec.md first.
S3 — FTS / vector index coverage verificationdocs/design/retired_scripts_patterns.md → S3The 3 deleted scripts under this theme (ci_verify_search_indexes.py,
migrate_fts5.py, rebuild_fts.py) were SQLite-FTS-specific. SciDEX
is now PG. The recurring task [Search] CI: Verify search indexes are (daily,
current3a897f8a-0712-4701-a675-07f0670d8f87) currently has
no implementation to call.
This is a narrow, well-scoped theme — a good second-rebuild after AG1
to exercise the pattern on a non-LLM-heavy process. Most of the work
here is observability + self-healing rebuild, not semantic judgment.
{{THEME_ID}} = S3{{THEME_NAME}} = search-index coverage verification{{LAYER}} = Senate{{LAYER_SLUG}} = senate{{THEME_SLUG}} = search_index_coverage{{CADENCE}} = hourly{{CORE_JUDGMENT}} = "is any search index materially stale or{{GAP_PREDICATE}} = (source_row_count - indexed_row_count) /last_rebuilt_at < now() -
stale_threshold — both thresholds from theme_config.Most of this theme is deterministic (count rows, compare, rebuild).
The LLM touch point: when a rebuild fails unexpectedly, an LLM
judges the failure message and proposes a remediation (missing
extension, permission error, tsvector config mismatch, etc.) before
escalating to a human. This keeps the process self-healing for the
common failure modes.
No hardcoded list of (source_table, index_name) pairs in code.
Instead, introspect PG:
pg_indexes filtered to indexname LIKE '%_fts' OR '%_embed' ORThis is principle #2 (discover schema) in pure form.
All template criteria, plus:
pg_indexes introspection.theme_config.3a897f8a-0712-4701-a675-07f0670d8f87 reassigned