DSH Token Economizer: An Evidence-Based DeepSeek Harness Plugin for Tool Definition Minimization

Preface

When designing tools for DeepSeek Harness (DSH), it’s easy to introduce a large number of definitions. Even if certain tools are used in only a handful of scenarios, they remain present in the system definition. This increases the context length and raises the potential overhead of tool calls. The existing DeepSeek Harness includes a reminder for repeated tool calls, but it provides no mechanism for trimming at the definition level.

DSH Token Economizer focuses on the tool definition layer. By analyzing usage patterns from historical sessions, it provides suggestions for reducing unnecessary tool definitions. It does not modify session history, nor does it store tool parameters or results—it only analyzes tool names.

Plugin Positioning

DSH Token Economizer is an independently maintained DeepSeek Harness plugin, created by developer Lphehe. The project is inspired by Microsoft TokenEconomizer, but there is no affiliation between the two. The plugin’s core objective is to provide evidence-driven tool definition trimming, helping developers reduce redundant tool definitions.

The plugin does not implement the upstream micro-skill engine, nor does it claim the same benchmark savings as TokenEconomizer. It only analyzes tool definitions and is intended to complement DeepSeek Harness’s own repeated tool call reminders.

Core Features

The plugin checks the most recent 40 historical sessions that share the same working directory as the current one, ignoring the current session and events inherited from forks. A candidate tool is only suggested for hiding when it has appeared in the requests of at least three sessions and has not been called in any of the checked sessions.

Currently, only two tools are analyzed: list_subagent_models and list_mcp_resource_templates. The plugin does not automatically hide tools—you must explicitly choose to apply the suggestions via commands. The plugin stores a policy for at most one directory at a time: the original directory must be restored before a policy can be set for another directory. Switching the working directory or disabling the plugin will lift any inapplicable restrictions.

The plugin calculates Prompt-to-Call (PTC) invocation counts in legacy sessions, but tools exposed only through the legacy PTC SDK are not counted toward the provision count, which may result in underreporting of suggestions.

Installation and Activation

Install via the DeepSeek Harness UI:

  1. In DSH, open Plugins → Add plugin
  2. Enter @lphehe/dsh-token-economizer and install

Alternatively, you can clone the repository and select the directory:

git clone https://github.com/Lphehe/dsh-token-economizer.git

After installation, restart DSH to load the updated JavaScript.

Typical Usage

Once installed, run the following commands in the DSH chat input field:

View Status and Suggestions

/economizer status

This command displays:
- Historical statistics for the current directory
- A list of tools suggested for hiding
- Whether already-selected tools in the current session are still visible

By default, no tools are hidden. You must explicitly use the apply command to select which to hide.

Apply Suggestions to Hide Tools

Select a tool to hide:

/economizer apply list_subagent_models

Or

/economizer apply list_mcp_resource_templates

Only candidate tools that meet the criteria in the current status can be applied.

Restore Tools

If you previously hid a tool and need to restore it, run:

/economizer restore

Use Cases and Cautions

This plugin is suitable for developers who are already using DeepSeek Harness to build agents and need fine-grained control over tool definitions. Please note the following when using it:

  • The plugin runs with the permissions of the current DSH process. Review the source code and license before installation.
  • Tool trimming may affect future tasks that require the hidden tool. It is recommended to apply changes only after confirming they will not disrupt your workflow.
  • Prompt caching may alter the actual token savings. The plugin does not guarantee any token or cost savings.
  • The plugin checks at most the 40 most recent historical sessions. If you have a large number of historical sessions, some tools may not appear in the suggestion list.
  • Switching the working directory or disabling the plugin will lift any inapplicable restrictions.

Conclusion

DSH Token Economizer provides an evidence-based path for trimming tool definitions. Combined with DeepSeek Harness’s own repeated tool call reminders, it offers a more comprehensive approach to reducing unnecessary tool definitions. The project is open source under the MIT license, and more information can be found in its GitHub repository.

  • Technical documentation: https://github.com/Lphehe/dsh-token-economizer
  • Community directory: https://www.skillhub.cn/plugins/Lphehe/dsh-token-economizer
羽毛球分组比赛记分
小程序二维码

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

Xiaoye