slack
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSlack Skill
Slack 技能
Slack workspace integration with two components:
- Scripts — 7 Python scripts for on-demand Slack operations (bundled here)
- Session Bridge — connect THIS Claude Code session to Slack (background listener + inbox file, no extra API costs)
Daemon & Soul Engine: The Claudicle daemon (unified launcher, soul engine, cognitive pipeline, three-tier memory, Soul Monitor TUI) now lives in its own repo: github.com/tdimino/claudicle. Install Claudicle separately for daemon features.
Slack工作区集成包含两个组件:
- 脚本 — 7个用于Slack按需操作的Python脚本(已打包在此)
- Session Bridge — 将当前Claude Code会话连接到Slack(后台监听器+收件箱文件,无额外API费用)
守护进程与灵魂引擎:Claudicle守护进程(统一启动器、灵魂引擎、认知管道、三层记忆、Soul Monitor TUI)现在托管在独立仓库中:github.com/tdimino/claudicle。如需使用守护进程功能,请单独安装Claudicle。
When to Use This Skill
何时使用该技能
Scripts (on-demand)
按需脚本
- Posting messages to Slack channels or threads
- Reading channel history or thread replies
- Searching messages or files across the workspace
- Adding or managing reactions on messages
- Uploading files or code snippets
- Listing channels, getting channel info, or joining channels
- Looking up users by name, ID, or email
- 向Slack频道或线程发送消息
- 读取频道历史消息或线程回复
- 在整个工作区内搜索消息或文件
- 为消息添加或管理反应
- 上传文件或代码片段
- 列出频道、获取频道信息或加入频道
- 通过名称、ID或邮箱查找用户
Session Bridge (recommended)
Session Bridge(推荐使用)
- Connecting any running Claude Code session to Slack
- Responding to @mentions and DMs with full tool access (this session IS the brain)
- No extra API costs — messages processed in the current session context
- Auto-notification of new messages via UserPromptSubmit hook
- Personality as Claudicle via soul.md instructions (no XML machinery needed)
- 将任意运行中的Claude Code会话连接到Slack
- 借助完整工具权限回复@提及和私信(当前会话即为核心处理逻辑)
- 无额外API费用 — 消息在当前会话上下文中处理
- 通过UserPromptSubmit钩子自动通知新消息
- 通过soul.md指令以Claudicle的人设响应(无需XML机制)
Prerequisites
前置条件
All scripts require the environment variable (a Bot User OAuth Token starting with ). Scripts also require ().
SLACK_BOT_TOKENxoxb-requestsuv pip install --system requestsbash
undefined所有脚本都需要设置环境变量(以开头的Bot用户OAuth令牌)。脚本还依赖库(可通过安装)。
SLACK_BOT_TOKENxoxb-requestsuv pip install --system requestsbash
undefinedVerify token is set
验证令牌是否已设置
echo $SLACK_BOT_TOKEN
undefinedecho $SLACK_BOT_TOKEN
undefinedFirst-Time Setup
首次设置
- Go to api.slack.com/apps -> Create New App -> From Scratch
- Name it "Claude Code" -> select your workspace
- OAuth & Permissions -> Bot Token Scopes -> add all:
app_mentions:read- ,
channels:history,groups:history,im:historympim:history - ,
channels:read,groups:read,im:readim:write chat:write- ,
files:writefiles:read - ,
reactions:writereactions:read search:read- ,
users:readusers:read.email - (optional — enables green presence dot)
users:write
- Settings -> Socket Mode -> toggle ON -> generate an App-Level Token:
- Name:
socket-mode - Scope:
connections:write - Copy the token
xapp-
- Name:
- Event Subscriptions -> toggle ON (no Request URL needed with Socket Mode) -> Subscribe to Bot Events -> add:
- — channel @mentions
app_mention - — direct messages (required for DMs to work)
message.im - — App Home tab rendering
app_home_opened
- App Home -> Show Tabs -> enable "Allow users to send Slash commands and messages from the messages tab"
- Install to Workspace -> approve permissions -> copy Bot User OAuth Token
- Set environment variables (add to shell profile):
bash
export SLACK_BOT_TOKEN=xoxb-... # Bot User OAuth Token export SLACK_APP_TOKEN=xapp-... # App-Level Token (Socket Mode) - Invite the bot to channels:
/invite @Claude Code
After any scope or event subscription change: reinstall the app (Install App -> Reinstall to Workspace) and restart the listener.
- 访问api.slack.com/apps -> 创建新应用 -> 从头开始创建
- 命名为“Claude Code” -> 选择你的工作区
- OAuth与权限 -> Bot令牌权限 -> 添加以下所有权限:
app_mentions:read- ,
channels:history,groups:history,im:historympim:history - ,
channels:read,groups:read,im:readim:write chat:write- ,
files:writefiles:read - ,
reactions:writereactions:read search:read- ,
users:readusers:read.email - (可选 — 启用在线状态绿点)
users:write
- 设置 -> Socket模式 -> 开启 -> 生成应用级令牌:
- 名称:
socket-mode - 权限范围:
connections:write - 复制开头的令牌
xapp-
- 名称:
- 事件订阅 -> 开启(Socket模式下无需请求URL) -> 订阅Bot事件 -> 添加:
- — 频道@提及
app_mention - — 私信(私信功能必需)
message.im - — 应用主页标签渲染
app_home_opened
- 应用主页 -> 显示标签 -> 启用“允许用户从消息标签发送斜杠命令和消息”
- 安装到工作区 -> 批准权限 -> 复制Bot用户OAuth令牌
- 设置环境变量(添加到Shell配置文件):
bash
export SLACK_BOT_TOKEN=xoxb-... # Bot用户OAuth令牌 export SLACK_APP_TOKEN=xapp-... # 应用级令牌(Socket模式) - 邀请机器人加入频道:
/invite @Claude Code
权限范围或事件订阅变更后:重新安装应用(安装应用 -> 重新安装到工作区)并重启监听器。
Quick Start
快速开始
bash
undefinedbash
undefinedPost a message
发送消息
python3 ~/.claude/skills/slack/scripts/slack_post.py "#general" "Hello from Claude"
python3 ~/.claude/skills/slack/scripts/slack_post.py "#general" "Hello from Claude"
Read recent messages
读取近期消息
python3 ~/.claude/skills/slack/scripts/slack_read.py "#general" -n 10
python3 ~/.claude/skills/slack/scripts/slack_read.py "#general" -n 10
Search the workspace
搜索工作区
python3 ~/.claude/skills/slack/scripts/slack_search.py "deployment status"
python3 ~/.claude/skills/slack/scripts/slack_search.py "deployment status"
Connect this session to Slack via Claudicle Session Bridge
通过Claudicle Session Bridge将当前会话连接到Slack
(requires Claudicle installed — see github.com/tdimino/claudicle)
—
cd ~/.claudicle/daemon && python3 slack_listen.py --bg
python3 ~/.claude/skills/slack/scripts/slack_check.py
---#(需安装Claudicle — 详见github.com/tdimino/claudicle)
cd ~/.claudicle/daemon && python3 slack_listen.py --bg
python3 ~/.claude/skills/slack/scripts/slack_check.py
---Session Bridge
Session Bridge
Connect any running Claude Code session to Slack. A background listener catches @mentions and DMs -> . This session reads the inbox, processes with full tool access, posts responses back. No extra API costs.
inbox.jsonlRequires Claudicle daemon installed — see github.com/tdimino/claudicle.
bash
undefined将任意运行中的Claude Code会话连接到Slack。后台监听器捕获@提及和私信 -> 写入。当前会话读取收件箱,借助完整工具权限处理消息,然后回复消息。无额外API费用。
inbox.jsonl需安装Claudicle守护进程 — 详见github.com/tdimino/claudicle。
bash
undefinedConnect
连接
cd ~/.claudicle/daemon && python3 slack_listen.py --bg
cd ~/.claudicle/daemon && python3 slack_listen.py --bg
Check messages
检查消息
python3 ~/.claude/skills/slack/scripts/slack_check.py
python3 ~/.claude/skills/slack/scripts/slack_check.py
Respond to thread, remove hourglass, mark handled
回复线程,移除沙漏反应,标记为已处理
python3 ~/.claude/skills/slack/scripts/slack_post.py "C12345" "response" --thread "TS"
python3 ~/.claude/skills/slack/scripts/slack_react.py "C12345" "TS" "hourglass_flowing_sand" --remove
python3 ~/.claude/skills/slack/scripts/slack_check.py --ack 1
python3 ~/.claude/skills/slack/scripts/slack_post.py "C12345" "response" --thread "TS"
python3 ~/.claude/skills/slack/scripts/slack_react.py "C12345" "TS" "hourglass_flowing_sand" --remove
python3 ~/.claude/skills/slack/scripts/slack_check.py --ack 1
Disconnect
断开连接
cd ~/.claudicle/daemon && python3 slack_listen.py --stop
**Soul Formatter** (optional): `scripts/slack_format.py` adds Open Souls cognitive step formatting — perception framing, dialogue extraction, monologue logging.
```bash
python3 slack_format.py perception "Tom" "What's the status?" # -> Tom said, "..."
echo "$raw" | python3 slack_format.py extract # -> external dialogue only
echo "$raw" | python3 slack_format.py extract --narrate --log # -> narrated + logged
python3 slack_format.py instructions # -> cognitive step XML formatAutomated Respond: processes all pending messages as Claudicle with full cognitive steps — perception, monologue, dialogue, post, ack — in a single invocation. See .
/slack-respond~/.claude/skills/slack-respond/SKILL.mdFor full installation, architecture, inbox format, auto-notification hook, and troubleshooting, see .
references/session-bridge.mdcd ~/.claudicle/daemon && python3 slack_listen.py --stop
**灵魂格式化工具**(可选):`scripts/slack_format.py`添加Open Souls认知步骤格式化 — 感知框架、对话提取、独白日志。
```bash
python3 slack_format.py perception "Tom" "What's the status?" # -> Tom said, "..."
echo "$raw" | python3 slack_format.py extract # -> 仅提取外部对话
echo "$raw" | python3 slack_format.py extract --narrate --log # -> 带旁白+日志
python3 slack_format.py instructions # -> 认知步骤XML格式自动回复:以Claudicle身份处理所有待处理消息,包含完整认知步骤 — 感知、独白、对话、回复、确认 — 一键执行。详见。
/slack-respond~/.claude/skills/slack-respond/SKILL.md完整的安装说明、架构、收件箱格式、自动通知钩子和故障排查,请查看。
references/session-bridge.mdScript Selection Guide
脚本选择指南
| Task | Script | Example |
|---|---|---|
| Post a message | | |
| Reply to a thread | | |
| Schedule a message | | |
| Read channel history | | |
| Read thread | | |
| Search messages | | |
| Search files | | |
| Add reaction | | |
| Upload file | | |
| Share code snippet | | |
| List channels | | |
| Join channel | | |
| Find user by email | | |
For full script documentation (all parameters, examples, test suite, common workflows), see .
references/scripts-reference.md| 任务 | 脚本 | 示例 |
|---|---|---|
| 发送消息 | | |
| 回复线程 | | |
| 定时发送消息 | | |
| 读取频道历史 | | |
| 读取线程消息 | | |
| 搜索消息 | | |
| 搜索文件 | | |
| 添加反应 | | |
| 上传文件 | | |
| 分享代码片段 | | |
| 列出频道 | | |
| 加入频道 | | |
| 通过邮箱查找用户 | | |
所有脚本的完整文档(所有参数、示例、测试套件、常见工作流),请查看。
references/scripts-reference.mdRate Limit Awareness
速率限制说明
| Tier | Rate | Key Methods |
|---|---|---|
| Tier 1 | 1/min | |
| Tier 2 | 20/min | |
| Tier 3 | 50/min | |
| Tier 4 | 100+/min | |
| Special | 1/sec/channel | |
All scripts handle rate limits automatically via (local cooldown + retry with ). See for full details.
_slack_utils.pyRetry-Afterreferences/rate-limits.md| 层级 | 速率 | 核心方法 |
|---|---|---|
| 层级1 | 1次/分钟 | |
| 层级2 | 20次/分钟 | |
| 层级3 | 50次/分钟 | |
| 层级4 | 100+次/分钟 | |
| 特殊 | 1次/秒/频道 | |
所有脚本通过自动处理速率限制(本地冷却 + 基于重试)。完整详情请查看。
_slack_utils.pyRetry-Afterreferences/rate-limits.mdTroubleshooting
故障排查
| Problem | Fix |
|---|---|
| Bot not responding to @mentions | Enable Socket Mode; verify |
| "missing_scope" error | Add the missing scope in OAuth & Permissions -> reinstall app |
| No search results | Invite bot to channels with |
| Rate limited (429) | Scripts auto-retry; reduce batch sizes |
| "Sending messages turned off" | App Home -> enable "Allow users to send Slash commands and messages from the messages tab" |
| No green presence dot | Add |
| App Home tab blank | Subscribe to |
For daemon-specific troubleshooting (soul engine, memory, launcher), see Claudicle docs.
| 问题 | 解决方法 |
|---|---|
| 机器人不响应@提及 | 开启Socket模式;验证已导出 |
| "missing_scope"错误 | 在OAuth与权限中添加缺失的权限范围 -> 重新安装应用 |
| 无搜索结果 | 使用 |
| 速率限制(429错误) | 脚本会自动重试;减小批量处理大小 |
| "Sending messages turned off" | 应用主页 -> 启用“允许用户从消息标签发送斜杠命令和消息” |
| 无在线状态绿点 | 添加 |
| 应用主页标签空白 | 订阅 |
守护进程相关故障排查(灵魂引擎、记忆、启动器),请查看Claudicle文档。
File Structure
文件结构
scripts/
├── slack_check.py # Session Bridge: read/ack inbox messages
├── slack_inbox_hook.py # Session Bridge: UserPromptSubmit auto-check hook
├── slack_format.py # Soul formatter: perception/extract/instructions (Open Souls paradigm)
├── slack_post.py # Post messages to channels/threads
├── slack_read.py # Read channel history or threads
├── slack_search.py # Search messages or files
├── slack_react.py # Add/remove reactions
├── slack_upload.py # Upload files or snippets
├── slack_channels.py # List/join channels
├── slack_users.py # Look up users
└── _slack_utils.py # Shared auth, rate limiting, API callsscripts/
├── slack_check.py # Session Bridge:读取/确认收件箱消息
├── slack_inbox_hook.py # Session Bridge:UserPromptSubmit自动检查钩子
├── slack_format.py # 灵魂格式化工具:感知/提取/指令(Open Souls范式)
├── slack_post.py # 向频道/线程发送消息
├── slack_read.py # 读取频道历史或线程消息
├── slack_search.py # 搜索消息或文件
├── slack_react.py # 添加/移除反应
├── slack_upload.py # 上传文件或代码片段
├── slack_channels.py # 列出/加入频道
├── slack_users.py # 查询用户信息
└── _slack_utils.py # 共享认证、速率限制、API调用Reference Index
参考索引
| Reference | Contents |
|---|---|
| Session Bridge: installation, architecture, inbox format, usage workflow, soul formatter, troubleshooting |
| Unified launcher: installation, architecture, per-channel sessions, SDK integration, data flows, threading model |
| Soul engine cognitive steps, memory tiers, XML format, App Home, Soul Monitor TUI |
| Full documentation for all 7 scripts, test suite, common workflows |
| User model interview, CLAUDE.md generation, export commands |
| Slack API rate limit tiers and handling strategy |
| 参考文档 | 内容 |
|---|---|
| Session Bridge:安装、架构、收件箱格式、使用工作流、灵魂格式化工具、故障排查 |
| 统一启动器:安装、架构、按频道会话、SDK集成、数据流、线程模型 |
| 灵魂引擎认知步骤、记忆层级、XML格式、应用主页、Soul Monitor TUI |
| 所有7个脚本的完整文档、测试套件、常见工作流 |
| 用户模型访谈、CLAUDE.md生成、导出命令 |
| Slack API速率限制层级与处理策略 |
Assets
资源文件
- — Slack app icon for bot configuration
assets/app-icon.png
- — 用于机器人配置的Slack应用图标
assets/app-icon.png