How We Reduced Our SQLite Database from 8.7GB to 3.8GB Without Downtime

Our OpenCode session database had grown to 8.7GB — 1.26 million event rows, most of them redundant state updates. Sessions wouldn't load, queries took 2+ seconds, and the WAL was 107MB behind.

Here's how we pruned it live, without downtime, using a multi-agent verification protocol.

The Problem

The event table stored every state change as a full JSON snapshot. After months of use: