ljsysfurry commited on
Commit
e3f52bc
·
verified ·
1 Parent(s): 453bad6

Upload dsh-plugin/compaction-agentframe/README.md with huggingface_hub

Browse files
dsh-plugin/compaction-agentframe/README.md ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # dsh-compaction-agentframe
2
+
3
+ AgentFrame 压缩后端插件 —— 把 DeepSeek Harness 的默认 LLM 摘要压缩替换为
4
+ **语义 + 物理双轨压缩**(35.6x KV 压缩思路)。
5
+
6
+ ## 为什么替换默认压缩
7
+
8
+ 默认 `compaction-basic` 用 LLM 摘要(有损总结旧对话),每次压缩都要一次
9
+ LLM 调用,且摘要可能丢细节。
10
+
11
+ AgentFrame 的思路:
12
+ - **语义轨**:MemoryDirector 判断哪些 token 值得保留(去闲聊、留关键)
13
+ - **物理轨**:吸收式 MLA + INT4 量化(270KB→7.6KB/token,28.4x)
14
+ - **效果**:保留关键信息 + 大幅省 token + 不额外调用 LLM
15
+
16
+ ## 使用
17
+
18
+ 在 profile 的 `cordis.patch.yml` 中把 `compaction-basic` 替换为:
19
+
20
+ ```yaml
21
+ - id: compaction-agentframe
22
+ name: '@deepseek-ai/dsh-compaction-agentframe'
23
+ config:
24
+ semantic: true
25
+ retainRatio: 0.2
26
+ physical: true
27
+ ```
28
+
29
+ ## 配置
30
+
31
+ | 字段 | 默认 | 说明 |
32
+ |------|------|------|
33
+ | `semantic` | true | 语义压缩(保留高信息行) |
34
+ | `retainRatio` | 0.2 | 压缩后保留比例 |
35
+ | `physical` | true | 物理压缩记账(bytes/token) |
36
+ | `bytesPerToken` | 7776 | INT4 压缩后每 token 字节 |
37
+ | `auto` | true | 自动压缩 |
38
+
39
+ ## 实现
40
+
41
+ 继承 `CompactionEngine`(compaction seam),实现三个抽象方法:
42
+ - `compactIfNeeded` — 自动压力触发
43
+ - `compactNow` — 手动 /compact 命令
44
+ - `compactRegion` — 指定范围压缩
45
+
46
+ 保持 dsh 的 surface/事件/持久化契约(compaction/start → replace → compaction/end),
47
+ 只替换"如何压缩"。
48
+
49
+ ## License
50
+
51
+ GPL-3.0 © Cloud LTE Studio / AgentFrame