Introduction

In the development and debugging of DeepSeek Harness (DSH), long sessions can often lead to a surge in API calls, consuming quota and potentially causing unpredictable behavior. The existing dsh-repeat-stop plugin is mainly used to intercept consecutive identical calls, but it cannot address the problem of “frequently using different tools within a single session.”

dsh-tool-budget was created to solve this scenario. It acts as a safety guardrail and forcibly stops further tool usage after the number of tool calls in a single session reaches a preset threshold, preventing budget exhaustion.

Plugin Introduction

dsh-tool-budget is a plugin for DeepSeek Harness and is part of the dsh-wsl-kit suite. It does not directly restrict product licenses; instead, it hard-blocks tool calls at runtime.

  • Plugin name: dsh-tool-budget
  • License: MIT
  • Version: 0.1.2
  • Core feature: Hard-stop tool usage after a single session ends.

Core Features

  1. Hard-stop mechanism: When the number of tool calls in a single session exceeds the threshold, the plugin directly blocks new tool calls.
  2. Default budget: By default, 80 tracked calls are allowed, and the 81st call will be rejected.
  3. Default exclusions: The job_* tool family is excluded by default (such as job_output, job_list, and job_kill) so that long-running task monitoring is not affected.
  4. Safety guardrail: It is a runtime safety limit, not a product-level license restriction, and users can manually adjust it as needed.

Installation and Enablement

To install this plugin, the following system environment is required:
* DeepSeek Harness (dsh) version >= 0.1.2
* Node.js version >= 18

Run the following command to install it:

dsh plugin --profile web add github:173787247/dsh-tool-budget

After installation, restart the dsh web process to apply the configuration. In Trajectory, blocked calls will be shown as dsh-tool-budget: blocked.

Configuration Methods

The configuration file is located at cordis.patch.yml. You can adjust configuration items to change the budget limit or exclusion rules.

- id: dsh-tool-budget
  name: dsh-tool-budget
  config:
    enabled: true
    maxCalls: 80
    exclude:
      - job_output
      - job_list
      - job_kill
    # include: []   # 如果设置此项,仅统计列表中的工具名称
Configuration Item Default Value Description
enabled true Master switch
maxCalls 80 Maximum number of tracked calls allowed per session
exclude job_* Tool names that are not counted toward the budget
include (empty) If not empty, only the tools listed are counted

If the limit of 80 calls feels too strict, you can increase the value of maxCalls in the configuration file.

Difference from dsh-repeat-stop

These two plugins can be used together to cover different tool-call scenarios:

Plugin Name Blocking Logic
dsh-repeat-stop Blocks consecutive identical calls
dsh-tool-budget Blocks cumulative call counts in a single session from exceeding the limit

Applicable Scenarios

This plugin is suitable for scenarios that require strict control over the API consumption of a single session, such as long-running WSL tasks or high-frequency automated scripts.

Summary

dsh-tool-budget provides a simple and effective way to prevent an agent from consuming resources without limit in a single session. When used together with dsh-repeat-stop, it can address both “repeated spamming” and “total count overrun.”