Saltar al contenido principal
V

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-optimizer

Este plugin se encuentra en el subdirectorio packages/bundle del repositorio.

README

dsh-prompt-optimizer

CI

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.

English | 简体中文

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>.md files): a 165-role catalog ships inside the package and is used whenever rolesDir is 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 blockWhat it isHow to judge with it
Optimized textThe rewritten promptRead it against the draft column, section by section
ChangesEach edit the model says it madeAsk per bullet: did it make the task clearer? Was anything changed that should not have been?
Acceptance criteriaConditions that define doneMechanical ones run via the check button; the rest verify by their stated judgment point — none verifiable means suspicious
SkillsInstalled skills matched this roundSkill mentions in the result must use exact listed names; with none listed, the result must not invent any
CritiqueRevision log of the system-prompt second roundDoes each revision say what changed and why?

Quick checklist:

  1. Zero detail loss — paths, versions, commands, and numbers preserved verbatim;
  2. Clear structure — goal, context, constraints, and expected output stated separately;
  3. No inventions — no facts the draft never stated (file names, error text, requirements);
  4. Verifiable acceptance — every criterion checkable by command or judgment point;
  5. 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

PackagenpmPurpose
packages/prompt-optimizer@yimiliya/dsh-prompt-optimizerHost service: optimization rounds, role library, skill hints, model routing
packages/api-prompt-optimizer@yimiliya/dsh-api-prompt-optimizerRemote controller and Typert descriptors (host/client shared method table)
packages/client-ui-prompt-optimizer@yimiliya/dsh-client-ui-prompt-optimizerBrowser UI: trigger button, preview panel, queue entries, settings page
packages/bundle@yimiliya/dsh-prompt-optimizer-bundleProfile 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)

FieldDefaultDescription
verifyTimeoutMssee sourceTimeout for acceptance-check commands
domainPriorstrueInject priors based on the draft's technical domain
provider / modelunsetExplicit model routing for optimization; the two must appear together
rolesDirbundled catalogRole definition directory override (<slug>.md); the shipped role library is used when unset and stays read-only for role evolution
defaultRoleunsetDefault role slug when none is specified; also settable in the settings page
skillAwaretrueFold 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-request record containing the full draft text and the auxiliary system prompt.
  • Every check run appends a plugin:prompt-optimizer/verify record containing the executed command and its (redacted) output.
  • "Improve this role" rewrites the role definition file <slug>.md under the configured rolesDir on disk; the previous version is kept alongside it as <slug>.md.bak. The bundled default catalog is read-only: configure rolesDir to 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 harness tsconfig.base.json paths 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 test
    

    The harness checkout must have had pnpm install run 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

Apache-2.0

Plugins relacionados