前言¶
在 DeepSeek Harness(DSH)裏跑編碼智能體時,模型常會聲稱「測試已通過」「文件已改」等結論。這些陳述是否與實際 shell、edit 等工具的執行結果一致,單靠對話文本無法確認。社區插件 dsh-truth-gate(npm 包名 @zakza/dsh-truth-gate,倉庫 Achi-Migo/dsh-truth-gate)在 Harness 側對照工具回執(receipts)做校驗,默認以 shadow 模式只記錄、不干預 agent 行爲,便於先觀察再決定是否啓用 gate。
這是什麼¶
TruthGate for DeepSeek Harness:原生 DSH 插件,校驗 coding-agent 關於測試、編輯等陳述是否與 shell/edit 類工具回執一致。維護者 Achi-Migo,在 SkillHub 目錄中歸類爲 admin-security。引擎爲隨包提供的純標準庫 Python 模塊 opc_truth(位於 python/),要求本機 Python ≥ 3.11 且在 PATH 上可用。
核心功能¶
- 三種運行模式(配置項
mode):off關閉;shadow僅記錄校驗結果(默認);gate在文檔語義上用於更強約束(具體攔截行爲以實現爲準)。 - 回執對照:針對 agent 聲明與已發生的工具執行回執做一致性檢查,而非僅信任自然語言輸出。
- 可配置校驗參數:協議要求、循環上限、超時等見下文配置節。
- DSH 版本:聲明兼容 DSH 0.2.1-rc.3 與 0.2.1-rc.4;
package.json中engines.dsh爲>=0.2.1-rc.3 <0.3.0-0,Node ≥ 20。
安裝與啓用¶
安裝前請確認 DSH 版本落在上述區間,並已安裝 Python 3.11+。官方 README 給出的安裝方式如下(<profile> 替換爲你的 DSH profile 名):
# from npm (preferred)
dsh plugin --profile <profile> add @zakza/dsh-truth-gate
# or local tarball / checkout
dsh plugin --profile <profile> add ./zakza-dsh-truth-gate-0.1.0.tgz
dsh plugin --profile <profile> add ./dsh-truth-gate
插件通過 cordis.patch.yml 注入 Harness;當前 npm 版本爲 0.1.0,許可證 MIT。
在 cordis.patch.yml 或插件配置中可設置:
# cordis.patch.yml / plugin config
mode: shadow # off | shadow | gate
python: python # interpreter
requireProtocol: true
loopLimit: 3
timeoutMs: 15000
mode:默認shadow,適合先上線觀察校驗日誌而不改變 agent 決策。python:用於調用內置opc_truth的解釋器命令。requireProtocol、loopLimit、timeoutMs:控制校驗協議與資源邊界,按環境收緊或放寬。
典型用法¶
倉庫提供 PowerShell 冒煙腳本,用於在指定 profile 下做快速驗證(示例 profile 名爲 truthgate-dev,可按本地改名):
powershell -ExecutionPolicy Bypass -File scripts/smoke.ps1 -ProfileName truthgate-dev
日常使用時,建議先在 shadow 下跑真實任務,對照 Harness 日誌與插件記錄,確認「陳述 vs 回執」的差異模式,再評估是否切換到 gate。具體 hook 時機與 gate 行爲以倉庫 lib/ 與 cordis.patch.yml 爲準。
適用場景與注意¶
適合:需要在 DSH 會話裏審計 agent 是否「說一套做一套」的團隊;希望在啓用強攔截前先 Shadow 觀測的 admin / security 場景(與目錄分類 admin-security 一致)。
注意:
- 插件與 DSH 進程同權限運行,安裝前應閱讀 GitHub 源碼 與 MIT 許可證,確認符合組織安全策略。
- npm 包名爲
@zakza/dsh-truth-gate,與 GitHub 組織路徑Achi-Migo並存,安裝與排錯時以 README 命令爲準,勿自行拼接未文檔化的github:owner/repo安裝串。 - SkillHub 目錄頁(plugins/Achi-Migo/dsh-truth-gate)爲社區索引,與 DeepSeek / 幻方無官方從屬關係;DSH 生態理念是「一切皆插件」,本文事實以倉庫 README 與
package.json爲準。
結尾¶
dsh-truth-gate 把「agent 說了什麼」和「工具回執證明了什麼」拆開對照,默認 shadow 降低誤攔風險。若要進一步瞭解說明與 issue,見 SkillHub 目錄頁 與 GitHub 倉庫。