Introduction¶
The native edit tool in DeepSeek Harness (DSH) requires the model to reconstruct exact source-code strings and submit both the old and new versions together via structured JSON parameters. This often leads to edit failures—because the code changes chosen by the model are correct, but old_string does not match the file in whitespace or characters. Moreover, this mechanism forces the model to re-emit most of the source code, causing unnecessary token consumption.
The dsh-smarter-edit plugin resolves the above issues by replacing the native edit with the Codex-compatible apply_patch. It allows the model to express code changes directly as patches, rather than reconstructing entire strings. This lets the model spend tokens on changing code instead of satisfying the formatting requirements of the edit protocol.
Features¶
The plugin provides the following core capabilities:
- Codex-compatible patching mechanism: Replaces the native
editwithapply_patchand supports free-form patch descriptions. - Multi-patch-block support: Supports processing multiple ordered hunks in a single call.
- Full operation types: Supports Add (add file), Update (update file), Move (move file), and Delete (delete file) operations.
- Context matching: Uses Codex-compatible context matching to reduce matching failure rates.
- Atomicity guarantees: Supports failure-atomic prechecks and rollback mechanisms to protect file state when processing fails.
- Native rendering: Uses DSH’s native diff rendering to display change results.
Installation and Activation¶
Install the plugin on the Desktop Profile:
dsh plugin --profile desktop add @anionex/dsh-smarter-edit
For Web or Headless Profiles, replace --profile desktop with --profile web or --profile headless. After installation, restart the corresponding Profile and create a new Session.
After installation is complete, you can verify whether the plugin has been mounted with the following command:
dsh --profile desktop --dump-config | grep tool-apply-patch
Typical Usage¶
The content sent by the model must be enclosed between *** Begin Patch and *** End Patch. The following operation syntax is supported:
*** Begin Patch
*** Add File: relative/path.ts
*** Update File: relative/current.ts
*** Move to: relative/renamed.ts
*** End of File
Use standard diff syntax to describe changes: - indicates deleted lines and + indicates added lines. Relative paths are resolved from the Session’s working directory. The Move to operation is optional, and End of File is used to anchor a hunk to the end of the file. Purely additive update hunks are appended directly to the file.
Compatibility and Limitations¶
- DSH version:
>=0.1.1-rc.1 <0.2.0. - Node.js version:
^22.19.0 || >=24.0.0. - Supported Profiles:
desktop,web, andheadless. - Permission requirements: Write access to the active DSH sandbox is required.
workspace-writepreserves the configured boundary, whiledanger-full-accessallows absolute paths and parent-level relative paths. - Rollback mechanism: When processing fails, the plugin rolls back emitted changes. If one hunk in a large patch fails, the entire patch is rejected, and the model must resubmit the complete patch.
Ecosystem Context¶
The philosophy of DeepSeek Harness is “everything is a plugin.” Community directories (such as SkillHub) provide indexing and distribution for plugins. These directories are unrelated to DeepSeek or High-Flyer and are independent community resources. When using third-party plugins, it is recommended to check the source code and license before installation.