The active-session case here is distinct from #57882, which expires whole inactive sessions, and #56365, which reclaims free SQLite pages. #16101 already discusses general storage statistics and lifecycle tooling; I would keep those out of a separate patch here.
For the two-compaction window, I suggest an opt-in, per-session retention preview as the first increment:
- Start at the second-newest completed compaction, retaining the subsequent conversation; failed/running compactions do not advance the boundary.
- Expand the retained set for
metadata.keepID references. Current summaries reconstruct recent text from older message rows, so those rows cannot simply be deleted.
- Preserve the history needed for native-compaction fallback. A model switch or undecodable native window can require the original transcript back to a local summary. For native-only histories, the preview should report that a safe two-checkpoint bound is unavailable rather than propose dropping that fallback.
These dependencies are visible in the history reader at 8482dbf. The preview would show the resulting boundary and why extra rows remain; it would perform no deletion. Existing retention would remain unchanged by default.
A later explicit apply operation would need agreed archive/history-loss semantics: exports include the settled transcript, and old fork/revert boundaries would no longer be available after deleting their messages. Validation would cover repeated/failed compactions, keepID, native model switching, legacy schemas, and export/fork/revert behavior.
Would maintainers approve this checkpoint-retention preview scope? This is source analysis of the development tree, not a diagnosis of the reported v1.19.4 30 GB database or its “Failed to fetch” error.