AI Agent Hub
Back to plugins
🤖

dsh-plugin-anti-rot

Model Inference Updated 2026.08.18

Run the following command in DeepSeek Harness:

dsh plugin install orangelightening/dsh-plugin-anti-rot

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

Run dsh plugin install orangelightening/dsh-plugin-anti-rot in your terminal to install; the plugin source is available at https://github.com/orangelightening/dsh-plugin-anti-rot .

About this plugin

In long-running agent sessions, every failed tool call injects a raw stack dump into the context window — often dozens of noise lines. Over hours of work with repeated failures, this redundant text steadily erodes the model's available context budget, a phenomenon known as context rot, where the model begins to forget earlier instructions and output quality degrades. dsh-plugin-anti-rot was built to address exactly this problem.

The plugin hooks into the tools/post-execute waterfall and targets two specific failure signals: isError results (infrastructure failures such as spawn errors or aborts) and the trailing non-zero [exit code: N] marker defined by the shared rendering contract of shell tools. When a match is found, the error text is compressed to the first maxLines message lines, intermediate stack frames are dropped, and an elision marker names what was removed. The exit code marker is always preserved as the final line so that both the model and the terminal UI can still parse it correctly.

If your workflow involves extended agent runs with frequent shell invocations that occasionally fail, this plugin significantly reduces context consumption without losing the essential error information, freeing up valuable window space for the reasoning that actually matters.

Use Cases

  • Repeated tool failures in long sessions steadily bloat the context window with raw stack dumps
  • Shell error tracebacks accumulate dozens of noise lines until the model loses track of earlier instructions
  • Compressing error text while preserving the exit code marker for terminal UI parsing

Best For

  • Developers running multi-hour agent workflows with frequent tool call failures
  • Automation pipeline authors relying on shell commands and mindful of context budget
  • Teams aiming to optimize inference window without losing essential error signals