[{"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\u002F02-mini-cursor-cli":74,"i-ri:arrow-left-s-line":1173,"i-ri:menu-2-line":1175,"i-ri:arrow-right-s-line":1177,"i-ep:copy-document":1179},{"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":35,"path":35,"title":36,"updatedAt":21,"meta":78,"body":80,"toc":1157},"bm90ZTpub3Rlcy9haS8wMi1hZ2VudC1hcmNoaXRlY3R1cmUvMDItbWluaS1jdXJzb3ItY2xpLm1k","note","notes\u002Fai\u002F02-agent-architecture\u002F02-mini-cursor-cli.md",{"id":75,"type":76,"sourcePath":77,"slug":79,"title":36,"updatedAt":21,"lastUpdated":21},"ai\u002F02-agent-architecture\u002F02-mini-cursor-cli",{"type":81,"children":82},"root",[83,91,114,118,125,131,174,179,187,190,196,201,250,266,269,275,280,313,318,869,872,878,884,917,923,935,960,965,971,984,987,993,998,1031,1036,1049,1052,1058,1063,1114,1117,1123,1128,1151],{"type":84,"tag":85,"props":86,"children":88},"element","h1",{"id":87},"实战项目mini-cursorcli-版",[89],{"type":90,"value":36},"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。目标不是造一个完整 IDE，而是把 ",{"type":84,"tag":100,"props":108,"children":109},{},[110],{"type":90,"value":111},"Tool Use + 安全护栏 + 可迭代改文件",{"type":90,"value":113}," 这条链路跑通。",{"type":84,"tag":115,"props":116,"children":117},"hr",{},[],{"type":84,"tag":119,"props":120,"children":122},"h2",{"id":121},"_0-目标与非目标",[123],{"type":90,"value":124},"0. 目标与非目标",{"type":84,"tag":126,"props":127,"children":129},"h3",{"id":128},"目标",[130],{"type":90,"value":128},{"type":84,"tag":132,"props":133,"children":134},"ul",{},[135,141],{"type":84,"tag":136,"props":137,"children":138},"li",{},[139],{"type":90,"value":140},"允许用户在终端输入需求：例如“把某个函数改成支持传入数组”",{"type":84,"tag":136,"props":142,"children":143},{},[144,146],{"type":90,"value":145},"Agent 能：\n",{"type":84,"tag":132,"props":147,"children":148},{},[149,154,159,164,169],{"type":84,"tag":136,"props":150,"children":151},{},[152],{"type":90,"value":153},"列目录 \u002F 搜索文件",{"type":84,"tag":136,"props":155,"children":156},{},[157],{"type":90,"value":158},"读取目标文件",{"type":84,"tag":136,"props":160,"children":161},{},[162],{"type":90,"value":163},"生成补丁（patch）",{"type":84,"tag":136,"props":165,"children":166},{},[167],{"type":90,"value":168},"写回文件",{"type":84,"tag":136,"props":170,"children":171},{},[172],{"type":90,"value":173},"重新读取并自检",{"type":84,"tag":126,"props":175,"children":177},{"id":176},"非目标",[178],{"type":90,"value":176},{"type":84,"tag":132,"props":180,"children":181},{},[182],{"type":84,"tag":136,"props":183,"children":184},{},[185],{"type":90,"value":186},"不做 LSP、不做 AST 精确改写、不做全量测试编排（后续可加）",{"type":84,"tag":115,"props":188,"children":189},{},[],{"type":84,"tag":119,"props":191,"children":193},{"id":192},"_1-工具设计最小集",[194],{"type":90,"value":195},"1. 工具设计（最小集）",{"type":84,"tag":96,"props":197,"children":198},{},[199],{"type":90,"value":200},"建议第一版只做 4 个工具：",{"type":84,"tag":202,"props":203,"children":204},"ol",{},[205,217,228,239],{"type":84,"tag":136,"props":206,"children":207},{},[208,215],{"type":84,"tag":209,"props":210,"children":212},"code",{"className":211},[],[213],{"type":90,"value":214},"list_dir(path)",{"type":90,"value":216},"：列出目录（用于定位文件）",{"type":84,"tag":136,"props":218,"children":219},{},[220,226],{"type":84,"tag":209,"props":221,"children":223},{"className":222},[],[224],{"type":90,"value":225},"search(pattern, path)",{"type":90,"value":227},"：grep 搜索（用于定位符号）",{"type":84,"tag":136,"props":229,"children":230},{},[231,237],{"type":84,"tag":209,"props":232,"children":234},{"className":233},[],[235],{"type":90,"value":236},"read_file(path, offset?, limit?)",{"type":90,"value":238},"：分段读文件（控 token）",{"type":84,"tag":136,"props":240,"children":241},{},[242,248],{"type":84,"tag":209,"props":243,"children":245},{"className":244},[],[246],{"type":90,"value":247},"write_file(path, content)",{"type":90,"value":249},"：覆盖写入（第一版简单粗暴）",{"type":84,"tag":92,"props":251,"children":252},{},[253],{"type":84,"tag":96,"props":254,"children":255},{},[256,258,264],{"type":90,"value":257},"后续升级：把 write_file 变成 ",{"type":84,"tag":209,"props":259,"children":261},{"className":260},[],[262],{"type":90,"value":263},"apply_patch(path, patch)",{"type":90,"value":265},"（更安全）",{"type":84,"tag":115,"props":267,"children":268},{},[],{"type":84,"tag":119,"props":270,"children":272},{"id":271},"_2-最小-agent-loopcli-驱动",[273],{"type":90,"value":274},"2. 最小 Agent Loop（CLI 驱动）",{"type":84,"tag":96,"props":276,"children":277},{},[278],{"type":90,"value":279},"你可以把它拆成三个层：",{"type":84,"tag":132,"props":281,"children":282},{},[283,293,303],{"type":84,"tag":136,"props":284,"children":285},{},[286,291],{"type":84,"tag":100,"props":287,"children":288},{},[289],{"type":90,"value":290},"LLM 层",{"type":90,"value":292},"：负责对话与 tool_calls",{"type":84,"tag":136,"props":294,"children":295},{},[296,301],{"type":84,"tag":100,"props":297,"children":298},{},[299],{"type":90,"value":300},"Tools 层",{"type":90,"value":302},"：真实执行文件系统\u002F命令",{"type":84,"tag":136,"props":304,"children":305},{},[306,311],{"type":84,"tag":100,"props":307,"children":308},{},[309],{"type":90,"value":310},"Loop 层",{"type":90,"value":312},"：不断“问模型 -> 执行工具 -> 回传结果”直到完成",{"type":84,"tag":96,"props":314,"children":315},{},[316],{"type":90,"value":317},"伪代码：",{"type":84,"tag":319,"props":320,"children":325},"pre",{"className":321,"code":322,"language":323,"meta":324,"style":324},"language-ts shiki shiki-themes github-light github-dark","const tools = [list_dir, search, read_file, write_file]\n\nconst system = `你是一个代码修改助手。\n规则：\n- 修改前必须 read_file\n- 尽量只修改必要最小范围\n- 修改后必须再次 read_file 自检\n- 不允许访问工作目录之外的路径\n- 输出最终答复时，说明改了哪些文件、改动点是什么\n`\n\nmessages = [{ role: \"system\", content: system }]\n\nwhile (true) {\n  const resp = await llm({ messages, tools })\n  const msg = resp.choices[0].message\n\n  if (!msg.tool_calls?.length) {\n    print(msg.content)\n    break\n  }\n\n  messages.push(msg)\n\n  for (const call of msg.tool_calls) {\n    const result = await runTool(call)\n    messages.push({\n      role: \"tool\",\n      tool_call_id: call.id,\n      name: call.function.name,\n      content: JSON.stringify(result)\n    })\n  }\n}\n","ts","",[326],{"type":84,"tag":209,"props":327,"children":328},{"__ignoreMap":324},[329,358,368,391,400,409,418,427,436,445,454,462,491,499,523,557,589,597,629,643,652,661,669,688,695,727,759,777,796,805,814,843,852,860],{"type":84,"tag":330,"props":331,"children":334},"span",{"class":332,"line":333},"line",1,[335,341,347,352],{"type":84,"tag":330,"props":336,"children":338},{"style":337},"--shiki-default:#D73A49;--shiki-dark:#F97583",[339],{"type":90,"value":340},"const",{"type":84,"tag":330,"props":342,"children":344},{"style":343},"--shiki-default:#005CC5;--shiki-dark:#79B8FF",[345],{"type":90,"value":346}," tools",{"type":84,"tag":330,"props":348,"children":349},{"style":337},[350],{"type":90,"value":351}," =",{"type":84,"tag":330,"props":353,"children":355},{"style":354},"--shiki-default:#24292E;--shiki-dark:#E1E4E8",[356],{"type":90,"value":357}," [list_dir, search, read_file, write_file]\n",{"type":84,"tag":330,"props":359,"children":361},{"class":332,"line":360},2,[362],{"type":84,"tag":330,"props":363,"children":365},{"emptyLinePlaceholder":364},true,[366],{"type":90,"value":367},"\n",{"type":84,"tag":330,"props":369,"children":371},{"class":332,"line":370},3,[372,376,381,385],{"type":84,"tag":330,"props":373,"children":374},{"style":337},[375],{"type":90,"value":340},{"type":84,"tag":330,"props":377,"children":378},{"style":343},[379],{"type":90,"value":380}," system",{"type":84,"tag":330,"props":382,"children":383},{"style":337},[384],{"type":90,"value":351},{"type":84,"tag":330,"props":386,"children":388},{"style":387},"--shiki-default:#032F62;--shiki-dark:#9ECBFF",[389],{"type":90,"value":390}," `你是一个代码修改助手。\n",{"type":84,"tag":330,"props":392,"children":394},{"class":332,"line":393},4,[395],{"type":84,"tag":330,"props":396,"children":397},{"style":387},[398],{"type":90,"value":399},"规则：\n",{"type":84,"tag":330,"props":401,"children":403},{"class":332,"line":402},5,[404],{"type":84,"tag":330,"props":405,"children":406},{"style":387},[407],{"type":90,"value":408},"- 修改前必须 read_file\n",{"type":84,"tag":330,"props":410,"children":412},{"class":332,"line":411},6,[413],{"type":84,"tag":330,"props":414,"children":415},{"style":387},[416],{"type":90,"value":417},"- 尽量只修改必要最小范围\n",{"type":84,"tag":330,"props":419,"children":421},{"class":332,"line":420},7,[422],{"type":84,"tag":330,"props":423,"children":424},{"style":387},[425],{"type":90,"value":426},"- 修改后必须再次 read_file 自检\n",{"type":84,"tag":330,"props":428,"children":430},{"class":332,"line":429},8,[431],{"type":84,"tag":330,"props":432,"children":433},{"style":387},[434],{"type":90,"value":435},"- 不允许访问工作目录之外的路径\n",{"type":84,"tag":330,"props":437,"children":439},{"class":332,"line":438},9,[440],{"type":84,"tag":330,"props":441,"children":442},{"style":387},[443],{"type":90,"value":444},"- 输出最终答复时，说明改了哪些文件、改动点是什么\n",{"type":84,"tag":330,"props":446,"children":448},{"class":332,"line":447},10,[449],{"type":84,"tag":330,"props":450,"children":451},{"style":387},[452],{"type":90,"value":453},"`\n",{"type":84,"tag":330,"props":455,"children":457},{"class":332,"line":456},11,[458],{"type":84,"tag":330,"props":459,"children":460},{"emptyLinePlaceholder":364},[461],{"type":90,"value":367},{"type":84,"tag":330,"props":463,"children":465},{"class":332,"line":464},12,[466,471,476,481,486],{"type":84,"tag":330,"props":467,"children":468},{"style":354},[469],{"type":90,"value":470},"messages ",{"type":84,"tag":330,"props":472,"children":473},{"style":337},[474],{"type":90,"value":475},"=",{"type":84,"tag":330,"props":477,"children":478},{"style":354},[479],{"type":90,"value":480}," [{ role: ",{"type":84,"tag":330,"props":482,"children":483},{"style":387},[484],{"type":90,"value":485},"\"system\"",{"type":84,"tag":330,"props":487,"children":488},{"style":354},[489],{"type":90,"value":490},", content: system }]\n",{"type":84,"tag":330,"props":492,"children":494},{"class":332,"line":493},13,[495],{"type":84,"tag":330,"props":496,"children":497},{"emptyLinePlaceholder":364},[498],{"type":90,"value":367},{"type":84,"tag":330,"props":500,"children":502},{"class":332,"line":501},14,[503,508,513,518],{"type":84,"tag":330,"props":504,"children":505},{"style":337},[506],{"type":90,"value":507},"while",{"type":84,"tag":330,"props":509,"children":510},{"style":354},[511],{"type":90,"value":512}," (",{"type":84,"tag":330,"props":514,"children":515},{"style":343},[516],{"type":90,"value":517},"true",{"type":84,"tag":330,"props":519,"children":520},{"style":354},[521],{"type":90,"value":522},") {\n",{"type":84,"tag":330,"props":524,"children":526},{"class":332,"line":525},15,[527,532,537,541,546,552],{"type":84,"tag":330,"props":528,"children":529},{"style":337},[530],{"type":90,"value":531},"  const",{"type":84,"tag":330,"props":533,"children":534},{"style":343},[535],{"type":90,"value":536}," resp",{"type":84,"tag":330,"props":538,"children":539},{"style":337},[540],{"type":90,"value":351},{"type":84,"tag":330,"props":542,"children":543},{"style":337},[544],{"type":90,"value":545}," await",{"type":84,"tag":330,"props":547,"children":549},{"style":548},"--shiki-default:#6F42C1;--shiki-dark:#B392F0",[550],{"type":90,"value":551}," llm",{"type":84,"tag":330,"props":553,"children":554},{"style":354},[555],{"type":90,"value":556},"({ messages, tools })\n",{"type":84,"tag":330,"props":558,"children":560},{"class":332,"line":559},16,[561,565,570,574,579,584],{"type":84,"tag":330,"props":562,"children":563},{"style":337},[564],{"type":90,"value":531},{"type":84,"tag":330,"props":566,"children":567},{"style":343},[568],{"type":90,"value":569}," msg",{"type":84,"tag":330,"props":571,"children":572},{"style":337},[573],{"type":90,"value":351},{"type":84,"tag":330,"props":575,"children":576},{"style":354},[577],{"type":90,"value":578}," resp.choices[",{"type":84,"tag":330,"props":580,"children":581},{"style":343},[582],{"type":90,"value":583},"0",{"type":84,"tag":330,"props":585,"children":586},{"style":354},[587],{"type":90,"value":588},"].message\n",{"type":84,"tag":330,"props":590,"children":592},{"class":332,"line":591},17,[593],{"type":84,"tag":330,"props":594,"children":595},{"emptyLinePlaceholder":364},[596],{"type":90,"value":367},{"type":84,"tag":330,"props":598,"children":600},{"class":332,"line":599},18,[601,606,610,615,620,625],{"type":84,"tag":330,"props":602,"children":603},{"style":337},[604],{"type":90,"value":605},"  if",{"type":84,"tag":330,"props":607,"children":608},{"style":354},[609],{"type":90,"value":512},{"type":84,"tag":330,"props":611,"children":612},{"style":337},[613],{"type":90,"value":614},"!",{"type":84,"tag":330,"props":616,"children":617},{"style":354},[618],{"type":90,"value":619},"msg.tool_calls?.",{"type":84,"tag":330,"props":621,"children":622},{"style":343},[623],{"type":90,"value":624},"length",{"type":84,"tag":330,"props":626,"children":627},{"style":354},[628],{"type":90,"value":522},{"type":84,"tag":330,"props":630,"children":632},{"class":332,"line":631},19,[633,638],{"type":84,"tag":330,"props":634,"children":635},{"style":548},[636],{"type":90,"value":637},"    print",{"type":84,"tag":330,"props":639,"children":640},{"style":354},[641],{"type":90,"value":642},"(msg.content)\n",{"type":84,"tag":330,"props":644,"children":646},{"class":332,"line":645},20,[647],{"type":84,"tag":330,"props":648,"children":649},{"style":337},[650],{"type":90,"value":651},"    break\n",{"type":84,"tag":330,"props":653,"children":655},{"class":332,"line":654},21,[656],{"type":84,"tag":330,"props":657,"children":658},{"style":354},[659],{"type":90,"value":660},"  }\n",{"type":84,"tag":330,"props":662,"children":664},{"class":332,"line":663},22,[665],{"type":84,"tag":330,"props":666,"children":667},{"emptyLinePlaceholder":364},[668],{"type":90,"value":367},{"type":84,"tag":330,"props":670,"children":672},{"class":332,"line":671},23,[673,678,683],{"type":84,"tag":330,"props":674,"children":675},{"style":354},[676],{"type":90,"value":677},"  messages.",{"type":84,"tag":330,"props":679,"children":680},{"style":548},[681],{"type":90,"value":682},"push",{"type":84,"tag":330,"props":684,"children":685},{"style":354},[686],{"type":90,"value":687},"(msg)\n",{"type":84,"tag":330,"props":689,"children":690},{"class":332,"line":5},[691],{"type":84,"tag":330,"props":692,"children":693},{"emptyLinePlaceholder":364},[694],{"type":90,"value":367},{"type":84,"tag":330,"props":696,"children":698},{"class":332,"line":697},25,[699,704,708,712,717,722],{"type":84,"tag":330,"props":700,"children":701},{"style":337},[702],{"type":90,"value":703},"  for",{"type":84,"tag":330,"props":705,"children":706},{"style":354},[707],{"type":90,"value":512},{"type":84,"tag":330,"props":709,"children":710},{"style":337},[711],{"type":90,"value":340},{"type":84,"tag":330,"props":713,"children":714},{"style":343},[715],{"type":90,"value":716}," call",{"type":84,"tag":330,"props":718,"children":719},{"style":337},[720],{"type":90,"value":721}," of",{"type":84,"tag":330,"props":723,"children":724},{"style":354},[725],{"type":90,"value":726}," msg.tool_calls) {\n",{"type":84,"tag":330,"props":728,"children":730},{"class":332,"line":729},26,[731,736,741,745,749,754],{"type":84,"tag":330,"props":732,"children":733},{"style":337},[734],{"type":90,"value":735},"    const",{"type":84,"tag":330,"props":737,"children":738},{"style":343},[739],{"type":90,"value":740}," result",{"type":84,"tag":330,"props":742,"children":743},{"style":337},[744],{"type":90,"value":351},{"type":84,"tag":330,"props":746,"children":747},{"style":337},[748],{"type":90,"value":545},{"type":84,"tag":330,"props":750,"children":751},{"style":548},[752],{"type":90,"value":753}," runTool",{"type":84,"tag":330,"props":755,"children":756},{"style":354},[757],{"type":90,"value":758},"(call)\n",{"type":84,"tag":330,"props":760,"children":762},{"class":332,"line":761},27,[763,768,772],{"type":84,"tag":330,"props":764,"children":765},{"style":354},[766],{"type":90,"value":767},"    messages.",{"type":84,"tag":330,"props":769,"children":770},{"style":548},[771],{"type":90,"value":682},{"type":84,"tag":330,"props":773,"children":774},{"style":354},[775],{"type":90,"value":776},"({\n",{"type":84,"tag":330,"props":778,"children":780},{"class":332,"line":779},28,[781,786,791],{"type":84,"tag":330,"props":782,"children":783},{"style":354},[784],{"type":90,"value":785},"      role: ",{"type":84,"tag":330,"props":787,"children":788},{"style":387},[789],{"type":90,"value":790},"\"tool\"",{"type":84,"tag":330,"props":792,"children":793},{"style":354},[794],{"type":90,"value":795},",\n",{"type":84,"tag":330,"props":797,"children":799},{"class":332,"line":798},29,[800],{"type":84,"tag":330,"props":801,"children":802},{"style":354},[803],{"type":90,"value":804},"      tool_call_id: call.id,\n",{"type":84,"tag":330,"props":806,"children":808},{"class":332,"line":807},30,[809],{"type":84,"tag":330,"props":810,"children":811},{"style":354},[812],{"type":90,"value":813},"      name: call.function.name,\n",{"type":84,"tag":330,"props":815,"children":817},{"class":332,"line":816},31,[818,823,828,833,838],{"type":84,"tag":330,"props":819,"children":820},{"style":354},[821],{"type":90,"value":822},"      content: ",{"type":84,"tag":330,"props":824,"children":825},{"style":343},[826],{"type":90,"value":827},"JSON",{"type":84,"tag":330,"props":829,"children":830},{"style":354},[831],{"type":90,"value":832},".",{"type":84,"tag":330,"props":834,"children":835},{"style":548},[836],{"type":90,"value":837},"stringify",{"type":84,"tag":330,"props":839,"children":840},{"style":354},[841],{"type":90,"value":842},"(result)\n",{"type":84,"tag":330,"props":844,"children":846},{"class":332,"line":845},32,[847],{"type":84,"tag":330,"props":848,"children":849},{"style":354},[850],{"type":90,"value":851},"    })\n",{"type":84,"tag":330,"props":853,"children":855},{"class":332,"line":854},33,[856],{"type":84,"tag":330,"props":857,"children":858},{"style":354},[859],{"type":90,"value":660},{"type":84,"tag":330,"props":861,"children":863},{"class":332,"line":862},34,[864],{"type":84,"tag":330,"props":865,"children":866},{"style":354},[867],{"type":90,"value":868},"}\n",{"type":84,"tag":115,"props":870,"children":871},{},[],{"type":84,"tag":119,"props":873,"children":875},{"id":874},"_3-关键难点-token-消耗怎么控",[876],{"type":90,"value":877},"3. 关键难点 ①：Token 消耗怎么控",{"type":84,"tag":126,"props":879,"children":881},{"id":880},"_31-只读必要片段",[882],{"type":90,"value":883},"3.1 只读必要片段",{"type":84,"tag":132,"props":885,"children":886},{},[887,904],{"type":84,"tag":136,"props":888,"children":889},{},[890,896,898],{"type":84,"tag":209,"props":891,"children":893},{"className":892},[],[894],{"type":90,"value":895},"read_file",{"type":90,"value":897}," 支持 ",{"type":84,"tag":209,"props":899,"children":901},{"className":900},[],[902],{"type":90,"value":903},"offset\u002Flimit",{"type":84,"tag":136,"props":905,"children":906},{},[907,909,915],{"type":90,"value":908},"先通过 ",{"type":84,"tag":209,"props":910,"children":912},{"className":911},[],[913],{"type":90,"value":914},"search",{"type":90,"value":916}," 找到函数附近，再读局部",{"type":84,"tag":126,"props":918,"children":920},{"id":919},"_32-让模型引用行号",[921],{"type":90,"value":922},"3.2 让模型“引用行号”",{"type":84,"tag":96,"props":924,"children":925},{},[926,928,933],{"type":90,"value":927},"你可以让 ",{"type":84,"tag":209,"props":929,"children":931},{"className":930},[],[932],{"type":90,"value":895},{"type":90,"value":934}," 返回带行号的内容：",{"type":84,"tag":319,"props":936,"children":940},{"className":937,"code":938,"language":939,"meta":324,"style":324},"language-txt shiki shiki-themes github-light github-dark","120| function foo() {\n121|   ...\n","txt",[941],{"type":84,"tag":209,"props":942,"children":943},{"__ignoreMap":324},[944,952],{"type":84,"tag":330,"props":945,"children":946},{"class":332,"line":333},[947],{"type":84,"tag":330,"props":948,"children":949},{},[950],{"type":90,"value":951},"120| function foo() {\n",{"type":84,"tag":330,"props":953,"children":954},{"class":332,"line":360},[955],{"type":84,"tag":330,"props":956,"children":957},{},[958],{"type":90,"value":959},"121|   ...\n",{"type":84,"tag":96,"props":961,"children":962},{},[963],{"type":90,"value":964},"这样模型更容易做精确修改（尤其是后续 patch 化）。",{"type":84,"tag":126,"props":966,"children":968},{"id":967},"_33-限制上下文",[969],{"type":90,"value":970},"3.3 限制上下文",{"type":84,"tag":132,"props":972,"children":973},{},[974,979],{"type":84,"tag":136,"props":975,"children":976},{},[977],{"type":90,"value":978},"只保留最近 N 轮 tool 结果",{"type":84,"tag":136,"props":980,"children":981},{},[982],{"type":90,"value":983},"或把“工具输出”做摘要再放回 messages",{"type":84,"tag":115,"props":985,"children":986},{},[],{"type":84,"tag":119,"props":988,"children":990},{"id":989},"_4-关键难点-修改准确性怎么保证",[991],{"type":90,"value":992},"4. 关键难点 ②：修改准确性怎么保证",{"type":84,"tag":96,"props":994,"children":995},{},[996],{"type":90,"value":997},"第一版“覆盖写入”很危险，建议至少加三层护栏：",{"type":84,"tag":202,"props":999,"children":1000},{},[1001,1011,1021],{"type":84,"tag":136,"props":1002,"children":1003},{},[1004,1009],{"type":84,"tag":100,"props":1005,"children":1006},{},[1007],{"type":90,"value":1008},"工作区沙箱",{"type":90,"value":1010},"：只能操作指定目录（例如 repo 根目录）",{"type":84,"tag":136,"props":1012,"children":1013},{},[1014,1019],{"type":84,"tag":100,"props":1015,"children":1016},{},[1017],{"type":90,"value":1018},"变更最小化约束",{"type":90,"value":1020},"：system prompt 强约束“只改必要范围”",{"type":84,"tag":136,"props":1022,"children":1023},{},[1024,1029],{"type":84,"tag":100,"props":1025,"children":1026},{},[1027],{"type":90,"value":1028},"自检回读",{"type":90,"value":1030},"：写完必须 read_file 校验自己改了什么",{"type":84,"tag":96,"props":1032,"children":1033},{},[1034],{"type":90,"value":1035},"如果你要进一步提升可靠性：",{"type":84,"tag":132,"props":1037,"children":1038},{},[1039,1044],{"type":84,"tag":136,"props":1040,"children":1041},{},[1042],{"type":90,"value":1043},"让模型输出 unified diff",{"type":84,"tag":136,"props":1045,"children":1046},{},[1047],{"type":90,"value":1048},"由你的程序做 patch apply（失败就回传错误让模型修正）",{"type":84,"tag":115,"props":1050,"children":1051},{},[],{"type":84,"tag":119,"props":1053,"children":1055},{"id":1054},"_5-推荐的输出格式让结果可审计",[1056],{"type":90,"value":1057},"5. 推荐的输出格式（让结果可审计）",{"type":84,"tag":96,"props":1059,"children":1060},{},[1061],{"type":90,"value":1062},"最终回答建议固定结构：",{"type":84,"tag":132,"props":1064,"children":1065},{},[1066,1083,1101],{"type":84,"tag":136,"props":1067,"children":1068},{},[1069,1071],{"type":90,"value":1070},"✅ 修改了哪些文件：\n",{"type":84,"tag":132,"props":1072,"children":1073},{},[1074],{"type":84,"tag":136,"props":1075,"children":1076},{},[1077],{"type":84,"tag":209,"props":1078,"children":1080},{"className":1079},[],[1081],{"type":90,"value":1082},"path\u002Fto\u002Ffile.ts",{"type":84,"tag":136,"props":1084,"children":1085},{},[1086,1088],{"type":90,"value":1087},"✅ 改了什么：\n",{"type":84,"tag":132,"props":1089,"children":1090},{},[1091,1096],{"type":84,"tag":136,"props":1092,"children":1093},{},[1094],{"type":90,"value":1095},"改动点 1",{"type":84,"tag":136,"props":1097,"children":1098},{},[1099],{"type":90,"value":1100},"改动点 2",{"type":84,"tag":136,"props":1102,"children":1103},{},[1104,1106],{"type":90,"value":1105},"✅ 如何验证：\n",{"type":84,"tag":132,"props":1107,"children":1108},{},[1109],{"type":84,"tag":136,"props":1110,"children":1111},{},[1112],{"type":90,"value":1113},"运行哪些命令\u002F测试",{"type":84,"tag":115,"props":1115,"children":1116},{},[],{"type":84,"tag":119,"props":1118,"children":1120},{"id":1119},"_6-下一步",[1121],{"type":90,"value":1122},"6. 下一步",{"type":84,"tag":96,"props":1124,"children":1125},{},[1126],{"type":90,"value":1127},"Mini Cursor 跑通后，你就具备了构建复杂 Agent 的基础“手脚”。接下来要解决的是：",{"type":84,"tag":132,"props":1129,"children":1130},{},[1131,1141],{"type":84,"tag":136,"props":1132,"children":1133},{},[1134,1139],{"type":84,"tag":100,"props":1135,"children":1136},{},[1137],{"type":90,"value":1138},"Memory",{"type":90,"value":1140},"：对话长了会撞 context window，怎么让它“像记得一样”？",{"type":84,"tag":136,"props":1142,"children":1143},{},[1144,1149],{"type":84,"tag":100,"props":1145,"children":1146},{},[1147],{"type":90,"value":1148},"Planning",{"type":90,"value":1150},"：任务复杂时，怎么让它先计划再执行，并能自我纠错？",{"type":84,"tag":1152,"props":1153,"children":1154},"style",{},[1155],{"type":90,"value":1156},"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":324,"searchDepth":360,"depth":360,"links":1158},[1159,1163,1164,1165,1170,1171,1172],{"id":121,"depth":360,"text":124,"children":1160},[1161,1162],{"id":128,"depth":370,"text":128},{"id":176,"depth":370,"text":176},{"id":192,"depth":360,"text":195},{"id":271,"depth":360,"text":274},{"id":874,"depth":360,"text":877,"children":1166},[1167,1168,1169],{"id":880,"depth":370,"text":883},{"id":919,"depth":370,"text":922},{"id":967,"depth":370,"text":970},{"id":989,"depth":360,"text":992},{"id":1054,"depth":360,"text":1057},{"id":1119,"depth":360,"text":1122},{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":1174},"\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":1176},"\u003Cpath fill=\"currentColor\" d=\"M3 4h18v2H3zm0 7h12v2H3zm0 7h18v2H3z\"\u002F>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":1178},"\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":1180,"height":1180,"rotate":4,"vFlip":6,"hFlip":6,"body":1181},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>"]