发动机 · Agent 自己把活干完The Engine · The Agent Finishes the Job Itself.
Chat 给你一段代码,你再去粘、去跑、去改。Agent 不是 —— 它自己改多个文件、自己在终端跑命令、看结果、再调整,直到这件事做完。这是 Cursor 从「编辑器」变成「工作台」的那台发动机。这一章讲怎么给它定任务、它默认用哪个模型、什么时候该换前沿模型或开 Max,以及别让它漫无目的地跑。Chat hands you a snippet; you paste it, run it, fix it. The Agent doesn't — it edits files, runs commands in the terminal, reads the output, and adjusts until the task is done. This is the engine that turns Cursor from an editor into a workbench. How to define a task for it, which model it runs by default, when to switch to a frontier model or Max — and how to keep it from running in circles.
Chat 给你一段代码,你再去粘、去跑、去改。Agent 不是这样 —— 它自己改多个文件、自己在终端跑命令、看结果、再调整,直到这件事做完。Chat hands you a snippet; you paste it, run it, fix it. The Agent doesn't work that way — it edits multiple files, runs commands in the terminal, reads the results, and adjusts until the task is done.这是 Cursor 从「编辑器」变成「工作台」的那台发动机,也是你多付那笔钱真正买到的东西。前一章的底座替你打字,这一章的 Agent 替你把一件事跑完 —— 这本书后面所有的面(终端、索引、MCP、云端),都是给这台发动机加燃料。This is the engine that turns Cursor from an editor into a workbench — and what your extra money actually buys. The base layer types for you; the Agent runs a whole task to completion. Every surface later in this book — terminal, index, MCP, cloud — is fuel for this one engine.
— I
它的循环:改、跑、看、再改Its Loop: Edit, Run, Check, Adjust.
Agent 不是给你代码,是替你把一件事跑完。The Agent doesn't give you code — it runs a task to completion for you.给它一个任务(Cmd+I),它会跨文件改代码、在终端跑命令、读回输出、对索引过的代码库做语义搜索、必要时开浏览器验证、调你接的 MCP 工具 —— 然后看结果不对就自己调整,直到达成。1注 1Note 1Cursor Docs · Agent —— Agent(Cmd+I)会跨文件改代码、执行终端命令并读输出、对索引过的代码库做语义搜索、控制浏览器验证、调 MCP 工具,看结果后自我调整直到任务完成。截至 2026-07-10。Cursor Docs · Agent — the Agent (Cmd+I) edits across files, executes terminal commands and reads output, runs semantic search over the indexed codebase, controls a browser to verify, calls MCP tools, and self-adjusts on results until the task is done. As of 2026-07-10.这一圈「改 → 跑 → 看 → 再改」是它和 Chat 的本质区别:Chat 把一段代码丢给你,闭环在你手上;Agent 把闭环收在它自己手里。Give it a task (Cmd+I) and it edits across files, runs commands in the terminal, reads the output back, semantic-searches the indexed codebase, opens a browser to verify when needed, and calls the MCP tools you wired in — then, seeing a wrong result, adjusts on its own until it lands.1注 1Note 1Cursor Docs · Agent —— Agent(Cmd+I)会跨文件改代码、执行终端命令并读输出、对索引过的代码库做语义搜索、控制浏览器验证、调 MCP 工具,看结果后自我调整直到任务完成。截至 2026-07-10。Cursor Docs · Agent — the Agent (Cmd+I) edits across files, executes terminal commands and reads output, runs semantic search over the indexed codebase, controls a browser to verify, calls MCP tools, and self-adjusts on results until the task is done. As of 2026-07-10. That loop — edit → run → check → adjust — is the real difference from Chat: Chat tosses you a snippet and leaves the loop in your hands; the Agent keeps the loop in its own.你的工作因此换了形状:从「逐行写」变成「定义任务、审结果」。这不是说你不看代码了 —— 是你看的从「每一行怎么敲」挪到「这个 diff 对不对」。会用 Agent 的人,省下的不是打字,是把注意力从执行挪到判断。Your work changes shape as a result: from 'writing line by line' to 'defining tasks and reviewing results.' Not that you stop reading code — what you read shifts from 'how to type each line' to 'is this diff right.' What an Agent-fluent person saves isn't typing; it's moving attention off execution and onto judgment.
— II
先 Plan,别让它瞎跑Plan First, Don't Let It Run Blind.
把验收标准定在前面,它就不容易跑偏;不定,它会很自信地做错。Fix the acceptance criteria up front and it stays on track; skip them and it will confidently do the wrong thing.复杂、要动很多文件、有多种做法的任务,先按 Shift+Tab 进 Plan 模式:它会提澄清问题、研究你的代码库,生成一份可编辑的实现计划,你审完、改完再让它动手。2注 2Note 2Cursor Docs · Plan Mode —— Shift+Tab 进入;Agent 先提澄清问题、研究代码库,生成一份可编辑、可审阅的实现计划(默认存 home,可 Save to workspace),批准后再动手;结果偏了「回到计划」比中途纠错更干净。Cursor Docs · Plan Mode — enter with Shift+Tab; the Agent asks clarifying questions, researches the codebase, and generates an editable, reviewable plan (saved to home by default, or Save to workspace), then builds once approved; if results drift, 'go back to the plan' beats mid-execution fixes.计划默认存在 home,可以 Save to workspace 给团队看。最值得记的一条:如果它做偏了,回到计划改,比在执行里一处处纠错更干净。For complex work that touches many files or has several valid approaches, press Shift+Tab into Plan mode first: it asks clarifying questions, researches your codebase, and generates an editable implementation plan you review and revise before it builds.2注 2Note 2Cursor Docs · Plan Mode —— Shift+Tab 进入;Agent 先提澄清问题、研究代码库,生成一份可编辑、可审阅的实现计划(默认存 home,可 Save to workspace),批准后再动手;结果偏了「回到计划」比中途纠错更干净。Cursor Docs · Plan Mode — enter with Shift+Tab; the Agent asks clarifying questions, researches the codebase, and generates an editable, reviewable plan (saved to home by default, or Save to workspace), then builds once approved; if results drift, 'go back to the plan' beats mid-execution fixes. Plans save to home by default, or Save to workspace for the team. The line worth remembering: if it drifts, go back and fix the plan — cleaner than patching errors mid-execution.尺子很简单:一句话能说清的小改动、你做过很多遍的活,直接 Agent;要动很多文件、有多种做法、或你自己都没想清楚的,先 Plan。它最强的活是「有明确验收标准」的 —— 先写测试再让它实现,跑得过测试就是做完。别在 Agent 里跑漫无目的的长会话,它会越改越远。会话卫生很简单:一会话一任务、任务尽量控制在三五个文件;一看它在报错里越钻越深,就按 ESC 停、回到计划,别由着它继续挖。岔出去的问题 —— 查个用法、比较个替代方案 —— 别塞进主会话:3.11 起可以用 /side 开一个 side chat,它带着主线的上下文、默认只查只答不动手,答案要用再 @ 回主线。4注 4Note 4Cursor Changelog · 3.11(2026-07-10)—— Side chats:/side 或 /btw 在主会话旁开一个带上下文的支线会话,默认偏向只读的查证与回答,可事后 @ 回主线;Agents 窗口新增会话转录搜索(Cmd+K),会话内 Cmd+F。Cursor Changelog · 3.11 (2026-07-10) — Side chats: /side or /btw opens a context-carrying side conversation beside the main one, defaulting to read-and-answer work, @-mentionable back into the main thread; the Agents Window adds transcript search (Cmd+K), with Cmd+F inside a conversation.主会话保持一件事。The ruler is simple: a one-sentence change or a task you've done many times, go straight to Agent; many files, multiple approaches, or something you haven't thought through yourself, Plan first. Its strongest work has clear acceptance criteria — write the tests first, then have it implement, and passing the tests is done. Don't run aimless long sessions in the Agent; it drifts further with each edit. Session hygiene is simple: one task per chat, kept to three-to-five files; the moment it digs deeper into an error, hit ESC and go back to the plan instead of letting it keep digging. And tangents — checking a usage, weighing an alternative — don't belong in the main thread: since 3.11, /side opens a side chat that carries the main context, defaults to read-and-answer, and @-mentions its findings back when needed.4注 4Note 4Cursor Changelog · 3.11(2026-07-10)—— Side chats:/side 或 /btw 在主会话旁开一个带上下文的支线会话,默认偏向只读的查证与回答,可事后 @ 回主线;Agents 窗口新增会话转录搜索(Cmd+K),会话内 Cmd+F。Cursor Changelog · 3.11 (2026-07-10) — Side chats: /side or /btw opens a context-carrying side conversation beside the main one, defaulting to read-and-answer work, @-mentionable back into the main thread; the Agents Window adds transcript search (Cmd+K), with Cmd+F inside a conversation. The main conversation stays on one task.
任务大小Task size
适合入口Best entry
例子Example
验收Acceptance
S
Cmd+K / Agent
改一个函数、补一个错误分支Change one function, add one error branch
肉眼 review + 单测Human review + unit test
M
Agent
跨 2–5 个文件修 bug、补测试、改文档Fix a bug across 2-5 files, add tests, update docs
明确测试命令 + diff reviewNamed test command + diff review
L
Plan → Agent
重构一块模块、改 API 契约、迁移配置Refactor a module, change an API contract, migrate config
先审计划,再分阶段跑测试Review plan first, then staged tests
XL
拆成多个 Agent / 多个 PRSplit into agents / PRs
优化整个项目、重做架构、迁移框架Optimize the whole project, redo architecture, migrate framework
先写 spec,不直接跑Write a spec first; do not run directly
目标:<一句话说清要做成什么>
验收:
- <可检验的条件,最好能跑测试>
- <另一个条件>
约束:用<某库 / 某风格>,别碰<某目录 / 文件>
先给计划,我确认后再动手。Goal: <one line on what to build>
Acceptance:
- <a checkable condition, ideally a test>
- <another condition>
Constraints: use <a lib / style>, don't touch <a dir / file>
Give me a plan first; I'll confirm before you change anything.
目标:给 /api/orders 加分页,支持 page 和 pageSize 两个查询参数
验收:
- tests/orders.test.ts 全绿,新增一条「翻到第二页拿到下一批」的用例
- pageSize 上限 100,超出返回 400
约束:用现有的 zod 校验,别碰 lib/db.ts 的连接逻辑
先给计划,我确认后再动手。Goal: add pagination to /api/orders, with page and pageSize query params
Acceptance:
- tests/orders.test.ts all green, plus a new case for 'second page returns the next batch'
- pageSize caps at 100; over the cap returns 400
Constraints: use the existing zod validation, don't touch the connection logic in lib/db.ts
Give me a plan first; I'll confirm before you change anything.
禁止把「优化一下项目」「提升质量」「整理一下」这种模糊任务直接交给 Agent。Do not hand vague tasks like 'optimize the project,' 'improve quality,' or 'clean this up' directly to Agent.
禁止让它无监督处理生产数据库、真实支付、密钥、云控制台、删除类批处理。Do not let it unsupervised touch production databases, real payments, secrets, cloud consoles, or deletion-heavy batches.
禁止把你自己都没有验收标准的任务交给 Cloud Agents 长跑。Do not send long-running Cloud Agent work when you do not have acceptance criteria yourself.
禁止把 Bugbot 或 Agent 的解释当成人工 code review 结论。Do not treat Bugbot or Agent explanations as the conclusion of human code review.
— III
它背后用哪个模型:默认 AutoWhich Model It Runs: Auto by Default.
日常活让 Auto 选,难的那一成才手动换前沿模型。Let Auto pick for everyday work; switch to a frontier model by hand only for the hard tenth.Auto 在智能、成本、稳定之间替你路由,配上 Cursor 自家的 Composer 2.5(专为 agentic 编码训练、又快又省 —— 现在连 Bugbot 也由它驱动),覆盖你大多数的活;这套走的是更宽的「第一方模型池」(Auto、Composer 2.5、Grok 4.5 共用)。3注 3Note 3Cursor Docs · Models —— 个人档两套额度池:「第一方模型池」(Auto、Composer 2.5、Grok 4.5,included 用量宽得多)与 API 池(手动选 Claude / GPT / Gemini 等前沿模型,按该模型 API 价)。Auto 在智能/成本/稳定间路由;另有 Premium 路由,替你挑最强模型、按所选模型 API 价计费;Max(最大上下文)按模型 API 价。Composer 2.5 是 Cursor 自家 agentic 模型,官方 changelog(2026-06-10)称其现在也驱动 Bugbot。截至 2026-07-10。Cursor Docs · Models — two pools on individual plans: the First-party models pool (Auto, Composer 2.5, Grok 4.5, with significantly more included usage) and the API pool (hand-picked frontier models — Claude / GPT / Gemini — at each model's API rate). Auto routes among intelligence/cost/reliability; a Premium router picks the most capable model at its API rate; Max (maximum context) bills at the model's API rate. Composer 2.5 is Cursor's own agentic model, and per the official changelog (2026-06-10) it now powers Bugbot too. As of 2026-07-10.遇到难推理、长链路、它反复卡住的题,再手动切到前沿模型(Claude / GPT / Gemini 这些,走 API 池);不想自己挑,还有 Premium 路由替你直接挑最强的、按该模型 API 价计费;上下文实在塞不下时开 Max(最大上下文窗口,按模型 API 价计费,烧得快)。Auto routes for you among intelligence, cost, and reliability, paired with Cursor's own Composer 2.5 (trained for agentic coding, fast and cheap — it now powers Bugbot too), covering most of your work on the wider First-party models pool (shared by Auto, Composer 2.5, and Grok 4.5).3注 3Note 3Cursor Docs · Models —— 个人档两套额度池:「第一方模型池」(Auto、Composer 2.5、Grok 4.5,included 用量宽得多)与 API 池(手动选 Claude / GPT / Gemini 等前沿模型,按该模型 API 价)。Auto 在智能/成本/稳定间路由;另有 Premium 路由,替你挑最强模型、按所选模型 API 价计费;Max(最大上下文)按模型 API 价。Composer 2.5 是 Cursor 自家 agentic 模型,官方 changelog(2026-06-10)称其现在也驱动 Bugbot。截至 2026-07-10。Cursor Docs · Models — two pools on individual plans: the First-party models pool (Auto, Composer 2.5, Grok 4.5, with significantly more included usage) and the API pool (hand-picked frontier models — Claude / GPT / Gemini — at each model's API rate). Auto routes among intelligence/cost/reliability; a Premium router picks the most capable model at its API rate; Max (maximum context) bills at the model's API rate. Composer 2.5 is Cursor's own agentic model, and per the official changelog (2026-06-10) it now powers Bugbot too. As of 2026-07-10. For hard reasoning, long chains, or a problem it keeps stalling on, switch to a frontier model by hand (Claude / GPT / Gemini, on the API pool); if you'd rather not pick, the Premium router picks the most capable model for you at that model's API rate; when context truly won't fit, open Max (the maximum context window, billed at the model's API rate, burns fast).判断:默认就让 Auto 跑,别每次手动挑模型 —— 那是在替路由器干活,还更费额度。模型不是越贵越好,是越贵越该留给真难的题。计费的细账(两套额度池、Max 怎么算)放到第 10 章一起说。The call: default to Auto, don't hand-pick a model every time — that's doing the router's job and spending more quota. A pricier model isn't better; it's better reserved for genuinely hard problems. The fine print on billing (the two usage pools, how Max counts) is gathered in Chapter 10.
Diff 是否只动了任务范围内的文件?Did the diff touch only files inside scope?
测试是新增真实断言,还是只改了快照 / 跳过失败?Did it add real assertions, or merely update snapshots / skip failures?
有没有新依赖、网络调用、权限扩大、配置改动?Any new dependency, network call, widened permission, or config change?
失败路径、回滚路径、日志是否还说得通?Do failure paths, rollback paths, and logs still make sense?
它解释的风险,和你自己看到的风险是否一致?Do its stated risks match the risks you see?
把这章用到一个你最近手动做过的改动上 —— 编码或非编码都行:Apply this to a change you recently made by hand — code or non-code:
01
挑一个跨 3 个以上文件的小任务Pick a small task spanning 3+ files
可以是代码改动,也可以是非代码的(整理一个笔记文件夹并生成索引、按规则改一批文件)。It can be a code change, or non-code (reorganize a notes folder and generate an index, edit a batch of files by a rule).
02
先 Plan,把验收标准写清楚,再让 Agent 动手Plan first, write the acceptance criteria, then let the Agent act
你只定义任务和「做完算什么样」,让它去改,你不逐行写。You only define the task and 'what done looks like'; let it make the change without writing line by line.
03
审它的 diff,记下分工Review its diff, note the division
记下哪一步它明显比你快、哪一步你还得自己来。这条分工就是你之后该不该开 Agent 的依据。Note which step it was clearly faster at and which you still had to do. That division is your basis for when to open the Agent at all.
你从写每一行,
变成定义任务、审结果.
You go from writing every line
to defining tasks and reviewing results.
Aklman Library
— 讨论Discussion
讨论Discussion.
评论区初始化中…Initializing comments…
01 / 01
没有匹配结果No matches.
换个关键词,或按 Esc 回到页面Try another keyword, or press Esc to return