Preface¶
When developing plugins or agents around DeepSeek Harness, everyone faces a common challenge: typing a draft requirement into the input box, repeatedly changing wording to test the model’s reaction. The draft often contains typos, messy punctuation, contradictory terms, etc., which are just noise to the model. DeepSeek Harness’s philosophy is “everything is a plugin,” and the input interface itself is also a place where plugins can be mounted. The @kongchenhui/dsh-prompt-tuner introduced below adds a button to the input toolbar to directly rewrite the current draft into a clearer, executable prompt. It is maintained by kongchenhui and is categorized under “Model Inference” in the community directory.
What is this¶
One-sentence positioning: A DSH plugin that provides a “Prompt Optimization” button in the input toolbar. It uses your custom prompt and model to rewrite the current draft into a clearer, executable prompt, while correcting typos, punctuation, grammar, terminology, and contradictions. After optimization, the draft is replaced, and the original text can be restored with one click.
Problems solved:
- Draft wording is loose and noisy; manual polishing adds an extra step before sending to the model.
- Copying drafts to other model windows every time increases error risk from pasting back and forth.
- Rewritten text often ends up in other sessions and cannot return to the input box.
Core Features¶
Rewrite and Restore¶
Click the button to start optimization. Once done, the draft is replaced, and the button changes to “Restore Original.” Clicking it again restores the original text. Restoration isn’t temporary hiding; it retrieves the original draft to overwrite the current input.
Cancellation and Failure Handling¶
- Clicking the button again while optimizing aborts the process and stops consuming model credits.
- Modifying the draft during optimization automatically cancels the current optimization—the result is based on the text before modification, continuing to run is meaningless. Your new text is retained as-is.
- When optimization fails, the button turns red; hover to see the reason; modify the draft or click again to clear the error state.
- After manually modifying the draft, “Restore Original” becomes invalid automatically to avoid overwriting user input.
Multi-session Isolation¶
Each session holds its own button state, not interfering with others:
- Switching away and back leaves the button in the previous “Restore Original” or failed state, and the original draft remains.
- Optimization requests are not aborted when switching sessions; results are written back to the initiating session.
- Exception: If the draft is manually modified during the switch, the completion result will not overwrite it; user input takes priority.
- Cancelling, failing, or restoring in one session does not affect the button in other sessions.
- Exception: Refreshing the page resets these states (only the session’s own draft is retained); requests are aborted if the plugin is uninstalled or disabled.
- To control memory, at most the last 32 sessions’ button states are retained; active sessions are not evicted.
Settings¶
Open “Settings → Prompt Optimization,” with three fields:
| Field | Description |
|---|---|
| Optimization Prompt | Determines how the draft is rewritten, used for every optimization. |
| Model | Defaults to “Follow Current Session,” using the model currently selected in the input box; can also be fixed to a specific model. |
| Max Output Tokens | Upper limit for single rewrite output, default 1024, no limit; too large values are rejected by the model service. |
The model selector supports search, grouping by provider, arrow keys to move, and Enter to confirm.
Configuration file path:
~/.dsh/prompt-tuner/settings.json
The settings page displays this path at the bottom; click to open with the system default application. If the file does not exist, it is generated with default values first. Deleting the file restores default settings. The content looks like:
{
"prompt": "你是一名提示词工程师兼校对员。……",
"model": { "provider": "", "model": "" },
"maxOutputTokens": 1024
}
Where "provider": "" means follow the current session.
Installation and Enablement¶
Installation command (replace <profile> with your profile name):
dsh plugin --profile <profile> add @kongchenhui/dsh-prompt-tuner
Requires DeepSeek Harness 0.2.1-rc.5 or higher (package.json’s engines.dsh also states >=0.2.1-rc.5). The current release version is 0.1.3, license MIT. Check the version before installing, then verify the source code content. The author does not retain build artifacts in the repository; the browser side is packaged by tsdown into harness closure-factory products.
Typical Usage¶
- Write a draft in the input box, e.g., “Test this,” wording may not be rigorous.
- Click the Prompt Optimization button in the toolbar; the plugin calls the configured model to execute the rewrite.
- After completion, the input box content is replaced by the rewritten prompt, and the button becomes “Restore Original.”
- If unsatisfied, click “Restore Original” to return to the draft, or manually continue editing—after manual editing, “Restore Original” automatically becomes invalid.
Writing Custom Prompts¶
Since the optimization result directly replaces the draft, the prompt must explicitly require the model to “output only the rewritten body,” without additional explanations, greetings, or code block markers. Otherwise, this extra content will enter the input box.
Applicable Scenarios and Notices¶
Suitable for: Developers who interact with the input box for a long time in DSH and frequently need to polish drafts before submission. The plugin runs with the DSH process permissions, allowing access to the session’s model configuration. Therefore:
- Read the source code and license (MIT) before installing to ensure the rewrite prompt and model call method meet your expectations.
- The default model follows the current session; if you want to fix a model, specify it explicitly in settings.
- If
maxOutputTokensis set too high, it will be rejected by the model service; it is recommended to try the default 1024 first. - The community directory is an independent site with no official affiliation with DeepSeek / Huanfuan; please do not treat it as an official app store.
Summary¶
Its value lies in incorporating the “Prompt Optimization” step into the input box, eliminating copy-pasting and back-and-forth trial-and-error, while retaining details like cancellation, failure alerts, restore original, and multi-session isolation. Directory page: https://www.skillhub.cn/plugins/kongchenhui/dsh-prompt-tuner , source code and docs at https://github.com/kongchenhui/dsh-prompt-tuner .