slack-personal

TotalClaw 作者 totalclaw

通过 slk CLI 读取、发送、搜索和管理 Slack 消息和 DM。当用户要求检查 Slack、阅读频道或 DM、发送 Slack 消息、搜索 Slack、检查未读内容、管理草稿、查看保存的项目或与 Slack 工作区交互时使用。也可用于心跳 Slack 检查。在“检查松弛”、“任何松弛消息”、“松弛发送”、“松弛未读”、“搜索松弛”、“松弛线程”、“松弛草稿”、“读取松弛 dms”、“松弛消息”上触发。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~therohitdas-slk
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~therohitdas-slk/file -o therohitdas-slk.md
# slk — Slack CLI

Session-based Slack CLI for macOS. Auto-authenticates from the Slack desktop app — no tokens, no OAuth, no app installs. Acts as your user (`xoxc-` session tokens).

## Commands

```bash
# Auth
slk auth                              # Test authentication, show user/team

# Read
slk channels                          # List channels (alias: ch)
slk dms                               # List DM conversations with IDs (alias: dm)
slk read <channel> [count]            # Read recent messages, default 20 (alias: r)
slk read @username [count]            # Read DMs by username
slk read <channel> --threads          # Auto-expand all threads
slk read <channel> --from 2026-02-01  # Date range filter
slk thread <channel> <ts> [count]     # Read thread replies, default 50 (alias: t)
slk search <query> [count]            # Search messages across workspace
slk users                             # List workspace users (alias: u)

# Activity
slk activity                          # All channels with unread/mention counts (alias: a)
slk unread                            # Only unreads, excludes muted (alias: ur)
slk starred                           # VIP users + starred items (alias: star)
slk saved [count] [--all]             # Saved for later items (alias: sv)
slk pins <channel>                    # Pinned items in a channel (alias: pin)

# Write
slk send <channel> <message>          # Send a message (alias: s)
slk react <channel> <ts> <emoji>      # React to a message

# Drafts (synced to Slack editor UI)
slk draft <channel> <message>         # Draft a channel message
slk draft thread <ch> <ts> <message>  # Draft a thread reply
slk draft user <user_id> <message>    # Draft a DM
slk drafts                            # List active drafts
slk draft drop <draft_id>             # Delete a draft
```

Channel accepts name (`general`), ID (`C08A8AQ2AFP`), `@username` for DMs, or user ID (`U07RQTFCLUC`).

## Auth

Automatic — extracts session token from Slack desktop app's LevelDB + decrypts cookie from macOS Keychain.

**First run:** macOS will show a Keychain dialog asking to allow access to "Slack Safe Storage":
- **Allow** — one-time access, prompted again next time
- **Always Allow** — permanent, no future prompts (convenient but any process running as your user can extract credentials silently)
- **Deny** — blocks access, slk cannot authenticate

**Token cache:** `~/.local/slk/token-cache.json` — auto-validated, auto-refreshed on `invalid_auth`.

If auth fails (token rotated, Slack logged out):
```bash
rm ~/.local/slk/token-cache.json
slk auth
```

Slack desktop app must be installed and logged in. Does not need to be running if token is cached.

## Reading Threads

Threads require a Slack timestamp. Use `--ts` to get it, then read the thread:

```bash
slk read general 10 --ts
# Output: [1/30/2026, 11:41 AM ts:1769753479.788949] User [3 replies]: ...

slk thread general 1769753479.788949
```

## Agent Workflow Examples

- **Heartbeat/cron unread check** — `slk unread` → `slk read <channel>` for channels that need attention
- **Save & pick up** — Human saves threads in Slack ("Save for later"). Agent runs `slk saved` during heartbeat, reads full threads with `slk thread`, summarizes or extracts action items
- **Daily channel digest** — `slk read <channel> 100` across key channels → compile decisions, open questions, action items → `slk send daily-digest "📋 ..."`
- **Weekly DM summary** — `slk read @boss 200 --from 2026-02-01 --threads` → extract action items, decisions, context
- **Thread monitoring** — Watch specific threads for new replies (incidents, PR reviews, decisions)
- **Draft for human review** — `slk draft <channel> "..."` posts to Slack's editor UI for human to review before sending
- **Search-driven context** — `slk search "deployment process"` or `slk pins <channel>` to pull context before answering questions

## Limitations

- **macOS only** — uses Keychain + Electron storage paths
- **Session-based** — acts as your user, not a bot. Be mindful of what you send
- **Draft drop** may fail with `draft_has_conflict` if Slack has that conversation open
- **Session token** expires on logout — keep Slack app running or rely on cached token

## Missing Features & Issues

Create PR or Report Issue at: https://github.com/therohitdas/slkcli

---

## 中文说明

# slk — Slack CLI

适用于 macOS 的基于会话的 Slack CLI。从 Slack 桌面应用自动完成身份验证 —— 无需令牌、无需 OAuth、无需安装应用。以你本人的身份运行(`xoxc-` 会话令牌)。

## 命令

```bash
# Auth
slk auth                              # Test authentication, show user/team

# Read
slk channels                          # List channels (alias: ch)
slk dms                               # List DM conversations with IDs (alias: dm)
slk read <channel> [count]            # Read recent messages, default 20 (alias: r)
slk read @username [count]            # Read DMs by username
slk read <channel> --threads          # Auto-expand all threads
slk read <channel> --from 2026-02-01  # Date range filter
slk thread <channel> <ts> [count]     # Read thread replies, default 50 (alias: t)
slk search <query> [count]            # Search messages across workspace
slk users                             # List workspace users (alias: u)

# Activity
slk activity                          # All channels with unread/mention counts (alias: a)
slk unread                            # Only unreads, excludes muted (alias: ur)
slk starred                           # VIP users + starred items (alias: star)
slk saved [count] [--all]             # Saved for later items (alias: sv)
slk pins <channel>                    # Pinned items in a channel (alias: pin)

# Write
slk send <channel> <message>          # Send a message (alias: s)
slk react <channel> <ts> <emoji>      # React to a message

# Drafts (synced to Slack editor UI)
slk draft <channel> <message>         # Draft a channel message
slk draft thread <ch> <ts> <message>  # Draft a thread reply
slk draft user <user_id> <message>    # Draft a DM
slk drafts                            # List active drafts
slk draft drop <draft_id>             # Delete a draft
```

Channel 参数接受名称(`general`)、ID(`C08A8AQ2AFP`)、用于 DM 的 `@username`,或用户 ID(`U07RQTFCLUC`)。

## 身份验证

自动进行 —— 从 Slack 桌面应用的 LevelDB 中提取会话令牌,并从 macOS Keychain 解密 cookie。

**首次运行:** macOS 会弹出 Keychain 对话框,请求允许访问 "Slack Safe Storage":
- **Allow** —— 一次性访问,下次仍会提示
- **Always Allow** —— 永久授权,今后不再提示(方便,但任何以你身份运行的进程都可以静默提取凭据)
- **Deny** —— 阻止访问,slk 无法进行身份验证

**令牌缓存:** `~/.local/slk/token-cache.json` —— 自动验证,并在 `invalid_auth` 时自动刷新。

如果身份验证失败(令牌已轮换、Slack 已登出):
```bash
rm ~/.local/slk/token-cache.json
slk auth
```

必须已安装并登录 Slack 桌面应用。如果令牌已缓存,则无需保持其运行。

## 读取线程

线程需要 Slack 时间戳。使用 `--ts` 获取它,然后读取线程:

```bash
slk read general 10 --ts
# Output: [1/30/2026, 11:41 AM ts:1769753479.788949] User [3 replies]: ...

slk thread general 1769753479.788949
```

## Agent 工作流示例

- **心跳/定时未读检查** —— `slk unread` → 对需要关注的频道执行 `slk read <channel>`
- **保存并跟进** —— 人在 Slack 中保存线程("Save for later")。Agent 在心跳期间运行 `slk saved`,用 `slk thread` 读取完整线程,进行总结或提取行动项
- **每日频道摘要** —— 对关键频道执行 `slk read <channel> 100` → 汇总决策、待解决问题、行动项 → `slk send daily-digest "📋 ..."`
- **每周 DM 摘要** —— `slk read @boss 200 --from 2026-02-01 --threads` → 提取行动项、决策和上下文
- **线程监控** —— 监视特定线程的新回复(事故、PR 审查、决策)
- **草稿供人审阅** —— `slk draft <channel> "..."` 将内容发布到 Slack 的编辑器 UI,供人在发送前审阅
- **搜索驱动的上下文** —— 在回答问题前用 `slk search "deployment process"` 或 `slk pins <channel>` 拉取上下文

## 限制

- **仅限 macOS** —— 使用 Keychain + Electron 存储路径
- **基于会话** —— 以你本人身份运行,而非机器人。请注意你发送的内容
- **Draft drop** 在 Slack 已打开该会话时可能因 `draft_has_conflict` 而失败
- **会话令牌** 在登出时过期 —— 请保持 Slack 应用运行或依赖缓存的令牌

## 缺失功能与问题

请在以下地址创建 PR 或报告 Issue:https://github.com/therohitdas/slkcli