1. Backfill Null Metadata
Purpose: Patch facts that are missing notability scores, challenge content, or other NULL metadata fields.
Prerequisites:
- Supabase credentials
- AI model API key (for notability scoring and challenge generation)
Cost / Duration: ~$0.005/fact for notability, ~$0.006/fact for challenges | varies by volume
Prompt
Backfill null metadata on existing facts.
Option A — Backfill everything:
```bash
bun scripts/seed/backfill-fact-nulls.ts --all
```
Option B — Backfill specific fields only:
```bash
# Notability scores only
bun scripts/seed/backfill-fact-nulls.ts --notability
# Challenge content only
bun scripts/seed/backfill-fact-nulls.ts --challenge-content
```
Before running, check how many nulls exist:
```bash
bun scripts/seed/backfill-fact-nulls.ts --audit
```
This will report the count of facts needing backfill per field, so you
can estimate cost before committing. Monitor progress in the console
output — the script reports batch completion with running totals.
Verification
- Audit run first to confirm scope and estimate cost
- Backfill completes without errors
- Re-run
--auditafter to confirm null counts decreased - Notability scores are in valid range (0-100)
- Challenge content passes
validateChallengeContent()checks - Cost reported matches pre-run estimate (within 20%)
Related Prompts
- Audit Fact Quality — Run audit first to find nulls
- CQ-002 Compliance Patch — Fix challenge content compliance after backfill