A conservative healer that catches and corrects factual drift in AI-generated content (e.g. lodge/post identity numbers) at both the DB boundary and render.
Fact-Guard is a safety net for the one thing AI content must never get wrong: verifiable facts. A tasteful site that states the wrong lodge number or a mangled name is worse than a plain one — it breaks trust, which is the top of the quality bar.
factGuardHeal($content, $biz, $opts) (includes/fact-guard.php) runs over generated content and conservatively corrects factual drift:
factGuardDeriveIdentity($name) parses a business name for a fraternal/civicidentity + number (Lodge / Post / Chapter / Council / Aerie / ... No. NNNN).
factGuardFixIdentityNumbers($data, $keyword, $number) repairs a wrong numberONLY when a real separator is present (No. / # / Number), so it never invents or over-corrects.
It is conservative by design — it fixes provable drift and leaves everything else alone. It runs at two boundaries: at generation (factGuardHeal(...) after decode in content generation) and at the DB boundary (hooked into saveGeneratedContent()), so both fresh builds and re-saves are guarded.
The Elks fleet surfaced it: an AI given a lodge name would occasionally restate the lodge number wrong. Fact-Guard is the general pattern — where a fact is derivable from hard input (the name, the Places data), verify the output against it. It complements the GIGO principle: GIGO says better input makes better voice; Fact-Guard says never let good input get corrupted on the way out. Extend it as new verifiable fact classes appear.
Fact-Guard is the net, not the first line. The better fix for most inaccuracies is to hand the generator the fact so it never invents a wrong one — no per-fact trap. Example (v2.2.330): an AI hero claimed a barbershop was open "Six Days" while its hours showed closed Sunday AND Monday (open 5). Root cause: the content-generation context (ai-content.php) fed name/address/rating/reviews but NOT the hours. Fix: inject the real weekday_text plus a computed "Open N days a week (closed …)" line. The model can't invent a schedule it's been handed. Operator rule: prefer accuracy by GIVING the model the fact over trapping for a specific mistake — same spirit as the muse custom_css prompt fix. Fact-Guard stays for the classes a prompt can't reliably prevent (e.g. an identity number the model mangles even when told).