AI 编程教程中文版
从原理到实战

Cloud Agent、Bugbot 和 Review

把 Cursor 放进异步任务、PR 审查、安全审查和团队交付流程。

Cloud Agent、Bugbot、Security Review 和 Agent Review 解决的是团队协作问题:任务可以离开本机会话进入云端环境,PR 可以被自动审查,安全风险可以被专门扫描,本地 diff 也可以在提交前再过一轮 AI review。

改名提醒:Cloud Agents 是官方在 2025-2026 间从 Background Agents 改名而来的——历史文档和老教程里还能看到旧名字,按 cursor.com/docs/cloud-agent 当前页为准。

本章目标:你会判断什么任务适合 Cloud Agent,Bugbot 应该怎样进入 PR 流程,以及 Agent Review / Security Review 不能替代哪些人工判断。

1. 四个能力的分工

flowchart TD
  Local["Local Changes"] --> AgentReview["Agent Review"]
  PR["Pull Request"] --> Bugbot["Bugbot"]
  Security["Security-Sensitive Repo"] --> SecReview["Security Review"]
  LongTask["Long Async Task"] --> Cloud["Cloud Agent"]
  Cloud --> Branch["Branch / PR / Artifacts"]
  Bugbot --> Findings["Review Findings"]
  SecReview --> Vulns["Security Findings"]
  AgentReview --> LocalFindings["Local Findings"]

分工:

  • Cloud Agent:长任务、并行任务、能用 branch / PR / artifacts 验收的云端执行。
  • Bugbot:自动或手动 PR review,发现 bug、安全问题和代码质量问题。
  • Security Review:Teams / Enterprise 场景下的安全审查和漏洞扫描。
  • Agent Review:对本地 changes 做提交前 review。

它们都不是“直接合并”的理由。它们提供 finding 和 evidence,最终仍要经过 CI、测试、diff review 和人判断。

2. Cloud Agent:适合长任务和隔离环境

官方 Cloud Agents 文档说明,Cloud Agent 运行在云端 isolated VM(隔离虚拟机,每次任务在独立云端环境跑,不污染本机),不依赖你的本机持续在线。它会 clone GitHub / GitLab repo,在独立 branch 上工作,产出 screenshots、videos、logs、demo references 等 artifacts,再把 changes push 回 repo。

可触发入口(按官方页 "How to access"):

  • Cursor Webcursor.com/agents,任何设备主入口。
  • Cursor Desktop:Agent 输入框下拉里选 Cloud
  • Slack:用 @cursor 命令。
  • GitHub:在 PR / issue 里评论 @cursor
  • Linear:用 @cursor 命令。
  • API:通过 API 程序化触发。

Cloud Agents 始终运行在 Max Mode,没有关闭开关——意味着用量按 Max Mode 速率计费,比本地 default context 烧得快得多。任务规模小的时候优先本地 Agent;只有真的需要并行 / 隔离 / 长时间跑时再上 Cloud。

Cloud Agents 也支持 MCP servers 和 .cursor/hooks.json 项目 hook;Enterprise 版本还能跑团队 / 企业级 hook。

适合:

  • 长时间测试和重构。
  • 多个任务并行探索。
  • 能通过分支、PR、日志和截图验收的工作。
  • 不依赖本机登录态或私有 GUI 环境的任务。

不适合:

  • 需要本机未提交状态的任务。
  • 依赖个人本机 keychain、浏览器登录态、私有桌面应用。
  • 生产后台、账单、密钥、删除动作。
  • 你不能写清 repo、范围、测试和 secret 边界的任务。

Cloud Agent spec 至少写:

Repo:
Branch target:
Goal:
Allowed paths:
Do not touch:
Test commands:
Secrets needed:
Expected artifacts:
Review criteria:

3. Bugbot:PR 审查,不是合并门禁替代品

Bugbot 会分析 PR diff,留下带解释和修复建议的评论。它可以在 PR update 后自动运行,也可以通过评论手动触发,例如 cursor reviewbugbot run——这两个命令既能放在 PR 描述里(首次自动触发),也能放在 PR 评论里(任意时刻手动触发)。

团队接入时要先定义:

  • 哪些 repo 启用。
  • draft PR 是否审查。
  • 个人设置和团队默认如何覆盖。
  • reviewer allow / deny lists。
  • Bugbot rules 写在哪里。
  • Autofix 是 off、新分支还是直接推现有分支。

规则来源有层级:Team Rules、Repository rules、.cursor/BUGBOT.md、User Rules。项目里建议放 .cursor/BUGBOT.md,并按目录嵌套更细规则。

好的 Bugbot rule 不是“注意安全”,而是具体说明触发路径、严重级别、检查方法和建议动作。

4. Autofix 要先用新分支

Bugbot Autofix 会调用 Cloud Agent 修复 findings。官方提供 Off、Create New Branch、Commit to Existing Branch、Use Installation Default 等模式。

商业级默认建议:

  • 初期 OffCreate New Branch
  • 不直接 commit 到现有 PR branch。
  • Autofix 后仍跑 CI 和 human review。
  • 敏感路径不允许自动修复。
  • 成本、storage、usage-based pricing 和 monthly PR cap(PR 数量上限,按月计费的封顶值)先核对。

原因很简单:review bot 找到的问题不一定都该自动改。新分支能保留隔离,方便人决定是否采纳。

5. Agent Review:提交前看本地完整 diff

Agent Review 用来审查 local changes。官方说明它有三种触发方式:

  • Automatic:每次 commit 后自动 review。
  • Slash command:输入 /agent-review
  • Source Control tab:对 all local changes against main branch 做 review。

Quick 和 Deep 的选择:

  • 小 diff、格式、文案:Quick。
  • 跨文件逻辑、安全敏感、权限、认证、支付、数据:Deep。

Source Control 视角很关键,因为本地可能不止 Agent 最近一次修改。提交前至少看完整 diff,不要只看 Agent 对话里的 summary。

6. Security Review:安全流程的一环

Security Review 面向 Teams 和 Enterprise,用于 PR / merge request 等 Git-based triggers。Vulnerability Scanner(漏洞扫描器,定时巡检整个代码库)则适合 cron-based codebase scan。

它适合接入:

  • 认证授权。
  • 输入处理。
  • 文件上传。
  • webhook。
  • 多租户数据访问。
  • secret 泄露。
  • 供应链风险。

但它不是完整安全体系。高风险系统仍需要 threat modeling、SAST / DAST、依赖扫描、人工安全评审和上线审批。

7. 一个团队接入顺序

建议按风险递进:

  1. 先用 Agent Review 审本地 diff。
  2. 给一个 test repo 开 Bugbot,只做评论,不开 Autofix。
  3. .cursor/BUGBOT.md,沉淀项目 review 标准。
  4. 开启 Create New Branch 模式的 Autofix,限制 repo 和路径。
  5. 对安全敏感 repo 单独接 Security Review。
  6. 对长任务启用 Cloud Agent,并要求 artifacts、日志和 PR diff。
  7. 每月复盘 false positive、fixed rate、成本和漏报。

这比一次性把 Cloud Agent、Bugbot、Autofix、安全扫描全部打开更稳。

8. 商业级验收清单

上线前确认:

  • Cloud Agent 的 repo 权限、secrets、network、tests 和 artifacts 明确。
  • Bugbot 在 test repo 跑通过自动和手动 review。
  • .cursor/BUGBOT.md 有项目级规则。
  • Autofix 默认不直接改现有 PR branch。
  • Agent Review 的 Quick / Deep 使用边界写清楚。
  • Security Review findings 有 Slack、issue tracker 或安全看板接收。
  • 成本、seat、usage pool、PR cap 和 storage 条件已核对。
  • AI review finding 不作为唯一 merge condition。

官方来源

  • Cursor Cloud Agents:官方 Cloud Agent isolated VM、repo flow、MCP、hooks、artifacts、billing 和 troubleshooting。
  • Cursor Bugbot:官方 PR review、rules、Autofix、MCP、Admin API、pricing 和 troubleshooting。
  • Cursor Agent Review:官方本地 review、触发方式、Source Control 和 Quick / Deep。
  • Cursor Security Review:官方 PR 安全审查、Vulnerability Scanner、triggers、tools、billing 和 analytics。

接下来去哪

本页目录