dsh-pr-gate: Deterministic Write Gatekeeping at Write Time

Preface

When running agents in DeepSeek Harness (DSH), common safeguards often focus on “read-back review” or “command interception”: using a second model to re-read the turn, verifying targets based on exit codes, or blocking destructive shell commands. Before merging a PR, many teams also rely on scope policies and residue scanning in CI to block non-compliant diffs. The problem is: during the agent’s write / edit / str_replace_editor operations, if the same deterministic checks aren’t performed at runtime, non-compliant files are already written to disk and can only be discovered during the PR stage.

Below, we introduce the community plugin dsh-pr-gate (maintainer zhengqiuyang). It hooks the scope policies and residue rules used by agent-pr-gate on the CI side into the DSH tool execution chain, rejecting files before writing, scanning after writing, and leaving a JSONL ledger for CI consumption. No LLM is called on the trust path.

What is this

dsh-pr-gate is an admin-security class plugin for DSH. Its directory page is on SkillHub, and the source code is on GitHub. The npm package version is 0.1.0 (MIT).

In one sentence: it performs scope policy + residue scanning on every file write by the agent, moving the gating previously left to PR/CI to the moment of writing.

Core Features

The plugin works in three stages, as described in the README:

Stage Hook Deterministic Behavior
Pre-write tools/pre-execute Scope policy: deny globs always take priority; a non-empty allow means “only these paths are permitted”. Rejected writes do not hit the disk
Post-write tools/post-execute Performs residue scanning on written text (e.g., injection text targeting reviewers, skipped tests, debug markers, etc.). Default residueMode: warn only logs; setting it to block causes the write to fail and provides corrective feedback
Throughout JSONL ledger One line per decision: tool, path, action, sha256 of content, matched pattern, residue type, etc. The agent-pr-gate in CI can consume this file as a session-side record

One set of policies, two enforcement points: The config item policyFile can point to agent-pr-gate.yaml in the repo, aligning in-session enforcement with CI-side allow/deny (policy entries are unioned). You can also forgo a file and simply write inline allow / deny in the plugin configuration.

The glob semantics for Scope and residue rules are vendored and synced from the sibling project agent-pr-gate (use npm run sync during development).

Installation and Activation

Official installation command (from the README, default profile):

dsh plugin --profile default add dsh-pr-gate

The README states: Installed from npm, no build required, and no allowBuilds authorization needed; the repo includes pre-built lib/.

Compatibility (from the source material):

  • DSH: Verified on the 0.2.x line (the source snapshot in the material is 0.2.1-alpha.2); can be installed via dsh plugin add on any profile
  • Node: >= 20 (CI matrix includes Node 20/22/24, Ubuntu and Windows)

After installation, when starting DSH, a prompt like [dsh-pr-gate] active: … will appear in the logs (description of disposable-profile verification in the README Compatibility section).

Typical Configuration

Add the following to the DSH plugin configuration (example from the README):

- id: dsh-pr-gate
  name: dsh-pr-gate
  config:
    tools: [write, edit, str_replace_editor]
    allow: [src/**, docs/**]     # Non-empty = only allow these
    deny: ["**/*.pem", .github/workflows/**]
    policyFile: ""               # Or e.g. agent-pr-gate.yaml
    residueMode: warn            # warn | block
    ledgerPath: .dsh-pr-gate/session.jsonl

tools lists the write-type tools that need gating; ledgerPath specifies the ledger path. If the repo already has agent-pr-gate’s YAML, simply pointing policyFile to it allows sharing the same policy file with CI.

Use Cases and Notes

Who it is for: Teams already using agent-pr-gate (or similar scope + residue rules) in PR or CI, who want to intercept out-of-bound paths or sensitive files before writing in DSH sessions, capture obvious “residue” content after writing, and retain a deterministic ledger for subsequent CI alignment.

Permissions and Security: The plugin runs with the current dsh process permissions and can hook into the write tools specified in the config. Before installing, please read the source code and LICENSE to ensure the policy and ledger paths comply with your repository standards. The community directory SkillHub is an independent site and has no official affiliation with DeepSeek / High-Flyer.

Boundaries: The README explicitly states zero LLM on the trust path; the roadmap includes items like bash write heuristics and ledger to GitHub check-run, but currently, the three-stage capabilities in the README table are the standard. If DSH official or review-type plugins later provide similar deterministic write gating, the maintainer states in the README “Kill criteria” that they may freeze at the last available version.

Conclusion

Through the steps above, you can install dsh-pr-gate in the default profile, align CI policies using allow / deny or policyFile, and choose warn or block to handle residue scanning results. Write decisions will be recorded in the JSONL specified by ledgerPath, facilitating the connection with agent-pr-gate’s PR checks.

  • Directory Page: https://www.skillhub.cn/plugins/zhengqiuyang/dsh-pr-gate
  • GitHub: https://github.com/zhengqiuyang/dsh-pr-gate
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye