证据快照复核于 2026-09-16GitHub 数据核对日期: 2026-08-21
证据已验证Plugin Bundle自动化与智能体Web ProfileHeadless Profile

DSH Completion Guard

一个用于 DeepSeek Harness 的附加组件:在签发任务完成证明前检查任务约定和匹配的已保存证据。

快速了解

它能做什么

一个用于 DeepSeek Harness 的附加组件:在签发任务完成证明前检查任务约定和匹配的已保存证据。

本站提供的是中文说明,不代表该项目或 Plugin 自身提供中文界面;语言支持请以上游文档为准。

使用场景
自动化与智能体智能体治理工作流自动化
适配技术
deepseek-harnesscordis
兼容性

Web Profile, Headless Profile
DSH 0.1.5-rc.2 || 0.1.5-rc.1; Cordis ^4.0.2; Node.js >=22

可信度与状态

证据已验证
核对日期 2026/9/14 UTC 14:22

有代码证据的贡献

它为 DSH 增加什么

完成检查点

记录任务要求,仅在已保存的 DSH 工具结果与要求匹配时才签发完成证明。

机制证据

选择前先看

DSH 完成守卫为 DeepSeek Harness 会话增加可选择启用或始终启用的完成检查点。它保留需求、验收检查、禁止事项和后续修正;会话恢复后会还原清单并重新检查。只有已保存的 DSH 工具证据与要求的操作及目标匹配,才会签发完成证明。

适合谁

希望在将智能体任务视为完成前,明确查看证据和未解决检查项的 DeepSeek Harness 用户。

常见任务

  • 使用 `/context-guard on` 启用当前会话保护,并用 `/context-guard status` 查看状态。
  • 要求任务所请求的文件、命令或操作具有已保存且目标匹配的工具证据。
  • 在严格策略下,要求视觉验证或完整范围验证必须有真实回读事实。
  • 在发布策略下,为由 Guard 路由的 npm 发布操作采用显式发布约定。

权限与数据

Guard 会读取已保存的 DSH 任务与工具证据,以评估自己的完成检查点。

权限
  • 使用 DSH 会话事件、命令、工具和智能体生命周期集成。
  • 主机锁注入会写入所选配置文件的 `cordis.patch.yml`;请先备份该文件。
数据处理
  • 保存需求和脱敏后的工具证据摘要。
  • README 声明不会保存完整提示词、stdout、文件内容、凭据、Authorization 标头、URL 查询值、图像字节或原始转录。

局限

  • 它不是安全沙箱,也不能替代 DSH 的权限、工具执行、Goal、Todo、Compaction 或续接机制。
  • DSH 内部可能绕过 Guard 所有的 Goal 完成路径;插件会报告这些情况,但不声称能阻止每一次写入。
  • 默认需要手动启用;`always` 模式需在对应配置文件的补丁中配置。
  • 由于没有独立验证市场已加载实例的绑定,当前市场重启集成不可用。
  • 请勿在同一配置文件中同时加载旧名称 `dsh-context-guard` 和本包。

DSHub 已核对

  • 已验证固定 Git 源提交和包补丁结构。
  • 清单声明版本为 0.6.0、许可证为 Apache-2.0、Node.js >=22,以及 DSH 0.1.5-rc.1 或 0.1.5-rc.2。
  • 该包未声明生命周期脚本。

DSHub 未核对

  • 未提供成功安装或在实际 DSH 运行时执行的证据。
  • 未提供 0.6.0 的原生验收或发布运行证据。
  • 提供的 npm 分发检查未找到该包版本。

固定版本安装

安装 DSH Completion Guard

这个Plugin Bundle没有 DSH Plugin 安装操作,请根据源码文档使用真实交付方式。

访问源码项目

维护者原文

项目 README

查看 commit cc5cbc6 对应的 README
维护者编写的上游内容原文于 2026/9/14README.md 获取,正文和仓库相对媒体固定到 commit cc5cbc6d4086,内容哈希为 1dc1aea61a4d。以下是未经 DSHub 翻译的上游原文,语言可能与当前页面不同;第三方托管的 badge 可能独立更新。

dsh-completion-guard

简体中文

An add-on for DeepSeek Harness (DSH) that keeps a task's requirements and checks them before the task is marked complete. It restores the same checklist after a resumed session and accepts only matching saved tool results as evidence.

Task-contract clauses and bounded evidence pass through a checkpoint before a completion certificate is issued

Quick start

Install the published 0.6.0 release into the DSH Web environment:

dsh plugin --profile web add dsh-completion-guard@0.6.0

Upgrade and restart DSH before running the host-lock checks below. The lock records the package versions and installation directories DSH actually uses. A lock generated before an upgrade describes the old packages and will fail against the new runtime. inject writes to <profile>/cordis.patch.yml, so back up that file first.

Check that each command's JSON output says status: "supported". inspect, inject and verify-dump can exit with code 0 even when their verdict is unsupported; a successful shell exit alone is insufficient.

DSH_RUNTIME_ROOT=/absolute/path/to/.dsh-runtime
DSH_PROFILE_ROOT=/absolute/path/to/.dsh/profiles/web
GUARD_HOST_LOCK="$DSH_PROFILE_ROOT/node_modules/.bin/dsh-completion-guard-host-lock"

"$GUARD_HOST_LOCK" inspect --runtime-root "$DSH_RUNTIME_ROOT" --profile-root "$DSH_PROFILE_ROOT"
"$GUARD_HOST_LOCK" inject --runtime-root "$DSH_RUNTIME_ROOT" --profile-root "$DSH_PROFILE_ROOT"
dsh --profile web --dump-config | "$GUARD_HOST_LOCK" verify-dump --runtime-root "$DSH_RUNTIME_ROOT" --profile-root "$DSH_PROFILE_ROOT" --dump-config -

On Windows, run the same three subcommands through dsh-completion-guard-host-lock.cmd in the Web settings directory's node_modules\.bin directory and use Windows absolute paths. The published 0.5.3 package passed separate macOS and Windows native acceptance on DSH 0.1.5-rc.2; both runs are bound to its exact bytes in the acceptance record. The 0.6.0 candidate has not yet had its own native or publication run, so treat its source and deterministic evidence as separate from any installed-artifact claim. Other host versions and artifacts need their own native evidence. Repeat this check after changing DSH, Guard or the profile location; an ordinary market-only update does not require reinjection. The Guard stays unavailable if the active package set is missing, mixed, duplicated, or different from a checked setup.

Restart DSH Web, open a session, and enable the Guard:

/context-guard on
/context-guard status

Activation is opt-in by default. status shows whether the Guard is on, its startup phase (armed means waiting for your first message), the active policy tier, how many checks remain, and a summary of why the rest are open. off stops protection for the current session without deleting its history. clear closes the current checklist while keeping prohibitions. diagnose explains why a completion check passed or failed. migration reports which rule set the session is under and what an upgrade or rollback would mean. release reports the explicit release contract, its coverage, and anything in flight.

What it protects

  • Saves requirements, acceptance checks, prohibitions, and later corrections without overwriting history.
  • Uses only tool calls and results that DSH has saved, and stores a redacted summary rather than full output.
  • Accepts evidence only when the action and result match the requested command, file, or other target.
  • Rechecks completion after a session is rebuilt or resumed, and refuses to certify damaged state.
  • Stops the Guard-owned Goal completion path when the current checklist has not passed. DSH internals can still bypass this path, so the plugin reports those cases rather than claiming to block every possible write.

Status and compatibility

Version 0.6.0 supports exactly DSH 0.1.5-rc.2 or 0.1.5-rc.1 with Cordis 4.0.2. These are the latest registered release and the verified minimum. The previous Session API, V2 event vocabulary, and every older host package set remain removed. If you are upgrading from DSH 0.1.2-rc.1, start a new session: Guard does not migrate old logs, proposals or certificates, and it never deletes or reinterprets your old data.

Package discovery and npm installation now publish the same newest-first exact union, 0.1.5-rc.2 || 0.1.5-rc.1. Older versions, unregistered stable 0.1.5, and future versions are not advertised as supported. Every admitted version must still match its complete 33-package DSH core graph; missing, mixed, or unknown graphs fail closed.

The registered host sets are DSH 0.1.5-rc.1 and 0.1.5-rc.2, each with its own exact 33-package graph. Their identities come from published npm tarballs; mixed versions fail the host check. Registry identity and native acceptance are separate: use the annex for the exact Guard artifact, host version and platform to establish a native pass. See the compatibility guide for version rules and host-lock provenance.

Restart is a separate capability. Current DSH does not supply independently verified bindings for market's loaded instance, so the Guard market restart adapter is unavailable. A requested restart remains pending; core protection and unrelated operations continue. Installing or applying a package on disk does not prove that a running process or UI has adopted it.

Upgrading the core lock requires fresh inspection and injection from the actual runtime and profile. Old certificates are not relabelled as evidence for the new lock. See the upgrade guide and compatibility guide.

Choose a published version from npm and verify its commit, checksum and native annexes on the GitHub Release. The historical 0.4.2 release targets DSH 0.1.2-rc.1 with market 1.41 and does not contain this decoupling. A source version, CI, same-byte native acceptance and publication are separate states; see acceptance scope.

The project was renamed from dsh-context-guard on 2026-08-29; its internal bundle id is still context-guard. Migration preserves sessions, activation and disabled settings. Do not load both package names in one profile. Node.js >=22 and pnpm >=11 are required.

Activation modes

Context Guard has two activation modes:

  • opt-in (default): protection is off when a session starts. Run /context-guard on in that session to turn it on, and /context-guard off to turn it off again. This changes only the current session.
  • always: DSH sessions are protected automatically from the first real message. A brand-new session stays completely empty — the Guard writes nothing into it — so you can still pick the DSH session mode (standard, minimal, or a custom preset) before sending anything. The moment your first real message enters a step, protection begins in that same step and ahead of your message: the first task, including its first file changes, is covered. A first message that only carries an image or an attachment starts protection too and leaves an unresolved asset item until its meaning is clarified; a blank message starts nothing. Running /context-guard off turns protection off for that session until you run on again.

These modes only control Guard protection. They are not the DSH session mode (for example, the standard or minimal mode) that a session starts with. Because the Guard no longer writes into sessions before the first message, a session's DSH mode can be selected while the session is still new. /context-guard on and /context-guard off turn Guard protection on or off; they never change the DSH session mode.

To make DSH sessions start with protection on, add this entry to the cordis.patch.yml used by the way you start DSH:

- id: context-guard
  name: dsh-completion-guard
  config:
    activation: always

DSH can run with a Web interface in a browser, or Headless without a browser interface from a terminal or an automated task. These two ways of running DSH use separate settings files. Edit the file for the one you use, or edit both if you use both:

System How you use DSH Default path
macOS / Linux Web $HOME/.dsh/profiles/web/cordis.patch.yml
macOS / Linux Headless $HOME/.dsh/profiles/headless/cordis.patch.yml
Windows Web %USERPROFILE%\.dsh\profiles\web\cordis.patch.yml
Windows Headless %USERPROFILE%\.dsh\profiles\headless\cordis.patch.yml

If you set a custom DSH_HOME, use that directory instead of $HOME/.dsh or %USERPROFILE%\.dsh.

You can also paste this prompt into DSH and let it make the change:

Set dsh-completion-guard to always mode. Find the cordis.patch.yml used by the way I am currently running DSH (Web interface or Headless), back it up first, and only set activation: always on the entry with id: context-guard. Do not change any other settings or restart DSH. When finished, show me the file path and the exact diff.

After the change, restart DSH.

How completion is checked

Once enabled, the Guard saves direct user requirements and acceptance checks. A saved tool result counts only when it matches the requested command, file, or other target. A machine-certified completion requires the Guard's checkpoint; missing, stale, or mismatched evidence leaves the task uncertified. Investigations and explanations outside the supported evidence rules can still end with an honest answer, without a completion certificate.

Read-only evidence collection and actions that change packages, files, services, or Git state use separate tools. A successful lookup never grants permission to make a change. Exact command limits and platform evidence are documented in docs/COMPATIBILITY.md.

When a requirement stays incomplete

“Update the plugin and check the GUI” can contain work the Guard cannot certify, and questions such as “是否有更新” are inquiries: they stay recorded with their source, but no checkpoint or rebind can machine-certify an answer — complete the investigation and report the result. The checkpoint reports a reason and one concrete next action per item, and context_guard_prepare (read-only) shows, before a stateful action, the supported command shape, the required resolution/effect/state evidence order, and the exact missing target fields.

Use context_guard_rebind to propose an exact, complete split of the old text. If the action or target needs clarification, first ask the root user for an explicit instruction that includes the original clause; the proposal can reference that new item's ID. The tool returns a proposal ID and a comparison. The user applies it with the confirmation line 确认重绑定 <proposal ID> as the first line of a reply; an explanation request or a new task after a blank line keeps its own meaning, and a new task is captured normally. A confirmation buried in a sentence, quotes, or a code block, or followed by a reversal, does nothing. Splitting a requirement into equally uncertifiable pieces returns “no certification gain” instead of asking for a pointless confirmation. Unsupported parts remain pending, and a qualified safe end does not mean all work is complete.

The default context_guard_checkpoint call uses bindings: [] for diagnosis. It shows at most eight current items/constraints and ten evidence rows, within 12 KiB of plugin JSON. pagination reports totals and a separate next_cursor for each list; the first page is not the whole contract. Use item_ids or evidence_ids to focus a query, or evidence_scope: "history" for the complete evidence history, including rows marked unavailable. Keep the query unchanged when following a cursor; a changed contract or evidence snapshot requires a fresh query. Large rows expose detail_id; retrieve chunks with detail_offset and return the first response's snapshot as detail_snapshot on later chunks. All queries remain read-only and never shrink the certification set.

What 0.6.0 changes for ordinary work

The following behaviours are what you will actually notice. Everything before the new protocol boundary keeps its old meaning; nothing is re-read.

Asking a question no longer leaves a permanent to-do. A question or an explanation is closed by the host's own record: the final assistant message of a turn that completed normally. A status summary, a draft, an intermediate reply, another turn's answer, a subagent's answer, or an interrupted turn never closes it. "Answered" means the answer reached you — it says nothing about whether it was correct or whether any work was done.

A document "update" is decided by the object, not the verb. "Update the docs" becomes a bounded modification whose exact file you leave to the assistant, inside the directory and file type your instruction captured. Something the Guard cannot recognize as a file keeps an honest "I could not determine this" state instead of being forced into an action or silently closed.

Answering a question does not complete the rest of the sentence. "Check for updates and also create report.txt" closes the question when the answer is delivered and leaves the file creation open until it has its own evidence.

Tasks are tracked as units. Delegating a sub-task to a subagent opens a child unit whose open work counts towards the parent, so delegating never drops the parent's own work. A subagent's answer is recorded as bounded evidence and never closes the parent on its own. A prohibition or a wait you declared earlier continues to govern the same action in later tasks.

Corrections replace what they refine. A later instruction that contains a pending obligation verbatim supersedes it atomically and keeps both revisions. Explanations, prohibitions and waits never delete an obligation by similar wording, and nothing is removed just because a new sentence looks alike.

A trusted answer to the host's own question narrows a target. When the assistant asks you where a file should go and you pick a directory, that answer — from the host's own question tool, with its call and result both on record — narrows where the file may land. Text pasted into the conversation does not. Sandbox approvals are recorded separately and never grant a target.

Policy tiers

Three tiers change how much proof is required at completion. They are separate from the opt-in / always activation modes, and installing never enters the release tier.

Tier What it demands
standard (default) Work must be supported by durable evidence; ordinary tools are not gated behind extra Guard approval.
strict On top of standard, a visual or complete-scope verification you explicitly asked for must be discharged by a real readback fact, not by a tool that merely succeeded.
release Only an explicitly adopted release contract authorizes a release operation. Until you adopt one, release operations are refused rather than performed under the standard rules.

Set the tier in the same cordis.patch.yml entry as activation:

- id: context-guard
  name: dsh-completion-guard
  config:
    activation: always
    policy: strict

Explicit release contracts

A release is never implicit. A "release" keyword in a message, a loaded Skill, or an installation does not adopt anything; only this command does:

/context-guard release adopt {"operations":["npm_publish"],"candidate":{"ref":"refs/heads/main","fullSha40":"<40 hex characters>","version":"0.6.0","artifactDigest":"<64 hex characters>"}}

After adoption, /context-guard release reports the contract, its candidate, its per-operation coverage, what has been consumed, and anything still in flight. Each operation spends exactly one reservation, written before the effect and settled afterwards from a trusted readback. A wrong candidate SHA, ref, artifact digest or version, an expired ticket, a consumed ticket, a retry of a request that is still in flight, and an opaque runner are all refused before any effect.

Coverage is stated honestly, and the gap is attributed. This release protects only the surface Guard itself routes: publishing an npm artifact through context_guard_action. git tag and the GitHub Release operations have no Guard-owned route yet, so a contract requiring them is refused before any effect and reported as release_operation_unrouted — a scope reduction this release explicitly took, not a claim that the host makes them impossible. A composite runner is refused as an opaque host boundary. /context-guard release prints this table in machine-readable form. A trusted in-process caller that bypasses the Guard entirely is a host trust boundary; the plugin reports what it can see and does not claim to stop what it cannot see.

Boundaries

Context Guard certifies completion; DSH still owns Goal, Todo, Compaction, continuation, permissions, and tool execution. This plugin is not a security sandbox, semantic proof system, token-pruning tool, or replacement for those DSH facilities.

Evidence is bounded and redacted. Complete prompts, stdout, file contents, credentials, Authorization headers, URL query values, image bytes, and raw transcripts are not stored by the guard. See docs/PRIVACY.md.

Relationship to Codex Context Guard

This project began as a DSH port of deterministic behavior from GreenLv/codex-context-guard v0.8.8. That version is the historical starting point, not the current compatibility level.

Version 0.4.0 was deliberately aligned with the shared evidence rules in Codex Context Guard 0.10.0: proof must belong to work that is still open and must show the operation, target, and result the user actually requested. This is a limited behavior-level alignment, not a claim that the two products have the same features.

The 0.6.0 line implements the C01–C12 shared contract that pairs this release with a planned Codex Context Guard 0.14.0: source spans and coverage, one interpretation view, trusted answer delivery, work units with a required-descendant closure, per-action conditions, responsibility tiers, bounded target resolution, atomic clarification, the proof capability matrix, explicit release tickets, fresh projections, and unified migration diagnostics. The plain-language comparison, the implementation status per contract, and the dated delta ledger are in docs/SEMANTIC_COMPATIBILITY.md.

Two shared artifacts are deliberately incomplete, and calling them done would be false. The upstream repository had not landed a frozen v2 conformance fixture at the time of this release, so the v2 fixture here is a DSH-authored candidate rather than a byte mirror, and UPSTREAM_PIN.json still pins only the unchanged v1 fixtures. Cross-language parity and the canonical mirror therefore remain open; the delta ledger records them as such.

The two repositories serve different runtimes:

  • codex-context-guard is the Codex Hook/Python implementation with Codex plugin-cache and Hook lifecycle integration.
  • dsh-completion-guard is an independent TypeScript implementation over native DSH Session events, commands, tools, and agent lifecycle.

They do not share runtime state, installers, caches, or release histories. Fixes are contributed to the repository that owns the affected runtime and are ported deliberately when the same behavior belongs in both products. See docs/UPSTREAM_BASE.md and docs/PORTING_NOTES.md for the exact reused and replaced boundaries.

npm download history

Combined cumulative npm download growth across dsh-context-guard and dsh-completion-guard

The cumulative chart keeps the old and new npm package totals visibly separate, marks the 2026-08-29 rename, and combines them only for the project growth line. npm download counts measure registry requests; they are not counts of unique users or confirmed installations.

History starts on the first public npm release day, 2026-08-26; its real first-day count is retained even when nonzero. The vertical axis starts at zero. Date labels share one fixed day interval and centered anchors; the caption always gives the exact coverage end.

The daily workflow publishes through the last day whose counts are unchanged in checks at least 12 hours apart and at least two UTC calendar days old. The API availability date is shown separately; this observation rule is not an npm guarantee that counts will never change. See the source data.

Documentation

Development

pnpm install --frozen-lockfile
pnpm run test:stats
pnpm run typecheck
pnpm test
pnpm run lint
pnpm run build
pnpm run pack:check

These commands validate a local source tree and package. CI, native-platform acceptance, npm publication, GitHub release identity, and installation in a live DSH environment remain separate evidence scopes.

有意识地管理

安装与管理

前置条件与目标 Profile

目标 Web Profile, Headless Profile

交付方式 Git Bundle — GreenLv/dsh-completion-guard#cc5cbc6d408664172d9383de7c83c55ec6dfd602

验证、更新与移除

显示生命周期命令
验证
dsh plugin --profile web list

兼容性与访问范围

DSH 0.1.5-rc.1 or 0.1.5-rc.2; Node.js 22+ DSH 0.1.5-rc.2 || 0.1.5-rc.1; Cordis ^4.0.2; Node.js >=22

检查兼容性证据

风险事实

completion-boundary

Does not block every DSH-internal bypass

证据
runtime-verification

Version 0.6.0 has no supplied native-install or publication-run evidence

证据
data-handling

Stores redacted evidence summaries rather than full tool output

证据
证据与编辑审查Manifest、Bundle patch、分发与新鲜度

不可变证据

审查状态与源码活动

AI 已审查

建议使用固定的 Git 包,并针对实际 DSH 运行时和配置文件验证主机锁。该插件提供完成认证,不保证能阻止主机侧的所有操作。

AI 审查于 2026/9/14 UTC 14:22GitHub 事实核对日期: 2026/9/14 UTC 14:22

自当前证据基线以来,没有记录到重要源码变化。

下一步

按 Plugin 安装流程操作

订阅重要变化: DSH Completion Guard