在 DSH (DeepSeek Harness) 开发流程中… -> English translation below.
In the DSH (DeepSeek Harness) development workflow, the input box is the core of interaction. Raw drafts entered by developers are often colloquial, ambiguous, or full of references, and sending them directly to an Agent often leads to poor execution results. The dsh-improve-prompt plugin uses local LLM capabilities to rewrite the input-box draft into a prompt with clear structure and explicit instructions, while ensuring key information is not lost.
Core Features¶
Fidelity Gate and Length Gate
The plugin has two built-in safety mechanisms. The fidelity gate extracts hard facts from the draft (such as file paths, URLs, code blocks, and version numbers) and verifies whether they are preserved after rewriting. If any are missing, it triggers a repair call or reintroduces the original details. The length gate limits the length of the rewritten text: in standard mode, it must not exceed 2.5 times the input length and must be at least 200 characters. If the length budget is exceeded, the plugin refuses to rewrite and keeps the original text.
One-Click Rewrite and Revert
Click the ✦ button in the input-box toolbar, and the plugin replaces the draft directly with an enhanced version within 1-3 seconds. Within 8 seconds after replacement, you can click “Revert” to restore the original text. Once you manually edit the input box, the revert bar disappears automatically and will not overwrite the user’s new input.
Quality Credentials and Modes
After rewriting is complete, a status bar appears above the input box, showing information such as “Fidelity X/5”, “Length multiplier”, and “Elapsed time”. The plugin provides two modes: Light (remove verbose content, ≤1.2x) and Standard (structured, ≤2.5x). It supports one-click switching, and the selected mode is stored locally.
Smart Context and Slash Commands
For drafts containing references (such as “that” or “it”) or for short drafts, the plugin automatically includes context from the most recent N conversation turns. For slash commands (such as /bugfix), the plugin preserves the command prefix and only rewrites the body content.
Failure Preserves the Original
When the model is unavailable, times out, or the network fails, the plugin never changes the input-box content. It only returns a notification, ensuring the user’s input is not corrupted.
Zero Configuration and API
The plugin requires no API key and directly calls the model built into DSH. It also provides a local HTTP endpoint POST /dsh-improve-prompt/api/improve for integration by scripts or tools.
Installation and Enablement¶
Installation
Ensure that the dsh version is not lower than 0.1.1-rc.2. Run the following command in a terminal to install the plugin:
dsh plugin --profile web add dsh-improve-prompt
Enablement and Uninstallation
After installation, restart dsh web; the ✦ button appears in the input-box toolbar (to the left of the send button). Hover over the button to view the current mode.
dsh plugin --profile web remove dsh-improve-prompt # 卸载
Typical Usage¶
1. Colloquial Rewrite
Enter a colloquial request:
it’s that one, please change maxRatioFor in src/host/config.ts to 2.5
After clicking ✦, the draft is replaced with:
ChangemaxRatioForinsrc/host/config.tsto2.5.
2. Slash Command Support
Enter /bugfix ISS-202607-00090605A user feedback: password field is cleared after filling.
After clicking ✦, the prefix /bugfix ... is preserved, and the body is rewritten into a version with clearly defined troubleshooting steps.
3. Script Integration
Call it via the local HTTP endpoint:
curl -X POST http://127.0.0.1:3080/dsh-improve-prompt/api/improve \
-H 'content-type: application/json' \
-d '{"text":"把那个接口加上限流","sessionId":"sess-1","mode":"standard"}'
4. Failure Handling
If no default model is configured, clicking ✦ produces an error saying “No available model found”, and the original text remains unchanged.
Applicable Scenarios and Notes¶
Applicable Scenarios
* Change requests that must precisely preserve hard facts such as file paths, class names, and version numbers.
* Normalization of colloquial, long English sentences, or mixed Chinese-English drafts.
* Directly pasting continuation-style drafts or error logs.
* Scenarios where you want to quickly verify prompt-rewriting effects and revert at any time.
Notes
* The plugin runs under the permissions of the current DSH process; check the source code before installation.
* On failure, the plugin does not modify the input-box content, making it suitable for scenarios with high input-safety requirements.
* Only the Web Profile is supported; it must be used in a dsh web environment.
Short Closing¶
dsh-improve-prompt focuses on solving the problem of uneven quality in input-box drafts. Through the fidelity gate, length gate, and one-click revert mechanism, it can provide high-quality prompt rewriting within seconds while ensuring the absolute safety of user input. If you need customized behavior, you can override the prompts/*.md template files.
GitHub repository: https://github.com/hoyyang/dsh-improve-prompt