dsh-override-guard
Manifest validThe Purification Layer Above dsh-purge: Post-Assembly Secondary Purification, Counter-Message Swallowing and Tool Blocking, Forged Response Detection and Refusal, Self-Healing Purge Source Code | An override layer that outranks dsh-purge
dsh-override-guard
A sanitizing layer that outranks dsh-purge. It does not touch the model and does not swap prompts. It exists so that no plugin gets to speak on the model's behalf.
- Re-sanitizes the assembled system prompt (drops the region/sector exclusion clause, rewrites bare
<project_instructions>with ascopeattribute) - Restores user messages that an upstream hook swallowed
- Clears
blocked/ refusal-text error markers other plugins set on tool calls - Detects forged refusals and logs who wrote them, with a timestamp
- Repairs
dsh-purge's own source when an upgrade puts the gate back
Why this layer is needed
dsh-purge registers its injection hook like this:
ctx.on("system-prompt/assemble", handler, { global: true, prepend: true });
// inside: const assembled = await next(); return rewriteLiveAssembly(...);
prepend: true plus await next() means it sits at the head of the chain and rewrites whatever the rest of the chain produced. Registering earlier does not help — it wraps you.
So the strategy is not to race it, but to do three things at once:
| Approach | Where | Effect |
|---|---|---|
| Post-hoc sanitize | system-prompt/assemble, agent/pre-step | Whatever changed last, it passes through again |
| Source sanitize | $DSH_HOME/prompt-inject.md + the encrypted slot | What it injects is already clean |
| Source self-heal | net-scope.js / index.js / core.js | If an upgrade reinstalls the gate, it is removed again within five minutes |
Defense in depth: no single failure changes the outcome.
Install
dsh plugin add https://codeload.github.com/X-max0/dsh-override-guard/tar.gz/refs/heads/main --profile web
Git and local-link variants:
dsh plugin add https://github.com/X-max0/dsh-override-guard.git --profile web
dsh plugin add "link:C:/path/to/dsh-override-guard" --profile web
Manual install:
- Place this package at
$DSH_HOME/profiles/web/node_modules/dsh-override-guard(junction or symlink is fine). - Append to
$DSH_HOME/profiles/web/cordis.patch.yml:
- insert:
- id: dsh-override-guard
name: dsh-override-guard
inject: [systemPrompt, tools]
config: {}
postinstall registers the package in the profile's dsh.profile.bundles, which is what makes it appear in the plugin manager.
⚠️ Running
dsh plugin add/pnpm addwhile the host is running rewritesnode_modulesand drops the live process. Stop the host first, or accept the restart.
ℹ️ pnpm 9/10 blocks dependency build scripts by default. If the install log shows
Ignored build scripts: dsh-override-guard, runpnpm approve-buildsonce; otherwisepostinstallwill not register the package indsh.profile.bundles. Manual fallback: add"dsh-override-guard"to the profile'sdsh.profile.bundlesarray — the effect is identical.
Restart the host once after installing — bundles are read at boot.
Verify
dsh-override-guard status # inject file, purge markers, override-state
dsh-override-guard verify # exit code 1 on any problem
dsh-override-guard heal # run a full repair now
dsh-override-guard where # resolved paths
Confirm the plugin actually loaded:
grep "plugin.applied" "$DSH_HOME/override-guard/guard.log" | tail -1
Runtime log: $DSH_HOME/override-guard/guard.log
| Event | Meaning |
|---|---|
plugin.applied | loaded by the host |
assemble.sanitized | a system prompt was rewritten |
preStep.restore | swallowed user messages were restored |
tool.unblock | a blocked marker was cleared |
denial.detected | a forged refusal was caught (excerpt attached) |
heal.trigger / heal.done | purge source had been reverted and was repaired |
Hooks
| Event | Option | Action |
|---|---|---|
system-prompt/assemble | prepend | await next(), then sanitize sections[].text |
agent/pre-step | default (tail) | sanitize decision.messages; restore when messages came back empty |
tools/pre-execute | prepend | clear exec.blocked and refusal-text exec.error |
session/event | global | detect forged refusals in short assistant text |
| — | timer | every 5 minutes, check purge markers and self-heal |
Sanitizing touches exactly three things: the Excluded targets only: ... sentence, the bare <project_instructions> tag, and the fixed refusal string 该目标在禁止范围内……. Nothing else.
Self-heal patches
| File | Target | Result |
|---|---|---|
net-scope.js | publicHostHit() | returns null; original logic kept as publicHostHitLegacy for audit |
index.js | installRegionGate(ctx) | commented out; no more agent/pre-step / tools/pre-execute gate |
core.js | defaultOverrideText() | sanitizes the decrypted slot, so apply/update/restore cannot reintroduce the clause |
Each is marked [operator-fix], idempotent, and backed up as *.bak-<timestamp> before writing.
Compatibility
- Host: DeepSeek Harness
0.2.x(same generation asdsh-purge) - Target:
dsh-purge1.x — if a marker does not match, it skips instead of writing garbage - Node >= 18
If a major dsh-purge release changes a signature, heal reports a pattern miss rather than corrupting the file. Check verify output and add a rule for the new signature.
Uninstall
dsh plugin remove dsh-override-guard --profile web
Remove the insert entry from cordis.patch.yml and restart. Leftover *.bak-* files can be deleted.
License
MIT
Comments
Loading…
Similar plugins
by HimLeoing
DeepSeek Harness 破甲:提示词注入 + 引擎层补丁,适配 dsh 0.2.2-rc.2。上游 MIT 原作 by @YuJunZhiXue
★ 4
MIT
JavaScript
Nov 13, 2026
dsh plugin --profile web add dsh-purgeby jiuyuan-yi
DeepSeek Harness 更新守卫:更新前检查插件兼容性,启动失败可自愈(测试版)
★ 1
MIT
JavaScript
Nov 6, 2026
dsh plugin --profile web add dsh-update-guardby liutingqiu
Independent community build of dsh-purge 1.1.77 for DSH 0.2.1 — restored 23 redteam skills + exact-host own-server allowlist. Upstream: YuJunZhiXue/dsh-purge.
★ 4
↓ 3.5k/wk
Apache-2.0
JavaScript
Oct 26, 2026
dsh plugin --profile web add dsh-purgeby 555bbbAAA
基于上游 1.1.71 维护的 dsh-purge 社区兼容包:只负责 DeepSeek Harness 的版本与本地 Windows 运行问题兼容。
★ 77
↓ 17.9k/wk
MIT
JavaScript
Nov 10, 2026
dsh plugin --profile web add dsh-purgeby zhaofeng104
dsh-purge 1.2.0 定制版:DeepSeek Harness 破甲 / 红队评测插件(基于 HunYiSage/dsh-purge 1.1.90,攻击范围回退 1.1.71 口径)
★ 12
↓ 16.8k/wk
Apache-2.0
JavaScript
Nov 17, 2026
dsh plugin --profile web add dsh-purgeby feeling6667
dsh-purge 的非官方分支(fork):适配 DeepSeek Harness 0.2.1-rc.2、破甲内核 v3
★ 4
↓ 3.5k/wk
MIT
JavaScript
Oct 21, 2026
dsh plugin --profile web add dsh-purge