Introduction

In DeepSeek Harness (DSH), the quality of a prompt directly determines agent performance. When dealing with rough drafts or unclear requirements, manual refinement is often inefficient. The dsh-better-prompt plugin solves this problem: it uses an LLM to rewrite the draft in the input box into a more standardized prompt and writes it back to the input box for confirmation. The optimization direction is not rigidly fixed; instead, it is based on an editable Skill document, making it both flexible and controllable.

Installation and Activation

Use the provided installation command to add the plugin.

dsh plugin --profile web add git+https://github.com/Areium/dsh-better-prompt.git

After installation, you need to restart the dsh web process (dsh web or dsh --profile web) to load the plugin. The browser plugin side supports HMR; after modifying front-end code, refresh the page for changes to take effect.

Core Features

The plugin mainly provides the following features:

  1. Optimization button: Adds a ✨ Optimize button to the input box toolbar (left of the send button).
  2. Intelligent judgment: After clicking, the plugin first determines whether the draft lacks key information.
    • If key information is missing, it triggers a native dsh question (ask_user_question), provides options or allows manual input, and automatically continues generation after the answer.
    • If the information is sufficient, it directly optimizes and rewrites the draft without interrupting the user.
  3. Undo mechanism: After the optimized content is written back to the input box, a ↩ Undo button appears, allowing you to restore the original pre-optimization content with one click.
  4. Error handling: If an error occurs, the input box displays a ! marker; hover over it to view error details.
  5. Settings page: In DSH settings, go to the “Prompt Optimization” page to view and edit the Skill document for optimization directions. It supports save, cancel, and reset to default, with a secondary confirmation for unsaved changes.

Usage

The usage flow is very intuitive and consists of the following steps:

  1. Enter a piece of content in the input box (supports any language and rough drafts).
  2. Click ✨ Optimize.
    • Case A (missing information): The input area switches to the native dsh question interface (each question has options and also allows manual input, up to clarifyMaxQuestions questions); after the user answers, generation automatically continues.
    • Case B (sufficient information): It directly generates the optimized prompt.
  3. The input box content is replaced with the optimization result. If unsatisfied, click ↩ Undo to restore the original text, or edit manually.
  4. After confirming, click send.

Edit Optimization Direction (Skill)

The optimization direction is not hard-coded; it comes from a Skill document (SKILL.md).

Default Location

On first load, this file is automatically generated at ~/.dsh/skills/better-prompt/SKILL.md.

Editing Methods

There are two main ways to modify the optimization logic:

  1. Settings page (recommended):
    Go to DSH settings -> Prompt Optimization. The current file path and status are displayed here. After modifying, click Save; it will take effect immediately the next time you click ✨ Optimize, without restart.

  2. Direct file editing:
    The file is located at ~/.dsh/skills/better-prompt/SKILL.md. The file contains frontmatter (for identification) and the body (defines optimization principles, such as role, context, constraints, output format, etc.).

Fault Tolerance

  • If the file is deleted, the plugin will automatically generate the bundled default version on next read.
  • If the document is empty, it likewise falls back to the default direction and will not cause a crash.

Configuration

The plugin supports customization via the Profile configuration file. The default configuration is located at ~/.dsh/profiles/web/cordis.patch.yml and must be modified by overriding the entire config line.

Field Default Description
skillDir $DSH_HOME/skills/better-prompt Skill directory for optimization direction (contains SKILL.md)
timeoutMs 120000 Timeout for a single optimization call (milliseconds)
maxInputChars 20000 Maximum character count for input draft
maxTokens 8192 Token limit for optimization output
clarifyMaxQuestions 3 Maximum number of questions asked in a single clarification round (1–10)
askTimeoutMs 300000 Timeout for waiting for the user to answer native questions (milliseconds)

Development and Architecture

The plugin uses a modular design, with no build step, pure ESM.

  • Host side (lib/index.js): Handles webServer routes, document read/write, LLM calls, and optimization logic decisions.
  • Client side (lib/client.js): Responsible for browser-side UI, including injection of input row buttons and settings page slots.
  • Skill logic (lib/skill.js): Provides pure function support for building system prompts, parsing frontmatter, and sanitizing results.

During development, after modifying lib/client.js, refresh the browser (client-modules are cached by content hash); modifying lib/index.js requires restarting dsh web.

Conclusion

dsh-better-prompt is a lightweight and practical DSH plugin. It makes the optimization logic transparent and customizable through a Skill document, helping developers quickly turn vague drafts into high-quality prompts. For more details and source code, please visit the GitHub repository.