Keeps exploratory questions read-only and blocks unsolicited file creation without busting Prompt Cache.
Install
# from a prebuilt release tarball
dsh plugin --profile web add -w "https://github.com/skyskyskyl/dsh-question-shield/releases/download/v0.1.0/dsh-question-shield-0.1.0.tgz"
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:skyskyskyl/dsh-question-shield
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
English | 简体中文
Stop your coding agent from refactoring your repo when you're just thinking out loud — and stop it from spawning random helper files you never asked for.
Before vs. After
1. Casual Question -> Accidental Refactor
# Before
you> Would it be better to make handleRequest() async?
agent> Great idea! Making it async right now...
[edit] src/server.ts (+48 -31)
[edit] src/router.ts (+22 -14)
[edit] tests/server.test.ts (+39 -19)
# You only wanted to discuss trade-offs. Now you're running `git checkout .`.
# After (with dsh-question-shield)
you> Would it be better to make handleRequest() async?
agent> Trade-offs to consider before changing handleRequest():
- Pros: non-blocking I/O under concurrent load, cleaner error propagation.
- Cons: viral async coloring across 3 callers in router.ts.
Want me to go ahead and refactor it?
# Zero files touched until you say the word.
2. Bug Fix -> Unsolicited File Sprawl
# Before
you> Fix the timeout bug in src/client.ts
agent> Fixed! Also created a few helper files for you:
[edit] src/client.ts (+4 -2)
[write] scripts/verify_timeout_tmp.mjs (NEW)
[write] TIMEOUT_FIX_NOTES.md (NEW)
# After
you> Fix the timeout bug in src/client.ts
agent>
[edit] src/client.ts (+4 -2)
[blocked] write scripts/verify_timeout_tmp.mjs
[Question Shield] Blocked unsolicited file creation: "scripts/verify_timeout_tmp.mjs".
The user did not ask to create a new file. Please edit existing files instead, or ask first.
Why it happens
In Speech Act Theory, "Would it be better to refactor this?" and "是不是改成异步会更好?" are Information-seeking / Polar Questions, not Directives. Coding agents trained to be eagerly helpful often collapse that distinction and treat every hypothetical question as an implicit order to start editing files.
dsh-question-shield restores that boundary locally using bilingual regex heuristics, a per-turn read-only lock, and a pre-execution file-creation guard. No extra LLM calls, and no system-prompt edits that bust your Prompt Cache.
(Never thought my linguistics knowledge would actually come in handy here lmao.)
Installation
Install from GitHub into a DSH profile
dsh plugin --profile default add github:skyskyskyl/dsh-question-shield
Note (pnpm >= 10): Git installs run
prepareto compile TypeScript. If pnpm blocks the build script on first install, allowdsh-question-shieldin your profile'spnpm-workspace.yaml(allowBuilds: { dsh-question-shield: true }) and re-rundsh plugin add.
Or load locally via --patch
git clone https://github.com/skyskyskyl/dsh-question-shield.git
cd dsh-question-shield
pnpm install && pnpm run build
Create a patch file question-shield.patch.yml:
- insert:
- id: question-shield
name: /absolute/path/to/dsh-question-shield/lib/index.js
Run DeepSeek Harness with the overlay:
dsh --patch ./question-shield.patch.yml
Configuration
All options are optional with sensible defaults. Override them in your profile's cordis.patch.yml:
- insert:
- id: question-shield
name: dsh-question-shield
config:
enableQuestionShield: true
strictReadOnlyOnQuestion: true
guardUnsolicitedFileCreate: true
allowCreatePatterns:
- "**/*.test.ts"
- "tmp/**"
customQuestionPatterns:
- "\\bbrainstorm\\b"
customDirectivePatterns:
- "\\bship it\\b"
| Option | Type | Default | Description |
|---|---|---|---|
enableQuestionShield |
boolean |
true |
Detect exploratory questions (EN/ZH) and inject a read-only reminder. |
strictReadOnlyOnQuestion |
boolean |
true |
Hard-block file mutation tools during a detected question turn. |
guardUnsolicitedFileCreate |
boolean |
true |
Block creating non-existent files unless explicitly requested or named by the user. |
allowCreatePatterns |
string[] |
[] |
Glob whitelist (*, **, ?) for paths allowed to be created freely. |
customQuestionPatterns |
string[] |
[] |
Extra regex patterns (case-insensitive) treated as exploratory question cues. |
customDirectivePatterns |
string[] |
[] |
Extra regex patterns (case-insensitive) that override question detection as directives. |
How it works
agent/pre-stephook:- Inspects incoming
source.kind === 'user'messages in Chinese, English, or mixed text. - Distinguishes exploratory questions (
是不是...,Would it be better...,?/?) from polite commands (能不能现在帮我把...改成...?,Can you please refactor...). - Appends a short
[Question Shield]notice at the end of the current turn'smessageswithout touching the system prompt prefix, so Prompt Cache stays warm. - Tracks per-agent turn state in a
WeakMap<Agent, TurnState>so follow-up tool steps stay guarded and new directive turns immediately unlock.
- Inspects incoming
tools/pre-executehook:- Intercepts built-in DSH file mutation tools (
write,edit,apply_patch, and non-viewstr_replace_editorcommands). - During a question turn with
strictReadOnlyOnQuestion: true, denies mutations and tells the model to explain trade-offs first. - During normal turns with
guardUnsolicitedFileCreate: true, checks if the target path does not yet exist on disk; unless the user asked to create a file, directly named the file, or the path matchesallowCreatePatterns, the creation is denied.
- Intercepts built-in DSH file mutation tools (
Development
pnpm install
pnpm run typecheck
pnpm run build
pnpm test
License
Links
More in this category
kenryu42/cc-safety-net★ 2148
Pre-execution guard that blocks destructive Git and filesystem commands and access to secrets such as SSH keys and .env files before a tool call runs.
ADWMC/helm-d#helmd★ 1630
Security-analysis plugin for DeepSeek Harness: 33 tools spanning six security domains, evidence/reporting and toolbox, plus the case lifecycle, routing and tool ledger; a session-bound case workflow with an evidence chain, E-id validation and reproducible findings; 362 on-demand references; three hot-swappable persona profiles; and a four-tab workbench (armor / case / intercept / about) with case-state recovery after context compaction.
SeaOf0/dsh-redteam-model★ 943
Authorized-security DSH collection: nine work modes (redteam coordinator, pentest, code audit, binary analysis, attack-defense, AV evasion, incident response, cloud security, CTF solving) and fifteen runtime plugins, managed from a settings page with one-click deploy, install, update and uninstall.
toby-bridges/api-relay-audit★ 938
Runs local security audits of AI API relays and LLM proxies from DeepSeek Harness, producing Markdown reports for prompt injection, model substitution signals, tool-call rewriting, error leakage, stream integrity, and profile-gated Web3 risks.
howmp/dsh-pentest★ 624
Authorized pentest mode for DeepSeek Harness — exploration chain, assets and findings with a Web view.
Jueze-2019/dsh-redteam-mode#packages/redteam-bundle★ 318
Red-team engagement mode: send one target organization name; a planner session runs five execution roles (recon, asset triage, vulnerability discovery, exploitation, internal pivot) with configurable concurrency; preflight checks skills/resources; scoring uses four stages (recon, internet, boundary, internal) with server-side caps and privilege-wins dedup; findings stay in a local SQLite fact base. The persistent right-side console has nine pages and includes asset mapping, agents, sessions/tunnels, findings, score targets, reports, POC knowledge base and skill library. v0.15.2 adds automatic HTTP evidence/action records, batch ingest, scope check, tunnel pivot probe, data proof, cleanup ledger and T0-T3 asset admission to prevent scope drift. 59 redteam_* tools; 38 bundled skills.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.