jiesou/dsh-stream-rules

Pattern matching automatically injects steering rules without occupying system context - Inject rules when needed, without wasting context

Injects steering rules into the agent only when a pattern matches — without wasting context. A rule fires on a tool call (tool name + serialized arguments) when its match returns true: the default action injects a SYSTEM NOTICE steering message via agent.inject(), and the agent retries from the same point now knowing the rule; reject:true denies only the FIRST tool call (later attempts allowed). Each rule fires at most once per session. Port of the author's opencode-stream-rules, with a very simple and compact code implementation. Won't work by default — you write the rules in your own rules.js file.

Coding & Development ★ 4 updated 2026-09-10 ✅ runtime-tested
View on GitHub ↗

Install

dsh plugin --profile web add @jiesou/dsh-stream-rules

npm package @jiesou/dsh-stream-rules 0.1.7 (registry-verified 2026-08-26): dsh plugin --profile web add @jiesou/dsh-stream-rules. Or from GitHub (runs prepare to build on install): dsh plugin --profile web add github:jiesou/dsh-stream-rules. Or add - id: stream-rules, name: '@jiesou/dsh-stream-rules' to cordis.patch.yml. After install you must write rules: copy rules/rules.js.example to rules/rules.local.js.

Compatibility

DeepSeek Harness profiles (npm prebuilt recommended). Injections use agent.inject() — DSH's non-waking 'queue model-facing context for the next pre-step'.

Details

Recent updates

v0.1.x: pattern-matched streaming rules; SYSTEM NOTICE injection; first-call reject; once-per-session dedup; custom rules directory via config.rules.

FAQ

Does it work out of the box?
No — you must write rules in rules/rules.local.js (copy the example first); files starting with _ are skipped.
What does reject: true do?
It denies the first matching tool call; later attempts are allowed — steering without over-restricting (e.g. letting pip install through inside a container).
How is context saved?
Rules inject a short steering notice only after a match, then the agent retries from the same point — no wasted context.

Alternatives

Drifter-yh/dsh-tool-policy · timeance/dsh-approve-for-me · Jiao-XXX/dsh-auto-approve

More plugins in Coding & Development

Browse more in Coding & Development

Guides for Coding & Development plugins