dsh-image-governor: DeepSeek Harness Session Image Payload Governance Plugin

Introduction

When developing multi-turn conversations with DeepSeek Harness, image attachments in the conversation context often accumulate continuously: screenshots generated by tools, interfaces read by the Agent, files pasted in earlier turns, and so on. These images are re-uploaded in every step request. Measured data shows that a session carrying 13 attachments (about 14.7 MB in base64) at an upload rate of 0.07–0.10 MB/s consumes 100–140 seconds per step for this alone, easily triggering gateway timeouts (around 150 seconds).

The existing routing-level solution is to set a maxRequestImageBytes limit. But this is a byte-based “byte budget” strategy, which usually keeps only the latest images. This leads to an awkward result: the original reference images that are actually depended upon become hidden, while the most recently generated artifacts remain visible.

The dsh-image-governor plugin returns control to developers, allowing you to specify explicitly, for a single session, which images to keep and which to move out of the model’s view.

Plugin Positioning

  • Name: dsh-image-governor
  • Positioning: Session image payload governor.
  • Function: Audits the images currently carried by a session, allows manual filtering and removal of redundant images, and only changes the model’s view without deleting the actual attachments.
  • Maintainer: 2432450223
  • License: MIT

Core Features

Interactive Interface

  • Picker overlay: Provides a full-screen overlay in the bottom-right corner (shell.overlay), listing all sessions that carry images. The same panel is also registered next to the session title.
  • Operation method: When the panel opens, no images are selected by default. Checkboxes are the operation targets and support preset logic (keep newest, hide from model, select all, clear).
  • Undo mechanism: After each write change, the panel provides an undo entry.

Command-line Tool

  • View status: /images status. Displays historical image sizes, actual sent payloads, and images hidden by the limit rule.
  • Remove images: /images clear [keep <seq|name|id> …] [--newest N] [--yes].
    • Supports specifying kept items by sequence number, file name, or ID.
    • --newest N quickly keeps the N latest images.
    • Without --yes, it only previews; without arguments, it clears.
  • Restore images: /images restore [--yes]. Puts previously removed images back into the view.

Installation and Enablement

This plugin is pure JavaScript with no build steps. The installation command is as follows:

dsh plugin --profile web add github:2432450223/dsh-image-governor

Typical Usage

  1. Confirm the current image payload:
    Enter the following in the session:
    /images status
Check how many images are present and the bandwidth they occupy.
  1. Clean up unneeded images:
    If certain images are unneeded, select them and run:
    /images clear
The system displays a preview. After confirming, add `--yes` to force execution:
    /images clear --yes
  1. Restore images removed by mistake:
    If you discover an accidental removal, immediately run:
    /images restore --yes

Technical Details and Limitations

  • Implementation principle: The plugin does not modify frozen outbound requests. It uses the surface-replacing protocol allowed by the session format to append position-replacement operations ({ op: 'replace', start, end }), replacing image blocks with text placeholders. The original image events remain in the append-only log, so restore works.
  • File operations: The plugin does not delete any attachments. The attachment service itself does not provide deletion operations, and this plugin does not write to the attachment service either.
  • Execution timing: Write operations are only executed when the session is idle. While an Agent is running a turn, write requests are rejected.
  • Dependencies: Zero dependencies, pure JavaScript. It reads services via ctx.get; missing services only degrade functionality without blocking startup.
  • Permission note: This plugin runs within the DSH process permission scope. Please check the source code and license (MIT) before installing.

Conclusion

dsh-image-governor provides a refined way to manage images in the conversation context, avoiding performance degradation and context loss caused by excessive attachments. For more details and source code, refer to the project homepage.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye