AI Agent Hub
Back to plugins
⚙️

context-pruner

Workflow Updated 2026.08.25

Run the following command in DeepSeek Harness:

dsh plugin install JohnXu22786/context-pruner

Paste the following prompt into your AI chat to install this plugin:

Run dsh plugin install JohnXu22786/context-pruner in the DeepSeek Harness terminal to install the plugin; source code is available at https://github.com/JohnXu22786/context-pruner .

About this plugin

Long-running agent workflows pile up a mountain of tool-call records—stale outputs, duplicated requests, verbose error traces, oversized results—that silently devour the context window, waste token budget, and dilute the signal the model actually needs. context-pruner solves exactly that: it plugs a fully heuristic, zero-LLM-call context-triage engine into the official dsh compaction pipeline, making every decision deterministic, testable offline, and independent of any extra service.

Five independently toggleable screeners each handle a distinct category of bloat: archiving stale tool outputs into compact summaries, collapsing repeated identical calls to the latest one, swapping failed-call arguments for a tight error stub, head-and-tail trimming of oversized tool results, and pruning or trimming expired reasoning blocks. Every action is guarded by a reserve zone (the most recent N user turns are never touched) and an exemption list (stateful tools like task, skill, write, and edit are protected by default). A strict before-and-after size comparison ensures no rewrite is applied unless it is provably smaller, and call-pair-level changes act as atomic groups—no half-finished states. Each triage run produces a structured audit report with per-reason counts, token savings, and item-level details.

Built for developers running multi-turn, multi-tool agent workflows on dsh who want the context window to stay focused on what matters without introducing an extra model dependency. If you need zero-cost, deterministic, and auditable context slimming that slots into the official harness compression seam, context-pruner is your plug-and-play answer.

Use Cases

  • Context window nearing its limit after many tool-call rounds, auto-prune stale outputs to free space
  • Repeated identical tool calls wasting tokens in long sessions, auto-collapse to the latest entry
  • Validate context compression strategies and screener rules offline with zero external LLM dependency

Best For

  • Developers building multi-turn, multi-tool agent workflows on dsh
  • AI engineers balancing token cost against context quality
  • Teams requiring deterministic, auditable, zero-model compression solutions