rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
Cyberbolt/dsh-snapcompact
A DeepSeek Harness context compaction plugin: renders DSH session history as images instead of text summaries, keeping more information while using fewer tokens. | DeepSeek Harness 上下文压缩插件:将 DSH 的会话历史渲染为图片,用图片代替文本摘要,保留更多信息并减少 token 消耗。
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:Cyberbolt/dsh-snapcompact
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
English · 简体中文
A DeepSeek Harness context compaction plugin: renders DSH session history as images instead of text summaries, keeping more information while using fewer tokens.
Concretely: when DSH triggers context compaction, the start and the end of the context stay as ordinary text while the middle is rendered as images (locally, with no model call), and each checkpoint carries a copyable index of exact strings and a FILES file map.
The plugin suits long-running sessions that keep coming back to earlier details. It is not meant for compacting short chats.
Quick start: Plugins → Add plugin → dsh-snapcompact → new session → Snapcompact (Standard).
Requires DSH 0.2.x and Node.js 24+.
dsh-snapcompact.| Official mode | Snapcompact preset |
|---|---|
standard |
Snapcompact (Standard) |
ptc |
Snapcompact (PTC) |
cordis |
Snapcompact (Cordis) |
minimal is not supported — it deliberately omits read/write/edit, so Snapcompact would defeat its purpose.
To uninstall, remove the plugin from the Plugins page. Its presets disappear; checkpoints already committed stay in their sessions as ordinary summary messages.
From the CLI:
dsh plugin --profile <your profile name> add dsh-snapcompact
On DSH Desktop, prefer the in-app Plugins page.
A locally packed tarball:
pnpm install --ignore-scripts
pnpm pack
dsh plugin --profile web add "file:$PWD/dsh-snapcompact-0.7.2.tgz"
A tarball URL:
dsh plugin --profile web add https://example.com/dsh-snapcompact-<version>.tgz
The npm package is the prebuilt option; for a local checkout, run pnpm pack (or pnpm run build) first.
Replacing a summary with images is an idea from snapcompact in Oh My Pi; this plugin is an independent implementation of snapcompact for DSH.
A vision model is billed mainly by image area, regardless of how many characters an image holds. Within the legibility limit, a dense frame carries more information per token than plain text. Content that would otherwise be condensed into a text summary is rendered as images instead, so more context survives at a lower token cost.
DSH selects a safe region
│
▼
deterministic serialization (head/tail caps, log elision, exact-token marking)
│
▼
snapcompact → shake → soft
│
▼
one checkpoint: exact head/tail + frames + text index
| Order | Method | Model call | Output |
|---|---|---|---|
| 1 | snapcompact |
none | Dense frames, exact head/tail, FILES index, exact-token index |
| 2 | shake |
none | Oversized tool outputs keep only head/tail excerpts; the middle is dropped |
| 3 | soft |
native summary | DSH's native text summary |
The snapcompact method (order 1) runs only when both conditions hold:
opencode-go/deepseek-v4.1-flash) must declare image input, and its image pricing must be determinable: the adapter supplies prices, an explicit per-frame cap is configured, or a labelled conservative estimate covers a known model family.If either condition fails, snapcompact is skipped, the chain moves on to the next method, and it ends at the native summary.
| Entry point | What it does |
|---|---|
/compact |
Manual compaction; needs to run inside a Snapcompact preset |
/snapcompact status |
Current route (provider/model), trigger threshold, retained tail and compactable space, plus whether each compaction method can run |
Manage the common keys on the Plugins → Snapcompact settings card. Saved values apply only to new sessions; existing sessions keep running with the configuration they were created with. The defaults are the chain [snapcompact, shake, soft], a trigger at 80% of the context window and at most 40 frames per compaction; every other key is YAML-only — see the configuration reference.
Not lossless: information can be lost before and during rendering.
?; tabs expand to spaces, runs of spaces collapse and ANSI escapes are stripped. The model reads pixels, not text, so a 64-character digest is not something to expect back from a picture.INFO/PASS lines and stack-call lines are dropped whole.[…80ch elided…] or […3 routine log lines elided…].Whether it saves tokens depends on the context length and the model in use. On short sessions a native summary may use fewer tokens, and expensive image tokens can also cancel the gain. Measurements are in Evaluation results.
No lookup after compaction. The only character-exact copies are the head/tail text and the text index; a string that made it into neither is not recoverable later.
Confirm the plugin is installed, restart DSH if the page asks, then create a new session and look for Snapcompact (Standard), Snapcompact (PTC) and Snapcompact (Cordis).
Run /snapcompact status. The current route (provider/model) probably declares no image input or no usable image pricing, which is the intended safe behavior.
This means every method (snapcompact, shake, soft) was skipped — it either could not shrink the checkpoint enough or went over budget. Run /snapcompact status first to see the current route, the compactable space and each method's availability; then retry once the session has more history, or move to a model that works. The error text lists, one by one, why each method was skipped or failed.
pnpm install --ignore-scripts
pnpm run check
pnpm pack
Setup details, the install check and the evaluation harness live in the contributing guide.
Original application code is MIT. Bundled GNU Unifont 18.0.01 data retains the SIL Open Font License 1.1; the Oh My Pi snapcompact design reference is MIT. See third-party notices.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness。