session_compact_ledger
Auto-compact old session ledger entries by rolling them up into AI-generated summaries to prevent indefinite growth and keep deep context loading fast.
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 |
|---|---|---|---|
| dry_run | No | If true, only preview what would be compacted without executing. Default: false. | |
| 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). |