| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
OpenCode plugin that connects Slack to your AI agent. Receives DMs and @mentions via Socket Mode, creates OpenCode sessions to process them, and sends responses back to Slack.
opencode serve
└─ [plugin: opencode-slack-agent]
├─ Plugin (Bun) — session management, OpenCode client, IPC
└─ Socket Worker (Node) — Slack Socket Mode, message delivery
├─ DM or @mention received → IPC → plugin
├─ Plugin creates/reuses OpenCode session
├─ Streams tool progress (🔧) to Slack thread
└─ Sends final response (or uploads file for long responses)
opencode plugin opencode-slack-agent --globalAdd plugin with tokens to ~/.config/opencode/opencode.json:
{
"plugin": [
["opencode-slack-agent", {
"SLACK_BOT_TOKEN": "xoxb-...",
"SLACK_APP_TOKEN": "xapp-..."
}]
]
}| Option | Default | Description |
|---|---|---|
| SLACK_BOT_TOKEN | — | Required. Bot token (xoxb-...) |
| SLACK_APP_TOKEN | — | Required. App-level token (xapp-...) |
| DEFAULT_DIRECTORY | serve directory | Default workspace for new sessions |
| DEFAULT_AGENT | — | Agent name to use for prompts in Slack threads. Reads plugin option first, then SLACK_DEFAULT_AGENT env var. Can be overridden per-message with @<agent> or per-thread with !agent; cleared by !agent reset. Useful when the global opencode default agent has an identity you don't want exposed in Slack (e.g., a chat-facing persona) |
| ALLOWED_USERS | — | Comma-separated Slack user IDs or emails. If unset, everyone can use the bot |
| ATTACH_TIMEOUT_SEC | 600 | Timeout (seconds) for !attach bg_xxx polling. Reads plugin option first, then env var fallback. Invalid/non-positive values fall back to 600 |
opencode serve --port 4096| Command | Description |
|---|---|
| !help | Show all commands |
| !model | Show current model |
| !model provider/model | Switch model |
| !model reset | Restore default model |
| !agent | Show current agent |
| !agent build | Switch agent |
| !agent reset | Restore default agent |
| !dir | Show current workspace |
| !dir /path/to/project | Change workspace |
| !attach ses_xxx | Attach existing session (URL paste supported) |
| !attach bg_xxx | Attach and poll a background task ID (bg_[A-Za-z0-9_-]+) |
| !reset | Reset current thread session |
Hybrid sidecar pattern:
Plugin (runs in OpenCode's Bun runtime)
Socket Worker (spawned Node.js process)
This separation exists because Bun's embedded runtime doesn't reliably handle WebSocket reconnections for Socket Mode.
git clone https://github.com/leecoder/opencode-slack-agent.git
cd opencode-slack-agent
npm install
npm run buildMIT
| Back | FazBrowse Home | New Git URL |