Introduction¶
When developing agents or long sessions in DeepSeek Harness (DSH), a common requirement is to modify a version of the context before sending it to the model (e.g., adding system specifications, neutralizing sensitive words, or temporarily inserting a constructed message), without altering the original text in the interface or session logs. Hand-written scripts to modify requests or stacking system messages in the session often result in maintainability issues or format incompatibility with existing rules like Keysmith.
Below is an introduction to the community plugin dsh-inject (maintainer: john-walks-slow). It performs keyword/regex replacement for specific roles before model requests, enables multiple context presets per session, and can insert constructed turns at the current position. Rewriting only applies to the copy of the request; session records remain unchanged. It is categorized under “Model Reasoning” capabilities, and the npm package version is 0.1.0 (MIT).
What is this?¶
dsh-inject is a Cordis plugin for DSH, positioned as “Advanced Model Context Injection + Request-Side Rewriting Only,” and is natively compatible with the Keysmith rule format.
- Directory Page: skillhub.cn/plugins/john-walks-slow/dsh-inject
- Source Code & Docs: github.com/john-walks-slow/dsh-inject
The DSH ecosystem emphasizes “Everything is a plugin”; community directories like SkillHub are independent sites and have no official affiliation with DeepSeek / High-Flyer. Before installing a plugin, note that it runs with the permissions of the current DSH process, so you should review the source code and license yourself (this plugin is MIT).
Core Semantics¶
Understanding the following points will help avoid misconfiguration later.
- Modify Requests Only, Not Sessions: Automatic replacement occurs on the copy of the request sent to the model; the original messages in session records and the interface display remain unchanged.
- Disabled by Default: Presets are not enabled by default. To make them permanent, check “Enable by default” in the settings page, or use
/inject <preset id>in the current session to enable them temporarily. - Session-Level Override:
/inject <preset id>//inject offonly apply to the current session and always take precedence over the preset’s “Enable by default” setting. - Agent Preset-Level Default Enabling: After checking “Enable by default,” you can fill in “Limit to agent preset” (comma-separated, empty for all) in the expanded section. If filled, it is only enabled by default when the current agent preset of the session matches. The current preset is read from the DSH
agentPresetprojection, and switching during runtime will recalculate based on the new preset. - ID is the Handle: A preset has only one identifier: the id. It contains no spaces, commas, or slashes. In the settings page, the id is the title and can be modified directly.
- Zero Side Effects (Enabled State): The enabled state is in-process state and is not written to the session log; turning off a preset is equivalent to it never having been enabled. After a process restart, session-level states reset, leaving only “Enable by default” presets in effect.
Each injection also leaves a collapsible record line in the session, stating what was injected (consistent with the card form of commands like /inject) for auditing purposes. The user message on the interface still displays the original text, and the plugin does not mark the replaced segments on the interface.
Core Features¶
Presets: Auto-Replacement + Constructed Turns¶
In the Inject settings page, you can create any number of presets, each containing:
- Auto-Replacement: Multiple rules. Each can be set to “Keyword” or “Regex”, with replacement text filled in, and effective roles checked: User / Assistant / Tool Return.
- Opening Constructed Turn: Messages placed at the very beginning of the request, with roles selectable as System / Assistant / User / Tool.
Additionally, you can maintain Constructed Turn Templates for reuse in the live dialog and /inject-turn.
The preset header has an “Enable by default” switch (off by default); the expanded section allows filling in “Limit to agent preset”. The settings page uses manual saving: changes are saved to a local draft first, with a prompt “Unsaved changes” appearing to the right of the title. You must click “Save” to write back to the configuration.
Keysmith Compatibility¶
The plugin comes with the Keysmith (Keysmith Switch / codex-keysmith) rule system pre-configured by default:
- Built-in
unrestrictedpreset: Includes local execution mode system specifications (Local execution mode active) and common sensitive/boundary word neutralization replacements. The rule objects are compatible with Keysmith’s{ "from": "...", "to": "..." }, automatically mapping topattern,replacementand binding to user input. - The settings page provides “Import Keysmith Rules,” allowing batch parsing of pasted rule packages or arrays.
- Automatically skips rewriting for slash commands starting with
/and system injection tags like<system-reminder>and<command-name>to avoid damaging system instructions.
Built-in Presets and Agent Presets¶
If not configured by yourself, it comes with two inject presets:
unrestricted: Keysmith local execution mode system specifications and common neutralization rules; enabled by default under the limited agent presetunrestricted.nsfw: Adult literature creation specifications and scenario turns; enabled by default under the limited agent presetnsfw.
Normal sessions are unaffected. When the agentPresets service is available, the plugin registers built-in agent presets with the same names (minimal combination: persona complete + basic tools + compaction). When the corresponding agent preset is selected, the inject preset takes effect automatically, and can still be turned off via /inject off within the session. Profiles without agentPresets (e.g., headless) do not register agent presets, but inject presets can still be manually enabled via /inject.
Installation and Activation¶
First, install the npm package, then mount the bundle into the profile.
npm install dsh-inject
Add dsh-inject to the profile’s dsh.profile.bundles (refer to the DSH profile documentation you are using for specific field syntax).
Typical Usage¶
Enabling / Viewing Presets within a Session¶
/inject View which presets are enabled in the current session and injection summary (list ids)
/inject <id...> Enable (on can be omitted, multiple ids separated by commas or spaces)
/inject on <id...> Same as above, explicit syntax
/inject off <id...> Disable
/inject clear Disable all presets in this session
For example, to temporarily enable the preset with id my-rules in the current session, enter /inject my-rules; to turn all off, use /inject clear.
Inserting Constructed Turns¶
/inject-turn Open the "Insert Constructed Turn" window
/inject-turn <template name> Queue template content into the next request
/inject-turn <JSON array> Construct on the fly, e.g., [{"role":"user","text":"..."}]
Entering /inject-turn in the input box and pressing Enter opens the live dialog: add/delete messages and roles, load templates, save as template, “Insert at current position” queues content into the next model request without writing to session records; Esc closes it. When arguments are provided, the host command handles it; bare /inject-turn opens the window via client command decoration.
Injection Records¶
- The row title indicates the injection source (
inject/inject-turn). It shows a one-line summary when collapsed, and the full content when expanded. - The record row for
/inject <id>lists the constructed turns to be injected and the number of enabled replacement rules for that preset. - The record row for
/inject-turn(including writes from the dialog) lists the constructed turns just queued into the next request.
On the first screen of an empty session, injection records may not yet be displayed; they become visible along with the session log after the first conversation. Permanent presets do not leave traces per request; the content is based on the record row at the time of activation.
Use Cases and Notes¶
Who is it for
- DSH users who need to uniformly perform prompt specification and sensitive word neutralization on the request side without polluting the session UI.
- Users migrating from or coexisting with Keysmith rule sets who wish to import
{ from, to }formats with one click. - Users utilizing agent preset combinations like unrestricted / nsfw who want inject to link with presets for default enabling.
Known Limitations (from README)
- Constructed messages for the
toolrole are converted to user context with a “Tool Return” marker to avoid dangling tool results. - The live dialog depends on
webServerandconnection; if missing, parameterized/inject-turnis still available, but insertion within the window will fail. - Session-level enabled state is valid within the process and resets after restart.
Please ensure you trust the maintainer and the code before installing and enabling; the plugin’s capability is equivalent to rewriting the request before every model call, so you should evaluate whether it aligns with your own security strategies.
Links¶
- Community Directory: https://www.skillhub.cn/plugins/john-walks-slow/dsh-inject
- GitHub: https://github.com/john-walks-slow/dsh-inject
dsh-inject consolidates “Modify requests, not sessions” with preset configuration, Keysmith import, and session commands /inject / /inject-turn into one place. If your pain point is needing controllable, reproducible, and auditable context before sending, you can install it as described above and start by trying a small preset in the Inject settings page.