DeepSeek Harness Plugin

HeliosTangDev/dsh-ops-conventions

Stars ★ 0 Category Workflow & Automation Added 2026-10-19

Injects a very short conventions reminder (absolute INDEX path + version) once per session per version; when the conventions version changes, the next turn re-injects it (chat turns included). Optional hard guard: on operation-like turns, write/edit tools are rejected until the session has read the index (chat turns and shell are not blocked by default). Ships example checklists or points at your own directory; zero dependencies, configurable paths. Solves: conventions are written down but never pulled up when the work starts.

Install

# from a prebuilt release tarball

dsh plugin --profile web add -w "https://github.com/HeliosTangDev/dsh-ops-conventions/releases/latest/download/dsh-ops-conventions.tgz"

# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)

dsh plugin --profile web add github:HeliosTangDev/dsh-ops-conventions

Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).

README

This plugin publishes its README in Chinese only.

在 AI 动手前把「你的操作约定清单」确定性地注入一次,并可选地硬拦截写操作,解决「约定记了,但干活时不提就不用」的问题。

插件本身不含任何个人约定:它只做「提醒 + 拦截 + 配置」。规则内容全部来自你自己的 INDEX.md(以及可选的补充文件)。

它做什么

  • 注入门铃:每个会话、每个约定版本注入一次,内容 = read <你的 INDEX.md> 并执行清单 + 可选补充文本;约 1 行,不改 VERSION 不会重复刷屏。
  • 版本变化再提醒:改约定目录里的 VERSION 文件后,下一轮(任何轮次)会重新注入。
  • 可选硬拦截:本会话还没 read 过 INDEX.md 时,拒绝写类工具(write/edit/…,可加 pwsh/bash/cmd 等);读过后本会话放行。
  • 可选待办门:配置 todoFile 后,还要求先跑一次 todoCheckCmd 校验器(防止报过时待办)。
  • 可选维护报告摘要:配置 maintReport 后,报告里有 Issues 就注入一条摘要。
  • 可选结构门:配置 structGates 后,写某个区域前必须先跑该区域的结构检查器。
  • 注入日志:每次注入/拦截都写日志,生效与否可核对。

安装

方式一:安装脚本(推荐)

git clone https://github.com/HeliosTangDev/dsh-ops-conventions.git
cd dsh-ops-conventions
node install.mjs                                  # 默认装到 ~/.dsh/profiles/desktop
node install.mjs /path/to/profile                 # 指定 profile
node install.mjs /path/to/profile --uninstall     # 卸载

方式二:自己加依赖

在 profile 的 package.json 里加:

"dsh-ops-conventions": "https://github.com/HeliosTangDev/dsh-ops-conventions/releases/latest/download/dsh-ops-conventions.tgz"

然后在该 profile 目录执行 pnpm install,重启 DSH。

方式三:市场

在 dsh-m 市场里搜索 dsh-ops-conventions 安装。

配置

在 profile 的 cordis.patch.yml 里追加(所有字段都可选,不配也能用):

- id: dsh-ops-conventions
  name: "dsh-ops-conventions"
  config:
    enabled: true                            # 总开关:false = 保持加载但零行为(不做注入/拦截/扫描),改后重启
    skillsDir: "D:\\my-conventions"          # 你的约定目录(里面放 INDEX.md + VERSION)
    # bellExtra: "额外的提醒文本"              # 直接追加一行文本
    # bellExtraFile: "D:\\my-conventions\\BELL.txt"  # 或指向文件(每次注入现读,改文件不用重启)
    # enforce: false                          # 只提醒、不拦截
    # blockedTools: ["write","edit","multi_edit","apply_patch","notebook_edit","pwsh","bash"]
    # todoFile: "D:\\my-work\\tasks\\OPEN.md"
    # todoCheckCmd: "powershell -NoProfile -ExecutionPolicy Bypass -File D:\\tools\\todo_check.ps1"
    # maintReport: "D:\\my-work\\tasks\\MAINT-LATEST.md"
    # structGates:
    #   - id: docs
    #     pathRe: "docs[/\\\\]"               # 命中这些路径时……
    #     checkRe: "docs_check\\.py"          # 这条命令就是该门检查器
    #     checker: "python D:\\tools\\docs_check.py"
    # 可选:现场状态行(宿主版本 / 维护报告 / 待办条数),默认关闭
    # status: true
    # statusTodoJson: "D:\\my-work\\todo.json"       # 读条目数用
    # hostVersionFile: "D:\\tools\\host_version.txt" # 宿主版本缓存(由你自己的脚本写)
    # asarCandidates: ["C:/apps/DSH/resources/app.asar"]
    # 可选:只读状态工具 ops_status(agent 可直接调用查看状态),默认关闭
    # statusTool: true
    # memoryDir: "D:\\my-memory\\memories"           # 统计记忆库 .md 数量与最近更新时间
    # todoLastFile: "D:\\my-work\\todo_last.txt"     # 上次校验器输出(可选)
    # 可选:版本引用核对(上一条回复写了非现场版本时警告),默认关闭
    # versionWarning: true
    # versionWarnFile: "D:\\my-work\\VERSION-WARN.md"
    # installedProfileDirs: ["C:/Users/me/.dsh/profiles/desktop"]
    # 可选:回复合规扫描(在下一轮检查上一条回复,命中注入警告并落文件),默认关闭
    # replyWarnFile: "D:\\my-work\\VERSION-WARN.md"
    # replyChecks:
    #   - id: no-next-time
    #     pattern: "下次注意"
    #     message: "不许用「下次注意」结案"
    #   - id: status-needs-time        # pattern 命中后,require 不命中才算违规
    #     pattern: "bell=v\\d+"
    #     require: "@\\d{1,2}:\\d{2}"
    #     message: "报状态要带命令、采样时间与数据年龄"
    # replyCheckBlock: true           # 违规后本轮拒绝写类工具(连续两轮自动解除)
    # 可选:窄工具 ops_run(只跑白名单里的脚本),默认关闭
    # narrowTool: true
    # narrowConfigFile: "D:\\my-work\\tools-run.json"  # 白名单文件,改它不用重启
    # narrowRoot: "D:\\my-work\\tools"                 # 白名单文件没写 rootDir 时的兜底根目录
  disabled: false

功能分区(2026-11-22)

15 个子系统按演进节奏分三组,可用组开关一次关掉一整组(features 仍是“只能减不能加”):

分区 成员 说明
conventions bell indexGate todoGate structGate replyCheck planGate rawWriteGate bareCommandGate 约定注入与门禁,跟你的规则一起变
observability statusLine maintHint signals versionWarn statusTool 状态行 / 维护摘要 / 信号 / 版本核对 / ops_status
execTools opsRun opsWrite 宿主侧执行(绕过会话沙箱,权限敏感)
{
  "features": {
    "execTools": false,
    "planGate": false
  }
}

上面表示:opsRun/opsWrite 整组关掉,另外单独关掉 planGate。组名与单项开关同级、都写在 features 里,不嵌套。

窄工具(ops_run,默认关闭)

只解决一件事:让 agent 在不放开任意执行的前提下,跑你指定的那几个脚本。

  • 调用方只能给 id 和参数;路径、cwd、解释器全部来自白名单文件,不接受任意 path/args/cwd。
  • 参数必须逐项命中该条目的 allowedArgs(字面量白名单,不做通配);未知 id / 未授权参数直接拒。
  • 授权按工作区/会话:每条必须写 workspaces(["*"] 才是全局,不写=拒绝);可选 sessions 再收窄到具体会话 id。判定在 tools/pre-execute 里做,用的是调用方会话的 cwd。
  • 执行永远 shell: false,cwd 固定为 rootDir,有 timeoutMs 与 maxOutputBytes,超时/截断如实上报。
  • 每次调用写一行审计到插件日志(narrow run id=… exit=… timeout=… duration=…)。

白名单文件格式(仓库里 tools-run.example.json 可照抄):

{
  "rootDir": "D:\\my-work\\tools",
  "scripts": [
    {
      "id": "todo-check",
      "path": "D:\\my-work\\tools\\todo_check.ps1",
      "launcher": ["powershell", "-NoProfile", "-ExecutionPolicy", "Bypass", "-File"],
      "allowedArgs": ["-Json"],
      "workspaces": ["D:\\my-work\\tools", "D:\\my-notes"],
      "sessions": ["session-xxxxxxxx"],
      "timeoutMs": 60000,
      "maxOutputBytes": 20000
    }
  ]
}

约束:path 必须是绝对路径、不得含 ..、必须落在 rootDir 之内;workspaces 里每一项必须是 "*" 或绝对路径,调用方工作区等于它或在其子目录下才放行;sessions 不写表示不限会话。不要把解释器、路径或 cwd 做成可传参——那样等于通用执行器,一个提示注入就能当后门。

最小约定目录

D:\my-conventions\
  INDEX.md     # 你的清单入口(写清“做什么事读哪份清单”)
  VERSION      # 一个数字;改它 = 让门铃重新注入

INDEX.md 示例:

# 操作约定索引

| 要做的事 | 读这份 |
|---|---|
| 写/改脚本 | ops-scripts/SKILL.md |
| 改完验证 | ops-check/SKILL.md |

不配置会怎样

  • 使用插件包自带的 skills/ 示例清单(会提示你去换成自己的目录);
  • 只拦截 write/edit/multi_edit/apply_patch/notebook_edit;
  • 其余可选功能(待办门/维护摘要/结构门)全部关闭。

验证生效

Get-Content "$env:USERPROFILE\.dsh\ops-conventions\ops-conventions.log" -Tail 5

应看到 plugin loaded skillsDir=...、inject vN chars=...;被拦截时应看到 guard deny ...。

卸载

node install.mjs --uninstall

或从 profile package.json 删除依赖、node_modules/dsh-ops-conventions,并删掉 cordis.patch.yml 里对应条目,然后重启。

边界

  • 这是「提醒执行器」,不是安全边界:它可以挡住误操作,但不能保证模型一定执行清单。
  • 注入/拦截都在本机,不联网、不收集数据。
  • 适配 DSH 0.2.x(Node 22 / 24),MIT 许可。

Content from the project README on GitHub ↗

Links

More in this category

View the whole category →

Community comments

Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.