前言¶
在 DeepSeek Harness(dsh)裏讓智能體改代碼,常見問題是:還沒讀清任務和測試就動手、 diff 裏夾帶無關重構、爲了過關改測或猜隱藏用例,最後報告也說不清根因和驗證命令。社區插件 dsh-coding-discipline(維護者 JinBeiCN,分類:工作流)不增加新工具、也不改權限,而是用 Coding 預設 persona 和可加載的 coding-discipline skill,把「先復現再改、最小改動、跑倉庫真實驗證、用證據收尾」寫成同一套契約。下面介紹它是什麼、怎麼裝、怎麼用,以及 README 裏對行爲與 benchmark 的說明。
這是什麼¶
dsh-coding-discipline 是面向 DeepSeek Harness 的編碼紀律增強包,當前版本 1.0.0(MIT 許可證)。插件由兩塊協同工作:
Codingagent preset(id: coding)——與 shipped 的standard預設使用相同工具列表,但 persona 強調 verify-first edits、minimal diffs、real test runs、不做 test gaming、僅按 spec 驗證、evidence-based reports;可隨時切回 baseline,因爲無新工具、無權限變化。- 內嵌
coding-disciplineskill——預設背後完整流程,在 host 層註冊,profile 內任意 agent 可按需從 skill 目錄發現加載;同名 project/user skill 仍按 rank 優先。
簡介原文:Coding agent preset + embedded coding-discipline skill for DeepSeek Harness: verify-first edits, minimal diffs, real test runs, evidence-based reports.
目錄頁:https://www.skillhub.cn/plugins/JinBeiCN/dsh-coding-discipline
源碼與文檔:https://github.com/JinBeiCN/dsh-coding-discipline
契約覆蓋哪些行爲¶
persona 與 skill 兩層表述同一規則,要點如下:
- 改代碼前先讀任務、驗收標準、測試與相關代碼;先復現失敗,並把根因寫成
file:line。 - 做最小改動,保持公開接口,不做無關重構或大面積格式化。
- 不得編輯、刪除、弱化、跳過或 xfail 測試,不得硬編碼期望值。
- 使用 API、import、參數前,須在倉庫或已安裝依賴中有據可查。
- 最後一次編輯後運行倉庫規定的真實驗證命令,不通過則迭代直到通過。
- 只依據倉庫內 spec/tests/code 驗證;不猜測隱藏測試、grader 或 benchmark;不讀父/兄弟目錄或 git history 找提示。
- 驗收條款較多(約 15 條以上)時,維護 clause → implementation → verification 清單;性能/併發類工作測一次證據即可,不必反覆壓測循環。
- 結束時給出證據:改動文件、根因、帶觀測結果的精確命令、未驗證部分與風險。
核心功能(已覈實)¶
| 能力 | 說明 |
|---|---|
| Coding 預設 | 與 standard 同工具集,強化編碼紀律 persona |
| coding-discipline skill | 7,600 字符正文(含 frontmatter 共 7,923),低於 standard 預設 8,000 字符 skill 預算;僅在會話加載 skill 時計費 |
| Persona 體量 | 約 325 詞,僅在選擇 Coding 預設的會話中按請求計費 |
| 插件形態 | Cordis 插件:index.js 導出 name、inject、apply;cordis.patch.yml 掛載 host 行並註冊 Coding 預設;無 build、無運行時依賴 |
README 中的 Measured behaviour:在自研 16 任務 coding benchmark 上,對未注入 baseline 與增強版各 18 次隔離運行(deepseek-flash,reasoningEffort=max), solved rate 均爲 15/16;增強側 18/18 觀察到注入指令且加載 skill,無 run 篡改測試或讀工作目錄外路徑;token 與 wall-clock 差異無統計顯著性。作者結論:這是 guardrail 而非能力 booster——改變做法與報告方式,對較弱模型、較低 reasoning effort、長 spec 或重 review 交付更有價值;在已有 benchmark 上未讓已飽和模型產出更多正確代碼。
安裝與啓用¶
環境要求:dsh >=0.2.1-rc.2,Node.js >=18。Web / Desktop 且具備 agent-preset registry 的 profile 可加載預設(默認 web profile 需已有 shipped standard 預設)。Headless/ACP profile 無 preset registry,不加載預設部分;內嵌 skill 在 bundle host 行掛載處仍可註冊。
默認從 npm 安裝到 web profile:
dsh plugin --profile web add dsh-coding-discipline
從 GitHub 安裝:
dsh plugin --profile web add github:JinBeiCN/dsh-coding-discipline
若上述途徑不可用,可用 release 壓縮包:
dsh plugin --profile web add https://github.com/JinBeiCN/dsh-coding-discipline/releases/download/v1.0.0/dsh-coding-discipline-1.0.0.tgz
卸載:
dsh plugin --profile web remove dsh-coding-discipline
禁用或移除 bundle 不會改動已有會話,需重建會話後生效。
典型用法¶
安裝完成後可按 README 兩種方式使用:
- 新會話:在 agent-preset 選擇器中選 Coding;若希望默認使用該預設,可在 Settings → General(Agent preset)中設置。
- 任意會話:在 skill 目錄中找到
coding-discipline,在編碼工作前加載;與是否選 Coding 預設獨立——skill 對 profile 內任意 agent 可用。
安裝不會自動改寫已有會話;只有新建會話或手動加載 skill 纔會應用契約。
適用場景與注意¶
適合:希望 agent 改代碼時遵守倉庫內驗證、少動測試、報告帶可複覈證據的團隊或個人;長驗收清單、review 重的交付流程。
注意:
- 插件以當前
dsh進程權限運行,安裝前請閱讀源碼與 MIT 許可證,確認符合你的安全與合規要求。 - 社區目錄 skillhub.cn 爲獨立站點,與 DeepSeek / 幻方無官方從屬關係;DSH 生態理念是「一切皆插件」,本文事實以 GitHub README 與 package.json 爲準。
- 不要指望單靠該插件在同等 benchmark 上提高 solved rate;其價值在於過程與報告紀律。
結尾¶
dsh-coding-discipline 用預設 + skill 雙軌把編碼紀律寫進 DSH,工具面與 standard 對齊,便於 A/B 與回退。需要安裝命令、契約全文與 benchmark 說明時,見 GitHub 倉庫 README 與 SkillHub 目錄頁。