Introduction

DeepSeek Harness (DSH) uses a plugin-based architecture, but it may be necessary to control tool visibility and invocation permissions uniformly at the host level without relying on a specific preset. dsh-tool-guard is a global tool-blocking plugin designed for this purpose. It achieves this goal through a three-layer mechanism (presentation-layer filtering, execution-layer hard veto, self-protection gate), and provides a WebUI editor to support hot-reload configuration.

Plugin Overview

Name: dsh-tool-guard
Maintainer: Tisitan
License: MIT

This is a preset-agnostic global tool-blocking plugin. It is not bound to any preset and intercepts, based on rules, tools that should not be visible to or invocable by the model at the unified plugin layer. The plugin includes presentation-layer filtering, execution-layer hard veto, self-protection gate, and a WebUI editor.

Core Features

  1. Preset-agnostic global tool blocking: Does not depend on a specific preset and performs unified interception at the host level.
  2. Presentation-layer filtering: Uses the system-prompt / assemble mechanism to prevent the model from seeing blocked tools.
  3. Execution-layer hard veto: Uses tools.guard to provide a fallback rejection when a call actually arrives.
  4. Self-protection gate: Protects core tools such as read / write / edit / bash from being blocked.
  5. WebUI editor: Provides a /dsh-tool-guard RPC channel and supports immediate hot updating of configuration through a graphical interface.

Installation and Enablement

  1. Clone the repository and install dependencies:
git clone https://github.com/Tisitan/dsh-tool-guard.git
cd dsh-tool-guard
npm install
npm test
  1. Link the repository path to DSH’s web profile:
    Add the following to dependencies in ~/.dsh/profiles/web/package.json:
"dsh-tool-guard": "link:<绝对路径>"

Append the following to the dsh.profile.bundles array in the same file:

"dsh-tool-guard"
  1. Install dependencies and restart DSH:
    Run the following in the ~/.dsh/profiles/web directory:
pnpm install

Restart DeepSeek Harness.

Configuration Methods

The plugin provides two configuration paths with identical semantics, both supporting hot reload.

1. WebUI Configuration

After startup, use the “Tool Blocking” card on the DSH Web settings page. Read and write operations are performed through the /dsh-tool-guard RPC channel, and changes take effect immediately after saving.

2. Manual YAML Editing

Edit the dsh-tool-guard.denyTools array in ~/.dsh/settings.yaml.

Note: The configuration plane is never locked; saving a modification immediately triggers a hot-reload update.

Notes

  1. Loader Source Restriction: Plugins with dsh.client are allowed only one loader source globally. If mounted at the home level, dsh.client must be removed to avoid dual loader sources causing startup failure.
  2. Protection Gate Cannot Be Blocked: read / write / edit / bash are covered by the self-protection gate and cannot be blocked or intercepted.
  3. Log Location: The log file is located at $DSH_HOME/dsh-tool-guard.log or ~/.dsh/dsh-tool-guard.log (can be overridden by the environment variable DSH_TOOL_GUARD_LOG).
  4. Mounting Methods: Global mounting (single-point mounting in the web profile bundle) and local mounting (writing to a specific preset’s agent.cordis.yml) are supported.

References