前言¶
DeepSeek Harness(DSH)默認只能與自身進程內的子代理協作。當需要把任務交給 Claude Code 或 Codex CLI / Desktop 時,往往只能通過文件來回傳遞,容易丟失上下文,也難以統一控制模型、推理強度和上下文範圍。
dsh-peer 插件讓 DSH 與 Claude Code / Codex 在同一對話線程中雙向通信,同時支持爲對等方指定模型、推理強度(reasoning_effort)和上下文(cwd、系統提示、文件列表等)。
這是什麼¶
這是一個運行在 DSH 主機進程內的插件,用於在 DSH、Claude Code、Codex CLI 和 Codex Desktop 之間建立 peer 橋接。插件內部提供五個面向模型的工具,並驅動對應的 CLI 或應用;同時提供零依賴的 peer CLI 和 cross-harness-peer skill,讓 Claude Code 和 Codex 能夠調用橋接並繼續對話。
維護者:caelricluo。
核心功能¶
- 雙向通信:DSH ↔ Claude Code / Codex CLI / Codex Desktop,支持實時 DSH 會話。
- 線程機制:追加式消息日誌,支持光標、長輪詢、恢復和關閉;會話可跨重啓。
- 明確路由控制:可指定 model、reasoning_effort 和豐富的 context(cwd、system/append prompt、文件、resume id、額外目錄)。
- 零運行時依賴:插件、橋接、存儲、適配器、CLI 均僅使用 Node.js 內置模塊。
- 迴環綁定:僅綁定 127.0.0.1;令牌位於 ~/.dsh-peer/bridge.json,權限 0600。
- 測試覆蓋:node –test 覆蓋存儲、HTTP 橋、CLI、適配器和 Cordis 插件生命週期。
安裝與啓用¶
從倉庫根目錄執行:
bash install.sh --profile desktop
安裝順序爲:
- peer CLI → ~/lib/dsh-peer/ + launcher ~/bin/peer(當 ~/.local/bin 存在時,會創建 ~/.local/bin/peer 符號鏈接)
- cross-harness-peer skill → ~/.claude/skills/ 和 ~/.codex/skills/
- 插件包 → dsh plugin –profile
add “link:$PWD”
安裝完成後退出並重新打開 DSH,啓動 Claude Code / Codex 以加載 skill,然後驗證:
peer doctor
peer status --json
典型用法¶
DSH → 另一 harness¶
peer_ask {
"harness": "codex-desktop",
"prompt": "Review lib/bridge.js for auth bypasses. Findings only.",
"model": "gpt-6-astra",
"reasoning_effort": "high",
"context": {
"cwd": "/path/to/project",
"files": ["lib/bridge.js"],
"append_system": "Be terse."
},
"timeout_seconds": 600
}
繼續同一對話:
peer_ask { "harness": "codex-desktop", "thread_id": "thr_…", "prompt": "Now fix finding 2." }
peer_send { "thread_id": "thr_…", "text": "Run the tests." }
peer_wait { "thread_id": "thr_…", "after": 2, "wait_seconds": 300 }
peer_thread{ "action": "list" }
Claude Code / Codex → DSH¶
peer ask --to dsh --effort high --cwd "$PWD" --file lib/store.js \
"Is the retry policy safe? Cite lines."
對話 DSH 會話(需要先獲取 session id):
peer status --json
peer ask --to dsh --session session-… --effort low "Reply with exactly OK."
繼續對話(使用 thread id):
peer ask --to dsh --json "…" > /tmp/peer.json
peer send --thread thr_… --wait 300 "Now propose the patch."
peer read --thread thr_… --wait 300
連接已有 Codex Desktop 線程:
peer ask --to codex-desktop --resume 01a16633-… "Continue that plan."
DSH 工具¶
- peer_status:顯示主機、適配器(可用性/模型/effort)、最近線程。
- peer_ask:啓動線程,返回 thread_id + 回覆文本。
- peer_send:向指定線程追加消息。
- peer_wait:獲取新消息並更新光標。
- peer_thread:操作線程列表或獲取/關閉線程詳情。
CLI 參考¶
peer status [--json]
peer ask --to <harness> [options] <prompt>|
--model M --effort E --cwd DIR
--system TEXT|@FILE --append-system TEXT|@FILE
--file PATH (repeatable)
--session S # dsh only: live DSH session
--thread T # continue a dsh-peer thread
--resume ID # remote session id (codex-desktop UUID, claude/codex session)
--wait SECONDS # 默認 300;0 表示僅發送不等待
peer send --thread T [--wait SECONDS] <prompt>|
peer read --thread T [--after N] [--wait SECONDS] [--follow]
peer threads [--json]
peer close --thread T
peer doctor [--json]
peer help
退出碼:
- 0:成功
- 1:用法或其他錯誤
- 2:橋接不可達
- 3:未授權
- 4:遠程輪次失敗
peer doctor 狀態碼:
- 0:健康
- 2:不可達/不健康
- 3:缺少或拒絕令牌
模型、effort 和 context 對應關係¶
| Knob | CLI | DSH tool | 說明 |
|---|---|---|---|
| harness | –to dsh|claude|codex|codex-desktop | harness | 啓動線程時必需 |
| model | –model M | model | 與 harness 相關;可用 peer status –json 查詢 |
| reasoning effort | –effort E | reasoning_effort | 取值 low|medium|high|xhigh|max;支持程度因 harness 而異 |
| cwd | –cwd DIR | context.cwd | 對等方的項目根目錄 |
| system prompt | –system TEXT|@FILE | context.system | 會替換對等方的系統提示 |
運行位置與需求¶
| 組件 | 運行位置 | 需求 |
|---|---|---|
| dsh-peer 插件 + 橋 | DSH 主機進程 | DSH Web/Desktop,Node >= 20 |
| 線程存儲 | ~/.dsh-peer/(可覆蓋 DSH_PEER_HOME) | 可寫入的 home 目錄 |
| peer CLI | 任意 shell(Claude Code / Codex Bash 工具) | 純 node >= 20,無 npm 依賴 |
| cross-harness-peer skill | ~/.claude/skills/、~/.codex/skills/ | Claude Code 和/或 Codex |
| Claude Code 適配器 | 子 claude 進程 | claude 可用且已登錄 |
| Codex 適配器 | 子 codex exec 進程 | codex 可用且已登錄 |
| Codex Desktop 適配器 | 子 codex app-server(JSON-RPC over stdio) | codex 二進制;共享桌面線程存儲 |
| DSH 適配器 | 進程內 DSH 子代理 | 運行的 DSH 主機 |
適用場景與注意¶
- 適合需要在 DSH 與 Claude Code / Codex 之間保持連續上下文、統一控制模型與推理強度的場景。
- 插件以當前 DSH 進程權限運行,安裝前請檢查源碼與許可證。
結語¶
dsh-peer 讓 DSH 與 Claude Code / Codex 在同一對話線程中雙向通信,並支持對模型、推理強度和上下文的顯式控制。更多細節可查看社區目錄與 GitHub 倉庫。