JohnXu22786/context-pruner

Session context triage for long DeepSeek Harness sessions: deterministic screeners trim stale, duplicate, failed, and oversized content through the official ctx.compaction seam.

dsh-context-triage automatically manages context volume during long sessions: five independently switchable deterministic screeners identify and handle stale, duplicate, failed, oversized and low-value content — stale output pairs are rewritten to an archive summary, repeated calls are cut to the most recent, failed calls get a failure stub (error text kept), oversized blocks are head/tail trimmed with the omitted amount annotated, and stale reasoning is removed or trimmed. A reserve area never touches content within the most recent N user turns; an exemption list (two-dimensional tool-name and file-path globs; protects task/skill/todowrite/todoread/write/edit/batch by default) keeps stateful tools safe. Every action requires a 'worth it' check (the rewrite must be strictly smaller), actions apply as atomic groups, an audit report emits per-reason counts/savings, and it integrates natively with the dsh compression seam (auto-pressure, overflow, manual and forced region compression).

Memory ★ 1 updated 2026-08-16
View on GitHub ↗

Install

dsh plugin --profile demo add github:JohnXu22786/context-pruner

README EN body verified 2026-09-02 (repo JohnXu22786/context-pruner, plugin dsh-context-triage; zh edition link present). Install per README: dsh plugin --profile demo add github:JohnXu22786/context-pruner (docs use a demo profile; substitute your profile). Other documented options: dsh plugin --profile web add link:/absolute/path/context-pruner (local mount, recommended by the README) or a manual cordis.patch.yml merge / dsh web --patch ./cordis.patch.yml. Note: ctx.compaction allows only one provider per context — if another compression implementation is already loaded, disable one via the patch (disabled: true).

Compatibility

DSH profiles with the compaction seam (implements ctx.compaction CompactionEngine); deterministic, zero model dependency.

Details

Recent updates

5 deterministic screeners (stale/repeated/failed/oversized/stale-reasoning); reserve area + exempt globs; worth-it atomic rewrites; audit report; native ctx.compaction integration.

FAQ

Does it call a model?
No — all verdicts and rewrites come from heuristic rules: zero LLM calls, zero extra services, predictable and testable offline.
What content is protected?
A reserve area keeps the most recent N user turns untouched, and an exemption list (defaults protect stateful tools like task, skill, todowrite, write, edit, batch) can exempt tool names and file paths by glob.
Can it coexist with other compression plugins?
ctx.compaction allows only one provider per context — if another compression implementation is loaded, disable one of them via the patch.

Alternatives

KitDoesIt/dsh-compaction-instant · 030611/dsh-context-provenance

More plugins in Memory

Browse more in Memory

Guides for Memory plugins