DeepSeek Harness 源码教程
DEEPSEEK HARNESS · OFFLINE TUTORIAL

13 · 自测与进阶

检验是否真正吃透

1. 四级理解

级别标准
Level 1会启动和配置
Level 2能追 user → inbox → turn → step → llm → tools → turn end
Level 3能写 Tool、Adapter、Policy、Provider、SessionEvent、Scoped capability
Level 4能设计新 Harness capability 并找对 seam

2. 12 道题

  1. 为什么不把所有功能写进 Agent?——composition / replaceability / scope / lifecycle。
  2. 为什么 Permission 更适合 Event/Guard?——policy/mechanism separation。
  3. 为什么 ctx.fs 比 LocalFilesystem 更重要?——Definition/Provider separation。
  4. 为什么 Agent Loop 也可以是插件?——loop strategy 可替换。
  5. 为什么 Message[] 不是事实源?——不能完整表达 execution lifecycle。
  6. 为什么 assistant chunk 值得记录?——replay / UI / fidelity。
  7. 为什么工具并发,但 durable result ordering 要谨慎?——避免调度时序污染模型历史。
  8. 为什么 compaction 不直接删旧消息?——append-only event sourcing。
  9. 为什么 Persistence 不属于 core Session?——storage 是 replaceable seam。
  10. 什么时候创建 SessionEvent?——reload 后仍必须存在的事实。
  11. 什么时候使用 agent/*?——观察或拦截 live agent execution。
  12. 什么时候才改 Agent Loop?——所有 Agent 共享的 generic control-flow 且现有 seam 无法表达。

3. 最终设计题

新增 browser-computer capability,同时支持本地 Chrome 和远程 Browser:

Browser Service Definition
        │
        ├─ Local Chrome Provider
        └─ Remote Browser Provider

Browser Policy Events
        │
        ▼
permission / sandbox plugins

Model-facing browser tools
        │
        ▼
ctx.browser
能独立画出运行时图、能追一次 Turn、能解释核心不变量、能给新能力找对 seam、能自己写出 mini-DSH,才算真正“吃透”。