[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"i-ri:search-line":3,"i-ri:moon-line":8,"i-ri:sun-line":10,"i-ri:menu-3-line":12,"i-ri:close-line":14,"notes-module-items-ai":16,"notes-page-ai-02-agent-architecture\u002F04-planning":74,"i-ri:arrow-left-s-line":920,"i-ri:menu-2-line":922,"i-ri:arrow-right-s-line":924,"i-ep:copy-document":926},{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":7},0,24,false,"\u003Cpath fill=\"currentColor\" d=\"m18.031 16.617l4.283 4.282l-1.415 1.415l-4.282-4.283A8.96 8.96 0 0 1 11 20c-4.968 0-9-4.032-9-9s4.032-9 9-9s9 4.032 9 9a8.96 8.96 0 0 1-1.969 5.617m-2.006-.742A6.98 6.98 0 0 0 18 11c0-3.867-3.133-7-7-7s-7 3.133-7 7s3.133 7 7 7a6.98 6.98 0 0 0 4.875-1.975z\"\u002F>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":9},"\u003Cpath fill=\"currentColor\" d=\"M10 7a7 7 0 0 0 12 4.9v.1c0 5.523-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2h.1A6.98 6.98 0 0 0 10 7m-6 5a8 8 0 0 0 15.062 3.762A9 9 0 0 1 8.238 4.938A8 8 0 0 0 4 12\"\u002F>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":11},"\u003Cpath fill=\"currentColor\" d=\"M12 18a6 6 0 1 1 0-12a6 6 0 0 1 0 12m0-2a4 4 0 1 0 0-8a4 4 0 0 0 0 8M11 1h2v3h-2zm0 19h2v3h-2zM3.515 4.929l1.414-1.414L7.05 5.636L5.636 7.05zM16.95 18.364l1.414-1.414l2.121 2.121l-1.414 1.414zm2.121-14.85l1.414 1.415l-2.121 2.121l-1.414-1.414zM5.636 16.95l1.414 1.414l-2.121 2.121l-1.414-1.414zM23 11v2h-3v-2zM4 11v2H1v-2z\"\u002F>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":13},"\u003Cpath fill=\"currentColor\" d=\"M3 4h18v2H3zm6 7h12v2H9zm-6 7h18v2H3z\"\u002F>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":15},"\u003Cpath fill=\"currentColor\" d=\"m12 10.587l4.95-4.95l1.414 1.414l-4.95 4.95l4.95 4.95l-1.415 1.414l-4.95-4.95l-4.949 4.95l-1.414-1.415l4.95-4.95l-4.95-4.95L7.05 5.638z\"\u002F>",[17,22,26,30,34,38,42,46,50,54,58,62,66,70],{"path":18,"title":19,"meta":20},"\u002Fnotes\u002Fai\u002F01-llm-basics\u002F01-hello-llm","LLM 交互基础：透过现象看本质",{"date":-1,"tags":-1,"summary":-1,"lastUpdated":21},"2026-11-05T09:47:15.000Z",{"path":23,"title":24,"meta":25},"\u002Fnotes\u002Fai\u002F01-llm-basics\u002F02-streaming-and-prompts","进阶交互：流式传输与提示词工程",{"date":-1,"tags":-1,"summary":-1,"lastUpdated":21},{"path":27,"title":28,"meta":29},"\u002Fnotes\u002Fai\u002F01-llm-basics\u002F03-function-calling","结构化输出与 Function Calling",{"date":-1,"tags":-1,"summary":-1,"lastUpdated":21},{"path":31,"title":32,"meta":33},"\u002Fnotes\u002Fai\u002F02-agent-architecture\u002F01-tool-use","Agent 核心能力 ①：Tool Use（工具调用）",{"date":-1,"tags":-1,"summary":-1,"lastUpdated":21},{"path":35,"title":36,"meta":37},"\u002Fnotes\u002Fai\u002F02-agent-architecture\u002F02-mini-cursor-cli","实战项目：Mini Cursor（CLI 版）",{"date":-1,"tags":-1,"summary":-1,"lastUpdated":21},{"path":39,"title":40,"meta":41},"\u002Fnotes\u002Fai\u002F02-agent-architecture\u002F03-memory","Agent 核心能力 ②：Memory（记忆管理）",{"date":-1,"tags":-1,"summary":-1,"lastUpdated":21},{"path":43,"title":44,"meta":45},"\u002Fnotes\u002Fai\u002F02-agent-architecture\u002F04-planning","Agent 核心能力 ③：Planning（规划能力）",{"date":-1,"tags":-1,"summary":-1,"lastUpdated":21},{"path":47,"title":48,"meta":49},"\u002Fnotes\u002Fai\u002F02-agent-architecture\u002F05-review-diff-chunking","代码改了很多，AI 为什么只审了前面？",{"date":-1,"tags":-1,"summary":-1,"lastUpdated":21},{"path":51,"title":52,"meta":53},"\u002Fnotes\u002Fai\u002F02-agent-architecture","Agent 架构笔记",{"date":-1,"tags":-1,"summary":-1,"lastUpdated":21},{"path":55,"title":56,"meta":57},"\u002Fnotes\u002Fai\u002F03-rag\u002F01-vector-db-and-embeddings-node","RAG ①：Embeddings 与向量数据库入门（Node.js 优先）",{"date":-1,"tags":-1,"summary":-1,"lastUpdated":21},{"path":59,"title":60,"meta":61},"\u002Fnotes\u002Fai\u002F04-document-extraction\u002F01-ocr-field-evidence","OCR 读对了字，为什么地址仍然错？",{"date":-1,"tags":-1,"summary":-1,"lastUpdated":21},{"path":63,"title":64,"meta":65},"\u002Fnotes\u002Fai\u002F05-development-workflow\u002F01-task-recovery","AI 任务做一半，中断后怎么继续？",{"date":-1,"tags":-1,"summary":-1,"lastUpdated":21},{"path":67,"title":68,"meta":69},"\u002Fnotes\u002Fai","AI 应用开发",{"date":-1,"tags":-1,"summary":-1,"lastUpdated":21},{"path":71,"title":72,"meta":73},"\u002Fnotes\u002Fai\u002Froadmap","AI Agent 全栈开发学习路线图 (Roadmap)",{"date":-1,"tags":-1,"summary":-1,"lastUpdated":21},{"id":75,"type":76,"sourcePath":77,"routePath":43,"path":43,"title":44,"updatedAt":21,"meta":78,"body":80,"toc":905},"bm90ZTpub3Rlcy9haS8wMi1hZ2VudC1hcmNoaXRlY3R1cmUvMDQtcGxhbm5pbmcubWQ","note","notes\u002Fai\u002F02-agent-architecture\u002F04-planning.md",{"id":75,"type":76,"sourcePath":77,"slug":79,"title":44,"updatedAt":21,"lastUpdated":21},"ai\u002F02-agent-architecture\u002F04-planning",{"type":81,"children":82},"root",[83,91,114,118,125,130,150,155,188,191,197,204,209,232,237,250,255,484,489,510,516,521,535,539,552,557,580,585,598,604,609,627,632,645,650,691,694,700,706,740,746,751,769,775,780,803,808,811,817,822,885,888,894,899],{"type":84,"tag":85,"props":86,"children":88},"element","h1",{"id":87},"agent-核心能力-planning规划能力",[89],{"type":90,"value":44},"text",{"type":84,"tag":92,"props":93,"children":94},"blockquote",{},[95],{"type":84,"tag":96,"props":97,"children":98},"p",{},[99,105,107,112],{"type":84,"tag":100,"props":101,"children":102},"strong",{},[103],{"type":90,"value":104},"摘要",{"type":90,"value":106},"：工具让 Agent 有“手脚”，记忆让它能“长期工作”，规划让它能处理 ",{"type":84,"tag":100,"props":108,"children":109},{},[110],{"type":90,"value":111},"复杂、多步、会出错",{"type":90,"value":113}," 的任务。Planning 的本质是：把“一句话需求”变成可执行的步骤，并在执行中持续修正。",{"type":84,"tag":115,"props":116,"children":117},"hr",{},[],{"type":84,"tag":119,"props":120,"children":122},"h2",{"id":121},"_1-为什么需要-planning",[123],{"type":90,"value":124},"1. 为什么需要 Planning",{"type":84,"tag":96,"props":126,"children":127},{},[128],{"type":90,"value":129},"没有 planning 的 LLM 往往会：",{"type":84,"tag":131,"props":132,"children":133},"ul",{},[134,140,145],{"type":84,"tag":135,"props":136,"children":137},"li",{},[138],{"type":90,"value":139},"直接输出一个看似完整但不可执行的答案",{"type":84,"tag":135,"props":141,"children":142},{},[143],{"type":90,"value":144},"遇到错误时卡住或胡编",{"type":84,"tag":135,"props":146,"children":147},{},[148],{"type":90,"value":149},"无法把大任务拆成可验证的小步骤",{"type":84,"tag":96,"props":151,"children":152},{},[153],{"type":90,"value":154},"Planning 的目标：",{"type":84,"tag":131,"props":156,"children":157},{},[158,168,178],{"type":84,"tag":135,"props":159,"children":160},{},[161,166],{"type":84,"tag":100,"props":162,"children":163},{},[164],{"type":90,"value":165},"可分解",{"type":90,"value":167},"：把复杂任务拆成小步",{"type":84,"tag":135,"props":169,"children":170},{},[171,176],{"type":84,"tag":100,"props":172,"children":173},{},[174],{"type":90,"value":175},"可验证",{"type":90,"value":177},"：每步都有观测结果（observation）",{"type":84,"tag":135,"props":179,"children":180},{},[181,186],{"type":84,"tag":100,"props":182,"children":183},{},[184],{"type":90,"value":185},"可恢复",{"type":90,"value":187},"：出错时能调整策略而不是重来",{"type":84,"tag":115,"props":189,"children":190},{},[],{"type":84,"tag":119,"props":192,"children":194},{"id":193},"_2-三种经典模式",[195],{"type":90,"value":196},"2. 三种经典模式",{"type":84,"tag":198,"props":199,"children":201},"h3",{"id":200},"_21-reactreason-act",[202],{"type":90,"value":203},"2.1 ReAct（Reason + Act）",{"type":84,"tag":96,"props":205,"children":206},{},[207],{"type":90,"value":208},"循环结构：",{"type":84,"tag":131,"props":210,"children":211},{},[212,217,222,227],{"type":84,"tag":135,"props":213,"children":214},{},[215],{"type":90,"value":216},"Thought：我该做什么",{"type":84,"tag":135,"props":218,"children":219},{},[220],{"type":90,"value":221},"Act：调用哪个工具",{"type":84,"tag":135,"props":223,"children":224},{},[225],{"type":90,"value":226},"Observation：工具返回了什么",{"type":84,"tag":135,"props":228,"children":229},{},[230],{"type":90,"value":231},"再 Thought...",{"type":84,"tag":96,"props":233,"children":234},{},[235],{"type":90,"value":236},"它适合：",{"type":84,"tag":131,"props":238,"children":239},{},[240,245],{"type":84,"tag":135,"props":241,"children":242},{},[243],{"type":90,"value":244},"信息不确定、需要边查边做",{"type":84,"tag":135,"props":246,"children":247},{},[248],{"type":90,"value":249},"工具链比较长（搜索 -> 打开 -> 再搜索 -> 再打开）",{"type":84,"tag":96,"props":251,"children":252},{},[253],{"type":90,"value":254},"最小伪代码：",{"type":84,"tag":256,"props":257,"children":262},"pre",{"className":258,"code":259,"language":260,"meta":261,"style":261},"language-ts shiki shiki-themes github-light github-dark","for (step = 0; step \u003C maxSteps; step++) {\n  const msg = await llm(messages, tools)\n  if (!msg.tool_calls) return msg.content\n  const obs = await runTools(msg.tool_calls)\n  messages.push(msg, obs)\n}\nthrow new Error(\"maxSteps exceeded\")\n","ts","",[263],{"type":84,"tag":264,"props":265,"children":266},"code",{"__ignoreMap":261},[267,321,356,390,421,440,449],{"type":84,"tag":268,"props":269,"children":272},"span",{"class":270,"line":271},"line",1,[273,279,285,290,296,301,306,311,316],{"type":84,"tag":268,"props":274,"children":276},{"style":275},"--shiki-default:#D73A49;--shiki-dark:#F97583",[277],{"type":90,"value":278},"for",{"type":84,"tag":268,"props":280,"children":282},{"style":281},"--shiki-default:#24292E;--shiki-dark:#E1E4E8",[283],{"type":90,"value":284}," (step ",{"type":84,"tag":268,"props":286,"children":287},{"style":275},[288],{"type":90,"value":289},"=",{"type":84,"tag":268,"props":291,"children":293},{"style":292},"--shiki-default:#005CC5;--shiki-dark:#79B8FF",[294],{"type":90,"value":295}," 0",{"type":84,"tag":268,"props":297,"children":298},{"style":281},[299],{"type":90,"value":300},"; step ",{"type":84,"tag":268,"props":302,"children":303},{"style":275},[304],{"type":90,"value":305},"\u003C",{"type":84,"tag":268,"props":307,"children":308},{"style":281},[309],{"type":90,"value":310}," maxSteps; step",{"type":84,"tag":268,"props":312,"children":313},{"style":275},[314],{"type":90,"value":315},"++",{"type":84,"tag":268,"props":317,"children":318},{"style":281},[319],{"type":90,"value":320},") {\n",{"type":84,"tag":268,"props":322,"children":324},{"class":270,"line":323},2,[325,330,335,340,345,351],{"type":84,"tag":268,"props":326,"children":327},{"style":275},[328],{"type":90,"value":329},"  const",{"type":84,"tag":268,"props":331,"children":332},{"style":292},[333],{"type":90,"value":334}," msg",{"type":84,"tag":268,"props":336,"children":337},{"style":275},[338],{"type":90,"value":339}," =",{"type":84,"tag":268,"props":341,"children":342},{"style":275},[343],{"type":90,"value":344}," await",{"type":84,"tag":268,"props":346,"children":348},{"style":347},"--shiki-default:#6F42C1;--shiki-dark:#B392F0",[349],{"type":90,"value":350}," llm",{"type":84,"tag":268,"props":352,"children":353},{"style":281},[354],{"type":90,"value":355},"(messages, tools)\n",{"type":84,"tag":268,"props":357,"children":359},{"class":270,"line":358},3,[360,365,370,375,380,385],{"type":84,"tag":268,"props":361,"children":362},{"style":275},[363],{"type":90,"value":364},"  if",{"type":84,"tag":268,"props":366,"children":367},{"style":281},[368],{"type":90,"value":369}," (",{"type":84,"tag":268,"props":371,"children":372},{"style":275},[373],{"type":90,"value":374},"!",{"type":84,"tag":268,"props":376,"children":377},{"style":281},[378],{"type":90,"value":379},"msg.tool_calls) ",{"type":84,"tag":268,"props":381,"children":382},{"style":275},[383],{"type":90,"value":384},"return",{"type":84,"tag":268,"props":386,"children":387},{"style":281},[388],{"type":90,"value":389}," msg.content\n",{"type":84,"tag":268,"props":391,"children":393},{"class":270,"line":392},4,[394,398,403,407,411,416],{"type":84,"tag":268,"props":395,"children":396},{"style":275},[397],{"type":90,"value":329},{"type":84,"tag":268,"props":399,"children":400},{"style":292},[401],{"type":90,"value":402}," obs",{"type":84,"tag":268,"props":404,"children":405},{"style":275},[406],{"type":90,"value":339},{"type":84,"tag":268,"props":408,"children":409},{"style":275},[410],{"type":90,"value":344},{"type":84,"tag":268,"props":412,"children":413},{"style":347},[414],{"type":90,"value":415}," runTools",{"type":84,"tag":268,"props":417,"children":418},{"style":281},[419],{"type":90,"value":420},"(msg.tool_calls)\n",{"type":84,"tag":268,"props":422,"children":424},{"class":270,"line":423},5,[425,430,435],{"type":84,"tag":268,"props":426,"children":427},{"style":281},[428],{"type":90,"value":429},"  messages.",{"type":84,"tag":268,"props":431,"children":432},{"style":347},[433],{"type":90,"value":434},"push",{"type":84,"tag":268,"props":436,"children":437},{"style":281},[438],{"type":90,"value":439},"(msg, obs)\n",{"type":84,"tag":268,"props":441,"children":443},{"class":270,"line":442},6,[444],{"type":84,"tag":268,"props":445,"children":446},{"style":281},[447],{"type":90,"value":448},"}\n",{"type":84,"tag":268,"props":450,"children":452},{"class":270,"line":451},7,[453,458,463,468,473,479],{"type":84,"tag":268,"props":454,"children":455},{"style":275},[456],{"type":90,"value":457},"throw",{"type":84,"tag":268,"props":459,"children":460},{"style":275},[461],{"type":90,"value":462}," new",{"type":84,"tag":268,"props":464,"children":465},{"style":347},[466],{"type":90,"value":467}," Error",{"type":84,"tag":268,"props":469,"children":470},{"style":281},[471],{"type":90,"value":472},"(",{"type":84,"tag":268,"props":474,"children":476},{"style":475},"--shiki-default:#032F62;--shiki-dark:#9ECBFF",[477],{"type":90,"value":478},"\"maxSteps exceeded\"",{"type":84,"tag":268,"props":480,"children":481},{"style":281},[482],{"type":90,"value":483},")\n",{"type":84,"tag":96,"props":485,"children":486},{},[487],{"type":90,"value":488},"工程要点：",{"type":84,"tag":131,"props":490,"children":491},{},[492,497],{"type":84,"tag":135,"props":493,"children":494},{},[495],{"type":90,"value":496},"你要把每次 Observation 清晰喂回模型（别给一坨日志）",{"type":84,"tag":135,"props":498,"children":499},{},[500,502,508],{"type":90,"value":501},"必须设置 ",{"type":84,"tag":264,"props":503,"children":505},{"className":504},[],[506],{"type":90,"value":507},"maxSteps",{"type":90,"value":509}," 防止死循环",{"type":84,"tag":198,"props":511,"children":513},{"id":512},"_22-plan-and-solve先计划再执行",[514],{"type":90,"value":515},"2.2 Plan-and-Solve（先计划，再执行）",{"type":84,"tag":96,"props":517,"children":518},{},[519],{"type":90,"value":520},"结构：",{"type":84,"tag":522,"props":523,"children":524},"ol",{},[525,530],{"type":84,"tag":135,"props":526,"children":527},{},[528],{"type":90,"value":529},"先让模型输出计划（Plan）",{"type":84,"tag":135,"props":531,"children":532},{},[533],{"type":90,"value":534},"再逐步执行计划（Execute）",{"type":84,"tag":96,"props":536,"children":537},{},[538],{"type":90,"value":236},{"type":84,"tag":131,"props":540,"children":541},{},[542,547],{"type":84,"tag":135,"props":543,"children":544},{},[545],{"type":90,"value":546},"任务边界清晰（例如“实现一个功能并改 3 个文件”）",{"type":84,"tag":135,"props":548,"children":549},{},[550],{"type":90,"value":551},"你希望对过程可控、可审计",{"type":84,"tag":96,"props":553,"children":554},{},[555],{"type":90,"value":556},"推荐的计划格式：",{"type":84,"tag":131,"props":558,"children":559},{},[560,565,570,575],{"type":84,"tag":135,"props":561,"children":562},{},[563],{"type":90,"value":564},"Step 1：定位文件与相关代码位置（search + read）",{"type":84,"tag":135,"props":566,"children":567},{},[568],{"type":90,"value":569},"Step 2：提出修改方案",{"type":84,"tag":135,"props":571,"children":572},{},[573],{"type":90,"value":574},"Step 3：应用补丁",{"type":84,"tag":135,"props":576,"children":577},{},[578],{"type":90,"value":579},"Step 4：回读自检",{"type":84,"tag":96,"props":581,"children":582},{},[583],{"type":90,"value":584},"执行策略：",{"type":84,"tag":131,"props":586,"children":587},{},[588,593],{"type":84,"tag":135,"props":589,"children":590},{},[591],{"type":90,"value":592},"每步执行后都把结果回传",{"type":84,"tag":135,"props":594,"children":595},{},[596],{"type":90,"value":597},"如果某步失败，允许模型“重写计划”或“只修正当前步”",{"type":84,"tag":198,"props":599,"children":601},{"id":600},"_23-reflection反思自我修正",[602],{"type":90,"value":603},"2.3 Reflection（反思\u002F自我修正）",{"type":84,"tag":96,"props":605,"children":606},{},[607],{"type":90,"value":608},"Reflection 用来处理：",{"type":84,"tag":131,"props":610,"children":611},{},[612,617,622],{"type":84,"tag":135,"props":613,"children":614},{},[615],{"type":90,"value":616},"工具调用失败",{"type":84,"tag":135,"props":618,"children":619},{},[620],{"type":90,"value":621},"输出不符合格式",{"type":84,"tag":135,"props":623,"children":624},{},[625],{"type":90,"value":626},"修改引入 bug",{"type":84,"tag":96,"props":628,"children":629},{},[630],{"type":90,"value":631},"常见做法：",{"type":84,"tag":131,"props":633,"children":634},{},[635,640],{"type":84,"tag":135,"props":636,"children":637},{},[638],{"type":90,"value":639},"当出现 error observation 时，追加一个“反思提示”",{"type":84,"tag":135,"props":641,"children":642},{},[643],{"type":90,"value":644},"让模型输出：失败原因、下一次行动、避免重犯的规则",{"type":84,"tag":96,"props":646,"children":647},{},[648],{"type":90,"value":649},"示例反思 prompt：",{"type":84,"tag":256,"props":651,"children":655},{"className":652,"code":653,"language":654,"meta":261,"style":261},"language-txt shiki shiki-themes github-light github-dark","你刚才的操作失败了。请输出：\n1) 失败原因（基于 observation，不要猜）\n2) 下一步最小修正动作\n3) 为避免重复失败，需要加入的约束\n","txt",[656],{"type":84,"tag":264,"props":657,"children":658},{"__ignoreMap":261},[659,667,675,683],{"type":84,"tag":268,"props":660,"children":661},{"class":270,"line":271},[662],{"type":84,"tag":268,"props":663,"children":664},{},[665],{"type":90,"value":666},"你刚才的操作失败了。请输出：\n",{"type":84,"tag":268,"props":668,"children":669},{"class":270,"line":323},[670],{"type":84,"tag":268,"props":671,"children":672},{},[673],{"type":90,"value":674},"1) 失败原因（基于 observation，不要猜）\n",{"type":84,"tag":268,"props":676,"children":677},{"class":270,"line":358},[678],{"type":84,"tag":268,"props":679,"children":680},{},[681],{"type":90,"value":682},"2) 下一步最小修正动作\n",{"type":84,"tag":268,"props":684,"children":685},{"class":270,"line":392},[686],{"type":84,"tag":268,"props":687,"children":688},{},[689],{"type":90,"value":690},"3) 为避免重复失败，需要加入的约束\n",{"type":84,"tag":115,"props":692,"children":693},{},[],{"type":84,"tag":119,"props":695,"children":697},{"id":696},"_3-规划的护栏让它能在生产跑",[698],{"type":90,"value":699},"3. 规划的护栏（让它能在生产跑）",{"type":84,"tag":198,"props":701,"children":703},{"id":702},"_31-步数与预算",[704],{"type":90,"value":705},"3.1 步数与预算",{"type":84,"tag":131,"props":707,"children":708},{},[709,717,726,735],{"type":84,"tag":135,"props":710,"children":711},{},[712],{"type":84,"tag":264,"props":713,"children":715},{"className":714},[],[716],{"type":90,"value":507},{"type":84,"tag":135,"props":718,"children":719},{},[720],{"type":84,"tag":264,"props":721,"children":723},{"className":722},[],[724],{"type":90,"value":725},"maxToolCalls",{"type":84,"tag":135,"props":727,"children":728},{},[729],{"type":84,"tag":264,"props":730,"children":732},{"className":731},[],[733],{"type":90,"value":734},"maxTokens",{"type":84,"tag":135,"props":736,"children":737},{},[738],{"type":90,"value":739},"成本预算（例如超过 1 元就停止并请求用户确认）",{"type":84,"tag":198,"props":741,"children":743},{"id":742},"_32-任务分级",[744],{"type":90,"value":745},"3.2 任务分级",{"type":84,"tag":96,"props":747,"children":748},{},[749],{"type":90,"value":750},"把任务拆成：",{"type":84,"tag":131,"props":752,"children":753},{},[754,759,764],{"type":84,"tag":135,"props":755,"children":756},{},[757],{"type":90,"value":758},"low-risk：只读、只总结（自动执行）",{"type":84,"tag":135,"props":760,"children":761},{},[762],{"type":90,"value":763},"medium-risk：写文件但可回滚（自动 + 强自检）",{"type":84,"tag":135,"props":765,"children":766},{},[767],{"type":90,"value":768},"high-risk：删库\u002F发邮件\u002F生产发布（必须人工确认）",{"type":84,"tag":198,"props":770,"children":772},{"id":771},"_33-输出可验证",[773],{"type":90,"value":774},"3.3 输出可验证",{"type":84,"tag":96,"props":776,"children":777},{},[778],{"type":90,"value":779},"让模型输出“可验证”的中间产物：",{"type":84,"tag":131,"props":781,"children":782},{},[783,788,793,798],{"type":84,"tag":135,"props":784,"children":785},{},[786],{"type":90,"value":787},"文件路径",{"type":84,"tag":135,"props":789,"children":790},{},[791],{"type":90,"value":792},"行号范围",{"type":84,"tag":135,"props":794,"children":795},{},[796],{"type":90,"value":797},"patch\u002Fdiff",{"type":84,"tag":135,"props":799,"children":800},{},[801],{"type":90,"value":802},"执行命令",{"type":84,"tag":96,"props":804,"children":805},{},[806],{"type":90,"value":807},"不要只要“我已经完成了”。",{"type":84,"tag":115,"props":809,"children":810},{},[],{"type":84,"tag":119,"props":812,"children":814},{"id":813},"_4-一个可复用的-agent-prompt规划版",[815],{"type":90,"value":816},"4. 一个可复用的 Agent Prompt（规划版）",{"type":84,"tag":96,"props":818,"children":819},{},[820],{"type":90,"value":821},"你可以把这段放到 system prompt（按你的项目调整）：",{"type":84,"tag":256,"props":823,"children":825},{"className":652,"code":824,"language":654,"meta":261,"style":261},"你是一个可执行的工程 Agent。\n工作方式：\n- 先给出 3~6 步计划（每步要可用工具验证）\n- 按步骤执行：需要信息时必须调用工具，不允许凭空猜\n- 每次写文件前先读文件；写完后必须回读自检\n- 遇到错误先反思，再提出最小修正动作\n- 如果超过 8 步仍未完成，停止并汇报阻塞点\n",[826],{"type":84,"tag":264,"props":827,"children":828},{"__ignoreMap":261},[829,837,845,853,861,869,877],{"type":84,"tag":268,"props":830,"children":831},{"class":270,"line":271},[832],{"type":84,"tag":268,"props":833,"children":834},{},[835],{"type":90,"value":836},"你是一个可执行的工程 Agent。\n",{"type":84,"tag":268,"props":838,"children":839},{"class":270,"line":323},[840],{"type":84,"tag":268,"props":841,"children":842},{},[843],{"type":90,"value":844},"工作方式：\n",{"type":84,"tag":268,"props":846,"children":847},{"class":270,"line":358},[848],{"type":84,"tag":268,"props":849,"children":850},{},[851],{"type":90,"value":852},"- 先给出 3~6 步计划（每步要可用工具验证）\n",{"type":84,"tag":268,"props":854,"children":855},{"class":270,"line":392},[856],{"type":84,"tag":268,"props":857,"children":858},{},[859],{"type":90,"value":860},"- 按步骤执行：需要信息时必须调用工具，不允许凭空猜\n",{"type":84,"tag":268,"props":862,"children":863},{"class":270,"line":423},[864],{"type":84,"tag":268,"props":865,"children":866},{},[867],{"type":90,"value":868},"- 每次写文件前先读文件；写完后必须回读自检\n",{"type":84,"tag":268,"props":870,"children":871},{"class":270,"line":442},[872],{"type":84,"tag":268,"props":873,"children":874},{},[875],{"type":90,"value":876},"- 遇到错误先反思，再提出最小修正动作\n",{"type":84,"tag":268,"props":878,"children":879},{"class":270,"line":451},[880],{"type":84,"tag":268,"props":881,"children":882},{},[883],{"type":90,"value":884},"- 如果超过 8 步仍未完成，停止并汇报阻塞点\n",{"type":84,"tag":115,"props":886,"children":887},{},[],{"type":84,"tag":119,"props":889,"children":891},{"id":890},"_5-下一步",[892],{"type":90,"value":893},"5. 下一步",{"type":84,"tag":96,"props":895,"children":896},{},[897],{"type":90,"value":898},"到这里，第二阶段（Tools \u002F Memory \u002F Planning）的核心概念齐了。\n接下来进入第三阶段：RAG。\n我们会从“向量库与 embedding”开始，把文档外挂成 Agent 的知识库。",{"type":84,"tag":900,"props":901,"children":902},"style",{},[903],{"type":90,"value":904},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":261,"searchDepth":323,"depth":323,"links":906},[907,908,913,918,919],{"id":121,"depth":323,"text":124},{"id":193,"depth":323,"text":196,"children":909},[910,911,912],{"id":200,"depth":358,"text":203},{"id":512,"depth":358,"text":515},{"id":600,"depth":358,"text":603},{"id":696,"depth":323,"text":699,"children":914},[915,916,917],{"id":702,"depth":358,"text":705},{"id":742,"depth":358,"text":745},{"id":771,"depth":358,"text":774},{"id":813,"depth":323,"text":816},{"id":890,"depth":323,"text":893},{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":921},"\u003Cpath fill=\"currentColor\" d=\"m10.828 12l4.95 4.95l-1.414 1.415L8 12l6.364-6.364l1.414 1.414z\"\u002F>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":923},"\u003Cpath fill=\"currentColor\" d=\"M3 4h18v2H3zm0 7h12v2H3zm0 7h18v2H3z\"\u002F>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":925},"\u003Cpath fill=\"currentColor\" d=\"m13.172 12l-4.95-4.95l1.414-1.413L16 12l-6.364 6.364l-1.414-1.415z\"\u002F>",{"left":4,"top":4,"width":927,"height":927,"rotate":4,"vFlip":6,"hFlip":6,"body":928},1024,"\u003Cpath fill=\"currentColor\" d=\"M768 832a128 128 0 0 1-128 128H192A128 128 0 0 1 64 832V384a128 128 0 0 1 128-128v64a64 64 0 0 0-64 64v448a64 64 0 0 0 64 64h448a64 64 0 0 0 64-64z\"\u002F>\u003Cpath fill=\"currentColor\" d=\"M384 128a64 64 0 0 0-64 64v448a64 64 0 0 0 64 64h448a64 64 0 0 0 64-64V192a64 64 0 0 0-64-64zm0-64h448a128 128 0 0 1 128 128v448a128 128 0 0 1-128 128H384a128 128 0 0 1-128-128V192A128 128 0 0 1 384 64\"\u002F>"]