Preface¶
When building workflows with DeepSeek Harness (DSH), developers often need to monitor the actual performance of tool calls—such as abnormal latency or the token consumption of arguments and results—beyond just the conversation transcript itself. Traditional logging methods often inject massive amounts of data into the context, making them difficult to retrieve and lacking in aggregate statistical capabilities. This plugin provides a “zero model visibility” lens that records only key metrics without interfering with the context.
Plugin Introduction¶
dsh-plugin-tool-trace is a DeepSeek Harness (dsh) plugin. Its core responsibility is to trace the duration, argument volume, and result volume (recording only size, not content) of every tool invocation. Data is persisted to JSONL files generated monthly, and a /tools-stats command is provided to generate a leaderboard of slow tools.
- Maintainer: 121212165
- License: MIT
Core Features¶
- Slow Tool Leaderboard: Access
/tools-stats. The system sorts by cumulative duration and displays the call count, cumulative duration, average duration, maximum duration, average result volume, and error count for each tool. - Zero Model Visibility: All tracking data is written only to local files and does not enter the conversation context. This protects privacy and ensures the data is purely for human analysis.
- Fault Tolerance: If a process crash interrupts a write, partial lines are automatically skipped and counted. Calls that died mid-process (having a start but no end) are naturally ignored during aggregate statistics.
Installation and Activation¶
The installation process requires adding the package to a specified Profile via the DSH plugin command and modifying the configuration file.
- Execute the installation command (ensure
pnpmis in your PATH):
dsh plugin --profile web add github:121212165/dsh-plugin-tool-trace
This command automatically runs the prepare script via pnpm to build the plugin.
-
Configure the patch file.
Locate thecordis.patch.ymlin the root directory of this plugin repository and merge its content into$DSH_HOME/profiles/web/cordis.patch.yml.
Note: This file defaults to an empty array[]. Please merge the patch content into the array; do not append it directly. Appending will cause a YAML parsing error (reportingfailed to parse overlay ... end of the stream or a document separator is expected). -
Restart dsh.
Both the configuration layer and the client need to be restarted for the changes to take effect (the client distributes content based on the rev at startup; a hard refresh of the browser will not work).
Configuration¶
The plugin supports the following configuration options:
| Field | Default Value | Description |
|---|---|---|
dataDir |
~/.dsh/tool-trace |
Directory for persisting JSONL logs |
captureArgsSize |
true |
Whether to record the length of the argument JSON |
Typical Usage¶
- View Statistics: Use the
/tools-statscommand in the DSH interface or terminal to view the slow tool leaderboard. - View Logs: Navigate to
dataDir(default~/.dsh/tool-trace) to view monthly JSONL files and understand specific call metrics.
Notes¶
- Result Volume Precision: The extraction of result body size relies on the data shape of the downstream result. If
contentis a string, the size calculation is exact; if it is another shape (such as an array or object), the size is estimated via serialization. - Live Mount Unverified: The plugin has not been verified for live mounting on a running dsh instance.
- Activation Conditions: The dsh process must be restarted for the plugin to take effect.
Closing¶
By persisting data to disk and performing aggregate statistics, this plugin helps developers shift their focus from “what was said” to “what was done and where the bottlenecks are.” For more details and source code, please visit GitHub or the Community Directory.