Repository navigation
DSH | dsh-hypercompact | byte-budget context compaction with no LLM call, and byte-exact recall #8422
mrbeandev
started this conversation in
Show Your Plugins!
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The failure
Long agent sessions get slower and then stop working. Every model call re-uploads the whole conversation, and on a slow or proxied connection it's the request body size that kills you, not the token count. A 20 MB request can take minutes to upload and hit a proxy's 100-second timeout before the model ever sees it. DSH then retries the same oversized request.
Why the built-in compaction doesn't help
On my own sessions, inline screenshots were 50–92 % of the request body, and tool traffic was most of the rest.
What I shipped
dsh-hypercompact is a compaction engine that measures the next request in bytes and compacts old history locally in milliseconds, with no model call.
/goalround prompts and team messages.+N/−M linesfor edits, and a pointer. Runs of read-only calls become one line (read ×7: a.js b.js …).recallandrecall_search, which restore any compacted original exactly from the append-only session log, or just the matching lines of a large one. You get/recalland/hypercompact.ctx.compactioncontract, so/compact, the token meter and the context charts keep working. It doesn't patch harness internals.Measured on real sessions
Measured offline through pi-ai's own OpenAI-completions serializer, default config, no LLM calls:
Every user message was kept verbatim. Every compacted request had 0 orphaned tool results and 0 unanswered tool calls, and
recallreturned a sampled tool result byte-identical to the log.Install
dsh plugin --profile web add dsh-hypercompact node ~/.dsh/profiles/web/node_modules/dsh-hypercompact/scripts/create-preset.mjsDSH picks a compaction engine per preset. The script copies the built-in
standardpreset with only the compaction engine changed, and installs it (your existing presets are untouched). Restartdsh web, click New session, and pick Hypercompact (standard) in the preset picker before the first message.Supported DSH versions
DSH
0.1.5-rc.2up to (not including)0.3.0. Tested on0.1.5-rc.2,0.1.5-rc.3,0.1.7-rc.2,0.2.0-rc.1and0.2.0-rc.2(currentlatest). Node^22.19.0or>=24. Outside that range it refuses to load with a clear message instead of guessing.Limits
recallit).The compiler and recall design are informed by dsh-compaction-instant and VCC; no code is copied from either.
MIT licensed. GitHub · npm. I'm the author, so feedback and bug reports are welcome.
中文摘要: 长会话里每一轮都会重新上传完整对话,在慢速或代理网络上,真正导致失败的是请求体字节大小(20 MB 的请求可能在模型看到之前就超时)。内置压缩按上下文窗口比例触发,并且要把整段历史发给 LLM 做摘要,正好是那个已经失败的大请求。dsh-hypercompact 按字节预估下一次请求,在本地毫秒级压缩旧历史,不调用模型;用户消息逐字保留,旧的工具调用/结果折叠为一行,旧图片转为文字标签,并提供
recall工具从会话日志中逐字节恢复任何被压缩的内容。实测 19.5 MB → 1.1 MB。支持 DSH 0.1.5-rc.2 至 0.2.x(不含 0.3.0)。All reactions