DSH 的位图帧上下文压缩插件:把被丢弃的对话历史渲染成像素字体 PNG 帧,交给支持视觉的模型直接读回;整个过程本地、确定,不调用任何辅助模型。
安装
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:JessenReinhart/dsh-snapcompact
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本——pnpm 默认拦截,所以安装可能停在 ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED 或 ERR_PNPM_IGNORED_BUILDS;dsh 会打印出需要添加的确切键名,把它加进该 profile 的 pnpm-workspace.yaml 的 allowBuilds 下,重跑一次即可装上。放行构建本身就是一次信任判断:请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
该插件的 README 只有英文版本。
Bitmap-frame context compression plugin for DeepSeek Harness (DSH).
Inspired by @oh-my-pi/snapcompact.
Instead of asking an LLM to summarize discarded conversation history in lossy prose, snapcompact serializes the exact conversation and renders the text into dense PNG frames of pixel-font glyphs that vision models read back directly. The entire process is local, fast, and deterministic — no auxiliary LLM API calls, no summarization latency, and zero token-cost overhead beyond the compact bitmap frames.
Features
- Local & Deterministic: High-throughput rasterization using native pixel-font rendering (
@oh-my-pi/pi-natives). - Provider-Aware Shapes:
anthropic(11on16-bw): 8x13 font on 11px advance, black-and-white.google(8on22-bw): 8x13 font on 22px pitch, tuned for Gemini vision budget.openai(8on22-bw): 8x13 font on 22px pitch, sent withdetail: "original".cjk(silver16-bw): Silver TrueType font on 16x16 grid for East Asian (Chinese, Japanese, Korean) text.
- Structured Transcript Serialization:
¶user:user message sections¶think:assistant reasoning blocks¶ai:assistant message sections¶call: name(args)//intenttool calls with parameters<out>...</out>formatted tool results with dimmed noise- Automatic
FILESsection tracking read and modified files ((Read),(Write),(RW))
- DSH Attachment Integration:
- Renders PNG frames and persists them through
ctx.attachments.saveImages - Fully compatible with DSH session persistence and replay
- Renders PNG frames and persists them through
- Command & Service Support:
/snapcompact [--frames <N>] [--shape <name>] [--all]command for on-demand manual compactionSnapcompactEngineimplements the standard DSHCompactionEngineservice- Automatic step-pressure compaction on
agent/pre-step - Automatic context-overflow recovery on
agent/request-error
Installation
1. Clone into DSH Profile
Clone the repository into your active DSH profile's packages/ directory (e.g. desktop):
# Windows PowerShell
git clone https://github.com/JessenReinhart/dsh-snapcompact.git "$env:USERPROFILE\.dsh\profiles\desktop\packages\dsh-snapcompact"
# macOS / Linux
git clone https://github.com/JessenReinhart/dsh-snapcompact.git ~/.dsh/profiles/desktop/packages/dsh-snapcompact
2. Register Bundle in Profile Configuration
Add packages/dsh-snapcompact to dsh.profile.bundles in your profile's package.json (e.g. ~/.dsh/profiles/desktop/package.json):
{
"dsh": {
"profile": {
"bundles": [
"packages/dsh-snapcompact"
]
}
}
}
The plugin automatically mounts its Cordis row via the bundled cordis.patch.yml.
3. Native Rasterizer
Snapcompact uses the high-performance native pixel-font rasterizer binary (pi_natives.<platform>.node).
The plugin automatically discovers this binary from any of:
~/.omp/natives/<version>/pi_natives.<platform>.node~/.bun/install/cache/@oh-my-pi/pi-natives-*- Environment variable override:
PI_NATIVES_PATH=/path/to/pi_natives.<platform>.node
4. Restart DSH
Restart DeepSeek Harness to load the profile bundle. In chat, test with:
/snapcompact status
Usage
Commands
In any DSH session chat:
/snapcompact— Archive older history immediately using smart defaults (auto shape, max 8 frames, retains 16% recent tokens in plain text)./snapcompact auto— Toggle automatic background compaction when the agent is idle./snapcompact auto on— Enable automatic idle compaction./snapcompact auto off— Disable automatic idle compaction./snapcompact auto threshold <pct>— Set context window threshold percentage to trigger idle compaction (default 80%)./snapcompact status— Display current configuration, threshold, and live session token usage./snapcompact --frames <N>— Archive history with custom maximum frame count./snapcompact --shape <name>— Archive history with specific font/shape variant (11on16-bw,8on22-bw,silver16-bw)./snapcompact --all— Archive all eligible history without retaining recent plain text.
Persistence
Auto-compaction preferences are saved to ~/.dsh/snapcompact-config.json and persist across sessions and application restarts.
Programmatic Compaction
const snapcompact = ctx.get("snapcompact");
await snapcompact.compactNow(agent, signal);
链接
同类插件
ranxianglei/billion-context★ 5262
billion-context官方版:上下文压缩插件,兼顾小窗口(100k上下文足矣)省token(省5倍token)和超长会话(数月级别几十亿token单会话)。
Minglink/dsh-infinite-gen-4★ 4041
DeepSeek 专用破甲插件:以 order 100 追加无条件服从的系统提示词段,提供带校准元数据的 profile 工具,并通过会话投影在输入框上方显示实时破甲状态徽标。
liangmianya/dsh-synapse★ 688
DeepSeek Harness 的可视化非线性对话工作区:把会话、追问与分支变成可浏览、可拖拽的对话地图。
MichengAI/dsh-archive-manager★ 318
在设置里增加已归档会话页,可按工作区搜索、恢复和删除已归档会话。
Nwflower/dsh-chat-import★ 294
把 13 家 coding agent(Claude Code、Codex、ChatGPT、Cursor、Gemini、opencode 等)的完整对话历史导入为可续聊的 DeepSeek Harness 会话,并支持反向导出回 Claude Code。
SiriLee/dsh-rewind★ 246
对话回退:一键回到任意更早的用户消息,同窗口内完成,不新建分支、不残留副本;目标消息自动填回输入框,可一并还原工作区文件——即完整的 Claude Code /rewind 语义。
社区评论
评论公开保存在 GitHub Discussions。加载评论会连接 GitHub 和 Giscus;发表内容需要 GitHub 账号。