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
- Trace messages from terminal and browser inputs through the inbox.
- Understand execution events, persistence, context, and interface projections.
- Study tool governance, goals, multiple agents, Cordis, MCP, and the SDK.
- Examine security boundaries and the verification of runtime behavior.
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
- 从敲下 dsh 到补丁栈组装完成
- Cordis:不是依赖注入,是生命周期状态机
- Agent 和 Session 共用一个身份证——但 Headless 和 Web 走的不是同一条路
- Agent、Session 和那个共用的身份证
- 为什么 Web 新建会话不是 CLI 的前端按钮
- Inbox 双队列:消息不是直接进模型的
- turn/start 之前:谁有权开始新一轮
- System Prompt 四层组装
- 历史从事件日志重建,不是从聊天界面
- LLM Service、流式 chunk 与 BlockAssembler
- 流式响应:chunk 怎样变成消息
- Retry、Abort 与 turn 结账
- 工具调度器与注册域
- 工具注册和作用域:谁能看到什么工具
- 工具参数校验与并行执行池
- 并行工具调用:顺序和屏障
- 审批三件套:Permission、Approval、AskUser
- Bash、Subprocess 和 PTY:各管哪段生命周期
- 结果太大了:Spill、截断和外溢
- append-only Session 与 Event 信封
- Event Envelope:每个事件必须带的身份证
- Surface 投影:模型看到的历史不等于你看到的
- 投影(Projection):同一份日志长出不同状态
- JSONL 原子写与崩溃恢复
- Resume、Fork、Compaction——上下文改写术
- Goal 为什么是事件流而不是字段
- Phase、Revision、Round——三道演化闸门
- Plan、Todo、Schedule——Goal 的三个邻居
- Subagent 出生与 lineage 管理
- Parent Mailbox:父 Agent 怎样接住子 Agent 的结果
- Workflow:Worker 线程里的脚本编排
- 收束:Cancel、Dispose 和多 Agent 清理
- Capability Seam 与 cordis.yml 组合
- cordis.yml 怎样声明可替换的组合
- Skills:发现、装载和上下文注入
- MCP 工具注册与 Repository Plugin
- Repository Plugin 和 Self-modification
- Agent Preset:给单个会话换一套运行时
- Headless CLI 与 JSON-RPC Server——两种产品面
- JSON-RPC Server:长期进程的暴露方式
- TypeScript 和 Python SDK 共享一套协议
- ApiProxy 与 SDK:Web 的控制面和客户端协议
- Conversation UI:消费事件但不冒充事实源
- 凭证隔离、Telemetry 与 Mock 测试
- Telemetry 不能反过来定义会话
- Trajectory、Query 和 Replay
- Mock LLM 和 Snapshot 测试
- Invariant:每个包都有自己的守卫
- 安全分层:Trust、Permission、Sandbox、Network
- 从一个 commit 到下一版:这本书怎样更新