Compaction backend replacing LLM summarization with a deterministic semantic extractor (keeps code/paths/commands, drops chatter) plus 28.4x KV-compression accounting.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:ljsysfurryACE/dsh-compaction
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time. Only install sources you trust, and pin a commit (github:owner/repo#sha).
README
AgentFrame 压缩后端插件 —— 把 DeepSeek Harness 的默认 LLM 摘要压缩替换为 语义 + 物理双轨压缩(28.4x KV 压缩思路)。
为什么替换默认压缩
默认 compaction-basic 用 LLM 摘要(有损总结旧对话),每次压缩都要一次
LLM 调用,且摘要可能丢细节。
AgentFrame 的思路:
- 语义轨:MemoryDirector 判断哪些 token 值得保留(去闲聊、留关键)
- 物理轨:吸收式 MLA + INT4 量化(270KB→7.6KB/token,28.4x)
- 效果:保留关键信息 + 大幅省 token + 不额外调用 LLM
使用
在 profile 的 cordis.patch.yml 中把 compaction-basic 替换为:
- id: compaction-agentframe
name: '@deepseek-ai/dsh-compaction-agentframe'
config:
semantic: true
retainRatio: 0.2
physical: true
配置
| 字段 | 默认 | 说明 |
|---|---|---|
semantic |
true | 语义压缩(保留高信息行) |
retainRatio |
0.2 | 压缩后保留比例 |
physical |
true | 物理压缩记账(bytes/token) |
bytesPerToken |
7776 | INT4 压缩后每 token 字节 |
auto |
true | 自动压缩 |
实现
继承 CompactionEngine(compaction seam),实现三个抽象方法:
compactIfNeeded— 自动压力触发compactNow— 手动 /compact 命令compactRegion— 指定范围压缩
保持 dsh 的 surface/事件/持久化契约(compaction/start → replace → compaction/end), 只替换"如何压缩"。
License
GPL-3.0 © Cloud LTE Studio / AgentFrame
Links
More in this category
omdsh-dev/dsh-mnemon★ 21
Cross-agent, local-first persistent memory plugin for DeepSeek Harness (DSH), powered by Mnemon. It shares long-term memory across Mnemon-enabled agents and adds runtime memory, searchable project documents, semantic recall, knowledge graph, and a Sidebar UI.
LoserFox/distill★ 16
Automatic conversation distillation: background subagent reflection + skill create/update.
modusensus/dsh-mneme#dsh-mneme★ 9
Cross-session memory for DSH: SQLite + human-editable Markdown mirror, autoDream consolidation, six memory tools, and fully-offline semantic search (local embeddings, reranking, clustering).
nowledge-co/nowledge-mem-deepseek-harness★ 5
One memory layer for every AI tool and agent: Context Bundle injection, prompt-time recall, MCP tools, and turn-end DSH thread capture.
Aik358/dsh-auto-memory★ 4
Auto-memory for DSH: three-layer memory (user / project notes / daily logs) with automatic injection, per-turn auto-consolidation, AI greetings, smart search, a calendar view and a settings page, plus inheritance of other AI tools' memories.
PerryLink/dsh-memento★ 3
Bounded, layered, approval-gated, auditable cross-session memory: a typed `ctx.memory` seam with a zero-dependency SQLite provider, a `memory` tool, and frozen snapshot injection; every write passes the approval gate and stays reconstructable from the session log.