DeepSeek Harness Plugin: dsh-prompt-polish — One-Click Prompt Polishing

Introduction

When writing prompts in the DeepSeek Harness (DSH) Web composer, drafts are typically sent to the agent as-is. Issues such as ambiguity, colloquial language, and incomplete logic often require multiple rounds of conversation to gradually fix. The dsh-prompt-polish plugin adds a “Polish” button to the control area in the bottom-right corner of the DSH input box. When clicked, it rewrites the draft using the current Profile’s model, generating a professional, precise, and actionable prompt, and presents a before-and-after comparison. Once confirmed, the result replaces the input box content before sending.

Plugin Overview

  • Plugin name: dsh-prompt-polish
  • Maintainer: chuilian
  • Category: Network tools
  • Core value: One-click prompt polishing plugin for the DSH Web input box

Core Capabilities

Polishing Workflow

In the control area at the bottom-right of the DSH composer, there is a “Polish” button located immediately to the left of the model selector. Upon clicking:

  1. The plugin analyzes the draft and rewrites it using the default model of the current Profile, sending the request to the same route as the composer.
  2. The rewritten result is temporarily stored and not sent directly to the agent.
  3. A comparison panel opens: the original draft is shown on the left, the rewritten result on the right, and a list of changes is displayed below.
  4. The comparison panel offers three actions: Replace Input (fills the rewritten result back into the draft), Copy (copies the rewritten content), and Re-polish (calls the model again).

Polishing Strategy

The plugin modifies drafts according to the following priorities:

  • Preserve intent: Do not fabricate files, technologies, data, or constraints; do not lose names, paths, numbers, or examples provided by the author; explicitly retain unknown details as placeholders (e.g., <target_file>).
  • Eliminate ambiguity: Replace vague expressions such as “optimize a bit,” “something’s off,” or “roughly” with specific, verifiable instructions.
  • Fix language: Correct grammar, punctuation, spelling, and unprofessional or colloquial wording without translating into other languages.
  • Improve logic and actionability: Organize content following the structure of Goal → Requirements → Constraints → Deliverables → Acceptance Criteria; number items where necessary; ensure each requirement is independently verifiable; supplement any obviously missing prerequisites.
  • Resolve logical contradictions: Merge or reorder contradictory, redundant, causally inverted, or prerequisite-missing statements.
  • Maintain proportion: Keep the output length comparable to the original; do not add filler, boilerplate, or fabricated personas.
  • Preserve code blocks: Code blocks, commands, paths, and quoted content are kept verbatim.

Button Placement

The button is located in the composer’s bottom-right control cluster, immediately to the left of the model selector. DSH composer defines this position as conversation.input.right (a list slot for “compact controls before composer submission”). This position intentionally avoids the floating button at the top-right of the input box to prevent occluding the first line of long drafts.

Installation & Activation

dsh plugin --profile <name> add github:chuilian/dsh-prompt-polish

After installation, refresh the page: the plugin’s client portion is a browser Bundle and requires a refresh to take effect.

Install from Source Directory (Development)

dsh plugin --profile <name> add link:/absolute/path/to/dsh-prompt-polish

After installation, you must manually add dsh-prompt-polish to dsh.profile.bundles, otherwise the plugin will not load. Changes to lib/host/* require a DSH restart; changes to lib/client.js require a page refresh.

Note: After installing with link:, do not run pnpm install in the same Profile, as it will reset the link: symlink to the registry version, potentially causing errors.

Configuration

The plugin provides optional configuration via its config: block. Subsequent patch layers replace the entire configuration block rather than merging with it.

Config Item Default Description
enabled true Whether to enable the route response
provider / model unset Specify a model route; setting only one half is ignored and treated as unset
maxInputChars 8000 Maximum allowed draft character count
maxOutputTokens 16384 Output limit for the polishing call
timeoutMs 150000 Timeout for a single polishing operation (measured at 46–65 seconds)
reasoningEffort unset off/low/medium are respected; high/max are capped at medium
retryDelaysMs [2000, 4000] Intervals for retrying when the route rejects capacity; set to [] to disable retries
trustedHosts [] Additional non-loopback authorities allowed for extra calls

Configuration changes take effect on the next request without requiring a remount.

Handling Model Busy State

Some deployments place a gateway in front of the backend, where the gateway for the same key only allows one concurrent request. Initiating another polishing request while generation is in progress will cause the gateway to return HTTP 429. DSH treats this as a generic transport failure and returns “Model call failed, please retry,” leaving the user unaware that simply waiting would resolve the issue.

This plugin identifies 429 as a model-busy error code and retries at the intervals specified by retryDelaysMs. No billing occurs during retries (the gateway rejects the request at the admission stage). If the route is still busy after all retries, the error message will clearly state the reason. The total retry time will not exceed timeoutMs.

How It Works

  • Host side (lib/index.js, lib/host/*): Provides routing, security decisions, model invocation, and response parsing. Does not depend on DSH internal modules; uses only Node built-in modules to avoid compatibility issues from Harness version changes.
  • Client side (lib/client.js): Button, comparison panel, notification bar, and shared state. Uses DSH’s lazy-loading CJS style, depending only on the platform module table (react, @deepseek-ai/dsh-client-ui, etc.).

Request flow:

composer draft ──click──▶ POST /prompt-polish/polish
                              │
                              ├─ Caller fencing (loopback / trusted authority, cross-site prohibited)
                              ├─ Draft validation (non-empty, below character limit)
                              ├─ Route resolution (specified provider/model → profile default model)
                              ├─ ctx.llm.stream({ system, messages, maxTokens, purpose })
                              ├─ Caller disconnect (abort model call when panel is closed)
                              └─ Response decoding (JSON → prompt + changes + summary)
                              ▼
                     before/after panel ──replace input──▶ composer draft

Use Cases & Notes

  • Suitable for developers and agent users who need to transform colloquial, ambiguous, or logically incomplete drafts into professional prompts.
  • The plugin runs with the privileges of the current DSH process. Review the source code and license before installation.

Conclusion

dsh-prompt-polish reduces the number of back-and-forth conversations and improves prompt quality by adding one-click polishing and comparison capabilities to the DSH Web composer. See the links below for the plugin directory page and source code repository.

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

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

Xiaoye