-- Slice 5 — wire topology_runs to missions so the task-card parser -- can attribute agent output to the right mission + phase. -- -- Populated by the phase executor (Slices 4/5/6/7/8) when it enqueues -- a topology_run on behalf of a mission phase. Left NULL for legacy -- runs and the existing research/loops paths that pre-date missions. -- -- The parser (task_card_parser) skips runs where mission_id IS NULL — -- keeps the surface additive during the Slice 9 transition. ALTER TABLE topology_runs ADD COLUMN mission_id UUID REFERENCES missions(id) ON DELETE SET NULL, ADD COLUMN mission_phase_id UUID REFERENCES mission_phases(id) ON DELETE SET NULL; CREATE INDEX topology_runs_mission_idx ON topology_runs (mission_id, created_at DESC) WHERE mission_id IS NOT NULL;