session_compact_ledger
Compact outdated session ledger entries into AI-generated summaries to prevent storage bloat and maintain fast context loading. Archives historical records while preserving recent entries, with dry-run preview support.
Instructions
Auto-compact old session ledger entries by rolling them up into AI-generated summaries. This prevents the ledger from growing indefinitely and keeps deep context loading fast.
How it works:
Finds projects with more entries than the threshold
Summarizes old entries using Gemini (keeps recent entries intact)
Inserts a rollup entry and archives the originals (soft-delete)
Use dry_run=true to preview what would be compacted without executing.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project | No | Optional: compact a specific project. If omitted, auto-detects all candidates. | |
| threshold | No | Minimum entries before compaction triggers (default: 50). | |
| keep_recent | No | Number of recent entries to keep intact (default: 10). | |
| dry_run | No | If true, only preview what would be compacted without executing. Default: false. |