rulemux-dsh
Verifiedrulemux-dsh Β· v0.3.6 Β· MIT Β· Web UI
rulemux rules inside DeepSeek Harness (dsh): reads the rule files rulemux syncs into <workspace>/.dsh/rules and injects them into the session.
Install
dsh plugin add rulemux-dsh Confirm the layer applied with dsh --profile default --dump-config β see the install guide.
Source
Tags
Readme
rulemux-dsh
DeepSeek Harness (dsh) plugin for rulemux.
rulemux syncs the rule files you maintain into each agent's native rules directory. dsh is
plugin-first and does not scan a rules directory on its own, so this plugin is the reading half:
it reads the copies rulemux puts in <workspace>/.dsh/rules/__rulemux__*.md and injects them into
the session once, at the first user turn β the same rules, the same token cost as a host that reads
a rules directory natively.
Install
dsh plugin --profile <name> add rulemux-dsh
That is the whole thing β the plugin is published on npm. Installing straight from git also works (no npm involved), which is handy for testing an unreleased change:
dsh plugin --profile <name> add "github:cq-guojia/rulemux#path:/dsh-plugin"
The host half needs no build: index.mjs is plain ESM. The details-page panel is bundled into
lib/client.js, and that artifact is committed β so a git install still needs no allowBuilds
approval (see βBuildβ below if you change src/client/).
Restart dsh after installing β the plugin mounts on the next start.
What you see in dsh
- Plugin list: an icon and a title, in the language of your UI (English / Chinese).
- Plugin detail page: an informational panel β the config file path
~/.rulemux/config.toml(with a copy button), what you need to edit by hand, a minimal example, and a button that opens the project on GitHub.
It does not save anything. ~/.rulemux/config.toml is the single source of truth and you edit
it in your own editor. dsh's own settings document is not a second home for it: the official config
form can only store values in dsh's document (the active profile's Cordis patch), and a plugin on
the detail page has no session context β it cannot read a file off your disk. So the panel tells you
where the file is and what it looks like, and the editing stays where it always was.
Build (only for the details-page panel)
npm install
npm run build # -> lib/client.js (re-run and commit the artifact after changing src/client/)
npm run typecheck
The flow you get
dsh plugin --profile <p> add "github:cq-guojia/rulemux#path:/dsh-plugin"
# restart dsh β ~/.rulemux/config.toml now exists (see below)
# edit it β add your [[source]] entries
# open ONE session β the rules are injected
No throwaway "chat once so it can create the config" session: readiness starts at load, before any session exists.
At dsh startup: three steps, all or nothing
This package declares no dependencies on purpose: a hard rulemux dependency would make the
whole dsh plugin add fail whenever the registry mirror lags β an install-time failure you cannot
act on. dsh runs no install scripts either, so instead the plugin makes itself ready when it loads,
i.e. when dsh starts, and it does exactly three things. Every one of them must hold; otherwise the
session fails with an error.
- The CLI is there and can do the job.
rulemuxis resolved (a dependency copy if one exists, elsePATH) and must either satisfy version>=0.3.1or demonstrably know thedshagent (rulemux --helplists it). Both halves matter: a version floor is meaningless if a capable CLI looks old β a binary built with plaingo build/go installreports main.go's hardcoded default version whatever code it contains β and a version number alone proves nothing about capability. A CLI that fails both checks is upgraded withpnpm add -g, falling back tonpm install -g, and re-checked afterwards. If it still fails, that is a failure, not a success. - This plugin is loaded. Nothing to check: the fact that this code runs at all is the proof.
- The config exists.
~/.rulemux/config.toml, created withrulemux init --agent dshwhen it is missing. An existing config counts as success and is never overwritten.
Because steps 1 and 3 need no workspace, they run at load; step 2 is the load itself.
Failures are loud and actionable: the error names the step that failed, carries the raw output, and says where to fix it (then restart the session to retry). There is deliberately no "succeeded halfway" notice β a half-ready plugin is useless, and it must not look healthy.
Syncing is separate, and never fails the session
rulemux sync --hook --agent dsh runs once per session β it needs the session's workspace, which
does not exist at load time β exactly as syncing works for every other agent. A non-zero exit is
logged (console.error, which lands in dsh's log) and the session carries on with whatever rule
files are already on disk.
A config with no [[source]] yet lands here too β the CLI exits non-zero, it is logged, and nothing
is injected. That is a normal syncing outcome, not a readiness failure: it has no bearing on the
three steps above.
What it does
- At load (dsh startup) β starts the three-step readiness chain, so
~/.rulemux/config.tomlis there before you need it. Atagent/session-startβ runsrulemux sync --hook --agent dshonce, so the on-disk copies are current. agent/pre-stepβ on the first turn that carries user input, reads.dsh/rules/__rulemux__*.mdand injects them as recalled material. It injects once per session and only re-injects if a later compaction provably dropped the block β never every turn.- It reads only files with rulemux's
__rulemux__prefix, so it coexists with other.dsh/rulesreaders.
Requirements
- Node 18+ (plain ESM) β dsh's own runtime satisfies this.
- Network and permission for a global install, only if
rulemuxis missing or too old. - A rulemux config (
~/.rulemux/config.toml) whose[[source]]entries cover the workspace; it is created for you at dsh startup, then it is yours to fill in.
License
MIT β same as rulemux.