Note settings.json for compaction settings in compaction.md

This commit is contained in:
Mario Zechner 2025-12-31 12:35:45 +01:00
parent 679343de55
commit dfc63a7bac

View file

@ -23,13 +23,13 @@ Auto-compaction triggers when:
contextTokens > contextWindow - reserveTokens
```
By default, `reserveTokens` is 16384 tokens. This leaves room for the LLM's response.
By default, `reserveTokens` is 16384 tokens (configurable in `~/.pi/agent/settings.json`). This leaves room for the LLM's response.
You can also trigger manually with `/compact [instructions]`, where optional instructions focus the summary.
### How It Works
1. **Find cut point**: Walk backwards from newest message, accumulating token estimates until `keepRecentTokens` (default 20k) is reached
1. **Find cut point**: Walk backwards from newest message, accumulating token estimates until `keepRecentTokens` (default 20k, configurable in `~/.pi/agent/settings.json`) is reached
2. **Extract messages**: Collect messages from previous compaction (or start) up to cut point
3. **Generate summary**: Call LLM to summarize with structured format
4. **Append entry**: Save `CompactionEntry` with summary and `firstKeptEntryId`