Introduction¶
In DeepSeek Harness (DSH), system prompts are assembled from multiple sections. If an agent preset uses a persona with complete: true (e.g., @deepseek-ai/dsh-persona occupying the entire personality segment), assemble() will retain only this single section, and all other paragraphs registered via ctx.systemPrompt.section() will be discarded. A common workaround is to stack more sections, but this path is blocked in complete scenarios. However, complete sections still undergo interpolate() via renderPrompt(), allowing you to write {{variable_name}} within the persona text, which will be expanded using values returned by prompt variable providers. Below is an introduction to dsh-prompt-inject, maintained by MacilyDots: it registers “an additional prompt segment” within the workflow as a variable for reference in preset prefixes. The plugin itself does not contain fixed text; the content is provided by you in the configuration or external files.
What is this¶
dsh-prompt-inject (npm package name @macily.dots/dsh-prompt-inject, version 0.1.2 in current documentation) is a DSH workflow plugin. It registers a configurable prompt variable with DSH, allowing agent presets using a complete: true persona to insert a block of custom text into the system prompt. It is maintained by MacilyDots; source code and documentation can be found in the GitHub repository, and the community directory page is the SkillHub Plugin Page. The license is MIT.
Why prompt variables are needed instead of adding more sections¶
The entry point for DSH system prompt registration is ctx.systemPrompt.section() from @deepseek-ai/dsh-system-prompt. There is a hard rule during assembly: as long as a section with complete: true exists, only that section remains in the final list. The only entry point that still works in this case is prompt variable interpolation—the complete section is not a concatenation target, but it still participates in interpolate(). Writing {{inject}} (the name is configurable) in the prefix or persona will allow it to be expanded.
Note that interpolate() throws an error for unregistered variables (e.g., unknown prompt variable "{{x}}" in section "..."). This error occurs during the system prompt rendering stage, causing the entire session chain under that preset to fail. Therefore, if {{x}} is written in the prefix, you must ensure the plugin registering x is loaded; use tools/disable.mjs to remove references before uninstallation; tools/check.mjs can verify pairing, and tools/uninstall.mjs will refuse to execute if references still exist.
Core Features¶
- Register Prompt Variable: The default variable name is
inject, which can be changed to a name matching[a-z][a-z0-9_]*incordis.patch.yml; theprefixof the preset persona is appended with{{variable}}via a tool script (idempotent). - Content Source: Supports
textFile(absolute path in UTF-8, auto-reloads based on mtime) or inlinetext;textFiletakes precedence; if both are empty, no content is injected. - Scope: Optional whitelists for
presets,sessions, andcwds; anenabledmaster switch; optionalstateFile/stateKeyto follow external JSON switches (injection occurs only if the key is strictly equal totrue). - Companion Scripts:
install.mjs/uninstall.mjsmanage the profile’sdsh.profile.bundles;enable.mjs/disable.mjsmanage preset references;check.mjslists all variable references within the profile and exits with code 1 on danger. - Fault Tolerance: The provider is called synchronously within
assemble(), and throwing an error will kill the session; the plugin internally uses try/catch for file reading and state reading, returning an empty string in the worst case (equivalent to no injection).
The plugin does not register a system-prompt section, so it does not participate in “multiple complete section” conflicts; however, registering the same variable name multiple times will still result in an error. You must change the variable configuration to avoid name collisions with other plugins.
Installation and Enablement¶
Below, %DSH_HOME% refers to the DSH home directory (Windows default is %USERPROFILE%\.dsh, other platforms use ~/.dsh), and the profile name defaults to desktop. The plugin requires Node >= 22.5.
Install from npm (official command):
dsh plugin --profile desktop add @macily.dots/dsh-prompt-inject
Note: The scoped package name @macily.dots/dsh-prompt-inject must be used on npm; the unscoped dsh-prompt-inject is already taken by another package.
Manual installation is equivalent to: copying the repository to the profile’s node_modules/@macily.dots/dsh-prompt-inject, and then running node tools/install.mjs to write into bundles. Whether DSH loads the plugin is determined by package.json’s dsh.profile.bundles, not just by modifying cordis.patch.yml (the GUI may rewrite the patch, while the bundles list is relatively stable).
Enablement process overview:
- Configure the plugin in the profile’s
cordis.patch.yml(see next section). - Hook up the variable reference for the target preset:
node tools/install.mjs
node tools/enable.mjs --preset preset-<your-preset-id>
node tools/check.mjs
- Restart DSH.
All write operation scripts will leave a .bak-prompt-inject-<timestamp> backup in the same directory; add --dry to preview without writing to disk.
Configuration Example¶
Override plugin items in the profile’s cordis.patch.yml:
- id: prompt-inject
config:
variable: inject
textFile: '<absolute path to text file>'
| Field | Default | Description |
|---|---|---|
variable |
inject |
The registered variable name; write {{<this-name>}} in the preset |
textFile |
'' |
Text file path (UTF-8), reloads based on mtime after changes |
text |
'' |
Inline text; textFile takes precedence |
presets |
[] |
Agent preset id whitelist; empty means no restriction |
sessions |
[] |
Session id whitelist |
cwds |
[] |
Working directory whitelist (header.cwd) |
enabled |
true |
Master switch |
stateFile |
'' |
External JSON switch file |
stateKey |
enabled |
Key read from JSON, must be strictly true for injection |
debug |
false |
Write to %DSH_HOME%/prompt-inject.log |
variable and presets are two independent gates: the reference determines which presets expand this variable; the provider and whitelists/switches determine when to return an empty string.
Typical Usage¶
- Prepare a set of rules or context intended only for a specific complete persona, save it as a UTF-8 file, and fill in
textFilein the configuration. - Run
node tools/enable.mjs --preset preset-<id>for the target agent preset to append{{inject}}(or your configuredvariable) to the end of the personaprefix. - Use
node tools/check.mjsto confirm that references and bundles are paired correctly before restarting DSH. - To temporarily disable injection, you can set
enabled: false, narrow the whitelist, or link with other plugins viastateFile; changing file content does not require a restart (textFilereloads based on mtime).
Use Cases and Notes¶
Suitable for: DSH users who have adopted complete: true personas but need to stably insert team specifications, project descriptions, or variable instruction blocks into the system prompt; cases where you want to decouple injected content from the persona repository and control it via external files or switches.
Important Notes:
- The plugin runs with the current DSH process privileges. Before installation, you should read the source code and the MIT license to confirm that the
textFilepath and content are trustworthy. - Referencing an unregistered variable will cause the entire preset session to fail; you must
disableandcheckbefore changing bundles or uninstalling. - Uninstallation sequence:
node tools/disable.mjs --preset <preset-id>→node tools/uninstall.mjs→ Restart DSH → Manually delete the plugin directory innode_modules.
Conclusion¶
dsh-prompt-inject does not attempt to bypass the assembly rules of complete sections but utilizes prompt variable interpolation to append configurable text blocks to complete persona presets. Combined with bundles installation, enable/check scripts, and cordis.patch.yml configuration, it separates the management of “references” from “when to inject”. Please refer to the repository README for more details.
- Community Directory: https://www.skillhub.cn/plugins/MacilyDots/dsh-prompt-inject
- GitHub: https://github.com/MacilyDots/dsh-prompt-inject