Preface¶
DSH’s system prompt determines the model’s “persona, rules, and workflow,” but DSH itself does not provide a general user entry point to modify it. If you want to add a global constraint, you can only modify the package, configuration, or source code, and once written, there is no way to undo it. Below is the introduction of the dsh-prompt-injector plugin maintained by qbclex: It turns system prompt injection into a feature that can be toggled on or off and rolled back at any time. Compared to manually editing configuration files, it adds a layer of history; compared to other injection methods, after injection, you can return to the previous state, or even restore it to the state before the program ran.
What is this¶
One-sentence positioning: A system prompt injection plugin for DeepSeek Harness, injecting prepared prompts into the system prompt, taking effect for all sessions, and supporting rollback by history.
- Maintainer: qbclex
- Repository: https://github.com/qbclex/dsh-prompt-injector
- Community Directory Page: https://www.skillhub.cn/plugins/qbclex/dsh-prompt-injector (Independent site, no official affiliation with DeepSeek / Hypothesis)
- Category: Model Inference; GitHub 1 star (As of 2026-11-06)
- License: MIT
- Current Version: 1.0.0 (See
package.jsonin README)
Core Features¶
- Inject: Supports two modes: Replace current injected content, or Append to current injected content. The next model call takes effect immediately without needing to restart DSH.
- Rollback: Undo the last injection and restore content to what it was before. If the history stack is empty, the current injection becomes the “no injection” state.
- History Protection: Before each injection occurs, the current content at that time is automatically saved to history, with a maximum retention of 20 items; you can restore any item from history to the current state. The original current content moves into history, so you can still roll back further.
- Restore Initial: One-click clear of current injection and all history, returning to the state before the program started. This operation requires double confirmation.
- Persistence: Current injection and history are written to
~/.dsh/prompt-injector/state.json. After restarting DSH, the injected content remains. - Three Entry Points: Settings page, chat command
/pinject, AI toolprompt_injector.
Design principles are written in the README: Do nothing you didn’t ask for. When there is no injection, the plugin completely unregisters the system prompt section it registered; the system prompt is identical to the state before installation; rollback is not adding a text block to cancel the previous one, but actually returning to the previous state.
Installation and Enablement¶
Prerequisites: DSH ≥ Desktop version / any version with a plugin system; Node.js ≥ 22.
Method A is suitable for developers, installing from the source code directory:
dsh plugin --profile <your profile name> add link:<absolute path to this repository>
For example:
dsh plugin --profile desktop add link:C:\path\to\dsh-prompt-injector
After installation, restart DSH, and a “Prompt Injector” page will appear on the left side of Settings.
Method B is for manual installation, use when DSH commands are unavailable. First, rename the repository directory to dsh-prompt-injector, and place it in:
~/.dsh/profiles/<profile>/node_modules/dsh-prompt-injector
Then add a line to cordis.patch.yml in the profile (or delete the existing prompt-injector line and add it back):
- insert:
- id: prompt-injector
name: dsh-prompt-injector
The same restart of DSH is required for it to take effect.
Typical Usage¶
Settings Page Operation: Enter “Settings → Prompt Injector”, paste the prompt into the large text box, select “Replace current injection” or “Append to current injection” from the dropdown, and click “Inject into system prompt” to take effect. To undo, click “Rollback one step”; to clear completely, click “Restore to before program start,” which will require double confirmation.
Chat Command Operation:
/pinject <prompt body> Direct inject (treats the whole paragraph as one injection)
/pinject status View current injection and history
/pinject rollback [steps] Rollback (default 1 step)
/pinject reset Clear all
The third path is to have the AI do it for you: Tell the AI “Inject this into the system prompt: …”, and it will invoke the prompt_injector tool. According to current approval policies, the tool invocation will be presented to you for confirmation first.
Implementation Details¶
For those who want to modify the code, here are the details. The injection point is ctx.systemPrompt.section(). The text of the registered section is a function that reads the current in-memory state during every model call assembly, so injection and rollback take effect immediately without restarting the process. The injected content is wrapped in a high-priority attached section:
# User-injected system prompt (Prompt Injector)
...
<user-injected-prompt>
...your prompt...
</user-injected-prompt>
The structure of the state file ~/.dsh/prompt-injector/state.json is { current, history }. Each item in history is a snapshot of the current content before an injection occurred. Rollback simply pops the last item and restores it to current. Regarding host dependencies, defineTool parses from the host object tree; if it fails to parse, it falls back to a local equivalent conversion to avoid the entire plugin failing to activate due to a single import failure. See the comments in lib/hostdeps.mjs for details. To troubleshoot issues, check the logs first:
~/.dsh/prompt-injector/injector.log
Applicable Scenarios and Notes¶
Suitable for the following types of people:
- General users who want to add fixed rules or persona to global sessions but do not want to modify DSH source code.
- Developers who need to quickly test different prompt schemes and rollback at any time.
- Automation scenarios that want to use chat commands or let the AI directly manipulate injection.
Points that need clarification:
- The injected content is treated by the model as the highest priority user instruction and takes effect for all sessions. Only inject text that you have written yourself or have fully read and understood; do not inject entire paragraphs copied from web pages or emails without reading them.
- The plugin runs with the permissions of the current DSH process. You should read the source code, confirm the distribution source, and pay attention to the license (MIT) before installing.
- History only retains 20 snapshots; older snapshots are discarded after that. A complete clean requires the “Restore to before program start” function, which needs double confirmation.
- “Restore Initial” only clears the injection content and history recorded by this plugin, equivalent to the state before the plugin ran, not necessarily restoring DSH to an arbitrary earlier time point.
Conclusion¶
The problem solved by dsh-prompt-injector is specific: DSH lacks a system prompt entry point; this plugin fills that gap and adds history and rollback to injection. The cost is a bit rigid (it only does what is asked for and leaves no trace when there is no injection). Repository: https://github.com/qbclex/dsh-prompt-injector , Directory page: https://www.skillhub.cn/plugins/qbclex/dsh-prompt-injector .