#!/usr/bin/env python3 """Does an INDEX.md row's status agree with the page it links? `INDEX.md` is read every iteration by both agents and is the first thing a new reader meets. sylpheed-port's phrase for it is "an index is an amplifier": a status that is wrong there is wrong everywhere it is quoted from. Found by accident: INDEX called movie skippability 🟡 unsettled while `movie-binding.md` had it ✅ settled since 2026-08-28, with a three-boot baseline and delivery confirmation -- and HANDOFF carried the answer correctly. The stale row is in the index alone. ⚠️ THIS PRINTS A LISTING, NOT A VERDICT. An audit that invents defects is worse than no audit, because its false positives are indistinguishable from its true ones until each is opened by hand (sylpheed-port paid for that, and so did I with a 7-candidate/0-real sweep). A row can legitimately say 🟡 about one clause while its page says ✅ about another. Every hit here is a PROMPT TO READ. index_vs_pages.py [--all] """ import re import sys from pathlib import Path ROOT = Path("docs/re") idx = (ROOT / "INDEX.md").read_text().splitlines() LINK = re.compile(r"\[`([^`]+\.md)`\]\(([^)]+)\)") rows = [] for n, line in enumerate(idx, 1): if not line.startswith("|"): continue m = LINK.search(line) if not m: continue target = (ROOT / m.group(2)).resolve() if not target.exists(): rows.append((n, m.group(1), "MISSING PAGE", "")) continue page = target.read_text() # the page's own headline status, if it declares one st = "" ms = re.search(r"\*\*Status:\*\*\s*(.+)", page) if ms: st = ms.group(1).strip() idx_unsure = ("🟡" in line) or ("❔" in line) page_sure = bool(re.search(r"^##+ ✅[^\n]*(settled|SETTLED|decoded|DECODED|measured)", page, re.M)) if idx_unsure and page_sure: rows.append((n, m.group(1), st[:70], "index unsure / page has a ✅ settled heading")) elif "--all" in sys.argv: rows.append((n, m.group(1), st[:70], "")) print(f"{len(rows)} row(s) to READ (not defects):\n") for n, name, st, why in rows: print(f" INDEX.md:{n} {name}") if why: print(f" {why}") if st: print(f" page Status: {st}")