English reading guide

DeepSeek Harness Source Code Guide: From Input to Agent Platform

A source-based guide to the official DeepSeek Harness repository at a fixed commit. Start with a terminal command or a browser message, follow it through the inbox and agent loop, and inspect how execution events support model context, persistence, and user interfaces.

Source version: 47f943859bef60e4160492346772ded9b24f765a

What you will learn

The complete chapters are written in Chinese and include source references, implementation walkthroughs, and failure cases. This page is an English introduction, not a translation of the full book.

Chapters in Chinese

  1. 从敲下 dsh 到补丁栈组装完成
  2. Cordis:不是依赖注入,是生命周期状态机
  3. Agent 和 Session 共用一个身份证——但 Headless 和 Web 走的不是同一条路
  4. Agent、Session 和那个共用的身份证
  5. 为什么 Web 新建会话不是 CLI 的前端按钮
  6. Inbox 双队列:消息不是直接进模型的
  7. turn/start 之前:谁有权开始新一轮
  8. System Prompt 四层组装
  9. 历史从事件日志重建,不是从聊天界面
  10. LLM Service、流式 chunk 与 BlockAssembler
  11. 流式响应:chunk 怎样变成消息
  12. Retry、Abort 与 turn 结账
  13. 工具调度器与注册域
  14. 工具注册和作用域:谁能看到什么工具
  15. 工具参数校验与并行执行池
  16. 并行工具调用:顺序和屏障
  17. 审批三件套:Permission、Approval、AskUser
  18. Bash、Subprocess 和 PTY:各管哪段生命周期
  19. 结果太大了:Spill、截断和外溢
  20. append-only Session 与 Event 信封
  21. Event Envelope:每个事件必须带的身份证
  22. Surface 投影:模型看到的历史不等于你看到的
  23. 投影(Projection):同一份日志长出不同状态
  24. JSONL 原子写与崩溃恢复
  25. Resume、Fork、Compaction——上下文改写术
  26. Goal 为什么是事件流而不是字段
  27. Phase、Revision、Round——三道演化闸门
  28. Plan、Todo、Schedule——Goal 的三个邻居
  29. Subagent 出生与 lineage 管理
  30. Parent Mailbox:父 Agent 怎样接住子 Agent 的结果
  31. Workflow:Worker 线程里的脚本编排
  32. 收束:Cancel、Dispose 和多 Agent 清理
  33. Capability Seam 与 cordis.yml 组合
  34. cordis.yml 怎样声明可替换的组合
  35. Skills:发现、装载和上下文注入
  36. MCP 工具注册与 Repository Plugin
  37. Repository Plugin 和 Self-modification
  38. Agent Preset:给单个会话换一套运行时
  39. Headless CLI 与 JSON-RPC Server——两种产品面
  40. JSON-RPC Server:长期进程的暴露方式
  41. TypeScript 和 Python SDK 共享一套协议
  42. ApiProxy 与 SDK:Web 的控制面和客户端协议
  43. Conversation UI:消费事件但不冒充事实源
  44. 凭证隔离、Telemetry 与 Mock 测试
  45. Telemetry 不能反过来定义会话
  46. Trajectory、Query 和 Replay
  47. Mock LLM 和 Snapshot 测试
  48. Invariant:每个包都有自己的守卫
  49. 安全分层:Trust、Permission、Sandbox、Network
  50. 从一个 commit 到下一版:这本书怎样更新