dsh-jev-prune: A Structured Context Compaction Plugin for DeepSeek Harness
yangyu666/dsh-jev-prune
Jev-judged two-layer context compaction for DeepSeek Harness: semantic tool-result pruning plus code-generated deterministic receipts instead of model-written summaries.
dsh-jev-prune is a context compaction plugin for DeepSeek Harness that replaces volumetric context reclamation with structured judgments. It targets two real pain points: size-based truncation cannot tell a large-but-still-needed tool result from a spent one, and letting the model write summaries for old history invites summary hallucination. The plugin takes over both the result trimming and receipt compaction interception points, letting Jev return calibrated probabilities to decide keep or discard, and injects a code-generated deterministic receipt while the original text stays verbatim in the session log. The judgment backend can be swapped for rules or a self-hosted model without touching the compaction algorithms.
How to Install
dsh plugin --profile web add github:yangyu666/dsh-jev-prune- Category
- Tools & Capabilities
- Platform
- DSH Plugin
- Author
- yangyu666
- Distribution
- Plugin
dsh-jev-prune Key Features
dsh-jev-prune Repo Summary
What Does It Do?
Jev-judged Prune is a DSH plugin for DeepSeek Harness that replaces the harness's purely volumetric context reclamation with structured judgments. It solves two problems: size-based truncation cannot tell a large-but-still-needed tool result from a spent one, and letting the model write summaries to stand in for old history invites summary hallucination. The plugin routes both compaction decisions through Jev's structured output, which returns calibrated probabilities, under one rule: what should not be generated by a model is not generated by a model.
Core Features
- Result trimming layer: takes over the tool-result pruning entry point and has Jev decide per result whether it will still be needed; needed results are never trimmed however large, stale ones are trimmed however small, and it falls back to the harness's original behaviour when no judgment is available.
- Receipt compaction layer: takes over region compaction, moves spent read-only probes (whole tool-call plus result pairs) out of the surface, and injects a deterministic receipt with tool name, command, path, character count and seq, containing no model inference at all.
- Multi-condition gating: a pair is only moved out when both the result and effect axes fall inside the session's trailing quantile, the tool is not excluded, and the evidence guard for error, assert, fail and similar markers does not fire.
- Separate text and reasoning budgets: overly long assistant text or overly long reasoning each independently blocks a move, so reasoning length alone cannot silently switch the second layer off.
- Pluggable judgment backend: judgments can come from Jev, rules, or a self-hosted model, while the compaction algorithms stay untouched.
- Verbatim preservation: trimming only ever decides keep or discard, never rewrites the original text, and the original events remain intact in the session log.
How to Use This Plugin?
After enabling it in DSH, the plugin attaches itself to the tool-result pruning and region compaction interception points automatically, so there is nothing to trigger by hand; keep calling tools as usual and the decisions happen in the background. Use the /jev status command to inspect the current judgment state, and the jev_* tools are available for the agent to call. To adjust behaviour, change the session's trailing quantile, the excluded tool list, the number of recently preserved nodes, the minimum characters to prune, the minimum characters to compact, and the receipt-to-original token ratio. Note that the receipt body and /jev status output are currently in Chinese, while the jev_* tool descriptions are already in English.
How to Troubleshoot This Plugin?
When the second layer does not move content out as expected, check the gating conditions first: whether both the result and effect axes fall inside the session's trailing quantile, whether the tool is on the exclusion list, and whether the result matches the evidence guard for error, assert, fail or todo markers. A step whose assistant text or reasoning exceeds its limit is also never moved out, so check the two separate budgets. A range is likewise skipped when tool pairing is unbalanced at either end, when the savings fall below the minimum characters to compact, or when the receipt exceeds the allowed ratio of the original content's tokens. When no judgment is available, the first layer falls back to the harness's original behaviour, which is expected degradation.
This page is an independent rewrite of the plugin's official README — for authoritative documentation and the latest changes, refer to the source: yangyu666/dsh-jev-prune. The plugin is third-party code that runs on your machine once installed; inclusion does not imply endorsement — please review the source before installing.
