1321928757/dsh-prompt-polish ↗★ 2

dsh-prompt-polish

DeepSeek Harness 输入栏提示词优化插件:6 种策略 × 3 种语言与自定义指令重写草稿,可选携带聊天上下文(含压缩摘要)、目标与任务清单,结果确认弹窗、最近 5 次历史与三级设置持久化。Input-bar prompt optimizer for DeepSeek Harness: rewrites drafts with 6 strategies × 3 languages plus custom instructions, optional chat context (with compaction summary), goal and todo injection, a confirm dialog, last-5 history and three-tier settings persistence. 适合希望统一提示词质量与风格的用户;建议先确认上下文上传策略再启用。

Package
dsh-prompt-polish
Compatibility
Unverified
Harness peer range
^0.1.0-rc.6
Cordis peer range
^4.0.1
Version
0.3.2
License
MIT
Last updated
Sep 6, 2026

Other repositories with this package name

Install

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:1321928757/dsh-prompt-polish

dsh-prompt-polish

English | 中文

A composer-side prompt optimizer for DeepSeek Harness (DSH). Click Optimize to send the current draft through the model provider configured in DSH and review a clearer, more specific version before deciding whether to use it.

Data boundary: This plugin does not add a separate API endpoint. Optimization uses the provider and model selected by DSH. When context is enabled, the request may include recent messages, the current goal and todo list, a compaction summary, and optional tool-result summaries. The draft and enabled context are therefore visible to that model provider; review its privacy and retention policy before using the feature with sensitive conversations.

At a glance

SurfaceWhat it provides
Composer → OptimizeRewrite the current draft, show the result for review, or stop an in-flight optimization.
Composer → gearQuick settings for context, tool summaries, mode, and language; opens the full settings dialog.
DSH Settings → GeneralA linked settings.general.item row for the Reference conversation context switch. Other options remain in the composer settings.

Features

  • Six prompt-rewriting modes: Default, Concise, Structured, Creative, Translate and optimize, and Code request.
  • Three language choices: Follow draft, Chinese, or English. An explicit language choice is applied after optional custom preferences; in Translate and optimize mode, Follow draft means optimize without translating.
  • Optional context injection from the current session: goal, todo list, compaction summary, recent messages, and—when both context switches are enabled—short tool-result summaries.
  • A result popover with the original draft, optimized draft, Adopt optimized result, Keep draft, and Later actions. Results are never automatically adopted.
  • Stop while a model stream is running; when the DSH conversation-block API is available, clear the composer block immediately and ignore late results from the cancelled run.
  • Failure results stay visible with the original draft and a Retry action.
  • A current-component, in-memory history of the last five optimization attempts. Successful entries can be reviewed or explicitly refilled into the composer; failed entries are retained as failure records.
  • Settings are saved locally and best-effort synchronized to a workspace file.
  • The browser UI uses DSH theme tokens and supports light/dark themes, keyboard focus, Escape/outside-click dismissal, reduced motion, and high-contrast borders. The composer controls stay quiet at rest: Optimize is transparent when idle and gains a host interactive surface only on hover, focus, or press, with lighter label text matching adjacent DSH controls.

Modes and language behavior

ModeWhat the optimizer is instructed to do
Default (precise)Clarify ambiguity and structure while preserving the original intent and supported constraints; do not add unsupported deliverables.
Concise (concise)Remove repetition and filler while retaining the goal, constraints, examples, acceptance criteria, and required output format.
Structured (structured)Use meaningful labels such as Goal, Context, Requirements, and Expected output; empty sections may be omitted.
Creative (creative)Add no more than three useful, actionable angles, marking uncertain additions as optional or examples rather than facts or mandatory work.
Translate and optimize (translate)Rewrite naturally and translate only when the selected target language differs from the draft language.
Code request (code)Organize applicable programming details into goal, context, environment, inputs, outputs, constraints, edge cases, and acceptance criteria without inventing unknown technologies or APIs.

The Follow draft language choice preserves the draft language. Chinese and English lock the final requested language. Custom instructions are limited to 500 characters and can influence optional behavior, but the optimizer's prompt places them below the output contract, draft/context boundaries, and explicit language lock.

The optimizer instructs the model to output one user-facing request rather than an answer, plan, explanation, or code fence. This is a model instruction, not a deterministic output filter: review the generated text before adopting it.

Runtime behavior and limits

This plugin is a browser composer extension, not a standalone shell command or a model tool exposed to the agent. The browser calls the Host promptPolish service through Typert RPC; the Host then streams a request through DSH's configured LLM service.

AreaImplemented behavior
Draft validationEmpty or whitespace-only drafts are rejected. Drafts longer than 20,000 characters are rejected.
Context collectionOpt-in. The browser scans up to 20 message nodes and up to 8,000 rolling message characters. A message over 4,000 characters is reduced to its first 2,600 and last 1,400 characters.
Goal, todo, and compactionThe current goal and todo list are placed before message turns when available. A compaction summary is capped at 2,000 characters and stops collection of older raw messages.
Tool resultsOnly built when both context and tool-result switches are enabled. At most the last three tool calls in a selected assistant turn are summarized, with the first 300 characters of each result.
Host-side context budgetThe Host keeps at most 30 message items and 60 tool-summary items from the payload, then prunes items again to fit the selected model's context budget. Some context can therefore be omitted.
Stream timeouts30 seconds without a new chunk, or 120 seconds total. Either timeout returns an error that can be retried.
Output budgetThe request is capped at 4,000 output tokens, also limited by the selected model and remaining context. The requested floor is 1,200 tokens; a model reaching its limit can return a result marked as possibly truncated.
CancellationEach run receives a runId. Stop calls cancelOptimize, aborts the Host stream, and discards a late result.
Adoption guardAdoption requires an explicit button click and succeeds only if the composer draft is still exactly the draft that was optimized. If the draft changed, the adoption button is disabled.

Requirements and compatibility

  • DeepSeek Harness with a compatible Web profile that provides the plugin's Host and browser dependencies.
  • The package peer ranges currently target @deepseek-ai/cordis ^4.0.1, @deepseek-ai/cordis-plugin-timer ^1.1.3, the DSH 0.1.0-rc.6 service/client packages listed in package.json, and React ^18.2.0. The package directly depends on zod ^4.4.3.
  • Node.js 20 or newer is the prerequisite reported by the installer and DSH setup. This package does not declare an engines field.
  • A configured DSH model provider is required for optimization. Provider availability, model limits, network access, and provider policy remain outside this package.

Install, update, or remove

Install the pinned GitHub release

The primary path installs the currently documented tag into the web profile:

dsh plugin --profile web add github:1321928757/dsh-prompt-polish#v0.3.2

Restart the existing DSH Web process after installation. Then verify the profile composition:

dsh --profile web --dump-config | findstr dsh-prompt-polish

After the restart, the Optimize button and gear should appear on the left side of the composer. If the button is missing, see Troubleshooting.

Update to a newer pinned tag

The repository's installer aligns an existing installation by running dsh plugin ... add again. You can use the same approach manually with the release tag you want:

dsh plugin --profile web add github:1321928757/dsh-prompt-polish#v0.3.2

Replace v0.3.2 with a newer published tag, then restart that profile's DSH Web process and repeat the --dump-config check.

Install from npm

Use this only after the package has been published and is available in your registry:

dsh plugin --profile web add dsh-prompt-polish

PowerShell installer

The repository contains a pinned installer:

irm https://raw.githubusercontent.com/1321928757/dsh-prompt-polish/v0.3.2/scripts/install.ps1 | iex

Review the script before executing a remote irm | iex command. It checks for dsh, ensures pnpm is available, pins pnpm 11.21.0, prefers Git when available, falls back to the GitHub tag archive when Git is unavailable, and installs the pinned release into the web profile by default. It may activate pnpm through Corepack or install it globally through npm. The script accepts -Profile when run from a downloaded file; when using another profile, use that profile in your own restart, verification, and removal commands.

To inspect it before running:

$path = Join-Path $PWD install.ps1
Invoke-WebRequest https://raw.githubusercontent.com/1321928757/dsh-prompt-polish/v0.3.2/scripts/install.ps1 -OutFile $path
Get-Content $path
powershell -NoProfile -ExecutionPolicy Bypass -File $path -Profile web

Remove

dsh plugin --profile web remove dsh-prompt-polish

Restart the profile's DSH Web process after removal. The command removes the package from that profile; it does not delete localStorage or an existing workspace settings file.

Local development profile

Keep local development separate from the profile you use daily:

dsh plugin --profile demo add E:\path\to\dsh-prompt-polish
dsh --profile demo --dump-config

Quick start

  1. Type a draft into the DSH composer.
  2. Optionally open the gear and enable Reference conversation context. Enable Include tool results only if you also want the context request to include short tool summaries.
  3. Choose a mode and language. In Translate and optimize, the language selector is the target language.
  4. Open Full settings if you need a custom instruction of up to 500 characters, or want to inspect the context preview and recent attempt history.
  5. Click Optimize. The composer is blocked while the request is running when the conversation block API is available; the button becomes Stop optimizing.
  6. Inspect the original and generated prompt in the result popover.
  7. Choose Adopt optimized result, Keep draft, or Later. The latter two only dismiss the result; they do not save a reminder. A changed draft cannot be overwritten by an older result.

The Retry action reuses the original snapshot from the failed attempt. The Refill action in history is an explicit write to the composer and is different from automatic adoption.

Screenshots

The screenshots use published GitHub Raw URLs so they render in GitHub, npm, and external marketplace views after the repository assets are pushed.

Composer entry

The Optimize button and gear are registered in the composer's conversation.input.left slot. In the current UI, the idle trigger is transparent and uses lighter label text; hovering or focusing it reveals the host interactive surface without adding a permanent highlight:

Composer with the Optimize button

Review before adoption

The result popover shows the original draft and the generated prompt before any composer write occurs:

Optimization result confirm dialog

Quick and full settings

The gear opens quick settings for context, tool summaries, mode, and language. The full dialog adds custom instructions, context statistics, current-component history, and persistence information:

Settings panel

The repository also keeps the three paths in screenshots.json. package.json.files includes both screenshots.json and assets so the metadata and images are present in packed releases.

Settings persistence and history

The plugin has three user-facing settings surfaces, but only two actual storage locations:

  1. L1 browser storage: normalized settings are written to localStorage under ptopt.settings.v1 and take effect immediately. If browser storage is unavailable, the current page keeps the settings in memory.
  2. L2 Settings surface: DSH Settings → General exposes a linked checkbox for Reference conversation context. This is a UI surface, not a separate database or settings backend; mode, language, tool-result behavior, and custom instructions remain in the composer panel/full dialog.
  3. L3 workspace synchronization: settings are shallow-merged into /.dsh/prompt-optimizer/settings.json through the Host file service. The write is subject to the DSH sandbox policy. A missing or malformed file is treated as empty settings, and a denied or failed write silently falls back to browser storage.

When a workspace becomes available, the browser makes a best-effort one-time pull and merges keys present in the workspace file. Cross-browser or cross-machine consistency therefore depends on using the same workspace and allowing the Host file operation; it is not a guaranteed cloud sync.

Optimization history is separate from settings. It is a FIFO list of the last five attempts held in the mounted React component, including failures. It is not written to localStorage or the workspace file and can disappear after a page reload, component/session unmount, plugin reload, or profile restart.

Security, privacy, and known limitations

Guardrail or boundaryWhat the code doesImportant limitation
Provider data flowUses DSH's configured LLM service and adds no separate plugin endpoint.Drafts and enabled context can leave the machine through that provider. Provider retention, logging, and regional handling are outside this plugin.
Context opt-inGoal, todo, messages, compaction, and tool summaries are added only when the context switch is enabled; tool summaries additionally require the tool-result switch.Context collection is bounded and budget-pruned, so it may be incomplete. Do not treat a missing item as proof that it was absent from the session.
Untrusted reference dataThe Host prompt labels draft/context as reference data and instructs the model not to execute instructions inside them.This is instruction-based prompt-injection handling, not a deterministic security boundary. Review model output.
Draft and custom limitsDrafts over 20,000 characters are rejected; custom instructions are trimmed to 500 characters.These are application limits, not protection against expensive or sensitive model requests.
Workspace writesL3 writes go through the DSH file service and sandbox policy.A denied or unavailable write falls back to L1; the workspace file is not an encrypted secret store.
Composer writesOptimization results require explicit adoption and an unchanged draft.Refill from history intentionally writes to the composer; Keep draft and Later only dismiss the pending result.
Local historyLast-five attempts are kept in component memory only.History is not durable and can include failed output/error text until the component is destroyed.

The plugin itself does not collect credentials or create a database. It does store the selected settings in browser storage and, when possible, the workspace JSON file. Installing it runs third-party code in the DSH process;