AI Agent Hub
Back to plugins
🤖

dsh-context-guard

Model Inference Updated 2026.08.25

Run the following command in DeepSeek Harness:

dsh plugin install kpl0111/dsh-context-guard

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

Run dsh plugin install kpl0111/dsh-context-guard in DeepSeek Harness to install this plugin; full source is available at https://github.com/kpl0111/dsh-context-guard .

About this plugin

Once a long agent session reaches several hundred turns, the context window often gets clogged first by tool output: a single command spitting out thousands of log lines, a file read pulling in an entire codebase. Before the next request even starts, most of the token budget is already consumed. dsh-context-guard solves this without replacing built-in compaction and without issuing its own LLM call. It swaps oversized tool output for a compact preview of roughly 2.3K characters right before each model request, keeping the focus on the actual conversation.

Pruned output is never lost; it stays intact in DSH's append-only session log. The plugin offers a layered recovery path: first use the retained file path or a narrow filesystem search, and only fall back to recall for the smallest relevant fragment when that is insufficient. A recall result is preserved in full for exactly the next model step, after which it re-enters normal pruning, so the model can act on complete content without letting large payloads linger in context.

Built for developers running multi-turn agent workloads in DeepSeek Harness who need to control context bloat without discarding raw tool data. It is compatible with the built-in compaction tool-result pruner and takes effect immediately in a new session after a DSH restart.

Use Cases

  • Tool output bloats the context window in long multi-turn agent sessions
  • Need token savings while preserving raw output for targeted downstream recall
  • Balancing immediate pruning with selective recovery via recall in extended sessions

Best For

  • Developers running multi-turn agent workloads on DeepSeek Harness
  • Engineers who need context control without losing raw tool data
  • Users already on DSH compaction seeking finer-grained tool-output management