# Coding with AI · 第 10 讲 > 单个编程智能体 ## Docs - [单个编程智能体](https://codingai-lec10.pages.dev/): Coding with AI · Fall 2026 ## 开场 - [2026-03-31:一个主流编程智能体的 harness 首次完整可见——看结构,不看代码](https://codingai-lec10.pages.dev/a-window-opens): 以前讲智能体,只能讲开源的小系统和论文里的系统;这是第一次能看清一个几十万开发者天天在用的 harness 在某一刻长什么样——管中窥豹。 - [100 行就能修 bug,另外约 50 万行在做什么?](https://codingai-lec10.pages.dev/two-codebases): 两份代码都能修一个 bug,差的不是“能不能修”。 - [harness 是因变量:随模型能力与人的需求而变——先写下你的预测](https://codingai-lec10.pages.dev/static-vs-dynamic): 你们都用过编程智能体,多半是第一种看法。 ## 全貌 - [核心循环只有三步:收集上下文、行动、验证,直到不再调用工具](https://codingai-lec10.pages.dev/three-step-loop): L01 的“做事系统”:看、做、验——这就是最小的做事系统;L07:验证不是附加的,是循环的一段。 - [Claude Code 全貌:循环外八层,每层对应一个不变的问题](https://codingai-lec10.pages.dev/the-whole-map): 这张图是静态的地图;后面要让它动起来。 - [约 50 万行的大头在外层,循环本身很小](https://codingai-lec10.pages.dev/inside-the-shell): 数字是报道方的口径(另有约 16.3 万行 TypeScript 的说法),只看数量级。 - [八层逐层引出:每一层解决一类失败,也带来下一类](https://codingai-lec10.pages.dev/each-layer-forced): 举一格就够:工具一好用,它就跑得多;跑得多,输出就把窗口撑满——上下文这一层就是这样引出的。 - [对齐三条时间线:harness 的增删都有同期的模型或需求变化](https://codingai-lec10.pages.dev/three-tracks): 只看 harness 轨就是静态地看;三条轨一起看,每个功能都有来由——要么是模型追上来了(删),要么是需求跑到前面去了(加)。 - [harness 补的是需求与模型能力的差距:能力追上就精简,需求领先就新增](https://codingai-lec10.pages.dev/the-gap): 这解释了一个看似矛盾的现象:同一个产品,一边在删、一边在加。 ## 循环 - [2023 年的 1.96%:差在模型,还是差在无法与代码库交互?](https://codingai-lec10.pages.dev/swe-bench-2-percent): 1.96% 不是“模型不会写代码”,是“看不到运行结果、一次写完”这个设定下的数。 - [把控制权交给模型:12.5%、49%,循环随后商品化](https://codingai-lec10.pages.dev/control-to-the-model): 口径要讲清:12.5% 与 49% 不在同一题集上,能说的是方向。 ## 工具 - [约 46 件工具:工具表是设计决策,随模型更替而改](https://codingai-lec10.pages.dev/tool-table): 同一件事,给一件专门的工具还是让它用 bash,是一次次权衡出来的(P14),模型一变,答案就变。 - [同一模型只改工具接口,解决率就差好几个点](https://codingai-lec10.pages.dev/aci-reveal): 只有同模型对照,才能把功劳分给界面。 - [让模型自己搜:先选 grep 而非索引,后把专用搜索并入 Bash](https://codingai-lec10.pages.dev/index-or-grep): 专门工具变少,不是偷懒:模型会用 shell 了,少一轮往返——模型追上来就删。 - [另一种取舍:Pi 只留四件工具,把决定权交还用户](https://codingai-lec10.pages.dev/pi-four-tools): Pi 是 2025-11 出来的,在 Claude Code 演化、泄露以前。 ## 上下文 - [窗口到了 100 万,放什么、何时放进去仍要设计](https://codingai-lec10.pages.dev/whats-in-the-window): L05:窗口有限,注意力被摊薄;L08:上下文工程——放什么、什么时候放、怎么压缩。 - [缓存定价决定上下文顺序:不变的放前面](https://codingai-lec10.pages.dev/prompt-and-cache): L02 回扣:预算。 - [窗口将满时先清工具输出、再压缩;长期规则写进文件](https://codingai-lec10.pages.dev/when-the-window-fills): 这是需求跑到前面的一个例子:任务长过窗口,harness 就得长出压缩。 - [工具说明也占窗口:按需加载、干脆不装、成熟再采纳](https://codingai-lec10.pages.dev/tool-descriptions-cost): 他刻意不要的东西列了一长串:不要 MCP——他举的例子是一个浏览器自动化的 MCP,21 个工具,光说明就占 1.37 万 token;不要子智能体、不要计划模式、不要内置待办、不要后台 bash,默认也不弹权限窗。 ## 验证 - [能用机器检查的,就不靠模型自评](https://codingai-lec10.pages.dev/verify-in-the-loop): L07 讲过验证器决定你能相信什么;这里是 harness 把验证器接进循环的四种方式。 - [进度管理随模型变强而移除,验证因模型会错而保留](https://codingai-lec10.pages.dev/done-is-not-done): L14 预告:怎样量一个组件值不值。 ## 权限 - [权限检查发生在每一次工具调用之前](https://codingai-lec10.pages.dev/a-gate-per-call): 团队说权限是整个产品里最复杂的部分(口述,第一版 P11)。 - [审批疲劳推动权限从弹窗到沙箱,再到分类器](https://codingai-lec10.pages.dev/permissions-sandbox): 97% 是需求曲线的信号:人的注意力成了瓶颈;89% 对 13.6% 是模型曲线的信号:判断这件事模型做得比打瞌睡的人好。 - [检查点只回滚文件编辑;Bash 改动和外部副作用回不去](https://codingai-lec10.pages.dev/rewind-limits): 权限管事前,检查点管事后。 - [人放在循环哪里:层层设防、交给用户、按授权开工](https://codingai-lec10.pages.dev/trust-elsewhere): 10 月 31 号,DeepSeek 发了一篇 super-agent 的设计文,附一个研究原型:面向一个 GitHub 仓库,有授权的人提了请求它才开工,在自己的会话和目录里做,做完回到原来的对话里交结果,比如一个 PR。 ## 记忆 - [跨会话靠外部存储:规则文件、自动记忆、会话记录](https://codingai-lec10.pages.dev/three-memories): L06、L08 回扣:记忆是可写的外部存储。 - [会话正在变成可续跑、可迁移的状态](https://codingai-lec10.pages.dev/sessions-are-assets): 打开 kimi-code 看看:循环和工具运行放在 core;终端界面用的是 pi-tui——就是刚才 Mario 拆出来的那个包,Kimi 把它分叉进来,在 README 里致谢,而且一直跟着上游同步,最近一次是 10 月 22 号;还有一个包专门把 Claude Code 和 Codex 的会话导进来——对手的会话格式,它读得懂。 ## 子智能体 - [子智能体用独立窗口隔离上下文,只交回摘要](https://codingai-lec10.pages.dev/subagent-windows): 第四类失败:一个大任务,一个窗口装不下。 - [agent teams 与 Opus 4.6 同日发布:从一个循环走向多个循环](https://codingai-lec10.pages.dev/subagents-to-teams): 这正是 P09 的上沿:模型撑得住更长的任务,人就要它干更大的活,一个窗口不够,harness 就长出“团队”。 ## 扩展 - [扩展点按上下文成本选:必须成立的规则写成钩子](https://codingai-lec10.pages.dev/hooks-skills-plugins): 第五类失败:每个团队要的不一样。 - [用的人一多,扩展点就变成开放标准](https://codingai-lec10.pages.dev/open-standards): 答案留一半给 P33:竞争者要互通,用户不想被锁住,标准降低了每一家的成本。 - [DeepSeek 选择组装:一切皆插件,连主循环也可替换](https://codingai-lec10.pages.dev/everything-is-a-plugin): 2026 年 8 月 13 号,DeepSeek 发布 DeepSeek-V4 模型的同时,开源了自己的 harness:DeepSeek Harness,MIT 许可证。 ## 演化 - [塑造 harness 的不只厂商:用户、竞争者、开源、标准、价格、安全、评测](https://codingai-lec10.pages.dev/who-shapes-the-harness): 模型和需求是两条曲线,这八只手是把曲线翻译成 harness 的人。 - [七个月后看八层:精简多由模型推动,新增多由需求推动](https://codingai-lec10.pages.dev/fates-table): 着完色会看到:减法多半是模型推的,加法多半是需求推的——这就是 P09 那张图。 - [每出一个新模型,Claude Code 就精简一轮](https://codingai-lec10.pages.dev/delete-with-each-model): 组件一个个新增,团队自己也走到了岔路口:用户要的功能越来越多,加功能,还是删代码? - [怎样证明“四件就够”:先设计对照,再看现有证据的口径](https://codingai-lec10.pages.dev/minimal-evidence): 穿越回 2025 年 11 月。 - [接口不是中性的:模型可能偏好它训练时用过的格式](https://codingai-lec10.pages.dev/interfaces-not-neutral): 这是“换个 harness,模型就变差”这个信号的出处(P41)。 - [版权管得住代码,管不住想法:下架之后是重写](https://codingai-lec10.pages.dev/takedown-and-rewrites): 代码摊开以后,各方的反应本身就是一课。 - [借鉴还是趋同:公开证据能分清多少?](https://codingai-lec10.pages.dev/copy-or-converge): 先有的,不可能是抄泄露的;但可能是看着 Claude Code 的产品形态做的——那是另一种借鉴。 - [新增的复杂度转向权限策略、持久化、并行与人的注意力](https://codingai-lec10.pages.dev/thickness-moves): 还记得泄露报道里那个常驻后台、定时被唤醒的 KAIROS 吗? ## 趋势 - [判断新功能:读信号,问五个问题](https://codingai-lec10.pages.dev/signals-and-five-questions): 这就是“屠龙技”:不是记住今天有哪些功能,而是拿到一个新功能,知道去哪里找它的来由和去向。 - [检验 3·31 的预测,再预测下一个七个月](https://codingai-lec10.pages.dev/check-the-bet): 不追求押中,追求说得出理由;理由就是“不变的问题+变化的自变量”。 - [本课的课件流水线也是一层 harness,同样随模型增删](https://codingai-lec10.pages.dev/our-super-agent): 说一个你们可能没想到的例子:这门课的课件。 - [另外约 50 万行买的是:可靠、可控、可回滚、长时运行、省注意力](https://codingai-lec10.pages.dev/back-to-two-codebases): 回到开场的问题:修同一个 bug,100 行和 50 万行差在哪? - [带走四个做法;第三阶段接着问:人、规模、闭环、证据](https://codingai-lec10.pages.dev/take-home): 第三阶段每一讲都会回到这张图:模型在变,人的需求变得更快,夹在中间的东西怎么办。 ## 动手实践 - [动手实践](https://codingai-lec10.pages.dev/labs): 课程配套实践 ## Agent skills - [coding-with-ai-10](https://codingai-lec10.pages.dev/.well-known/agent-skills/coding-with-ai-10/SKILL.md): Read the Coding with AI · 第 10 讲 docs instead of answering from memory. 单个编程智能体 Use when a task involves Coding with AI · 第 10 讲: how it works, how to set it up or configure it, or its API. ## Agent resources - [llms-full.txt](https://codingai-lec10.pages.dev/llms-full.txt): The full Markdown of every page in one file. - [Page Markdown](https://codingai-lec10.pages.dev/index.md): Append `.md` to any page URL to fetch that page as raw Markdown. - [JSON API](https://codingai-lec10.pages.dev/api/docs/pages.json): Page index of the JSON docs API; each entry links the page's JSON and Markdown forms. Described by the OpenAPI document at https://codingai-lec10.pages.dev/openapi.json. - [Agent skills](https://codingai-lec10.pages.dev/.well-known/agent-skills/index.json): Agent Skills discovery index of the skills this site publishes. - [API catalog](https://codingai-lec10.pages.dev/.well-known/api-catalog): RFC 9727 linkset of the APIs documented here. - [AI catalog](https://codingai-lec10.pages.dev/.well-known/ai-catalog.json): ARD manifest of the agent-facing resources on this site (MCP server, skills, APIs). - [agent-readability.json](https://codingai-lec10.pages.dev/agent-readability.json): Manifest of every agent-facing artifact on this site. - [Sitemap](https://codingai-lec10.pages.dev/sitemap.xml): Every indexable page URL with its last-modified date.