AI 编程教程中文版
官方教程中文版集成与 SDK

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. 安装流程

流程:

  1. 打开 Cursor dashboard 的 Integrations。
  2. 点击 Slack 旁的 Connect,或访问 Slack app installation page。
  3. 在 Slack workspace 中安装 Cursor app。
  4. 回到 Cursor 完成设置:连接 GitHub、选择 default repository、开启 usage-based pricing、确认 privacy settings。
  5. 在 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 branchbranch=main
autopr开关自动创建 PRautopr=false

优先级:

  1. explicit values 覆盖 defaults。
  2. 同一项重复时,后面的值覆盖前面的值。
  3. 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 的顺序:

  1. message content:repo 名称或关键词。
  2. recent agent activity。
  3. routing rules:keyword 到 repo 的自定义映射。
  4. channel default。
  5. personal default repository。

Routing rules 在 Dashboard -> Cloud Agents 中配置。适合把 frontendmobileapidocs 这类关键词映射到固定 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 ChannelsSlack 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 的责任人明确。

官方来源

接下来去哪

本页目录