Claude Code源代码

Claude Code源代码 参考URL: 如何评价Claude Code源代码泄漏? - 卜寒兮的回答 - 知乎 https://www.zhihu.com/question/2022392127145911515/answer/2022520709964931142 总结:值得借鉴的设计模式 模式 在 Claude Code 里的体现 可借鉴的场景 AsyncGenerator 作为流式原语 query() 的整体结构 任何需要流式输出 + 可中断的 agent 分层错误恢复 五层上下文压缩策略 资源受限下的 long-running task 流式并发工具执行 StreamingToolExecutor 多工具并行调用的 agent 投机性预计算 startSpeculativeClassifierCheck 任何有必然后续操作的流程 工具自声明并发安全性 isConcurrencySafe() 接口 混合读写操作的任务编排 Forked Agent 共享缓存 CacheSafeParams + compact agent 需要 fork 子任务但不想丢失 prompt cache Hook 与主循环解耦 Post-sampling / stop hooks 任何需要插入评估逻辑的 agent 系统 回到上面那句话:harness 编码了对”模型不能独立完成什么”的假设(“the harness itself encodes assumptions about what models cannot do independently”。) ...

April 15, 2026 · 1 min · 76 words · WY