Rebuild spec — follow docs/planning/specs/rebuild_theme_template_spec.md first.
S4 — Orphan / duplicate / broken-link detection +docs/design/retired_scripts_patterns.md → S4Two deleted recurring-task implementations (orphan_coverage_check.py,
convergence_monitor.py, cleanup_stale_figure_artifacts.py) plus
the open recurring task [Senate] Orphan coverage check (every-12h,
e1cf8f9a-6a64-4c25-8264-f103e5eb62db) and [Senate] Convergence (
monitor1c1ea5d4-d2c9-4def-82bb-87174192bc31). Both tasks currently
have no implementation to call.
{{THEME_ID}} = S4{{THEME_NAME}} = orphan / duplicate / broken-link sweeper{{LAYER}} = Senate{{LAYER_SLUG}} = senate{{THEME_SLUG}} = integrity_sweeper{{CADENCE}} = every 6h{{CORE_JUDGMENT}} = "is this row broken (orphan / duplicate /{{GAP_PREDICATE}} = output of a registry of integrity checks,(entity_id, violation_type) rows.Most integrity work is rule-based (FK check, file-exists check),
but duplicate-merging is fundamentally semantic. "Are these two
wiki pages for the same gene?" can't be answered by string equality —
"TREM2", "trem2", "Trem2 receptor", "TREM-2" are all the same
canonical entity.
Rule for this theme: FK / file-exists / reference-resolution checks
are rules. Entity equivalence / merge proposals / repair-path
disambiguation are LLM rubrics.
High-confidence LLM verdicts (similarity ≥ 0.95) execute
auto-merge. Lower-confidence create a review ticket (a new orchestra
task). The operator-gate threshold is in theme_config.
The registry of integrity checks is self-describing:
pg_constraint where the referencing row can be missingpath-typed column (name matches _path, _url, *_file)integrity_check_registry tableNo code change needed to add new FKs or path columns; the checker
finds them.
All template criteria, plus:
theme_config, adjustable.e1cf8f9a- and 1c1ea5d4- reassigned to