Slack 整合
基於 Cursor 官方 Slack integration 文件解釋 @Cursor 命令、repo 路由、channel settings、status handoff、privacy 和許可權。
Slack 整合讓團隊可以在對話執行緒裡直接透過 @Cursor 啟動 Cloud Agent,並把狀態、PR 和 follow-up 帶回 Slack。
閱讀目標:讀完本章,你應該能配置 Slack app,並能解釋 Cursor 如何選擇 repo、model、thread context 和 channel defaults。
1. 安裝流程
流程:
- 開啟 Cursor dashboard 的 Integrations。
- 點選 Slack 旁的 Connect,或訪問 Slack app installation page。
- 在 Slack workspace 中安裝 Cursor app。
- 回到 Cursor 完成設定:連線 GitHub、選擇 default repository、開啟 usage-based pricing、確認 privacy settings。
- 在 Slack 中 mention
@Cursor開始使用。
安裝後先在測試 public channel 驗證,不要直接進生產 incident channel 或客戶可見 Slack Connect channel。
2. 基本用法
提到 @Cursor 並寫 prompt,Cursor 會根據訊息內容和最近 agent activity 自動選擇 repo 和 model。
| 需求 | 寫法 |
|---|---|
| 指定 repo | @Cursor in cursor-app, fix the login bug |
| 指定另一個 repo | @Cursor fix the auth issue in backend-api |
| 指定 model | @Cursor with opus, fix the login bug |
| 指定具體模型 | @Cursor use gpt-5.2 to refactor the auth module |
| 檢視命令 | @Cursor help |
| 檢視執行中的 agents | @Cursor list my agents |
在已有 agent 的 thread 中,@Cursor [prompt] 會嘗試追加 follow-up instructions。要在同一 thread 強制建立新 agent,用 @Cursor agent [prompt]。
3. Commands 和 options
| Command | 行為 |
|---|---|
@Cursor [prompt] | 啟動 Cloud Agent;在已有 agent thread 中新增 follow-up |
@Cursor settings | 配置預設值和 channel default repository |
@Cursor [options] [prompt] | 使用 advanced options |
@Cursor agent [prompt] | 在 thread 中強制建立新 agent |
@Cursor list my agents | 顯示執行中的 agents |
常用 options:
| Option | 用途 | 示例 |
|---|---|---|
branch | 指定 base branch | branch=main |
autopr | 開關自動建立 PR | autopr=false |
優先順序:
- explicit values 覆蓋 defaults。
- 同一項重複時,後面的值覆蓋前面的值。
- inline options 優先於 settings modal defaults。
4. Thread context 和 handoff
Cloud Agents 會讀取整個 Slack thread 作為上下文。團隊已經在 thread 裡討論過復現步驟、方案或日誌時,這很有用。
風險也在這裡:thread 裡不要混入憑據、客戶資料、私有連結、不能進程式碼上下文的截圖。
執行狀態:
- agent 啟動後,Slack 會提供 Open in Cursor。
- agent 完成後,Slack 會通知,並給出 GitHub PR 連結。
- agent message 的三點選單可做 Add follow-up、Delete、View request ID、Give feedback。
排障時優先拿 request ID,而不是隻描述“Slack 沒反應”。
5. Repository selection
Cursor 選擇 repo 的順序:
- message content:repo 名稱或關鍵詞。
- recent agent activity。
- routing rules:keyword 到 repo 的自定義對映。
- channel default。
- personal default repository。
Routing rules 在 Dashboard -> Cloud Agents 中配置。適合把 frontend、mobile、api、docs 這類關鍵詞對映到固定 repo。
Channel settings 用 @Cursor settings 配置,只適用於 public channels。它們是 per team 的 channel defaults,會覆蓋個人 default,但仍可被訊息中顯式 repo 覆蓋。
6. Privacy 和 summary
Cloud Agents 支援 Privacy Mode,但 Legacy Privacy Mode 不支援。因為 Cloud Agents 執行時需要臨時程式碼儲存。
兩個 summary 相關設定要謹慎:
| Setting | 風險 |
|---|---|
| Display Agent Summary | 可能展示 file paths 或 code snippets |
| Display Agent Summary in External Channels | Slack Connect、guest、外部成員 channel 中可能擴散敏感資訊 |
外部 channel 預設要保守。尤其是客戶、供應商、外包或跨 workspace 的 Slack Connect,不要把 diff images 和 code snippets 當成普通通知。
7. Slack permissions
Cursor Slack app 需要一組許可權支撐 mention、thread context、status updates、檔案和 reactions。
| Permission group | 用途 |
|---|---|
| mentions / chat | 讀取 @Cursor mention,傳送狀態、完成通知和 PR link |
| channel / group / DM history | 讀取 thread 或 conversation context |
| channel / group / DM metadata | 定位 channel、participants 和 threading |
| files read/write | 讀取日誌、截圖、程式碼樣本,上傳 visual summaries |
| reactions read/write | 讀取反饋,新增執行、完成、失敗狀態 reactions |
| users / team | 匹配 Slack users 和 Cursor accounts,區分 workspace |
許可權審計要結合實際開關:如果開啟 external channel summary 或允許 any-channel Slack actions,風險會顯著升高。
商業級驗收
上線前至少完成:
- 測試 public channel 中
@Cursor help、@Cursor settings和一次真實任務。 - default repo、channel repo、routing rules 三層優先順序可解釋。
- usage-based pricing 已確認。
- Privacy Mode 和 summary 展示策略已確定。
- Slack Connect / guest / external channel 策略已寫清。
- request ID 獲取流程已寫進排障 SOP。
- Delete / archive agent 的責任人明確。
官方來源
- Cursor Slack Integration —— 官方 Slack 安裝、命令、options、thread context、routing、privacy 和 permissions。
- Cursor Cloud Agents —— Slack 觸發的 Cloud Agent 背景。
- Cursor Cloud Agent Settings —— summary 和 team settings。