Introduction¶
DeepSeek Harness (DSH) adopts a “everything is a plugin” architecture. When developing and debugging agents, you often need to temporarily inject instructions mid-turn. Existing approaches either modify the system prompt (which breaks caching and is hard to audit) or rely on external scripts (with high integration costs). The dsh-prompt-inject plugin achieves zero-intrusion injection by appending a plugin user message at agent/pre-step, and comes with a draggable management overlay for more intuitive operation.
Plugin Overview¶
dsh-prompt-inject is a DSH prompt injection plugin maintained by TNTChinaAAA. It provides a session header entry point and a draggable management overlay, supporting one-shot injection, unconditional inject-on-send (no disk persistence), and conditional per-step automatic injection—all without modifying the system prompt.
Core Features¶
Never Modifies the System Prompt¶
Injection is performed by appending a plugin user message at agent/pre-step, making it zero-intrusion to conversation logs, fully auditable, and non-destructive to prompt caching.
One-Shot Injection & Save¶
There are two buttons to the right of the input box:
- Send: One-shot unconditional injection into the current session (effective on the next model call). Not saved, not added to the list.
- Save: Persisted to disk as an entry and added to the list. Not injected.
Queue items created via Send carry force: true; when consumed at agent/pre-step, the window check is skipped. Regular Inject still uses the window check (skipped if already within the window).
Manual & Conditional Injection¶
- Manual injection: Click Inject on an entry to enqueue it. It takes effect before the next model step in that session (one-shot, 10-minute TTL, repeated clicks overwrite the queue entry).
- Conditional injection: Enable the checkbox to expand the condition panel.
| Condition | Trigger Timing |
|---|---|
| Turn start | First model step after the user message |
| After thinking | Model reasoning ends (reasoning block closed or first text output) |
| After tool call | After the selected tool (glob / grep / pwsh / web_search / web_fetch) completes execution |
Window Check & Forced Injection¶
When “Forced Injection” is off, the sole criterion is “whether this prompt is still within the model’s current context window”—it is only backfilled once it slides out. When “Forced Injection” is on, injection fires immediately upon condition match.
Session Scope & Data Persistence¶
- Per-step / forced injection config: Purely in-memory, isolated per session; all defaults to off after DSH restart or a new session.
- Prompt body / pinning: Persisted to
$DSH_HOME/dsh-prompt-inject/prompts.json. - Injection queue: In-memory at runtime, 10-minute TTL, cleared upon consumption.
Draggable Overlay & Multi-Session Follow¶
- Hold the title bar to drag; opens centered by default, double-click the title bar to re-center; iframe pointer events are automatically disabled during dragging.
- When the frontend switches sessions, a
BroadcastChannelbroadcast is sent so the management page inside the overlay follows the current session in real time.
Official Look & Feel¶
- The entry button is a byte-for-byte replica of the official
IconContextInjectionOutline16. - The management page uses
--dsw-alias-*design tokens, with light/dark themes following DSH’s appearance settings.
Installation & Activation¶
Option 1: Local Link (Development)¶
git clone <repo-url>
cd dsh-prompt-inject
npm install
npm run build # produces lib/
dsh plugin add --profile web link:X:/path/to/dsh-prompt-inject
Or manually declare it in the profile’s package.json:
{
"dependencies": {
"dsh-prompt-inject": "link:X:/path/to/dsh-prompt-inject"
},
"dsh": {
"profile": {
"bundles": [
"dsh-prompt-inject"
]
}
}
}
With the local approach, after modifying src/ you must re-run npm run build and restart DSH.
Option 2: Install from npm (After Publication)¶
dsh plugin add --profile web dsh-prompt-inject
The CLI automatically registers the plugin into dsh.profile.bundles based on the package’s cordis.patch.yml.
Option 3: pnpm add Manual Fallback¶
cd <DSH_HOME>/profiles/web
pnpm add dsh-prompt-inject
Then add "dsh-prompt-inject" to the profile package.json’s dsh.profile.bundles and restart to activate.
Typical Usage¶
- Open any session and click “Inject Prompt” in the session header toolbar to open the management overlay (auto-bound to the current session, draggable).
- In the top input box, after writing your content:
- Click Send: One-shot unconditional injection into the current session (effective on the next model call); not saved, not added to the list.
- Click Save: Persisted to disk as an entry and added to the list; not injected. - Entry cards support: Pin / Inject / Edit / Delete.
- Inject: One-shot injection; the prompt is backfilled only if it is not already in the current context window.
- Conditional injection: Enable the checkbox to expand the condition panel.
- Forced Injection: On = inject immediately on condition match; Off = inject only when the prompt has slid out of the window (recommended off for daily use).
Injection Mechanism Overview¶
Condition match / Manual injection / Send (force) → Enqueue (10-min TTL, overwrite) → agent/pre-step (before the next model step) merges manual queue + per-step queue → Window check: is the original prompt text already in the current request’s messages? → Not in window (or force / forced injection) → Append one plugin user message → Injected only once; turn ends → Discard any unconsumed per-step queue for this turn.
HTTP API¶
The management page communicates with the host via the following routes (same-origin, prefix /plugins/dsh-prompt-inject):
| Method | Path | Purpose |
|---|---|---|
| GET | /prompts?sessionId= |
List prompts (with per-step config for that session) |
| POST | /prompts |
Create a new prompt entry (list only) |
| PUT | /prompts/{id} |
Update body / pin / per-step config |
| DELETE | /prompts/{id} |
Delete and clean up all session configs for that id |
| POST | /inject |
Enqueue an existing prompt for the next model call |
| POST | /send |
One-shot unconditional injection (Send button; in-memory queue only, no disk persistence, no entry created) |
| GET | /page |
Management page HTML |
| GET | /theme |
Read DSH appearance preference (light / dark / system) |
Use Cases & Notes¶
- Ideal for scenarios requiring temporary instruction insertion mid-conversation, A/B testing, or prompt strategy debugging.
- The plugin runs with the current DSH process’s permissions. Review the source code and license before installing.
- Conditional and forced injection configs are session-scoped, in-memory state; they default to off after DSH restart or a new session.
- Conditional injection mode may have a one-to-two-step delay; for precise next-step injection, use Inject or Send directly.
Summary¶
dsh-prompt-inject achieves zero-intrusion prompt injection by appending a plugin user message at agent/pre-step, and is complemented by a draggable management overlay and conditional injection capabilities. It is well-suited for DSH developers who need to inject prompts on demand mid-turn.
- Directory page: https://www.skillhub.cn/plugins/TNTChinaAAA/dsh-prompt-inject
- GitHub: https://github.com/TNTChinaAAA/dsh-prompt-inject