Introduction¶
A subtle failure often occurs when asking models to modify code in DeepSeek Harness (DSH): the model includes placeholder comments like // ... existing code ... in the new content of a write or edit operation. When the editing tool performs a literal replacement, dozens of lines of actual code are replaced by a single comment line. This is often discovered when the build fails; worse still, the build might pass while the logic remains incomplete.
Manually reviewing every tool call is costly, and post-hoc diffs cannot prevent writes that have already been persisted to disk. The following introduces the community plugin dsh-block-placeholder-edits (maintained by acus9345), which validates every write / edit before execution. If a rule is triggered, it rejects the call and preserves the original file, while returning the problematic lines and fix suggestions to the model.
What is this¶
dsh-block-placeholder-edits is a plugin for DeepSeek Harness that hooks into the file writing path on the Cordis side. As positioned in its README, it rejects edits that replace real code with placeholder comments, as well as whole-file writes that would silently discard most of a large file’s content. It is licensed under MIT; the current npm package version is 0.2.3 (see the repository’s package.json). In the community directory, it is categorized under “Model Inference,” and the GitHub repository has approximately 2 stars.
The plugin runs with the permissions of the current DSH process; before installation, it is recommended to review the source code and license yourself to ensure its behavior meets your security and compliance requirements.
Core Features¶
Placeholder Comment Detection¶
The plugin checks if the new text contains comments that “talk about code rather than being the code itself.” Common comment styles are covered: //, #, /* */, <!-- -->, --, ;, JSX {/* */}, etc.
Examples (excerpted from the README):
// ... existing code ...
# rest of the file unchanged
/* ... */
// keep the rest as is
// ... other methods
{/* ... */}
A standalone line of ... is also treated as a placeholder, but it is excluded in files where ... has semantic meaning, such as Python and Markdown. Normal comments (including explanatory comments mentioning existing code) will pass; if a placeholder comment already exists in the old text, the model will not be repeatedly warned about it.
Large File “Shrink” Whole-Write Detection¶
For whole-file write operations: if the original file contains at least 40 lines (default minLinesForShrink) and the new content has fewer than half the lines of the original (default shrinkRatio: 0.5), the write is rejected. The README explains that this pattern usually indicates the model is rewriting from memory and discarding large chunks of content. Targeted edits (old_string / new_string) are not affected by this rule, nor are newly created files.
Feedback and Retry after Rejection¶
Upon rejection, the model receives an explanation similar to the following (including the problematic line number and fix suggestions):
dsh-block-placeholder-edits blocked this edit to src/app.ts: the new text contains
placeholder comments that stand in for code instead of the code itself. Writing them
would delete whatever they replace.
line 2: // ... rest of the function unchanged
Fix: write out the full code in place of each placeholder, or use a smaller `edit`
that replaces only the lines you are changing (old_string/new_string) so untouched
code stays as it is.
The README notes that in practice, models often switch to narrower edits or complete the full code. If it is truly necessary to delete a large section of content, the model can execute the exact same call a second time to confirm intent, which will pass on the second attempt (this can be disabled via configuration). If you prefer a human decision, set mode to ask.
Installation and Activation¶
The common web profile (the browser UI corresponding to dsh web) is typically used. If using headless (scripts/CI) or acp (editor integration), the plugin list must be installed separately for the respective profile.
dsh plugin --profile web add dsh-block-placeholder-edits
It takes effect immediately after installation without requiring additional switches. To uninstall:
dsh plugin --profile web remove dsh-block-placeholder-edits
When testing plugin modifications locally, the README provides a path to build a tarball from a clone and then install it (version numbers depend on the npm pack output, shown as dsh-block-placeholder-edits-0.2.0.tgz in the example):
git clone https://github.com/acus9345/dsh-block-placeholder-edits
cd dsh-block-placeholder-edits
npm install
npm pack
dsh plugin --profile web add ./dsh-block-placeholder-edits-0.2.0.tgz
Configuration¶
You can click on dsh-block-placeholder-edits in the Plugins section of the DSH sidebar to modify and Save. Changes take effect on the next tool call without requiring a restart.
Alternatively, you can append to ~/.dsh/profiles/<profile>/cordis.patch.yml or the global ~/.dsh/cordis.patch.yml (unspecified keys retain their default values):
- id: block-placeholder-edits
config:
mode: deny # or `ask` for an approval prompt
shrinkRatio: 0.5 # 0 turns the large-deletion check off
minLinesForShrink: 40 # files shorter than this are never shrink-checked
allowIdenticalRetry: true # false: a refusal is final
extraPatterns: [] # extra regexes for your own placeholder phrasing
ignore: ['docs/**'] # globs to skip entirely
Setting shrinkRatio to 0 disables large file shrink detection; ignore can be used to completely skip plugin checks for specified globs.
Use Cases and Caveats¶
This is suitable for developers who frequently ask models to modify repositories in DSH and have encountered issues with placeholder comments or “whole-file rewrites becoming shorter.” It does not replace code review but reduces a class of predictable data loss at the tool layer.
Notes:
- The plugin list is independent for each profile; you must
addit once for every profile actually used. - The plugin runs with the same process permissions as DSH. The configuration for
ignoreand customextraPatternsshould be scoped clearly to avoid accidentally allowing sensitive paths. - The community plugin directory (such as SkillHub) is an independent site and has no official affiliation with DeepSeek / High-Flyer; installation sources should be based on the directory page and the GitHub repository.
Development and Verification¶
The maintainer provides unit tests and end-to-end tests in the repository (e2e uses a scripted local model and requires no API key):
npm install
npm test # detector unit tests
npm run test:e2e # real dsh runs against a scripted local model, no API key needed
Installation-related tests execute dsh plugin add; the README notes that pnpm must be available on the PATH. Issues and ideas can be reported via GitHub Issues.
Summary¶
dsh-block-placeholder-edits intercepts placeholder comments and suspicious large-file shrink writes before they occur, returning specific line numbers and fix suggestions to the model, thereby reducing the probability of “silent code deletion.” When necessary, you can coordinate with mode: ask or disable shrink detection to adjust the balance between safety and flexibility according to your project.
- Community Directory: https://www.skillhub.cn/plugins/acus9345/dsh-block-placeholder-edits
- Source Code & Documentation: https://github.com/acus9345/dsh-block-placeholder-edits