Problem / 问题
Automatic context compaction is configurable in storage:
"contextCompaction": {
"enabled": true,
"keepRecentTokens": 20000,
"reserveTokens": 16384
}
Sidecar / host-core read keepRecentTokens and reserveTokens. Settings UI has no controls for them (no matches in the settings renderer). Long threads compact on defaults only; changing the threshold means editing pi.sqlite.
自动上下文压缩的阈值已经在 sqlite 里(keepRecentTokens / reserveTokens / enabled),sidecar 会读。设置页没有入口,长对话何时压缩、压完留多少只能改库或吃默认。
Proposed change / 期望改动
Add a Context compaction section (Agent settings or Models — either is fine):
- Toggle: enable automatic compaction (
enabled)
- Keep recent: presets 20k / 32k / 64k / 100k, plus a number field (
keepRecentTokens)
- Reserve for output: presets 8k / 16k / 32k / 64k (
reserveTokens)
- One-line help: when the window is nearly full, a checkpoint is taken; keep-recent is how much recent context survives the summary; reserve is space left for this turn's output
设置里增加「上下文压缩」:开关、保留最近、为输出预留,并配常用档位 + 可手改数字。说明:窗口快满时做检查点;保留最近 = 摘要后仍留给模型的近期 token;预留 = 压缩后给本轮输出留的空位。
Alternatives / 其他方案
Leave it sqlite-only: users cannot tune it. Deriving both numbers only from the model window: too coarse (20k keep + 16k reserve is wrong for both 128k and 1M).
Additional context / 补充信息
PI-Desktop 0.14.5 · Windows. Related ADRs: 0030, 0049, 0061. This is the missing settings surface, not a change to the compaction algorithm.
Problem / 问题
Automatic context compaction is configurable in storage:
Sidecar / host-core read
keepRecentTokensandreserveTokens. Settings UI has no controls for them (no matches in the settings renderer). Long threads compact on defaults only; changing the threshold means editingpi.sqlite.自动上下文压缩的阈值已经在 sqlite 里(
keepRecentTokens/reserveTokens/enabled),sidecar 会读。设置页没有入口,长对话何时压缩、压完留多少只能改库或吃默认。Proposed change / 期望改动
Add a Context compaction section (Agent settings or Models — either is fine):
enabled)keepRecentTokens)reserveTokens)设置里增加「上下文压缩」:开关、保留最近、为输出预留,并配常用档位 + 可手改数字。说明:窗口快满时做检查点;保留最近 = 摘要后仍留给模型的近期 token;预留 = 压缩后给本轮输出留的空位。
Alternatives / 其他方案
Leave it sqlite-only: users cannot tune it. Deriving both numbers only from the model window: too coarse (20k keep + 16k reserve is wrong for both 128k and 1M).
Additional context / 补充信息
PI-Desktop 0.14.5 · Windows. Related ADRs: 0030, 0049, 0061. This is the missing settings surface, not a change to the compaction algorithm.