内部技术报告 · 官方源码对照

deepseek-harness(官方) vs art-harness chat-assistant
能力对照与优化建议

对照 DeepSeek 官方开源的 deepseek-harness(github.com/deepseek-ai/deepseek-harness,Cordis「一切皆插件」架构,developer preview)。第三份 DSH 报告基于第三方逆向,本报告用官方源码验证并修正其推断。deepseek-harness 是本地单机开发者工具,art-harness 是多租户内部 IM 服务 —— 定位不同,价值评估剔除单机独占部分。

deepseek-harness:官方源码(54 packages) 架构:Cordis 插件(everything is a plugin) art-harness:mvp2/chat-assistant 生成:2026-08-13

1官方 vs 第三份逆向报告

第三份 DSH 报告基于泄漏截图 + 部分源码反推;本报告用官方源码验证,修正几处推断。

第三份报告推断官方源码验证
「遥测一等公民」(turns/steps/cache hit 66%)✅ 确认官方 ui-trajectory 有 TTFT + cacheRead/Write 分桶 + contextBreakdown,比逆向看到的更全
「无内置 turn budget」✅ 确认官方明确 "No built-in turn budget",policy 走 agent/turn-stopping 插件
「translate.ts 协议翻译」✅ 基本确认官方有 llm-deepseek(官方 SSE adapter)+ llm-pi-ai(多 provider)
「verify / checkpoint」❌ 修正官方无独立 verify —— goal 是模型自报 complete/blocked("No independent evaluator");checkpoint 仅是 session persistence
「Cordis 4.0 插件引擎」✅ 确认且更深官方 vendored Cordis,「everything is a plugin」,连 agent loop 本身都是插件
最大修正:第三份报告把 DSH 描述为有「verify 阶段」,实际官方没有独立验证 —— goal 包明确 "the caller that records completion or blocking is authoritative; evaluator-backed certification is deferred"。这与 art-harness 缺「独立验证」是同一个缺口,谁也借鉴不了谁,需各自自研。

2核心范式(官方源码)

官方架构(docs/architecture.md + AGENTS.md)提炼的四个范式,是它和 art-harness 的根本差异。

① Everything is a plugin(Cordis)

插件向 shared context contribute services / typed events / reversible effects。无 privileged core —— model adapter、tool registry、session log、agent loop 本身都是插件,全部可从配置替换。

There is no privileged core to patch: you extend dsh by mounting a plugin beside the others, and registrations are effects that unwind when their plugin unloads.

② Model-visible logged

session log 是唯一 authority。任何进 model request 的东西必须能从 log 重建;新增 model-visible input 必须新增 SessionEvent。fork / resume / transcript / telemetry 全从这条流 derive。

③ Loop engineering(loop 内逻辑最小化)

agent-loop 只有 496 行,全事件化扩展点。新行为挂到 documented extension points,改 loop 必须更新 architecture.md。policy(限流/恢复/验证)全走插件,不内建。

④ Capability seam 三角

一个 capability = Service Definition(接口)+ Service Provider(实现)+ Consumer(常用是 model-facing tool)。换 provider 不改 consumer。加能力必须设计三角。

对 art-harness 的启示:art-harness 把大量逻辑内建在 Go loop(compaction/steering/budget/cache),deepseek-harness 把 loop 压到最小、全走插件。这是两种工程哲学。art-harness 不必移植 Cordis(Go + 多租户移植成本极高),但可借鉴:capability seam 三角拆分typed events 三语义配置层叠覆盖

3能力对照总表

逐项对照,标注对 clawbot 替换价值。

能力deepseek-harnessart-harness对 clawbot 价值
MCP 客户端完整 stdio+http,重连,HMR
中间件抽象(typed events)agent/*+tools/* 全事件化自研 Hooks seam
compaction 精细度routed policy + KV cache 复用summary/prune中高
遥测细度TTFT + cache 分桶 + breakdowndur_ms/iterations/ratio
HITL / 审批 seamapproval + ask-user
code runtime 多后端worker-thread + E2Bexec local/none中高
Extensions 自修改 runtimetool-cordis低(风险高)
LSP 集成4 操作只读
ACP 协议automation server
goal 长时程跟踪event-sourced + round-driver
plan/todo 工具plan-mode + todo_write
guard(repeat-reminder)advisory + timeout
background jobsowner-isolated + wakecron低中
独立验证(模型自报)共同缺口,需自研
message 工具(WEA 主动发)(只有 ask-user)art-harness 需自研
多租户/鉴权/配额(单机)art-harness 自有优势

4MCP 客户端(最高价值)

deepseek-harness 有完整 MCP 客户端,art-harness 无 —— 这是六份对照里反复出现的缺口,官方实现可直接借鉴。

deepseek-harness MCP

  • stdio + streamable-http 两种 transport
  • 工具命名 mcp__<server>__<tool>(与 Claude Code/Codex 同形)
  • 自动重连(exponential backoff,budget per outage)
  • notifications/tools/list_changed re-sync
  • HMR hot-swap(不重启换 server)

对 art-harness 价值:高

MCP 生态(数据库、API、内部系统连接器)对多租户 IM 助手扩展工具集价值高 —— clawbot 284 个 skill 里部分可 MCP 化,免自研每个集成。官方实现的 namespace 规则、重连 backoff、list_changed re-sync 可用 Go 重新实现。
这与 xagent / DeerFlow / AgentScope 报告的 MCP 结论一致(都标 P2 可选辅),但官方 deepseek-harness 的实现细节(重连/HMR)是最成熟的参考。

5中间件抽象(typed events)

deepseek-harness 的 typed events + 三语义(waterfall/serial/emit)是比 art-harness Hooks seam 更系统的中间件抽象。

事件语义deepseek-harness用途
waterfall(listener 调 next() 委托)agent/pre-step / agent/request / llm/stream / tools/pre-execute / tools/execute / tools/post-execute可改写/拒绝/重试
serial(无 next)agent/turn-stopping顺序观察,限流 policy 在此 cancel
emit(detached)session events持久事实,append-only log
对比 art-harness:art-harness 的 Hooks seam(8 个 typed 方法)是单向观察(OnToolCallStart/End 等),不能改写/拒绝/重试。deepseek-harness 的 waterfall 让中间件能 reject pre-step、deny/ask pre-tool、retry request-error —— 这是「中间件能干预决策」而非「只观察」。
建议:art-harness 缺「中间件抽象」是六份报告共识。deepseek-harness 给了最成熟的设计:waterfall(可干预)+ serial(观察)+ emit(持久)三语义 + 每点 typed Decision。可在 Go loop 上引入类似事件点,让 DeerFlow 的 loop_detection / result sanitization / LongHorizon 的产出自检 都以中间件形式挂入,不侵入 loop。

6compaction 精细化

deepseek-harness 的 compaction 比 art-harness 更精细,三个点可借鉴。

能力deepseek-harnessart-harness
KV cache 复用 summarize 时直接 ctx.llm.stream() 重放 prefix 复用 cache
routed policy按 provider/model 不同容量单一 triggerRatio
两阶段剪枝prune-then-summarizesummary 或 prune 二选一
overflow recoveryagent/request-error 路径422 context_overflow
人类命令/compact
建议(中高):借鉴 KV cache 复用(compaction summarize 重放 prefix,省成本)+ prune-then-summarize 两阶段(先剪 oversized tool result 再 summarize,减少 summarize 输入)。clawbot 84.4% cache 命中,compaction 时复用 cache 能进一步省钱。

7遥测细度(TTFT / cache 分桶)

deepseek-harness 遥测比 art-harness 刚加的 SSE 遥测更细,几个指标可直接借鉴。

指标deepseek-harnessart-harness(已加)
TTFT(首 token 时延) Assistant span 分 TTFT vs decoding
cacheRead/cacheWrite 分桶 tokenUsage projectioncache_read/write 已有,ratio 已加
contextBreakdownsystem/tools/message tokens 分桶
contextPressure projectionlive pushcontext_ratio(已有)
iterations(无迭代预算)
OTel 导出session-telemetry-otelOpik
建议(高):art-harness 已加 dur_ms/iterations/context_ratio/cache_hit_ratio(本分支),下一步可加 TTFT(流式首 token 时延,UX 关键)+ contextBreakdown(system/tools/message 分桶,定位 context 膨胀来源)。这两个是 deepseek-harness 比 art-harness 细的地方。

8ask_user_question 与 HITL

deepseek-harness 有完整 HITL seam,其中 ask_user_question 对 art-harness 的 message 缺口有直接参考价值。

deepseek-harness HITL

  • ask_user_question 模型工具(questions/options/multi_select)
  • user-approval one-shot 审批(fail closed)
  • permission-presets(sandbox mode + approval 捆绑)
  • commands slash 命令注册/派发

对 art-harness 价值

art-harness 缺 message 工具(WEA 主动发)是 P0。deepseek-harness 的 ask_user_question 是「模型主动向用户提问」—— 虽不是「主动发 IM」,但「模型主动发起对话」的交互模式对 art-harness 的 message 工具设计有参考:模型在 loop 中调一个工具向用户发问/发产物,而非等 run 结束。
slash commands 对 IM UX 也有用(art-harness 已有 /new /reset,可再借鉴注册/派发模式)。

9共同缺口:独立验证

最重要的发现 —— deepseek-harness 也没有独立验证,与 art-harness 是同一个缺口,谁也借鉴不了谁。

deepseek-harness 官方明确:"No independent evaluator — the caller that records completion or blocking is authoritative; evaluator-backed certification is deferred"(goal 包 Known Limitations)。即 goal 完成与否由模型自报,无独立 Auditor 验证。
art-harness 同样:loop 只看工具 IsError,不验证产出正确性(本次 BTC 报告事件就是 agent 流程对但最后超时,无验证兜底)。LongHorizon 报告识别的「Auditor 独立验证」在 deepseek-harness 也缺。
结论:「独立验证」是行业共同未解难题,不是 art-harness 独有短板。art-harness 若要做,需自研(参考 LongHorizon 的 Auditor 角色 + DeerFlow 的产出自检),不能指望借鉴 deepseek-harness。

10不值得借鉴的

deepseek-harness 有些能力对多租户 IM 助手不适用或风险高,明确不借鉴。

能力为何不借鉴
LSP 集成(代码导航)IM 助手很少做代码导航,价值低
Extensions 自修改 runtimeagent 动态 mount/unmount 自身插件,多租户下风险极高
CC/Codex hooks 桥接IM 助手不接 Claude Code/Codex hooks
session-local scheduleart-harness 的全局 cron 更适合多租户
单机 identity/credentialsharness home 模型,多租户需自建(art-harness 已有)
Cordis 插件系统整体Go + 多租户移植成本极高,只借鉴 seam/层叠哲学

11优化优先级

综合官方 deepseek-harness 价值 + clawbot 场景,排定优先级。

P1 · 工具生态

① MCP 客户端

借鉴:namespace 规则 mcp__<server>__<tool>、自动重连 backoff、list_changed re-sync、HMR。用 Go 重新实现。

价值:clawbot 284 skill 部分可 MCP 化,免自研每个集成。六份报告共识缺口,官方实现最成熟。

P1 · 架构

② 中间件抽象(waterfall/serial/emit 三语义)

借鉴:typed events + 三语义 + 每点 typed Decision,让中间件能干预(reject/deny/retry)而非只观察。

价值:art-harness 缺中间件抽象是六份报告共识;这是让 DeerFlow/LongHorizon 的防御/验证能力以中间件挂入的基础设施。

P1 · 成本

③ compaction KV cache 复用 + 两阶段剪枝

借鉴:summarize 重放 prefix 复用 cache;prune-then-summarize。

价值:clawbot 84.4% cache 命中,compaction 复用 cache 进一步省钱。

P1 · 遥测

④ TTFT + contextBreakdown

借鉴:流式首 token 时延(TTFT)+ system/tools/message tokens 分桶。

价值:art-harness 已加 dur_ms/iterations/ratio,TTFT 是 UX 关键,contextBreakdown 定位膨胀来源。

P1 · 交互

⑤ ask_user_question 模式(message 工具参考)

借鉴:「模型主动发起对话」的工具化交互,供 art-harness message 工具(WEA 主动发)设计参考。

P2 · 自研

⑥ 独立验证(无借鉴对象)

deepseek-harness 也缺,需自研(参考 LongHorizon Auditor + DeerFlow 产出自检)。

12七报告综合

报告对照对象补什么层面
clawbot真实流量能力缺失:message/记忆/skill/多模态
xagentAgentScope 薄包装记忆/guardrail/IntentRouter
DSH(逆向)第三方反推遥测一等公民
DeerFlowLangGraph 研究agent治理防御:SkillScan/sandbox/loop_detection
LongHorizonLoop Engineering执行可靠:update_plan/verified checkpoint
AgentScope框架源码框架范式:中间件/事件流/Task
deepseek-harness(本报告)官方源码MCP/中间件三语义/compaction cache 复用/TTFT

一句话总结

官方 deepseek-harness 验证并修正了第三份逆向报告(确认遥测/无 turn budget/插件引擎;修正「无独立验证」)。它对 art-harness 的最高价值是 MCP 客户端(最成熟实现)、中间件三语义(waterfall 可干预)、compaction KV cache 复用TTFT/contextBreakdown 遥测。同时确认「独立验证」是行业共同缺口,art-harness 需自研。七份报告合起来:art-harness 应聚焦内部助手本质,在工具生态/中间件/成本/遥测上借鉴各对象范式,而非移植任一形态。