Introduction

In long-running agent sessions, stack traces produced by tool errors can easily cause “context rot.” Lengthy error messages consume the model’s context budget, and repeated failures make the problem worse. This plugin compresses errors before they enter the model context, reducing noise in the session log.

What Is This

This is a DeepSeek Harness (DSH) plugin maintained by Orangelightening. The problem it addresses is compressing verbose tool error payloads to prevent them from accumulating in the session log and context window.

Core Features

The plugin hooks into the tools/post-execute pipeline and rewrites error text in place. It recognizes two failure signals: an isError result or a non-zero [exit code: N] marker.

  • Truncates the text of failed calls to their first maxLines message lines.
  • Removes indented stack trace frame lines.
  • Preserves truncation markers (such as [anti-rot: dropped ...]).

Installation and Enablement

From the repository checkout directory:

pnpm dsh plugin --profile web add /path/to/dsh-plugin-anti-rot

Typical Usage

Add the following entry to cordis.patch.yml:

- insert:
    - id: anti-rot
      name: dsh-plugin-anti-rot
      config:
        maxLines: 15

Use Cases and Notes

This plugin is suitable for scenarios where tool failures produce long stack traces and consume the context budget.

  • The maxLines configuration option must be a positive integer; otherwise, loading will fail.
  • Successful exits (clean exits) remain unchanged.
  • The exit marker is always re-appended as the last line of the compressed payload.
  • Handling large successful text is the responsibility of the @deepseek-ai/dsh-spill-policy plugin.
  • The plugin delegates and composes via next().

Conclusion

By compressing error payloads, this plugin helps reduce context noise in long sessions and saves context budget. For more details, refer to the plugin directory or source repository.