DeepSeek Harness plugin

dsh-stream-rules

Inject steering rules when needed without wasting system context.

Jump to install

Source facts

Repository
jiesou/dsh-stream-rules
Latest update
Aug 21, 2026
Category
Security & Permissions
GitHub stars
5
Format
plugin
Catalog evidence
Upstream dsh.bundle evidence
Evidence path
package.json#dsh.bundle
Checked against
0.1.0-rc.8
Upstream check date
2026-08-20

This evidence comes from the upstream catalog. This site has not installed, run, or security-reviewed the plugin.

Install

Start with a prompt that asks an agent to review the GitHub repository and source. Switch to the command if you want to install it yourself.

Copy this prompt into DSH, Codex, or another agent and ask it to review the GitHub repository and source first.

Do not install or run any commands yet. Read this plugin's GitHub repository, README, and relevant source code. Then answer the questions below clearly and directly so I can decide whether it fits my needs:

1. What is this plugin, and what problem does it solve?
2. Who is it for, and what are its typical use cases?
3. How is it used after installation? Include one minimal example.
4. What known limitations or privacy, security, compatibility, or maintenance risks does it have?
5. Give a clear recommendation: recommend, conditionally recommend, or do not recommend, with reasons.

Distinguish statements documented by the repository, inferences from source code, and unknowns. If evidence is insufficient, say so explicitly. Do not guess or simply repeat the README.

GitHub: https://github.com/jiesou/dsh-stream-rules
Plugin: dsh-stream-rules
Author: jiesou

Check the source files

Read the README and other files from this plugin directory before installing.

File explorer4 files
README.mdSource · read only
README language

dsh-stream-rules

简体中文

Inject rules when needed, without wasting context.

<img height="500" alt="-6336866371853030306_121" src="https://github.com/user-attachments/assets/09a5b140-bfcc-4401-895d-af9280b44709" />

You can write custom streaming rules for the agent.

These rules are injected only as a steering notice after a pattern match, then agent retry from the same point. This allows you to control the boundaries of agent behavior, without wasting context.

Port of my jiesou/opencode-stream-rules to DSH. Similar to oh-my-pi's "Time-traveling stream rules", but with a very simple and compact code implementation.

How it works

A rule fires on a tool call (tool name + serialized arguments) when its match returns true:

  • default — injects a SYSTEM NOTICE steering message into the agent via agent.inject() (DSH's non-waking "queue model-facing context for the next pre-step"). The agent retries from the same point, now knowing the rule.
  • reject: true — denies the FIRST tool call ({ kind: 'deny' }); later attempts are allowed. Steering without over-restricting, e.g. letting pip install through when it's already in a container.

Each rule fires at most once per session (per agent), mirroring the original's notified dedup.

Install

From npm (prebuilt, recommended):

dsh plugin --profile <name> add @jiesou/dsh-stream-rules

Or from GitHub (runs prepare to build on install):

dsh plugin --profile <name> add github:jiesou/dsh-stream-rules

Or add the row to your profile's cordis.patch.yml:

- id: stream-rules
  name: '@jiesou/dsh-stream-rules'

After installing

You need to write the rules in your own .js file. This plugin won't work by default until you edit the rules.

1. Locate the plugin's path:

$DSH_HOME/profiles/<name>/node_modules/@jiesou/dsh-stream-rules

where $DSH_HOME defaults to ~/.dsh.

2. Write rules:

mv rules/rules.js.example rules/rules.local.js
  • Files starting with _ are skipped.
  • To point at a different rules directory: config.rules:
- id: stream-rules
  name: '@jiesou/dsh-stream-rules'
  config:
    rules: /path/to/your/rules
  • A rule with reject: true will only be rejected on the first toolcall; subsequent attempts by the agent will be allowed. This provides steering while avoiding overly restricting the model (e.g., allowing pip install if it's already in a container).

Writing rules

// rules/rules.local.js
export default [
  {
    match: (v) =>
      v.includes('pip') &&
      v.includes('install') &&
      !v.includes('uv pip') &&
      !v.includes('uvx'),
    reject: true,
    prompt: 'Use `uvx` or `uv venv` + `uv pip` instead of `pip install` directly',
  },
  {
    match: (v) => v.includes('curl') && v.includes('api.github.com'),
    prompt: 'Prefer using `gh` cli over `curl https://api.github.com/...`. gh offers more requests limits.',
  },
  {
    match: (v) => v.includes('pdf'),
    prompt: 'Use the `markitdown` skill to read PDF files.',
  },
  // add your rules here
]
fieldrequireddescription
match(v: string) => boolean; every tool call is flattened to a string and matched
promptThe prompt for steering
rejectIf true, prevent the tool call first, instead of just steering

Implementation notes

  • A single src/index.ts (~60 lines).
  • Uses DSH's tools/pre-execute waterfall (deny) and agent.inject() (steering), the documented native extension points. No core changes, no monkey-patching.