dsh-claimcheck · 验收取证
把"做完了"从一句自称,变成一份可机读、会过期的证据。
DSH(DeepSeek Harness)插件:由插件自己执行项目的验收命令,捕获真实退出码与输出,把结果钉在 当前工作区指纹上,写入带 digest 的证据文件;工作区一变,旧证据自动过期。收尾时如果改了东西却拿不出 新鲜证据,插件会把这一轮"拦一下",提示先取证再宣称完成。
English summary · 证据格式 · 配置 · 设计取舍
为什么需要它
现在的 agent 生态里,"已完成"是最便宜的一句话,也是最贵的一次不信任:
| 现状 | 后果 |
|---|---|
| 模型说"测试都过了" | 没有人知道它到底跑没跑、跑的是哪份代码 |
| 改完 A 又改了 B | A 的验证结论被静默沿用,其实已经过期 |
| 多个 agent / 多轮会话并行 | 各自的"通过"互相污染,没有锚点 |
现有做法大多停在软提示(system prompt 里写"记得跑测试")或事后看日志。dsh-claimcheck 的差别是:
命令由插件执行,不由模型转述。模型只能选择跑什么、不能伪造结果;pass 必须有真实退出码支撑。
它保证什么
- 执行权在插件。
command类检查通过 DSH 的 shell seam 真正执行,退出码、信号、超时、输出都来自真实进程。 - 通过不可伪造。
pass要求每个 required 检查实际通过;缺证据是incomplete,永远不是 pass。 人工确认类的检查记为unknown,不会自动折算成通过。 - 证据会自己过期。 证据记录工作区指纹(git HEAD + 工作区状态,或非 git 目录的有界文件扫描)。
指纹一变,
claim_status立刻返回 stale。 - 运行期间被改动 = 不可信。 如果检查命令自己改了工作区,本次结论降级为
incomplete并说明原因。 - 可审计。 证据是普通 JSON,带内容 digest(
artifactDigest覆盖除 digest 自身外的全部字段)、 每个检查的输出摘要与字节数,以及明确的outputTruncated标记。
三个工具
| 工具 | 作用 | 关键行为 |
|---|---|---|
claim_plan |
声明"什么算完成" | 校验检查样式;拒绝危险命令与越界路径;最多 12 条 |
claim_verify |
真正执行并记录证据 | 无计划时可自动发现项目测试命令;写 runs/<runId>.json、latest.json、index.jsonl |
claim_status |
证据现在还算不算数 | 只读,不执行、不写盘;返回 fresh / 过期原因 |
claim_report |
交接用 Markdown | 从最新证据渲染,含 digest 与工作区指纹 |
检查类型
// 1) 命令检查:插件执行,要求退出码
{ "id": "unit", "kind": "command", "title": "单元测试通过", "command": "pnpm run test", "timeoutMs": 180000 }
// 2) 文件检查:存在 / 包含文本 / 匹配正则
{ "id": "doc", "kind": "file", "title": "README 更新", "path": "README.md", "contains": "claimcheck" }
// 3) 人工检查:显式需要人,永不自动通过
{ "id": "ux", "kind": "manual", "title": "交互已人工确认", "requirement": "产品负责人签字" }
不给检查时,claim_verify 会按项目形状自动发现:package.json 的 test/typecheck/lint/build
(按锁文件选择 pnpm/yarn/bun/npm)、pytest、cargo test、go test ./...。
完成闸门
每轮结束时,如果这一轮产生了文件变更(write/edit,或写文件、移动、删除、装依赖、带 --write/--fix
的 shell 命令)而当前没有新鲜证据,插件会向该会话注入一条提醒并让这一轮继续(agent.followup)。
warn(默认):提醒 + 留出继续取证的机会;strict:同样的机制,用于"不接受无证据收尾"的场景;off:完全关闭;- 提醒有上限(
maxNudgesPerSession,默认 3),且同一状态不会重复提醒;纯问答轮、只读轮不会触发。
诚实说明:插件层能做的是显著提高伪造成本 + 让结果可审计,不是密码学意义上的不可伪造。 人可以运行任意命令;插件保证的是"每份证据都指向它实际跑过的那次执行和那棵树"。
安装
插件是零依赖的 Host-only bundle(无运行时 @deepseek-ai/* 导入)。
方式 A · 市场/桌面端安装页:搜索 dsh-claimcheck 安装(仓库带 dsh-plugin topic,会被社区索引自动收录)。
方式 B · Release 离线包(无需 clone,带 sha256)
# 下载并校验
curl -LO https://github.com/Daphne999/dsh-claimcheck/releases/download/v0.1.0/dsh-claimcheck-0.1.0.tgz
curl -LO https://github.com/Daphne999/dsh-claimcheck/releases/download/v0.1.0/dsh-claimcheck-0.1.0.tgz.sha256
sha256sum -c dsh-claimcheck-0.1.0.tgz.sha256
mkdir -p ~/dsh-plugins/dsh-claimcheck && tar -xzf dsh-claimcheck-0.1.0.tgz -C ~/dsh-plugins/dsh-claimcheck
dsh plugin --profile <profile> add link:"$HOME/dsh-plugins/dsh-claimcheck"
方式 C · 从源码链接
git clone https://github.com/Daphne999/dsh-claimcheck.git
dsh plugin --profile <profile> add link:"$PWD/dsh-claimcheck"
方式 D · 写进 profile
// ~/.dsh/profiles/<profile>/package.json
"dependencies": { "dsh-claimcheck": "link:/abs/path/to/dsh-claimcheck" },
"dsh": { "profile": { "bundles": [ /* ... */ "dsh-claimcheck" ] } }
装完重启宿主。安装后在插件列表里能看到「Claimcheck 验收取证」,且会话中多出 claim_* 四个工具。
证据格式
证据写在会话工作区下的 .dsh/claimcheck/:
.dsh/claimcheck/
├── runs/run-mvwkx7ff-qbwqlf.json # 本次运行的完整证据
├── latest.json # 最新一份(原子写入)
└── index.jsonl # 追加式索引,一行一条
{
"schema": "dsh-claimcheck/evidence@1",
"runId": "run-mvwlo6pv-ufq4z4",
"verdict": "pass", // pass | fail | incomplete
"summary": "all 1 checks passed; required checks have evidence",
"digest": "c33357…2121", // 覆盖除 digest 自身外的全部字段
"workspace": {
"fingerprint": "f35cb7…98c4",
"fingerprintSource": "git", // git | files
"detail": { "head": "…", "branch": "main", "dirtyFiles": 0 }
},
"plan": { "id": "…", "source": "agent|user|discovered", "checks": [/* … */] },
"counts": { "total": 1, "pass": 1, "fail": 0, "unknown": 0, "error": 0 },
"checks": [{
"id": "unit", "kind": "command", "status": "pass",
"command": "node --test", "exitCode": 0, "signal": null, "timedOut": false,
"output": "…", "outputDigest": "…", "outputBytes": 1234, "outputTruncated": false,
"durationMs": 812
}]
}
这个文件不需要装插件也能读:CI、评审脚本、另一个 agent 都能直接消费。
配置
写在 profile 的 patch 行里(cordis.patch.yml):
- id: dsh-claimcheck
config:
mode: warn # warn | strict | off
maxNudgesPerSession: 3
maxOutputBytes: 16384 # 每条检查保存的输出上限
evidenceDir: .dsh/claimcheck
autoDiscover: true
requireGateAfterWrite: true
安全边界
- 拒绝红线命令:递归强删、格式化、关机、
curl | sh、强推/硬重置、chmod 777 /、带凭据外传的下载命令等, 在claim_plan/claim_verify阶段直接拒绝(见lib/checks.js的RED_LINE_PATTERNS)。 - 路径不越界:
file检查拒绝绝对路径与..。 - 执行沿用 DSH 沙箱:检查通过
ctx.shell跑,与 shell 工具同一套执行策略。 - 不收集遥测:插件不联网、不上报;证据只写本地工作区。
不做什么
- 不替代测试框架:它只负责"执行 + 记录 + 过期判定"。
- 不做汇总评分:没有 score / passRate;只有 pass / fail / incomplete 三态与逐条证据。
- 不评审代码:质量判断留给人和评审工具。
- 不伪造指纹:拿不到可靠状态就写文件扫描来源,不编造版本号。
与相邻工具的关系
生态里已有 dsh-acceptance(任务级人工验收台,明确不执行测试)、 dsh-dod(只提醒不拦截)、dsh-eval-harness (插件回归评测)。claimcheck 的定位是它们缺的那层:自己执行、结果绑定工作区、会过期, 产物是可被上述工具导入的 JSON,而不是又一个看板。
开发
node --test test/*.test.mjs # 33 项单元/集成测试(含真实子进程)
node scripts/smoke.mjs # 端到端演示:发现→过期→闸门→修复→通过→交接
零运行时依赖;纯 ESM,Node ≥ 22。
在市场里找到它
仓库已带 dsh-plugin topic 与项目简介,因此走社区索引的自动收录通道:
- awesome-dsh-plugin 每日从 GitHub Topic 抓取快照,
新仓库先进入待审核队列(
data/review/pending.md),维护者核实后进入 CATALOG 与市场文件; - 下游市场(桌面端「发现」页、
dsh-market、DSH-Plugins-Marketplace等)消费同一份数据; - 欢迎在 SHOWCASE.md 的作者自荐区 推荐它(该区要求仓库 Star > 10)。
License
English
dsh-claimcheck is a DeepSeek Harness plugin that makes "done" auditable:
- it runs the project checks itself through the harness shell seam (real exit codes, bounded output);
- it pins every result to a workspace fingerprint and expires the evidence when the tree changes;
- it emits a digest-addressed JSON artifact any tool can consume;
- it holds a turn open when file-mutating work ends without fresh evidence (bounded, state-aware, never for read-only turns).
Tools: claim_plan, claim_verify, claim_status, claim_report. Verdicts are pass / fail / incomplete —
a missing check is never a pass. Zero runtime dependencies, Host-only bundle.
git clone https://github.com/<owner>/dsh-claimcheck.git
dsh plugin --profile <profile> add link:"$PWD/dsh-claimcheck"
No comments yet. Be the first to write one.