yangyu666/dsh-jev-prune 预览 preview

yangyu666/dsh-jev-prune

Plugin插件 Native原生 ⭐ 4 MIT Sessions & Context会话与上下文

Jev-judged context compaction for DeepSeek Harness: semantic tool-result pruning + deterministic receipt compaction

Project Overview项目介绍

dsh-jev-prune is a native Cordis plugin for DeepSeek Harness (MIT-licensed) that replaces DSH's built-in two-layer context compaction with TypeSafe Jev structured judgments. At the first interception point, ctx.toolResultPruner.pruneSession, the plugin asks Jev's noul/choice endpoint, which returns calibrated probabilities, whether each tool result is still needed; needed results are never trimmed however large, stale ones are trimmed however small, and absence of a judgment falls back to DSH's original volumetric behaviour above minCharsToPrune. At the second layer, ctx.compaction.summarize and compactRegion, the plugin does not let the model rewrite history but moves whole read-only tool-call + tool/result pairs out of the surface and injects a deterministic receipt computed by the plugin's own code, listing tool name, command, path, character count and seq, while the original events stay verbatim in the session log.

Typical users are DSH operators running long agent sessions whose context budget keeps collapsing. Installation goes through cordis.patch.yml so the plugin is prepended ahead of the host's compaction-basic; once mounted, the /jev slash command reports runtime status, inspect_session.mjs audits multi-frame zstd JSONL session logs offline, verify_real_shapes.mjs regresses tool-name resolution against real logs, and wire_profile.mjs lets operators wire the plugin by hand on machines without pnpm. Probabilities are consumed as relative quantiles within a session rather than as a fixed cutoff, write-type tools are excluded by a hard rule, an evidence guard never moves results matching error/assert/fail/todo (and follows sourceEventSeqs when layer 1 has already trimmed), and the gate requires compactQuantile on both the result axis and the effect axis, balance of DSH's tool-pairing, savings of at least compactMinChars, and a receipt kept below receiptMaxRatio of the original tokens.

Dependencies and limits are concrete: Node ≥22.19, DSH 0.1.x-rc, and the plugin must replace the host's base bundle; CI only covers pure-function logic, takeover and the append protocol under a fake ctx, plus an integration check that the module loads against the real dependency tree with freezeMessage available, so live-host takeover and event-shape drift between rc versions must be verified with jev_probe_shapes in a real session. By default the plugin sends session history text, including file paths, code snippets and command output, to the TypeSafe API for judgment, so sensitive codebases need a self-hosted swap at the jev.js and state.js replacement points, and the runtime receipt/status strings ship in Chinese today while jev_* tool descriptions are already in English.

dsh-jev-prune 是一款面向 DeepSeek Harness 的原生 Cordis 插件(MIT),专门替换 DSH 内置的两层上下文压缩决策:第一层 ctx.toolResultPruner.pruneSession 改为由 TypeSafe Jev 的结构化输出(noul/choice,含校准概率)逐条判断工具结果是否仍被需要,需要的永不裁剪、过期的即便很短也会裁剪、无判定时回退到 DSH 原生行为;第二层 ctx.compaction.summarize + compactRegion 不再让模型改写历史,而是把只读探测整对移出,并注入由插件 JavaScript 代码生成的确定性回执(工具名、命令、路径、字符数、seq),不含任何模型推断,原文按 seq 完整保存在会话日志中。

典型工作流面向长会话场景下的 DSH 用户:通过 cordis.patch.yml 安装并叠加在宿主 bundle 之上,prepend 在 compaction-basic 之前生效;用户可借 /jev 查看状态、用 inspect_session.mjs 离线审计多帧 zstd JSONL 日志、用 verify_real_shapes.mjs 回归工具名解析、用 wire_profile.mjs 在无 pnpm 机器上手动接线。判定采用 session 内相对分位数而非固定阈值,写类型工具被硬规则排除,证据守卫会扫描原始事件避免误压错误与断言,阈值含 compactMinChars、receiptMaxRatio、compactPreserveRecent、neverCompactTools 等。

依赖与限制:Node ≥22.19、DSH 0.1.x-rc、需替换 base bundle(CI 不覆盖真实宿主内的 service takeover 与 rc 版本间 event shape 漂移,须用 jev_probe_shapes 在真实会话中验证)。插件默认将含文件路径、代码片段与命令输出的会话文本发往 TypeSafe API 做判定,处理敏感代码前需自评;如数据不可出本机,可将 jev.js 与 state.js 替换为自托管模型,回执文案目前为中文,运行时常量以代码生成为准。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 4 stars - very few users, little community feedback星标只有 4,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add github:yangyu666/dsh-jev-prune

把 yangyu666/dsh-jev-prune 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-jev-prune

dsh-jev-prune — Jev-judged context compaction for DeepSeek Harness

Jev-judged context compaction for DeepSeek Harness. Structured judgments from TypeSafe Jev drive DSH's two-layer context compaction. The compaction algorithms are untouched; the judgment backend is pluggable (Jev / rules / a self-hosted model).

English · 简体中文

license node dsh CI smoke checks

The problem it solves

DSH's built-in context reclamation is purely volumetric. Once a tool result crosses a size threshold, its middle is chopped out and the head and tail are kept; region compaction, meanwhile, has the model write a summary to stand in for old history. The first approach cannot tell "this result is large but I still need it" from "this one is spent", and the second one invites summary hallucination.

This plugin replaces the decision in both places with Jev's structured output (noul / choice, returning calibrated probabilities), under one design rule:

What should not be generated by a model is not generated by a model. Trimming only ever decides keep or discard; the original text is preserved verbatim. Region compaction injects a deterministic receipt produced by code, containing no model inference at all.

The two layers

The two layers: result trimming and receipt compaction

Layer Interception point DSH default This plugin
1 · Result trimming ctx.toolResultPruner.pruneSession Chops the middle once thresholdChars is exceeded Jev decides, per tool result, whether it will still be needed. Needed ones are never trimmed, however large; stale ones are trimmed however small (unless shorter than minCharsToPrune); with no judgment available it falls back to DSH's original behaviour
2 · Receipt compaction ctx.compaction.summarize + compactRegion, or a single-result surface replacement for mixed batches The model reads the raw history and writes a summary Moves fully eligible read-only steps out of the surface. In a parallel batch where only some results qualify, it keeps every call/result envelope and replaces only the eligible result bodies with deterministic receipts. Tool name, command, path, character count and seq are all computed by code

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-workbuddy2api 下一个 Next dsh-subagent-default-model →