- Início
- Plugins
- Melhorias de UI
- dsh-prompt-optimizer (bundle)
dsh-prompt-optimizer (bundle)
viewway/dsh-prompt-optimizer/packages/bundle
Prompt optimizer for the DSH composer. One click runs rewrite then self-review rounds over the draft with per-round diff preview, and a rejected result rides into the next round as a prior attempt. Five fixed re-run directions (more concise / more detailed / more technical / restructure / stronger acceptance); a 164-role library ships in the package, roles recommended by draft or picked explicitly; matched installed skills fold into the meta-prompt under exact-name constraints; results save to a prompt library (browse, insert, re-optimize, two-step delete); mechanical acceptance criteria carry an executable check-command template; output language follows the agent UI language.
Instalar
dsh plugin --profile web add github:viewway/dsh-prompt-optimizerEste plugin está no subdiretório packages/bundle do repositório.
README
dsh-prompt-optimizer
A standalone, independently distributed plugin family for the DeepSeek Harness that turns a rough idea draft into a polished, agent-ready prompt through iterative rewrite → self-review → fix rounds.
Features
- One-click Optimize button on the input box plus domain recommendation chips; multi-round optimization with retry and per-round diff preview
- Role library (
<slug>.mdfiles): a 165-role catalog ships inside the package and is used wheneverrolesDiris unset; list roles on demand, recommend by draft, re-run with an explicit role; set a default role in the settings page - Skill awareness (
skillAware): when a draft matches an installed skill, its name and description are folded into the meta-prompt so the output references those skills — guarded by exact-name constraints against hallucination. Chinese and English drafts both match: a built-in bilingual gloss bridges Chinese terms like 页面/接口/部署 to English-described skills and back - Optimization directions: five chips on the preview panel (more concise / more detailed / more technical / restructure / stronger acceptance) re-run the round toward a picked direction and echo the active one; directions are a fixed enum — no free text, so no prompt injection
- Prompt library: save any result with one click; the library button on the input row opens a management panel — browse, expand, insert into the draft, re-optimize from a stored entry, or delete with a two-step confirm (newest first)
- Output language follows the agent UI language: a Chinese interface yields Chinese prompts, English yields English, while code identifiers, paths and commands stay verbatim
- Inline Optimize entry on queued (unsent) conversation items
- Acceptance criteria: mechanical criteria ship with an executable check-command template
Judging an optimization
The result is more than the rewritten text — every block in the preview panel is review material:
| Panel block | What it is | How to judge with it |
|---|---|---|
| Optimized text | The rewritten prompt | Read it against the draft column, section by section |
| Changes | Each edit the model says it made | Ask per bullet: did it make the task clearer? Was anything changed that should not have been? |
| Acceptance criteria | Conditions that define done | Mechanical ones run via the check button; the rest verify by their stated judgment point — none verifiable means suspicious |
| Skills | Installed skills matched this round | Skill mentions in the result must use exact listed names; with none listed, the result must not invent any |
| Critique | Revision log of the system-prompt second round | Does each revision say what changed and why? |
Quick checklist:
- Zero detail loss — paths, versions, commands, and numbers preserved verbatim;
- Clear structure — goal, context, constraints, and expected output stated separately;
- No inventions — no facts the draft never stated (file names, error text, requirements);
- Verifiable acceptance — every criterion checkable by command or judgment point;
- Sound skill references — named skills genuinely fit the task and match their exact names.
When any check fails: hit Regenerate — the rejected result rides into the next round as a prior attempt, so the model must produce a meaningfully different revision; or click a direction chip (more concise / more detailed / more technical / restructure / stronger acceptance) to re-run toward that direction; or re-run with another role, or switch to the system-prompt mode. Save what works with Save to prompt library, then recall, re-optimize, or delete it any time from the library button on the input row.
Repository layout
| Package | npm | Purpose |
|---|---|---|
packages/prompt-optimizer | @yimiliya/dsh-prompt-optimizer | Host service: optimization rounds, role library, skill hints, model routing |
packages/api-prompt-optimizer | @yimiliya/dsh-api-prompt-optimizer | Remote controller and Typert descriptors (host/client shared method table) |
packages/client-ui-prompt-optimizer | @yimiliya/dsh-client-ui-prompt-optimizer | Browser UI: trigger button, preview panel, queue entries, settings page |
packages/bundle | @yimiliya/dsh-prompt-optimizer-bundle | Profile bundle (cordis.patch.yml) that installs all three plugins in one shot |
Each package carries its own README, which npm renders on the package page; this document is the family-level view. tools/tsdown.client.ts is the standalone client build preset: it emits browser closure artifacts against the harness window.__ModuleLoader__.load({id, factory}) contract, with CSS Modules compiled by lightningcss into self-contained injected styles.
Installation (users)
Once published to npm, on any profile that has dsh installed:
dsh plugin --profile web add @yimiliya/dsh-prompt-optimizer-bundle
The bundle stacks prompt-optimizer, api-prompt-optimizer and ui-prompt-optimizer into that profile's dsh.profile.bundles. You can also install it from the web client's plugin marketplace.
Before any release exists, install from tarballs. A raw local path or git spec does not work: the bundle's workspace:* dependencies resolve only inside this repository's pnpm workspace, while dsh plugin add installs inside the profile's own root. Packing rewrites those ranges to real versions (pnpm -r pack), and the tarball's dependencies then resolve from the registry — so this path needs the other three packages published first:
pnpm -r pack # writes *.tgz next to each package.json
dsh plugin --profile web add packages/bundle/yimiliya-dsh-prompt-optimizer-bundle-<version>.tgz
Configuration (optional — plugins > config > prompt-optimizer in cordis.yml)
| Field | Default | Description |
|---|---|---|
verifyTimeoutMs | see source | Timeout for acceptance-check commands |
domainPriors | true | Inject priors based on the draft's technical domain |
provider / model | unset | Explicit model routing for optimization; the two must appear together |
rolesDir | bundled catalog | Role definition directory override (<slug>.md); the shipped role library is used when unset and stays read-only for role evolution |
defaultRole | unset | Default role slug when none is specified; also settable in the settings page |
skillAware | true | Fold matched installed skills into the meta-prompt |
Privacy
Optimization runs are recorded in the session's own event log; treat drafts accordingly:
- Every optimization round appends a
plugin:prompt-optimizer/llm-requestrecord containing the full draft text and the auxiliary system prompt. - Every check run appends a
plugin:prompt-optimizer/verifyrecord containing the executed command and its (redacted) output. - "Improve this role" rewrites the role definition file
<slug>.mdunder the configuredrolesDiron disk; the previous version is kept alongside it as<slug>.md.bak. The bundled default catalog is read-only: configurerolesDirto enable role evolution.
If you paste secrets into a draft, expect them to appear in the session log.
Development
pnpm install
pnpm run check # lint + typecheck + build + test (the same gate CI runs)
pnpm run typecheck # TypeScript only
pnpm run lint # oxlint
pnpm run test # vitest (node + client projects)
pnpm run build # tsdown, dependency order
-
node project (host + api tests) runs out of the box.
-
client project (jsdom browser tests) resolves the
@deepseek-ai/*modules through a deepseek-harness checkout: the published dsh client packages are browser closure artifacts that only load inside the real web client, so tests follow the harnesstsconfig.base.jsonpaths map into its source tree — the same way these suites run natively inside the harness repo. It defaults to the sibling checkout../deepseek-harness-latest, or point at it explicitly:DSH_HARNESS_ROOT=/path/to/deepseek-harness pnpm run testThe harness checkout must have had
pnpm installrun inside it (its sources resolve their own dependencies from its tree). The test config also pins react / react-dom / use-sync-external-store to a single copy to avoid cross-copy hook errors.
Agents and contributors should read AGENTS.md for repo conventions.
Compatibility
The supported baseline is @deepseek-ai/dsh-* 0.2.1-rc.5; earlier versions are unverified. Installed releases keep working across the whole 0.2.x line via engines.dsh — details, including the queue-entry slot requirement and the pinned peer dependencies, live in docs/compatibility.md, which is the single source of truth.
Releasing (maintainers)
Keep the four packages on one version. Tag a release (git tag vX.Y.Z && git push origin vX.Y.Z) and GitHub Actions builds, checks and publishes all four packages to npm in dependency order (host → api → client → bundle). See .github/workflows/release.yml.
License
Plugins relacionados
dsh-web (dsh-task-board)
zhu1090093659/dsh-web
dsh-web (dsh-web-all)
zhu1090093659/dsh-web
dsh-TUI
ccch1mneyyy/dsh-tui
dsh-web-ui (dsh-task-board)
zhu1090093659/dsh-web-ui