dsh-session-prompt-optimizer: One-Click Rewrite of Drafts into Clearer Prompts with Composer

Preface

When conversing with agents in DeepSeek Harness (DSH), Composer often starts with a colloquial draft: the intent is there, but task boundaries, constraints, and specific actions are mixed together. Sending it directly works, but the model is more likely to miss constraints, misunderstand priorities, or interpret vague verbs arbitrarily. The common approach is to handwrite a “formal prompt” or optimize it in an external tool before pasting it back—this adds an extra step of switching, and the rewritten result often directly overwrites the original, making it difficult to compare and decide.

Below is an introduction to the community plugin dsh-session-prompt-optimizer: it adds a button to the Composer toolbar to initiate a rewrite using the current draft, displaying the original text and the result side-by-side above the input box; the text in Composer will only be replaced after you confirm.

What is it

dsh-session-prompt-optimizer is a plugin for DeepSeek Harness, maintained by markmuteki, categorized under Model Inference in the SkillHub directory. The README summarizes it as: a button in Composer that reads your entered draft, rewrites it into clearer agent instructions, and displays both versions side-by-side before replacing.

The plugin is released under the MIT license (current package version is 1.2.3, requiring Node >= 20). It targets only the web platform (dsh web), injecting the conversation UI via a Cordis patch, without requiring additional configuration files.

Core Features

Three Rewrite Modes

The rewrite mode is distinguished by the way you click; it uses the open-source prompt-optimizer project’s user-optimize template (not custom-written copy within the plugin):

Action Effect
Single Click Polishes the draft while maintaining its original length and form
Shift+Click Structured rewrite: Goal -> Context and Constraints -> Final phrasing
Alt+Click Compress: Same intent, fewer words

The button is located to the left of the model selection chip. The button is disabled when Composer is empty, a message is being sent, or a rewrite is already in progress.

Comparison Card and Confirmation Replacement

Upon completion of the rewrite, a card appears above Composer: the left side is the draft, and the right side is an editable result. Use this writes back to Composer, Copy only copies without affecting Composer, and Dismiss closes it. If you continue typing while a request is in progress, the card will prompt you rather than overwrite the updated text.

What is Preserved and Discarded During Rewriting

The plugin documentation explicitly states: Do not fabricate requirements; preserve the intent, facts, paths, names, numbers, versions, and constraints in the draft; maintain the same language as the draft (Chinese/English); preserve code, commands, paths, URLs, and quoted strings verbatim. Small talk and vague framing will be removed in favor of task leads, and vague verbs will be replaced with more specific actions; if the draft is already a qualified prompt, it will remain almost unchanged.

Session Context (Read-only)

Drafts often rely on the current session. Every rewrite is accompanied by a bounded session excerpt: the most recent 6 messages (up to 600 characters each, totaling about 2,400 characters), the session title and active goal, and the workspace directory. The excerpt is for reading only; the plugin does not append messages to the session and does not persist user content other than template cache.

Cost, Privacy, and Template Source

Each click initiates an additional 1 model request, using the model currently selected in Composer, and sets the reasoning effort to the lowest tier. The draft and the above excerpt are sent to the same model that the session would naturally use. Apart from HTTPS checks for GitHub upstream releases after startup and every 6 hours, the README does not describe any other outbound paths.

Templates are cached in .state/upstream.json; new templates take effect on the next click without needing a restart or reinstall. Offline usage relies on the cache, falling back to built-in prompts. Operations-related: GET /_prompt-optimizer/health reports the followed release; POST /_prompt-optimizer/refresh forces a check.

Installation and Enablement

Installation commands should follow the original README text. Choose one:

dsh plugin --profile web add github:markmuteki/dsh-session-prompt-optimizer

Or from npm:

dsh plugin --profile web add dsh-session-prompt-optimizer

After installation, restart dsh web. The README states: No configuration required.

Please note before use: the plugin runs with the permissions of the current DSH process; you should review the source code and license of the repository yourself before installing (MIT; the rewrite templates come from prompt-optimizer, which has its own respective license).

Typical Usage

  1. Open a session in dsh web and type an unrefined task description in Composer (can include paths, versions, constraints).
  2. Click, Shift+click, or Alt+click the optimize button according to your needs, and wait for the card to appear.
  3. Fine-tune the result on the right, then click Use this to write back, or Copy / Dismiss.
  4. Send the message as usual after confirming it is correct.

If the draft contains slash commands, the plugin will reject the rewrite (to avoid breaking command structures). Drafts longer than 12,000 characters will also be rejected. Only one rewrite is allowed per session at a time; the server timeout is approximately 45 seconds, and the client timeout is approximately 90 seconds.

When accepting the replacement, the entire draft is replaced; inline reference chips will become @path text—if you rely on chip semantics, you need to verify them yourself after writing back.

Applicable Scenarios and Limitations

Suitable for: Developers who frequently write long explanations in the DSH web Composer and want to convert colloquial drafts into executable instructions without leaving Harness; workflows that require comparing two versions of text before replacement.

Limitations and Boundaries (all from README):

  • Only the Web platform, not covering other profiles like CLI.
  • One click triggers one additional model call, incurring cost and latency.
  • Templates depend on the upstream prompt-optimizer release; in extreme offline scenarios, behavior degrades to using cache / built-in prompts.
  • Stars and community popularity do not equal a security audit; sensitive workspace content will enter the session excerpt attached to the rewrite request.

The DSH ecosystem philosophy is “everything is a plugin”; SkillHub is a community directory and has no official affiliation with DeepSeek / Huanfang as described in the README.

Conclusion

dsh-session-prompt-optimizer brings “optimize prompt before sending” into Composer: side-by-side preview, manual confirmation of replacement, and read-only access to a small amount of session context during rewriting. If you are already using dsh web for agent development, you can install it using the command above and try the three modes in the toolbar.

羽毛球分组比赛记分
小程序二维码

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

Xiaoye