AI Agent Hub
Back to plugins
🧩

dsh-write-rule-guard

admin-security Updated 2026.09.04

Run the following command in DeepSeek Harness:

dsh plugin install better-er/dsh-write-rule-guard

Paste the following prompt into your AI chat to install this plugin:

Run dsh plugin install better-er/dsh-write-rule-guard in DeepSeek Harness to install; the source repository is at https://github.com/better-er/dsh-write-rule-guard. Restart DSH web after installation to activate automatically.

About this plugin

In DSH, a model may inject disallowed characters into edit/write payloads, or after being blocked by a content rule fall back to a pwsh command to write the file and bypass the restriction entirely. dsh-write-rule-guard solves exactly this: before any write hits disk, it checks edit/new_string and write/content against your custom regex rules, blocks the call with a configurable error message on first match, and switches pwsh into a disabled state to close the write-it-another-way gap.

The error text is entirely yours to define via the message field, with placeholders such as {file}, {count}, {lines}, and {pattern}; once filled the result is a clean single-line message with no auto-appended details or stack traces. A per-turn state machine tracks edit/write outcomes: any failure (rule block or runtime error) disables pwsh for the rest of the turn; a single successful write immediately re-enables it; turn end always resets to allowed. Rules are injected via the cordis config file—installation ships one default rule matching full-width parentheses, and you can change the pattern to any valid regex or clear the list entirely.

This plugin fits users running code or file-writing tasks in DSH who want a content-level guardrail on written output. It does not replace file permissions or sandboxing; it enforces one specific rule—the written content must not contain certain characters—and uses the pwsh disable as a secondary tripwire against routing around that rule. If you need command-level write protection or a stricter anti-bypass guarantee, the deliberate trade-off of treating one successful write as a compliance signal and then re-opening pwsh may not be sufficient on its own.

Use Cases

  • Block model from writing code containing disallowed characters like full-width parentheses
  • Prevent pwsh fallback after an edit/write call is intercepted by a content rule
  • Customize interception error messages with placeholders for precise feedback

Best For

  • Developers needing content-level write guardrails in DSH
  • Users who want to prevent pwsh-based file-write bypass in agent tasks
  • Engineering teams requiring custom regex rules and tailored error copy