-- Migration 002 — Phase 3 parse columns (AGENTS.md §4 FR-4/FR-5, §11 Phase 3). -- -- Every item records the page it came from (FR-5), a classification of -- importance (FR-4) and a stable external reference so re-parsing the same page -- updates a row instead of inserting a second one. ALTER TABLE items ADD COLUMN source_page TEXT NOT NULL DEFAULT ''; ALTER TABLE items ADD COLUMN importance TEXT NOT NULL DEFAULT 'normal'; ALTER TABLE items ADD COLUMN external_ref TEXT NOT NULL DEFAULT ''; -- One row per real item: the same source item parsed twice maps to one row. CREATE UNIQUE INDEX IF NOT EXISTS idx_items_dedupe ON items(child_id, source, type, external_ref);