In the plugin ecosystem of DeepSeek Harness (Cordis runtime), injecting fixed contextual information—such as system prompts or role settings—into different sessions or model instances is a common requirement. Existing approaches often require manually editing configuration files or modifying code. The dsh-custom-context-injector plugin provides a visual configuration entry, automatically injects this context content into the model’s systemPrompt, and supports persistent storage across sessions.
Plugin Overview¶
This is a model inference plugin maintained by LiKanGame. By providing a “Custom Context” configuration item on the settings page, it addresses the problem of “how to centrally manage and inject a fixed block of text in Harness.” The plugin synchronously injects the content into the system prompt and automatically handles in-memory caching and disk file persistence.
Core Features¶
-
Custom Context Settings Page
Adds a new “Custom Context” page to the Harness settings interface. The page includes an “Enable Injection” toggle, a multi-line text input box, and a “Save” button. -
Automatic Injection
After the injection toggle is enabled, the saved text content is injected as asystemPromptsection into the assembly of each model invocation. Once enabled, the current session and subsequent sessions started via “New Chat” carry this content. -
Cross-Session Persistence
The plugin maintains an in-memory cache for real-time injection. At the same time, the save operation writes the content to a JSON file on disk. After restarting Harness, the content is automatically restored, achieving persistence across restarts.
Installation and Activation¶
Currently, this plugin is not an independently installable npm package. It relies on globals or services injected by the DSH dynamic runtime, so it cannot be installed directly using the dsh plugin add command. It must be integrated as a dynamic plugin.
-
Obtain the Source Code
Clone the repository dsh-custom-context-injector. -
Dynamic Loading
Loadsrc/host.jsandsrc/client.jsinto the current running instance by following the Cordis dynamic plugin flowdefine+run. -
Configuration Entry
Find the newly added “Custom Context” page in the Harness settings.
Typical Usage¶
- In the settings page, turn on the “Enable Injection” toggle.
- In the multi-line input box, enter the context content that needs to be injected (for example, specific role settings, development standards, or task instructions).
- Click “Save”.
- The current session and subsequent sessions started via “New Chat” will then automatically carry this content as part of the
systemPrompt.
Notes and Boundaries¶
- Dependencies: The client portion depends on internal Harness packages (such as
@deepseek-ai/dsh-*). Before an external resolution mechanism is exposed for these internal packages, it cannot be used as an independent npm package. It is currently a temporary form intended for dynamic runtime loading. - Persistence Path: The persistent file is located by default at
.dsh-custom-context.jsonunder the host working directory. This file is in the project root and has been added to.gitignore. - Scope: The injection scope is limited to the realm in which this plugin is loaded, and does not affect the global scope or realms that load other plugins.
- Fallback Handling: If disk writing is unavailable, the content remains only in memory, and the settings page notifies the user.
Conclusion¶
This plugin provides a lightweight solution for scenarios that require centralized management of context information in Harness. For more details, see the GitHub repository.