DSH Too Long Warning

The DeepSeek Harness (DSH) ecosystem allows feature extension through plugins. Context window management is a common pain point in agent development, especially when compression strategies cause repeated operations and extra token consumption. The dsh-toolong-warning plugin aims to address this issue. It does not proactively interrupt the user and only raises a hint when a conversation becomes inefficient.

Plugin Introduction

This is a DSH client plugin maintained by Hjdd14. It counts the number of compactions in each session and displays the count in real time in the interface. The plugin only issues a warning when compactions occur relatively frequently and a large number of extra tokens have been consumed afterwards.

The plugin is written in hand-written JavaScript and requires no build step. It provides a draggable floating window, supports Chinese/English language switching, and defaults to remaining silent to avoid a “cry wolf” effect.

Core Features

  • Compaction Count Display: Persistently displays the compaction count for each chat in a floating window.
  • Smart Trigger Mechanism: Only raises a warning when specific conditions are met. A warning is triggered only when the compaction count reaches the threshold and a large amount of extra token consumption has occurred since the last compaction.
  • Interface Interaction: Supports Chinese/English switching. Clicking “Got it” only hides the current reminder card, while the counter continues to update.
  • Floating Window: The window is draggable and does not compete with other plugins for screen space.

Installation and Enablement

Prerequisites:
* DSH version >= 0.1.7-rc.1
* Node.js version >= 22.19
* A profile that supports a browser client is required (web or desktop)

Installation Steps:

  1. Run the following command in the terminal to install the plugin:
dsh plugin --profile web add @hjdd14/dsh-toolong-warning
  1. After the plugin is installed, the configuration values are written into the profile’s cordis patch and take effect immediately when loaded.

Typical Usage

  • Language Switching: Locate the section for this plugin on the DSH settings page and switch the interface language (Chinese/English).
  • Threshold Adjustment: In the plugin settings, you can adjust parameters such as compactCountMin (minimum compaction count), occupancyPercentMin (minimum context occupancy rate), and tokensSinceCompactionMin (minimum extra token consumption).
  • Viewing Reminders: When a chat repeatedly goes through compaction and consumes a high amount of extra tokens, a warning card appears at the top, showing the current context occupancy rate and token consumption since the last compaction.

Applicable Scenarios and Notes

  • Applicable Scenarios: Suitable for developers who need fine-grained context window management and frequently perform compaction operations. It helps developers identify chats that are becoming inefficient.
  • Silencing Mechanism: If usage data is missing, or if the route does not declare a context window, the plugin remains silent. If compaction has never occurred, the compaction count is insufficient, or extra token consumption has not reached the threshold, the plugin also does not issue a warning.
  • Disabled State: When the plugin is disabled or no chat is open, nothing is displayed.
  • Security Recommendation: Before installation, it is recommended to review the source code and license (MIT).

Summary

dsh-toolong-warning provides a non-intrusive monitoring approach that helps developers balance context management and cost. It uses counting and threshold checks to prompt users when a chat is no longer worth continuing; otherwise, it stays quiet.

GitHub Repository

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

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

Xiaoye