DeepSeek Harness Tool Integrity Patch

Preface

The built-in tools in DeepSeek Harness (DSH) often fail to explicitly inform the caller when a result is incomplete. This silent truncation prevents the model from correctly determining whether subsequent data exists, and it cannot independently follow a pagination or recovery path.

The DSH plugin w3353239621-tech/dsh-tool-completeness addresses this gap. It ships as a standalone bundle that shadows same-named tools at the Agent scope, without modifying the installation tree, so it can survive application upgrades. The plugin is maintained by w3353239621-tech and categorized under “Workflow.”

Core Features

The plugin shadows read / grep / glob, supplements the canonical value with “completeness” and “pagination” metadata, and extends the ripgrep (rg) exit-code protocol.

1. read: Distinguishing Truncation Type and Continuation Position

The built-in read drops the truncation flag when the byte limit is reached, leaving the PTC path with no truncation information at all. This plugin adds the following fields to the canonical value:

  • truncatedByBytes: whether the result was truncated by byte limit
  • truncatedByLimit: whether the result was truncated by line-count limit
  • hasMore: whether additional content remains
  • nextOffset: the offset to resume reading from
  • bytesReturned: the actual number of body bytes returned

The rendered text remains consistent with the built-in formatReadOutput to prevent external regex patterns from breaking.

2. grep / glob: Pagination in the Canonical Value, Rendered on the Same Page

The built-in grep / glob keep their canonical value and rendered output on different pages, causing a mismatch between PTC and native result counts and making “next page” information unavailable. The plugin moves pagination logic into execute(), so pagination is reflected in the canonical value, and adds:

  • offset / limit: pagination parameters
  • returned / total / totalKnown / complete: hit statistics
  • nextOffset / spillRef / warnings: continuation path and warning information

Rendering reads the same canonical value, ensuring PTC and native result counts match.

3. rg Exit Code: Partial Results + Warning on Non-0/1

When rg returns an exit code other than 0 or 1, the built-in behavior fails the entire search. The plugin introduces an exit2Policy configuration option (unset by default) supporting the following strategies:

  • Unset (default): salvage what can be salvaged — return partial results + complete=false + warnings
  • Set to 'error': restore the built-in strict “non-0/1 means failure” mode
  • Regex syntax errors: still fail immediately

4. Implicit vs. Explicit Parameters: Defaults Match the Built-In

For compatibility, the defaults of new explicit parameters strictly align with the built-in behavior:

  • grep: hidden=false / noIgnore=false
  • glob: hidden=true / noIgnore=true

Installation and Activation

The plugin requires DSH 0.2.x and is not published to npm; it must be installed from a local directory.

git clone https://github.com/w3353239621-tech/dsh-tool-completeness.git C:/src/dsh-tool-completeness

# Add it as a bundle to a profile
dsh plugin --profile <profile> add link:C:/src/dsh-tool-completeness

# Verify it registered
dsh --profile <profile> --dump-config | Select-String -Context 2 'dsh-tool-completeness'

After installation, the plugin automatically registers tool shadowing in memory; it takes effect on the next startup. To uninstall:

dsh plugin --profile <profile> remove dsh-tool-completeness

Configuration

In cordis.patch.yml or a configuration file, you can adjust the following as needed:

Key Default Description
read / grep / glob true Toggle the shadow implementation of an individual tool
readLimit 2000 Aligned with the built-in readLimit
grepLimit 250 Aligned with the built-in GREP_MAX_MATCHES
globLimit 100 Aligned with the built-in GLOB_MAX_RESULTS
exit2Policy Unset Unset = salvage what can be salvaged; 'error' = restore strict mode

Self-Test and Acceptance

The plugin includes a self-test script that runs without a host DSH instance:

node test/selftest.mjs   # equivalent to npm test

The expected output is {"total": 12, "failed": 0, "failures": []}.

Acceptance evidence is located in the acceptance/ directory, including PTC and native execution logs, baseline comparisons, self-test records, and configuration snapshots. The author replays these acceptance checks via the repro.ps1 script and documents the criteria and measured values item by item in ACCEPTANCE.md.

Use Cases and Caveats

  • Suited for Agent scenarios where the model needs to autonomously determine “whether the result is complete” and “how to continue,” especially those involving file reading, search, and file listing.
  • The plugin runs with the permissions of the current DSH process. It is recommended to review the source code and license (MIT) before installing.
  • The plugin targets DSH 0.2.x only; upstream changes to the tool layer may cause breakage. The author explicitly labels it as a “personal cloud archive, not a maintained project.”

Summary

dsh-tool-completeness adds explicit “completeness” and “pagination” information to DSH’s read / grep / glob and extends the rg exit-code protocol. As a result, the model can more accurately assess whether a result is complete and obtain an actionable recovery path. The plugin shadows tools at the scope level as a bundle without modifying the installation tree, making it well-suited for long-term deployments that need to track application upgrades.

  • Directory page: https://www.skillhub.cn/plugins/w3353239621-tech/dsh-tool-completeness
  • GitHub: https://github.com/w3353239621-tech/dsh-tool-completeness
羽毛球分组比赛记分
小程序二维码

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

Xiaoye