DeepSeek Harness (DSH) adopts a plugin-based architecture. Developers often write prompts directly in the input box, but it can be difficult to ensure they are clearly structured. The dsh-prompt-optimizer plugin solves this problem with one-click optimization.

Plugin Overview

This is a plugin designed for the DSH composer. Enter a draft and press ✨ (or Alt+O) to rewrite it into a clearer, more structured prompt. The plugin requires no configuration by default and directly reuses the model service of the current session. It also supports connecting to any OpenAI-compatible API endpoint.

The plugin is maintained by winditer and is licensed under MIT.

Installation

Installation via GitHub repository identity is recommended to avoid npm name conflicts that may prevent the marketplace from recognizing the plugin source:

dsh plugin --profile desktop add github:winditer/dsh-prompt-optimizer

After installation, fully restart DSH (quit and reopen it). The ✨ button will appear on the right side of the composer.

Core Features

  • One-click optimization: Enter a draft in the composer, then click the ✨ button on the right, or select the input box and press Alt+O. The plugin immediately displays an optimization preview card above the input box.
  • True streaming preview: Uses the harness webServer service for SSE transport. The model first streams the “reasoning process” (typically in a secondary color), then streams the polished prompt. You can observe the model’s thinking process in real time.
  • No configuration required by default: By default, the plugin reuses the default model configuration of the current session or agent (agentDefaultModel + llm service). No additional API Key entry is required.
  • Custom endpoint mode: After unchecking “Use current session model,” you can enter any OpenAI-compatible /chat/completions endpoint URL, API Key, and model name.
  • Action row: After the preview completes, action buttons are provided at the bottom of the card: Replace draft (writes the result back to the composer), Copy, Re-optimize, or Discard.
  • Bilingual UI: The interface language follows the current DSH language (Chinese/English) without requiring a page refresh.
  • Local configuration: Settings are persisted in ~/.dsh/prompt-optimizer-config.json and communicated with the host through a local RPC channel, independently of the host settings registry.
  • Dark mode support: All colors follow the DSH theme variables. In dark night mode, brand blue and white text are used.
  • Local credential security: In custom endpoint mode only, the API Key is stored in the local configuration file and sent only to the endpoint URL you configure.

Usage Flow

  1. Enter a raw prompt in the DSH composer.
  2. Click the ✨ on the right (or press Alt+O).
  3. The preview card appears above the input box. You will first see the reasoning text output by the model, followed by the optimized prompt displayed token by token in a stream.
  4. Review the result:
    - Click Replace draft to write the polished content directly to the composer.
    - Click Copy to copy the content to the clipboard.
    - Click Re-optimize to run again based on the original draft.
    - Click Discard to close the preview card.

Configuration Notes

Go to DSH Settings → General Settings → Prompt Optimization to see the following settings:

Setting Default Description
Use current session model Enabled Reuses the current session model. No API Key required. Once disabled, enter the endpoint information below.
Endpoint URL https://api.deepseek.com Base URL for a custom OpenAI-compatible endpoint.
API Key — Key for custom mode. Stored only in local configuration.
Model name deepseek-v4-flash Model name for custom mode.

The configuration file is saved at ~/.dsh/prompt-optimizer-config.json. When the plugin is uninstalled, this file is also cleaned up.

Architecture and Security

The plugin uses a Host-Client separation design:

  • Host Half: Located in lib/index.js. It persists configuration through a loopback RPC channel (/dsh-prompt-optimizer), registers an HTTP API (/dsh-prompt-optimizer/api) via webServer, and handles streaming requests.
  • Client Half: Located in dist/client.js. It calls the Host API via fetch and renders the UI (button, preview card, settings row).

Security notes:
- The default route does not send credentials. It directly reuses the provider already configured in the harness.
- The API Key in custom mode is stored locally only and is not uploaded to other servers.
- Optimization results are displayed only in the preview card. The text is written to the current session only after clicking Replace draft.

Ecosystem and Resources

Plugin directory: dsh-prompt-optimizer

Source repository: github.com/winditer/dsh-prompt-optimizer