dshbase

插件目录 / Developer / deepseek-harness-prompt-optimizer

deepseek-harness-prompt-optimizer

未验证 lizhecome

✓ 持续维护 基于 11 个官方 DSH 包

查看 GitHub ↗ ← 返回插件目录

2Stars
0Forks
0未关闭 issue
语言
2026-08-15最近推送
跨平台平台

功能简介

LLM-backed prompt optimization bundle for DeepSeek Harness

我们的评价
未验证 — 尚未实测

LLM-backed prompt optimization bundle for DeepSeek Harness 尚未验证——请自行安装测试。

「未验证」表示我们的自动化 CI 尚未安装过该插件。功能描述与版本兼容性均为作者声明。这不是安全审计,也不代表对第三方代码的背书。

你是插件作者? 想拿到「已验证」标签——提交你自己的验证证据(截图、日志或短视频),我们审核通过后即改为「已验证」。

提交验证证据 ↗

README

DeepSeek Harness Prompt Optimizer

An installable DeepSeek Harness profile bundle that uses an auxiliary LLM call to improve prompts. The Web UI adds a sparkle button beside Send, and the host plugin can also optimize direct user messages on the cooperative agent/pre-step waterfall. It does not patch the agent loop.

中文说明

Install

Requires DeepSeek Harness 0.1.0-rc.6 or later.

gh repo clone lizhecome/deepseek-harness-prompt-optimizer
cd deepseek-harness-prompt-optimizer
dsh plugin --profile web add --ignore-workspace-root-check .

Use headless instead of web to enable automatic optimization for one-shot tasks. The composer button is available only in the web profile. DeepSeek Harness anchors add . to the invoking checkout before pnpm switches to the profile directory. The package manifest declares a dsh.bundle patch and a Web client entry, so installation mounts the host optimizer, invariant companion, and composer control automatically.

To remove it:

dsh plugin --profile web remove --ignore-workspace-root-check @lizhecome/dsh-prompt-optimizer

Behavior

Composer button

The Web UI contributes a sparkle button to conversation.input.right, immediately before the normal send control. It is disabled while the draft is blank or the composer is busy. Clicking it runs one auxiliary request and replaces the unsent draft with the rewritten text.

The button compares both the draft revision and exact text before applying the response. If the user edits while optimization is running, the response is not applied and the current draft is preserved. Transport, routing, and model failures also preserve the draft and place the failure in the button's accessible status and tooltip.

The host exposes the same operation as /optimize-prompt <prompt>. The button marks its successful result for a one-time exact-match bypass: sending that unchanged result does not trigger a second automatic optimization. Editing the result removes that match, so the normal automatic policy applies when it is sent.

Automatic optimization

The listener delegates first, then inspects the final PreStepDecision. It optimizes only direct-user messages whose blocks are all text and whose trimmed length reaches minChars. Plugin context, tool results, goal rounds, relays, images, and short prompts pass through unchanged.

The default append delivery preserves the original user message and adds the optimized text as a separately sourced notice. Both messages are recorded as user/message events before the main request, so replay and the model see the same content. replace keeps the original message identity and source but records and sends only the optimized text.

The optimizer route resolves in this order:

  1. configured provider and model;
  2. the session's last routed request;
  3. the agent's explicit provider/model options.

If none is available, optimization fails. With the default pass-through policy, the plugin logs a warning and preserves the original prompt. fail rejects the proposed step instead. Turn cancellation is always propagated.

Configuration

Later profile patches replace a row's complete config, so restate every field you want to keep:

- id: prompt-optimizer
  config:
    provider: deepseek
    model: deepseek-chat
    maxTokens: 1024
    minChars: 20
    delivery: append
    failureMode: pass-through
    instruction: >-
      Rewrite the prompt for precise execution. Preserve every constraint and
      return only the rewritten prompt; do not solve the task.
Field Default Meaning
provider '' Auxiliary provider. Set together with model; empty follows the agent route.
model '' Auxiliary model. Set together with provider; empty follows the agent route.
maxTokens 1024 Positive integer output cap for the optimizer call. A capped response is rejected as incomplete.
minChars 20 Non-negative trimmed character threshold for optimization.
delivery append append preserves the original and adds a sourced notice; replace substitutes its text.
failureMode pass-through Preserve the original after a runtime error, or fail the proposed step.
instruction built in System instruction for the auxiliary call; a blank value is rejected at load.

provider and model are an atomic pair. A half-configured route, non-integer bound, or blank instruction fails at plugin load.

Model and cost effects

Every prompt eligible for automatic optimization adds one independent model request. A button click also adds one request, but sending its unchanged result consumes the one-time bypass and does not add another optimizer request. If the result is edited before sending, normal automatic eligibility applies. Each optimizer input is the draft or direct user message plus the optimizer system instruction, and its output is bounded by maxTokens. append makes an automatically optimized main request longer because it contains both versions; replace avoids that duplication but does not retain the original prompt in durable history. Auxiliary requests reuse the session id for routing but do not reuse the main conversation prefix.

The built-in instruction tells the optimizer to preserve language, facts, identifiers, quoted text, constraints, and requested output format; remove ambiguity and redundancy; avoid inventing requirements; and return only a rewritten prompt.

Known limitations

  • Multimodal and mixed-block direct-user messages pass through unchanged.
  • Prompt optimization is semantic model output, so it can still distort intent; use append when auditability matters.
  • The auxiliary model exchange is not stored as a separate model event. Button results are stored in the durable command lifecycle, while automatically delivered output is stored in the main turn.

Development

pnpm install
pnpm run check

The tests boot the published Harness services and a real agent loop with a deterministic in-process LLM adapter. They verify durable append/replace behavior, failure fallback, short-prompt bypass, command execution, one-time deduplication, listener disposal, DOM replacement, and concurrent-edit protection.

安装

🧩 让 Agent 自动装(推荐)

装一次目录插件,之后本站所有插件都能让 DeepSeek Harness 自动找、自动装:

dsh plugin add dshbase-catalog

然后对 agent 说「帮我装 deepseek-harness-prompt-optimizer」,它会在目录里找到并自动安装。文档:dshbase-catalog · 已验证场景包

该插件是 GitHub 源码(未发 npm)——直接从仓库装:

Web profile:

dsh plugin --profile web add github:lizhecome/deepseek-harness-prompt-optimizer

Headless(CLI)profile:

dsh plugin --profile headless add github:lizhecome/deepseek-harness-prompt-optimizer

实测报告

尚未 L3 验证——若已跑过,见下方失败备注。

状态:pending · 最近测试 2026-08-26 · 标记 webonly
备注:验证: web-only;待 L4 web CDP;L4 web CDP runtime-fail on dsh 0.1.0-rc.8. 浏览全部待验证失败 →
安全:尚未扫描——我们的每日静态扫描将很快覆盖它。

分享徽章

Developer 里更多

浏览全部 7789 个插件 →