dsh-composer-prompt-optimizer: One-click prompt optimization in DSH input box

Preface

When writing task descriptions in DeepSeek Harness (DSH), a common practice is to type a few draft lines in the input box first, then manually flesh out goals, scope, and acceptance criteria. If there are already several rounds of discussion in the session, you also need to blend the context into the same prompt yourself. When drafts are short and information is scattered, the model often has to guess your intent.

The community plugin dsh-composer-prompt-optimizer (GitHub repo subisle/dsh-prompt-optimizer) addresses this. It adds a one-click rewrite button to the chat input toolbar: it combines the most recent user turns in the current session and uses the model you have already selected in the UI to organize your draft into a more structured prompt, then writes it back to the input box.

What Is This

dsh-composer-prompt-optimizer is a DSH plugin published by maintainer subisle. The npm package name and the plugin line’s name are both dsh-composer-prompt-optimizer (different from the GitHub repo name dsh-prompt-optimizer, because dsh-prompt-optimizer on npm is already taken by someone else; the name in package.json is authoritative). Current version 0.2.0, license MIT, categorized under model inference capabilities: it rewrites prompts via a single auxiliary LLM call rather than directly executing the task for you.

The plugin mounts a toolbar button on the Composer. On click, it reads the current draft, invokes the host-side optimization logic, and replaces the draft with the result; if the draft has been modified during optimization, it reports a conflict instead of silently overwriting.

Core Features

One-Click Rewrite with Zero Side Effects

The optimization process is a single auxiliary LLM call (purpose: 'compaction'): per the README, it does not write to the session log and does not activate the Agent, and can be canceled with Esc. While optimization is running, the button dims and becomes disabled, with no spinner and no layout shift, and it carries an appropriate aria-label.

Session Context

It pulls the most recent user turns from the chat snapshot as reference (default up to 6 turns, with a character limit per turn’s context). @path-style mentions are preserved verbatim.

Injection Safety and Output Form

The draft and context are wrapped in evidence markers like <draft-evidence> and declared as data rather than instructions; marker collisions are escaped to prevent text like “ignore all rules” in the draft from hijacking the optimizer.

The optimizer restructures content in the order “Goal → Scope → Requirements → Deliverables → Acceptance”, does not produce persona cards, and does not fabricate facts. Short drafts are expanded according to an extension strategy (e.g., the README example: 审计项目看一下目前有啥问题 can be expanded into an audit description with scope, requirements, deliverables, and acceptance criteria); long drafts are mainly reorganized, deduplicated, and have gaps filled. Output automatically strips redundant code fences or wrapping quotes.

Model Routing

The optimization call reuses the current session’s model. The resolution order is:

  1. The pending model in the session’s modelSelection projection (the one just switched to)
  2. The last-used routing in the projection
  3. The routing recorded in the session log’s requestHeader
  4. The deployment-configured agentDefaultModel fallback

Installation and Activation

Recommended to install from npm into a specified profile (replace <name> with your profile name):

dsh plugin --profile <name> add dsh-composer-prompt-optimizer

You can also install from a release package, a local directory, or GitHub (as stated in the README):

curl -LO https://github.com/subisle/dsh-prompt-optimizer/releases/download/v0.2.0/dsh-composer-prompt-optimizer-0.2.0.tgz
dsh plugin --profile <name> add ./dsh-composer-prompt-optimizer-0.2.0.tgz

dsh plugin --profile <name> add /path/to/prompt-optimizer

dsh plugin --profile <name> add github:subisle/dsh-prompt-optimizer

After installation, you can use the following command to confirm the plugin is composed in the profile:

dsh --profile <name> --dump-config | grep -A1 prompt-optimizer

In DSH Desktop, the README requires installing to ~/.dsh/profiles/desktop and restarting the application: client-side entries can be hot-reloaded via HMR, but host-side changes require a restart to take effect.

The plugin declares its DSH-related peer as ^0.2.0-rc.2; composition performs a semver check, and if the host version is out of range, the profile will skip that bundle.

Typical Usage

  1. Type a brief task draft in the Composer input box (even just a few words).
  2. Confirm the model selection next to the input box matches the routing you want to use for optimization (optimization will use that session’s model).
  3. Click the optimize button on the toolbar and wait for the draft to be replaced by a structured prompt.
  4. Compare before and after the rewrite, fine-tune as needed, then send the formal request.

The README’s suggested fastest way to verify: type a few characters, click the optimize button, and directly compare the before/after diff.

Configuration (Optional)

In the profile’s plugin line, id is prompt-optimizer and name is dsh-composer-prompt-optimizer. All fields are optional; invalid values will cause the plugin to fail loading and report a schema error rather than silently falling back to defaults.

- id: prompt-optimizer
  name: dsh-composer-prompt-optimizer
  config:
    maxOutputTokens: 4096
    timeoutMs: 120000
Field Default Description
maxDraftChars 8000 Maximum draft character count; exceeding it reports draft-too-large
maxContextTurns 6 Number of recent user turns to bring in
maxContextChars 600 Per-turn context truncation limit
maxOutputTokens 2048 Auxiliary call output token limit
timeoutMs 60000 End-to-end timeout (prompt-optimizer/timeout)

Use Cases and Notes

Suitable for: developers who frequently write coding-agent task descriptions in DSH Composer, whose drafts tend to be short or poorly structured, and who want to incorporate the most recent few turns of user context into the prompt.

Notes:

  • The plugin runs under the current dsh process’s permissions, and optimization triggers one LLM call; before installing, review the GitHub source and the MIT license yourself to confirm it meets your security and compliance requirements.
  • The community directory SkillHub plugin page and GitHub are independent information sources with no official affiliation to DeepSeek / Hithink; the DSH ecosystem emphasizes “everything is a plugin”, and the facts in this article are based on the repository README and package.json.

Conclusion

dsh-composer-prompt-optimizer consolidates “completing task descriptions” into a single step in the input box: context-aware, uses the currently selected model, produces structured output, and tries not to pollute the session log. If you write Agent tasks in DSH, you can install it in your profile via the commands above and give it a try.

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

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

Xiaoye