mirror of
https://bitbucket.org/siakitem/my-pi.git
synced 2026-10-26 10:45:22 +00:00
refactor(pi-compaction): 改为压力触发的观察遮蔽与空闲阈值整段摘要
原实现对所有工具结果(含 read)在下一次请求即替换为约 4K 的首尾存根, 不看上下文压力,导致模型看不到大文件中段;后台逐条语义摘要又反复改写 历史、打碎 prompt 缓存。参照 Anthropic 上下文编辑、Manus 与 JetBrains 观察遮蔽研究重构为: - L2:上下文达到阈值时在 turn_end 批量提交 Pi 原生 context_edit,把最近 keepRecentTurns 轮之外的旧 toolResult 换成确定性占位符;trigger/target 回差与 minClearTokens 保证少触发、一次清够;原始条目保留,可经 context_tree_query 取回 - L3:空闲 agent_settled 且超过绝对阈值时调用一次 ctx.compact - 阈值按绝对 token 计并受窗口比例约束,默认针对 1M 窗口(DeepSeek V4.1 Flash):遮蔽 200K→100K、整段摘要 400K - 删除逐条存根、语义 worker、soft/hard/target 比例与自行取消 Pi 压缩的门控; Pi 原生阈值压缩保留为最终安全网 Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent
a254d4fd68
commit
a6d8416c76
+13
-13
@@ -1,20 +1,20 @@
|
||||
{
|
||||
"enabled": true,
|
||||
"softRatio": 0.72,
|
||||
"hardRatio": 0.9,
|
||||
"targetRatio": 0.55,
|
||||
"deterministic": {
|
||||
"masking": {
|
||||
"enabled": true,
|
||||
"maxStubTokens": 1024
|
||||
"triggerTokens": 200000,
|
||||
"triggerRatio": 0.6,
|
||||
"targetTokens": 100000,
|
||||
"targetRatio": 0.35,
|
||||
"minClearTokens": 50000,
|
||||
"keepRecentTurns": 10,
|
||||
"minEntryTokens": 256,
|
||||
"excludeTools": ["ask_user_question"]
|
||||
},
|
||||
"semantic": {
|
||||
"enabled": true,
|
||||
"model": "default",
|
||||
"thinking": "low",
|
||||
"concurrency": 1,
|
||||
"minInputChars": 4000,
|
||||
"maxInputChars": 24000,
|
||||
"maxRetries": 2
|
||||
"summary": {
|
||||
"triggerTokens": 400000,
|
||||
"triggerRatio": 0.9,
|
||||
"thinking": "low"
|
||||
},
|
||||
"native": {
|
||||
"enabled": true
|
||||
|
||||
Reference in New Issue
Block a user