メインコンテンツへスキップ
G

dsh-prompt-optimizor

grampusworld/dsh-prompt-optimizor

Rewrites the composer draft into a tighter prompt in one click and restores the exact original in another, running on Harness's own models by default or any OpenAI-compatible endpoint, with an editable polishing prompt.

インストール

dsh plugin --profile web add github:grampusworld/dsh-prompt-optimizor

README

Prompt Optimizor

A DeepSeek Harness plugin that puts a small ✦ button next to the composer: one click rewrites the draft into a tighter prompt with the model you pick, a second click puts the original back.

中文说明 →

What it does

  • Adds a ✦ button to the composer's right-hand control row.
  • Click once — the current draft is sent to the configured model and replaced in place with the polished prompt. The button turns into "restore".
  • Click again — the draft goes back to exactly what it was before the first click.
  • Click while a request is running — cancels it; the draft is left alone.
  • Drafts that contain attachment or @-reference placeholders are skipped with a hint instead of being rewritten, so references are never dropped.
  • Ships its own settings panel under Plugins → Prompt Optimizor.

The button sits at the bottom-right corner of the composer:

The ✦ button at the bottom-right of the composer

Install

dsh plugin add github:Grampusworld/dsh-prompt-optimizor

From a local checkout, use the plugin manager instead:

plugin_manager action=install_bundle target=/absolute/path/to/dsh-PromptOptimizor

Reload after editing the source: disable and re-enable the plugin (or refresh the page).

Settings

FieldMeaningDefault
ModeBuilt-in model (uses the models already configured in Harness, no API key needed) or Custom OpenAI-compatible APIBuilt-in
provider / modelUsed in built-in mode; the list comes from Harness' own model catalogdeepseek-official / deepseek-flash
Reasoning effortModel default / off / low / high / max; falls back to the model's default when unsupportedoff
Base URL / Model name / API keyUsed in custom mode; any service that accepts POST {base}/chat/completionsempty / deepseek-chat / empty
Polishing promptSystem instruction sent to the model; saving an empty value restores the defaultbuilt-in "prompt compressor" prompt
Max charactersRequests above this are refused with a hint instead of being sent8000
Request timeoutMilliseconds60000

Save and test saves first, then runs a sample prompt end to end and shows the before/after.

Settings panel

How it works

  • Host half (index.js) registers /api/prompt-optimizor/{state,catalog,optimize,test}. The routes accept loopback peers only, require application/json on POST, and cap request bodies at 256 KiB. Two polishing paths:
    • built-in mode streams through ctx.llm.stream, so it uses the providers Harness already has;
    • custom mode fetches any OpenAI-compatible /chat/completions endpoint.
  • Browser half (client.js) mounts the button into conversation.input.right (rewriting the draft through inputActions.setDraft) and the settings panel into plugins.bundle.config.
  • Configuration is read and written through the settings service under the namespace dsh-prompt-optimizor; the schema is declared with schemastery, so no manual package.json or cordis.patch.yml edits are needed.

Privacy

The API key is stored in your local Harness profile configuration and is never sent back to the page — GET /api/prompt-optimizor/state only answers hasApiKey. Requests go from your machine straight to the provider you configured.

Development

node --check index.js && node --check client.js

License

MIT.

関連プラグイン