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。

接下來去哪

本頁目錄