dsh-prompt-inject: Customize Prompt Injections per Injection Point and Model in DSH Settings

Introduction

DeepSeek Harness (DSH) assembles system and user messages before sending a request; if you want to use different supplementary instructions on different models, the common practice is to modify the global configuration or manually paste content each time, which makes it difficult to finely control by “injection position + model.” Maintainer XuezuoYS’s dsh-prompt-inject is a DSH community plugin (category: model inference) that provides a GUI in the Web settings: configure rules at eight injection points, with each rule individually switchable, reorderable, and scoped to specific models; changes are auto-saved and take effect in the next conversation turn. Configuration is stored locally and only affects the current environment.

The following covers the plugin’s positioning, capabilities, and installation/usage; facts are subject to the GitHub repository README.

What Is This

dsh-prompt-inject targets users already using DeepSeek Harness: in Settings → dsh-prompt-inject, write injection rules for “user message prefix/suffix” and six positions within system, and decide whether to participate in the current request based on the provider/model scope. The plugin’s current version is 0.2.0, targeting the 0.2.1-rc.2 declared in engines.dsh; license MIT.

Core Features

Eight Injection Points

Rules are divided into two groups: user messages (prefix, suffix) and system segments (six items ordered by their appearance in system).

Settings Page Name Key Behavior Summary
User Prefix user.prefix Independent user message, placed before the current user input, injected once per turn
User Suffix user.suffix Independent user message, placed after the current user input, injected once per turn
System Head system.personaHead Replaces the official persona head (order 0)
Before Tools Description system.beforeTools Adds a new segment (order 950)
After Tools Description system.afterTools Adds a new segment (order 3050)
Before Structured Output system.middle Adds a new segment (order 9800)
System Tail system.personaTail Replaces the official persona tail (order 10200)
System Very End system.last Adds a new segment (order 10300)

For “add” positions without configured rules, the result resolves to an empty string, which is discarded during official rendering, so it won’t override official content; for “replace” positions without rules, the official default is preserved.

Rule Cards and Saving

Each injection point can have multiple rules; within the same point, rules are concatenated top to bottom, separated by a blank line. Each rule includes: an enable toggle, model scope (All / specific models / None), multi-line body text, and actions for reordering, copying, and deleting (after deletion, a Toast allows one undo). Edits are auto-submitted after about 500ms, with Saving / Saved / Save Failed shown at the top; there is no separate save button.

Template Fields

Rule body text supports substitution at send time:

Field Replaced With
{{model}} The actual model id for this request, e.g., deepseek-flash
{{provider}} The provider of the model, e.g., deepseek-account
{{cwd}} The absolute path of the current session’s working directory

User prefix/suffix are rendered and written into history at injection time; system items are rendered each time the system is assembled. Unrecognized field names are kept as-is; to get a literal {{model}}, you can write {{ model }} etc.

Model Scope

The model key format is <provider>/<model>, e.g., deepseek-account/deepseek-flash. Checking “All” means the rule applies to all models (including ones added later); when only specific models are checked, unchecked models do not match. To determine “which model is used this time,” priority is: the official model selection projection first, then the most recent request routing in the session, then falling back to the option chosen when the agent was established.

Installation and Enabling

Install the plugin from GitHub into a specified profile using DSH’s built-in command; --profile should match your usual startup profile (commonly web for Web UI, desktop for the desktop version).

dsh plugin --profile web add github:XuezuoYS/dsh-prompt-inject

To pin a version, add a commit after the repository name:

dsh plugin --profile web add github:XuezuoYS/dsh-prompt-inject#<sha>

This package is a hand-written pure JS package with no prepare / install build scripts. After installation, if DSH is already running, follow the command prompt to decide whether to apply immediately or restart. You can also check whether the configuration layer includes this plugin without starting a process:

dsh --profile web --dump-config   # You should see a line "# == dsh-prompt-inject"

Uninstall (does not delete rule files; configuration remains after reinstall):

dsh plugin --profile web remove dsh-prompt-inject

Version matching: engines.dsh in package.json is 0.2.1-rc.2. DSH validates this field starting from 0.2.1; if it doesn’t match, the entire bundle will be silently skipped in skippedBundles during startup diagnostics, appearing as if “the plugin disappeared.” You’ll need to change engines.dsh or align the DSH version.

Typical Usage

Configure in the Settings Page

  1. Open Settings → dsh-prompt-inject.
  2. Click “+ Add Rule” at the target injection point, fill in the body text; if needed, use the field badge at the top to insert {{model}} etc.
  3. Click the model scope capsule and select “All” or specific provider/model.
  4. Wait for “Saved” to appear at the top, then verify the effect in a new session or the next send.

Configuration File (for Troubleshooting)

Default path: ~/.dsh/dsh-prompt-inject/rules.json (on Windows, usually C:\Users\<you>\.dsh\dsh-prompt-inject\rules.json). Structure example:

{
  "version": 1,
  "revision": 12,
  "slots": {
    "user.prefix": {
      "rules": [
        {
          "id": "r1",
          "enabled": true,
          "text": "总是用中文回答",
          "models": { "all": true, "list": ["deepseek-account/deepseek-flash"] }
        }
      ]
    },
    "system.beforeTools": { "rules": [] }
  }
}

Officially, it’s recommended to only modify via the settings page; if the file is corrupted or the version is unrecognized, it will be renamed with a timestamp to rules.json.<timestamp>.bad and continue running with empty configuration.

Use Cases and Notes

Who it’s for: Developers who need to uniformly maintain “model-differentiated” system instructions, constraints before/after tools, or fixed user-side prefixes/suffixes within DSH, and are willing to manage rule lists in a GUI.

Design cost of user prefix/suffix (the settings page has notes at the top of these two sections): injected content is an independent user message that, once written into conversation history, will not be compressed, cleared, or restored, and will accumulate over turns; the previous turn’s suffix may end up sandwiched between the previous turn’s original text and the current turn’s input, easily being misread by the model as supplementary speech. Therefore, these two positions should be used for fixed requirements that are unlikely to cause misunderstanding; if you want a piece of text to only take effect in the system without entering user history, use system-related injection points.

Runtime and trust: The plugin loads within the DSH process, reads/writes local rules, and participates in request assembly; before installing, you should review the source code and MIT license yourself.

Other known limitations (excerpted from README): The settings page does not show the “current model”; there is no final concatenation preview; each injection point supports up to 200 rules, each rule body up to 20000 characters, each rule up to 500 model keys; when directly modifying DSH configuration files or when models are listed/unlisted remotely, you need to refresh the page to update the model catalog.

Conclusion

dsh-prompt-inject brings “pre-send prompt injection” into the settings page: eight injection points, model-scoped rules, template fields, and auto-save, making it suitable for reproducible model-level prompt management within the DSH ecosystem. Community catalog page: SkillHub - dsh-prompt-inject; repository: github.com/XuezuoYS/dsh-prompt-inject.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye