AI Agent Hub
Back to plugins
🤖

dsh-active-context-pruning

Model Inference Updated 2026.08.25

Run the following command in DeepSeek Harness:

dsh plugin install aerince/dsh-active-context-pruning

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

Run dsh plugin install aerince/dsh-active-context-pruning in your terminal, or paste the source URL https://github.com/aerince/dsh-active-context-pruning into the Desktop plugin panel, then restart DSH to activate.

About this plugin

Long multi-turn tool-calling sessions in DeepSeek Harness quickly exhaust the context window, and the built-in auto-compaction treats all old messages uniformly—compressing content that should remain visible while potentially discarding details that matter later. dsh-active-context-pruning inverts this: the model itself decides which history segments are worth compressing, writes its own checkpoint summaries, and then calls the official compactRegion API to hide that range from the next request's surface layer, saving tokens while the original text stays intact in session.events.

The plugin provides four tools: acp_status to inspect compaction state and the surface-layer seq table, acp_compress to replace a surface-layer seq range with a model-authored summary, acp_decompress to read back the hidden text, and acp_search to query both the surface layer and compressed content. Safety guards are built in: the most recent preserveRecent surface entries (default 2) are protected from compression, summaries must be shorter than the content they replace, tool-call pairs must stay balanced, and the raw events log is never modified—decompress returns the text as a tool result without undoing the surface replacement.

This plugin is ideal for developers running long-horizon Agent tasks or multi-step tool chains in Harness, especially when you want the context window reserved for the steps currently in flight rather than buried under completed history, while still keeping the ability to retrieve any original text on demand.

Use Cases

  • Long multi-turn tool-calling sessions approaching the context window limit, requiring selective history compression instead of blanket compaction
  • Complex Agent workflows where you want the window reserved for in-flight steps while retaining on-demand retrieval of older records
  • Built-in auto-compaction is too coarse; you prefer model-led judgment on which history deserves summarization

Best For

  • Developers running long-horizon Agent tasks in DeepSeek Harness
  • Harness users working with multi-step tool chains who need fine-grained context control
  • Prompt engineers who prefer model-decided compression over uniform auto-compaction