dsh-prompt-refine
DeepSeek Harness prompt-engineering plugin (dsh-prompt-refine): refine vague requests into precise instructions
- Stars
- 0
- Language
- TypeScript
- Created
- Sep 12, 2026
- Updated
- Sep 12, 2026
Introduction
dsh-prompt-refine (prompt engineering plugin)
Rewrites a user's vague natural-language request into a precise instruction the model can execute directly; the rewritten result is confirmed by the user before entering the conversation. Developed in the deepseek-harness repo on 2026-09-02 (packages/prompt/); this directory is the plugin's complete archival snapshot: three package source trees + tests + snapshot assembly + hand-off documentation, verified file-by-file against the repo source via MD5 at archive time (35 files).
Difference from this repo's other plugins (no install.ps1)
This plugin is a deepseek-harness repo-level cordis plugin, not a standalone desktop plugin under D:\项目\dsh-native\plugins\: the three packages have workspace dependencies on each other and also depend on other repo packages (dsh-llm / dsh-session / dsh-commands / dsh-user-questions / schemastery) and on unpublished repo changes (dsh-llm's purpose union gains 'prompt-refine', dsh-session's known events gain prompt/refine). It therefore cannot be installed into the DshNative runtime on its own, and this directory contains no install.ps1 / uninstall.ps1 or pkg/ build artifacts — it must wait for a harness release that includes packages/prompt/ and ship with the runtime. The archive records the source; build artifacts are regenerated in the repo with pnpm run build:lib:host (tsc emits lib/types/, tsdown bundles lib/index.js).
Capability-seam three packages
| Package | npm name | Role | Responsibility |
|---|---|---|---|
refine/ | @deepseek-ai/dsh-refine | Service Definition | PromptRefiner abstract class, the ctx.refine service, the RefineContextSource background-context registry (the mounting point for a future database), the prompt/refine session event |
refine-llm/ | @deepseek-ai/dsh-refine-llm | Provider | Completes the rewrite with a single auxiliary ctx.llm.stream() call; routing order: dedicated config → session's most recent route → agent options; background context is folded into the input as "context first, request after" |
refine-command/ | @deepseek-ai/dsh-refine-command | Consumer | the /refine command (sends via agent.steer() after Send / Discard confirmation) + an optional auto: true pre-step that auto-rewrites (falls back to the original text on failure, never interrupting the user's turn) |
Trigger & configuration
- Command trigger:
/refine run the demo project - Auto-rewrite:
config.auto: trueon refine-command in cordis.yml - refine-llm config keys:
refinementProvider/refinementModel(dedicated route, must be paired),maxTokens(default 2048),instruction(the rewrite system prompt, replaceable in full) - Inject background context (database mounting point):
ctx.refineContexts.register({ name, provide })
Prompt (core asset)
The rewrite instruction lives at refine-llm/src/config.ts → DEFAULT_REFINE_INSTRUCTION, tuned on 2026-09-02 into 11 rules, each blocking a measured failure mode: output in the same language, user's voice (no third-person paraphrasing), goal + deliverable + success criteria, don't invent requirements, preserve both semantics and literals, pass through already-precise input, request takes precedence over context, disambiguate by the most likely interpretation (ask no clarifying questions), be as short as possible, output only the rewritten text (no quotes/code fences/tool calls). See docs/提示词.md for the verbatim list and per-rule Chinese explanations.
Directory layout
| Path | Contents |
|---|---|
refine/ refine-llm/ refine-command/ | Full source for the three packages: src, tests, package.json, tsconfig.json, bilingual README |
snapshot/ | Keyless snapshot assembly: refine.cordis.snapshot.yml (assembly config) + refine-snapshot-backend.mjs (deterministic backend) + refine-auto/ (input and expected transcriptions) |
docs/ | 交接文档.md (implementation hand-off), 提示词.md (prompt list), agent-note/ (bilingual design-decision records) |
The snapshot assembly's in-repo original locations: examples/headless-agent/refine.cordis.snapshot.yml, examples/headless-agent/tests/fixtures/refine-snapshot-backend.mjs, examples/headless-agent/tests/snapshots/refine-auto/; the tests are registered in examples/headless-agent/tests/headless.snapshot.ts (a shared file, not archived separately).
Verification status (2026-09-02)
- 80 unit tests across the three packages pass; the keyless
refine-autosnapshot (end-to-end assembly transcription) passes; all green after the prompt tuning (11 rules) - doc-sync has 5 pending gates introduced by this plugin (subsystem page, purpose sync, README Model Experience, translation pairing); the list is in section 6, "A-class", of
docs/交接文档.md - Source not yet committed (repo working-tree state); the archive matches the source's current content
Deployed to the local DshNative runtime (2026-09-02 17:46)
Because the main repo working tree had several parallel in-flight changes (memory/browser-use/pi-ai), the deployment did not build from the main tree but used an isolated worktree (D:\项目\wt-dsh-refine, rc.8 checkout + minimal overlay: the three prompt packages + one purpose line in types.ts + one event line in known-event-types.ts + three tsconfig.host.json references), built it, passed 80/80 tests, then installed it surgically:
| Deployment item | Contents |
|---|---|
New runtime\node_modules\@deepseek-ai\dsh-refine / dsh-refine-llm / dsh-refine-command | lib + README + package.json (dependencies rewritten from workspace:^ to real published versions) |
Overwrote only 2 files of dsh-session | lib\index.js, lib\types\known-event-types.js (only one extra 'prompt/refine' line; file-by-file MD5 comparison confirms the other 23 files match rc.8) |
dsh-llm / dsh-llm-deepseek not replaced | the purpose change is purely at the type layer; the rc.8 adapter only does equality checks on purpose (=== 'session-title' / === 'compaction'), so 'prompt-refine' safely falls into the default path |
| farm junction ×3 | ~\.dsh\profiles\node_modules\@deepseek-ai\dsh-refine* → runtime packages |
desktop.yml appended insert entries | the three plugins, ids refine / refine-llm / refine-command, auto not enabled (default is the /refine command only) |
Cold-start verification: process stays alive, web service binds, zero errors in the startup log. Rollback: %LOCALAPPDATA%\DshNative\backup-refine-deploy-20260902\ (full rc.8 copy of dsh-session + desktop.yml backup); delete the three new package directories and junctions and restore the backup. This deployment is an in-place runtime patch and is not inside the runtime.zip installer; the official release must wait for a harness version that merges packages/prompt/ and ship with the installer.