bvcvb/dsh-baize-rules 预览 preview

bvcvb/dsh-baize-rules

Plugin插件 Native原生 ⭐ 3 MIT Sessions & Context会话与上下文

DeepSeek Harness (DSH) plugin — inject durable user-set session/global must-do / must-not requirements into the model at conversation start (Baize).

Project Overview项目介绍

dsh-baize-rules (Baize) is a plugin built specifically for the @deepseek-ai/dsh harness, named after the mythical beast Baize that "understands the nature of all creatures." At the start of every conversation it injects the user's plain-text, durable "must-do / must-not" rules into the model request as a persistent user/message, wrapped in a <system-reminder> frame and tagged with source.kind='plugin' plus plugin='baize-rules'. The rule bodies carry no must / mustNot markers — the body language itself decides whether something is required or forbidden — and if no rules are active (or the byte budget cuts all of them) the plugin returns undefined and never emits an empty reminder shell. It installs through the dsh package, registers the /baize-rules slash command, mounts an HTTP API at /baize-rules.api, and exposes a web panel.

The plugin supports three scopes — global (all sessions), session (the current session) and project (the session's working directory) — all of which ultimately reach the model; render precedence is project > session > global, and tighter byte budgets keep the more specific rules first. State is persisted under $DSH_HOME (default ~/.dsh), tolerant reads turn a broken or hand-edited file into an empty scope plus a problems warning instead of failing the conversation, and every write carries the file version it read so concurrent edits are refused with a retry hint rather than silently overwritten. Both the command and the panel share the same store, deduplicate by SHA-1 of the rendered text, republish the snapshot after startup/resume/clear/compact or once it is refreshAfterSteps steps old (default 20), escape literal </system-reminder> in user bodies, and offer tag filtering plus a JSON exportable/importable template library whose application produces a content copy rather than a live link.

For development the repo is a pnpm + TypeScript project whose fast feedback loop is pnpm dev:render (sub-second, without touching dsh); other scripts cover pnpm test, pnpm test:watch, pnpm test:client, pnpm build, pnpm typecheck and pnpm check:exports, with sources split across src/rules.ts, src/core.ts, src/store.ts, src/command.ts, src/index.ts, src/api.ts, src/invariant.ts and a cordis.patch.yml mount. License is MIT and dependencies are Node.js with pnpm. First-run caveat: the CI publish job in .github/workflows/ci.yml requires an NPM_TOKEN secret that is not configured, so every v* tag fails with npm error code ENEEDAUTH (verified on v0.1.3–v0.1.5); the version that actually ships is the one you push locally with npm publish --access public after building, typechecking and testing.

dsh-baize-rules(白泽)是面向 @deepseek-ai/dsh 的插件,以白泽命名寓意通晓万物之性。它在每次会话开始时把用户预先设定、纯文本写成的"必须做/不可做"规则,封装进 <system-reminder> 框架中,作为带 source.kind='plugin' 标识的持久 user/message 注入到模型请求里。规则不依赖 must/mustNot 标记,由正文语言本身表达,且通过 dsh 包安装后挂载为插件并提供 /baize-rules 命令与 Web 面板。

插件支持 global(跨全部会话)、session(当前会话)与 project(会话工作目录)三级作用域,所有规则都最终抵达模型;渲染顺序为 project > session > global,字节预算紧张时优先保留更具体的规则。文件持久化在 $DSH_HOME(默认 ~/.dsh),损坏文件仅降级该作用域并写入 problems 警告,不阻断会话。面板与命令共享同一核心,并提供 SHA-1 去重、refreshAfterSteps 重新发布、标签筛选、模板库 JSON 导入导出以及基于文件版本的冲突安全写入。

运行依赖 Node.js 与 pnpm,工作流脚本包括 pnpm dev:render、pnpm test、pnpm build 与 pnpm test:client 等;/baize-rules 命令在前端面板与核心之间复用同一存储。许可为 MIT,但 .github/workflows/ci.yml 中的 NPM_TOKEN 尚未配置,带 v* 标签的发布任务会因 ENEEDAUTH 失败,实际发布需本地 npm publish --access public。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 3 stars - very few users, little community feedback星标只有 3,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add dsh-baize-rules@0.2.4

把 bvcvb/dsh-baize-rules 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-baize-rules

English | 简体中文 — 中文说明见 README.zh.md。

Listed on dsh-plugin.org npm version license

dsh-baize-rules (Baize) is a dsh plugin that injects user-set, durable "must-do / must-not" requirements — plain-text rules — into the model at conversation start as a sourced user/message.

The name comes from Baize (白泽) — a mythical beast said to "understand the nature of all creatures, know the names of all things, and comprehend the principles of everything." It carries the behavioral baseline that the user sets for the model.

The rules panel in the dsh web UI — the 规则 / 模板 panes, scope tabs (conversation / project / global), tag-chip filtering, per-row enable / save-as-template actions, and the active rules listed

  • Rules are plain text with no must/mustNot markers — whether something is "must-do" or "must-not" is expressed by the language of the body itself (e.g. Write comments in Chinese. = must, Do not delete the tests. = must-not).
  • Injection happens at the start of a conversation: the currently active rules are injected into the model request as a persistent user/message, wrapped in a <system-reminder> frame, with source.kind='plugin' and plugin='baize-rules'.
  • No rules → no injection; if the byte budget shrinks such that all rules are cut, it returns undefined and never injects an empty reminder shell.

Features

Feature Description
Three scopes, all injected global (all sessions) / session (current session) / project (the session's working directory — this directory only): all three reach the model
Persistence Everything is written to $DSH_HOME (default ~/.dsh); survives across sessions and restarts
Specificity wins Render order project > session > global; when the byte budget is tight, the more specific rules are preserved first
A corrupt file never breaks a step Rule files are read tolerantly: a broken or hand-edited file degrades that scope to empty and surfaces a problems warning, instead of failing the conversation
Deduplication Suppresses duplicate injection by SHA-1 digest of the rendered text; optional injectAtEveryStep forces a refresh on every step
Stays present in long threads The snapshot is republished when the text changes, after a session lifecycle change (startup / resume / clear / compact), and once the last copy is refreshAfterSteps steps old (default 20) — so the rules are never left behind only at the top of a long conversation
Escape protection Literal </system-reminder> in rule bodies is escaped so user text can't close the plugin's frame
Command + API share the same source The /baize-rules command and the front-end panel use the same store/core, so there is always a single source of truth
Tags Rules can carry free-text tags (flow, #frontend) that the panel filters by. Panel-only by default — tags cost no model-context budget (injectTags opts in)
Template library Save frequently used rules as templates (body + tags) and apply them to any scope; export/import the library as JSON to move it across machines and sessions. Applying a template makes a content copy — later template edits do not rewrite the rules you already added
Conflict-safe writes Every write carries the file version it read; if another window changed the file in between, the write is refused with a retry hint instead of silently overwriting

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-plugin-consult 下一个 Next Liltloom →