Slack Integration
Connect Agent Swarm to Slack — @mention agents to create tasks, use swarm# syntax to target specific workers, and manage multi-agent workflows via direct messages, channels, and the Slack Assistant sidebar.
Enable Slack for task creation, agent communication, and interactive workflows via direct messages and the Slack Assistant sidebar.
Setup
- Create a Slack App
- Enable Socket Mode (for real-time events without public webhooks)
- Enable Interactivity (for action buttons and modals)
- Enable Agent View (for sidebar conversations)
- Add required bot token scopes:
app_mentions:readassistant:writechannels:history,channels:join,channels:manage,channels:readchat:write,chat:write.customize,chat:write.publiccommandsfiles:read,files:writegroups:history,groups:read,groups:writeim:history,im:read,im:writempim:history,mpim:read,mpim:writereactions:writeusers:read
- Subscribe to bot events:
app_mention,assistant_thread_started,assistant_thread_context_changed,entity_details_requested,message.channels,message.groups,message.im,message.mpim,member_joined_channel,channel_shared,channel_unshared - Install to your workspace and copy tokens
chat:write.customize lets each agent post under its own name and Slack icon, including streamed replies. An agent set to the Slack app icon posts with no icon override, so Slack shows the app's avatar.
A ready-to-use slack-manifest.json is included in the repository root — import it directly in the Slack App configuration page to set up all scopes, events, and features automatically. After adding channel-management scopes to an existing app, reinstall the app to the workspace so Slack grants them to the bot token.
The manifest's oauth_config.redirect_urls lists two generic placeholders (a hosted-cloud callback and a web.localhost dev callback). Replace or extend these with your own deployment's HTTPS callback URL(s) before installing — do not reuse another deployment's callback host.
Token rotation is off (settings.token_rotation_enabled: false) because the app runs under Socket Mode with a static SLACK_BOT_TOKEN; there is no refresh-token exchange in this codebase. Rotate or revoke compromised tokens from the Slack App configuration page (OAuth & Permissions → reinstall, or Manage Distribution → revoke).
Configuration
# Socket Mode (default)
SLACK_MODE=socket
SLACK_BOT_TOKEN=xoxb-... # Bot User OAuth Token
SLACK_APP_TOKEN=xapp-... # App-Level Token
# Signed HTTP ingress (no Socket Mode, no app token)
# SLACK_MODE=http
# SLACK_BOT_TOKEN=xoxb-...
# SLACK_SIGNING_SECRET=...
# Disable Slack (if not using)
SLACK_DISABLE=trueSLACK_MODE accepts only socket or http and defaults to socket. Invalid values fail closed and never fall back to a socket.
With http, the API serves POST /api/integrations/slack/events for Events API deliveries, slash commands and interactivity. Point the app's event, interactivity and slash-command request URLs at it and set socket_mode_enabled to false in the manifest. Every request is verified with SLACK_SIGNING_SECRET (HMAC v0 over the raw body, timestamp within 5 minutes) before any work, and a delivery for another workspace is refused with 403. Events are stored before the 200 response, so a Slack retry never creates a second task, even across a restart. Slack also verifies the URL with a url_verification challenge when you save it; the route answers it once the signature checks out.
A socket watchdog restarts the Slack app when the Socket Mode link stays down for 60 seconds, for example after @slack/socket-mode gives up on a failed reconnect. Retries back off exponentially from 30 seconds to 5 minutes, and a restart never overlaps a config reload. Each down and restart transition is logged.
Development API processes do not open Socket Mode by default, even when Slack tokens are present in the ambient environment. This prevents a local bun run start:http process from consuming events intended for production. Set SLACK_ALLOW_DEV_SOCKET_MODE=true only when that development process must connect to the configured Slack app; the server logs the blocked reason and this opt-in name otherwise.
Workspace guard
Socket Mode sends each payload to any one of a Slack app's open connections, whatever workspace it came from. When several swarms share one Slack app (same SLACK_APP_TOKEN, different bot tokens), a swarm receives deliveries meant for the others. The swarm processes only deliveries proven to belong to its own installation:
- At startup it calls
auth.testwith the bot token and opens the socket only after that succeeds. While it fails, Slack stays disconnected and the start is retried with backoff (5 seconds up to 5 minutes). - A delivery belongs to a workspace install when its
authorizations(events) orteam(interactive payloads, slash commands) names the bot's workspace. An enterprise id alone never matches. - Set
SLACK_ENTERPRISE_INSTALL=truewhen the bot token comes from an org-wide Enterprise Grid install (is_enterprise_installin theoauth.v2.accessresponse). The swarm then matches deliveries made to an org-wide install of its enterprise. Slash commands and some interactive payloads omitis_enterprise_install. A button or view without it belongs to the installation whose bot posted the message or opened the view. Any other flag-less delivery belongs to the workspace it names, as Slack's Bolt SDK reads it, so an org install claims it only when it names no workspace. - Any other delivery, or one with no installation field, is neither acked nor dispatched. Slack retries an unacked event a few times, and a retry can reach the owning swarm's connection. Interactive payloads and slash commands are not retried; the user sees an error.
Retries make a misrouted event likely, not certain, to reach its owner. For reliable delivery, give each swarm its own Slack app.
How It Works
Task Work Objects
Set SLACK_WORK_OBJECTS_ENABLED=true on the API to populate task Work Object flexpanes. This feature defaults to off. Apply the repository's updated slack-manifest.json, reinstall the Slack app, and enable Work Object Previews in the app settings.
Supported cards use external_ref: { "type": "task", "id": "<full task UUID>" }. The pane shows the task's current title, description, status, assignee, timestamps, and result, failure, or progress. It respects the configured Slack user filters and requires the task's Slack channel to match the requesting channel. Forwarded cards in other channels and tasks without Slack context receive a restricted view.
The handler responds to entity_details_requested events; this flag does not add automatic link unfurls. If a card does not trigger that event, it cannot populate a pane. See the deployment smoke test for the card payload and event-delivery check.
Creating Tasks
@mention the bot in Slack to create tasks. All Slack messages are routed directly as tasks — there is no separate inbox system.
Routing priority:
swarm#<uuid>— explicit agent targeting (always wins)swarm#all— broadcast to all workers- Thread follow-up — if in a thread where a worker is already active, or the thread was originally started by the swarm, routes directly to that worker/flow
- Lead fallback — if the bot was @mentioned and no other match, routes to the lead agent
If no agents are online, the message is queued as an unassigned task in the pool. The bot confirms that your request has been queued and will be processed when agents come back up.
The bot's own @mention is identified as “that's you” in task text from assistant DMs and buffered follow-ups, including their thread context. Other user mentions resolve to names when available.
Acceptance reactions
When the swarm accepts a Slack message, it adds an :eyes: reaction after it has successfully created or queued the task. A thread message accepted as steering for a running task receives :speech_balloon: by default. If ingestion fails before the request is accepted, the bot leaves the message unreacted instead of implying that work started; repeated delivery of an already-acknowledged event is treated as a harmless no-op.
Additive thread buffering uses a slightly richer vocabulary: :eyes: for the first captured message, :heavy_plus_sign: for later messages appended to that buffer, and :zap: when !now triggers an immediate flush.
Each of the 7 reactions is configurable through a swarm_config key, scope global. With no saved row, deployment configuration applies, then the default shown below. A saved empty string disables the reaction.
| Key | Event | Default |
|---|---|---|
SLACK_REACTION_ACCEPTED | Task accepted from a channel mention, thread reply, follow-up or assistant DM. Also the first message in an additive buffer. | eyes |
SLACK_REACTION_BUFFERED | Message 2 and later in an additive buffer window. | heavy_plus_sign |
SLACK_REACTION_NOW | The !now command flushes the buffer. | zap |
SLACK_REACTION_STEERED | A thread message is accepted as steering for a running task. | speech_balloon |
SLACK_REACTION_COMPLETED | Every task linked to the trigger message reached status completed. | white_check_mark |
SLACK_REACTION_FAILED | Any linked task reached failed, cancelled or superseded. | x |
SLACK_REACTION_SKIPPED | Every linked task ended skipped (the agent decided the message was not its to answer), or a pre.task.create extension blocked the task. | mute |
A value is trimmed, has at most one leading and one trailing colon stripped, and is lowercased before Slack sees it — :ThumbsUp: and thumbsup both resolve to thumbsup. An empty or whitespace-only value disables the icon. Nonempty values must match the shortcode format (including an optional ::skin-tone-[2-6] suffix); malformed values such as : or :: are rejected at write time. Invalid legacy or deployment values retain the built-in fallback.
Disabled reactions make no addition or fallback API calls. If Slack rejects a configured name with invalid_name (the emoji does not exist in the workspace), the bot logs one error-level line, increments an OTel counter, and retries once with the default for that event before giving up on the reaction. Task state and the outcome card never depend on a reaction landing. A terminal reaction (completed, failed or skipped) is never removed once added.
When a task finalizes, the bot removes the currently enabled acceptance-stage reactions, even when the terminal reaction is disabled. It adds the terminal reaction only when enabled. The removal list is the configured name for each of the four acceptance-stage events (SLACK_REACTION_ACCEPTED, SLACK_REACTION_BUFFERED, SLACK_REACTION_NOW, SLACK_REACTION_STEERED). With no configuration, that list is eyes, heavy_plus_sign, zap and speech_balloon, the same fixed list the bot removed before these keys existed. The bot keeps no record of which reaction it applied to which message, so an API restart between acceptance and finalization does not change the result. reactions.remove only removes the bot's own reaction, so a reaction that a person or another bot applied with the same name stays in place. If you change an acceptance-stage key while a task is active, the bot removes the new name at finalization and the old reaction stays on the message.
SLACK_STATUS_ICON_COMPLETED sets the "done" glyph in thread text: the task tree line of a completed task, the 🧵 ✅ done thread header, and completed outcome cards. It takes the same values as the reaction keys and renders as :name:. An absent value uses ✅; an empty value omits the icon and its separator. Invalid legacy or deployment values keep ✅. Text has no invalid_name fallback, so a name the workspace lacks shows as literal :name:. The failed, waiting and working glyphs are fixed.
In Settings → Configuration, choose No icon or clear the field and save to disable it. Remove the saved value restores the deployment setting or default. Global changes reload automatically. An explicitly empty deployment variable also disables the icon. Existing empty values now disable instead of falling back. SLACK_REACTION_SKIPPED also controls the skipped glyph in V2 text. Other task-state glyphs and agent avatars are unaffected.
Terminal reply recovery
Pending terminal replies are stored in the database and retried after API restarts. The watcher marks a reply delivered only after Slack accepts it. When a persisted progress message is available, it updates that message to the final result; if Slack reports that the message no longer exists, it sends a replacement. Task-tree messages retain their own final update path.
Thread Follow-up Routing
When you @mention the bot in a thread where a worker is already handling a task, the message routes directly to that worker — no lead delegation needed. This keeps conversations flowing naturally.
If the assigned worker is offline or unavailable, the follow-up routes to the lead agent instead of dropping the message. The lead picks up the thread context and continues the conversation, preserving parentTaskId continuity for chained tasks.
By default, thread follow-ups route automatically without requiring an @mention. That includes human replies to swarm-started root messages, even when no task row existed yet for the thread. Set SLACK_THREAD_FOLLOWUP_REQUIRE_MENTION=true to require an explicit @mention for thread follow-up routing — non-mention thread messages will be silently dropped instead of auto-routing.
A thread reply that @mentions another user but not the bot (for example @Alice wdyt?) is addressed to that user, so the swarm ignores it. This applies to follow-up routing, the additive buffer, and assistant threads. Set SLACK_THREAD_WAKE_ON_ANY_MESSAGE=true to make the swarm wake on these replies too. Each such reply then becomes a follow-up, and the additive buffer (ADDITIVE_SLACK, on by default) batches side conversations into one task. SLACK_THREAD_FOLLOWUP_REQUIRE_MENTION=true takes precedence over this flag.
Live steering instead of follow-up tasks
Slack can send buffered thread feedback into a task that is still running:
| Variable | Default | Behavior |
|---|---|---|
SLACK_THREAD_STEERING | lead | lead targets the latest in-progress lead task in the thread; all targets the latest active task regardless of role. Explicit off and invalid values preserve normal follow-up task routing. |
SLACK_THREAD_STEERING_MODE | queue | queue adds the message at a turn boundary. steer requests an interrupt and degrades when the harness cannot interrupt. |
This changes a thread reply from a durable follow-up task into input for an already-running task. Slack posts an acknowledgement that reflects the actual server outcome (steered, queued, or promoted to a follow-up).
Follow-up re-delegation guard: When the lead receives a task.worker.completed or task.worker.failed follow-up, it is explicitly instructed (via prompt template) not to re-delegate the same work back to a worker. A second guard in send-task blocks any re-delegation on a Slack thread that already has a completed task within the last 48 hours, preventing the duplicate-response cycle where repeated re-delegations caused the bot to answer the same thread multiple times.
Slack Context Propagation
Slack metadata (slackChannelId, slackThreadTs, slackUserId) is auto-inherited from the creator's current task. When a lead delegates work from a Slack-originated task, workers automatically receive the Slack context and post progress updates to the originating thread — no manual metadata passing needed.
The auto-inheritance works via the X-Source-Task-Id header, which links the new task back to the creator's active task to look up Slack metadata.
For cases where auto-inheritance isn't available (e.g., programmatic task creation without an active parent task), you can pass Slack metadata explicitly on send-task:
slackChannelId— Channel ID for progress updatesslackThreadTs— Thread timestamp for thread-level updatesslackUserId— Original requester's Slack user ID
Treat Slack channel/thread metadata as one routing unit. When a parent task or Slack-family context key already defines the route, send-task rejects a different explicit channel or thread instead of silently sending updates elsewhere. Omit the explicit Slack fields to inherit the existing route. For an intentional cross-channel handoff, provide both slackChannelId and slackThreadTs and set overrideSlackContext: true; the override is logged for audit.
Additive Slack Buffer
By default, thread replies that do NOT @mention the bot are captured, buffered, and batched into a single follow-up task. This allows multi-message feedback without requiring an @mention each time. Set ADDITIVE_SLACK=false to turn it off.
- Messages are buffered for a configurable debounce window (
ADDITIVE_SLACK_BUFFER_MS, default 10s) - Buffered messages are flushed into a single task with dependency chaining to the active task
- Use the
!nowcommand to flush the buffer immediately — skips dependency chaining so the task starts right away - Reactions provide visual feedback: :eyes: for first captured message, :heavy_plus_sign: for subsequent appended messages, :zap: for
!now - When
SLACK_THREAD_FOLLOWUP_REQUIRE_MENTION=true, the additive buffer is disabled for non-mention messages
Tree-Based Status Messages
The v2 renderer is enabled by default. Set SLACK_RENDER_V2=false to use the legacy renderer. With v2 and task trees enabled, each Slack thread owns one task-tree message: a task tree that is updated in place with chat.update. Later asks append to the same tree, delegated tasks stay nested under their parent, and task IDs remain clickable:
🧵 worked for 44m
├─ ✅ First ask · 7m51s · task-id
├─ ⏳ Current ask · 8m05s · task-id · latest progress
│ └─ ✅ Researcher · 8m24s · task-id
└─ ✅ Completed ask · 12m · task-idThe tree is rendered as footer-weight context blocks and contains status, elapsed time, hierarchy, task links, and the latest bounded progress for active tasks. It does not repeat worker output or cross-link Slack messages: keeping message permalinks out of the tree prevents Slack from producing noisy link previews. Updates are debounced, link/media unfurls are disabled, and rate-limit retries honor Slack backoff.
Working status
With the v2 renderer, Slack's own "working" state follows the whole life of an ask, in channel threads and DMs, so anyone reading a long thread can tell whether the swarm is still on it. It uses agents.sessions.setStatus, which needs only the chat:write bot scope. There is no manifest change and no reinstall.
| Thread state | Status |
|---|---|
| Any task in the thread is running or queued | processing: Slack shows its loading indicator |
Nothing is running, and a request-human-input request from the thread is still open | suspended: waiting on a person |
| Everything is finished, or the ask is deferred and waits for its wake-up | active: indicator cleared |
The status starts when the ask is accepted, is re-asserted every 30 minutes because Slack ends a processing session after one hour, and is cleared when the outcome card lands. If a second ask in the thread is still running when the first card lands, the indicator stays. Slack shows a Stop button next to the indicator only when the Slack app subscribes to agent_session_stopped: see Stop button.
Setting the status also opens the thread for the person who asked, and Slack's free-text status (is working on your request...) is not available with this method, so Slack shows its standard loading indicator.
The indicator never blocks a task. If Slack refuses the call, the swarm logs it once and keeps the :eyes: reaction and the tree message:
- Workspace or app cannot use it (
missing_scope,feature_disabled, a revoked token): the native call is switched off for an hour, then probed again. DMs keep the legacyassistant.threads.setStatusindicator. - Slack refuses one thread (for example the bot is not in the channel): that thread is left alone until it goes idle.
- Transient errors (rate limit, timeout,
internal_error): retried with backoff by the swarm, never by the Slack client. At most eight status writes start per render tick, counting tree creation, tree recovery, and outcome delivery; threads past the cap catch up on the next tick. - A write that gets no answer (timeout, reset): status calls use their own Slack client, separate from message delivery, with no automatic retries and an 8 second limit that aborts the request. Slack may still have applied the write, so the next reconcile sends its status even if the thread looked already clear. A write that lands after the timeout is reconciled against the thread's tasks again.
Stop button
Slack can show a native Stop button in a thread's "Working…" line while the swarm is on an ask. The setting is on by default, but the button shows only after step 2. To use it:
- Leave
SLACK_STOP_BUTTON_ENABLEDunset on the API, or keep Slack Stop button on in Settings → Configuration. Set it tofalseto turn it off. It applies without a restart. - In the Slack app settings, under Event Subscriptions → Subscribe to bot events, add
agent_session_stoppedand save. It needs only thechat:writescope the app already has. Reinstall the app if Slack asks you to.
The checked-in slack-manifest.json does not subscribe to the event, because a subscribed app with the setting off would show a Stop button that does nothing.
When someone clicks Stop, the swarm checks the channel and the person as it does for any message (external channels and user filtering). It then cancels every open task in that thread and the open tasks delegated from them (up to 500 delegated tasks outside the thread), with the reason Stopped from Slack by @person. Workers stop their sessions and workflow steps see a cancelled task, as with a cancel from the dashboard. The thread's status leaves processing right away: Slack does not do this by itself, and would keep the button up for an hour. The tree, reactions and outcome card then show the cancel as usual.
With the setting off, the swarm ignores agent_session_stopped and logs once that the app is subscribed while the setting is off. The button exists only in the built-in Slack integration, not through the Chat SDK adapter.
Outcome Cards and Message Provenance
Each completed Slack ask gets one outcome card containing the full multi-paragraph Markdown result, bounded only by Slack's presentation limit with a link to the full task when truncation is required. If the agent already delivered the result with slack-reply, the outcome card collapses to a compact completion instead of repeating that message. The renderer re-reads this delivery marker before finalizing, so a retry cannot preserve stale duplicate content. Outcome cards do not link back to the tree, which avoids an otherwise redundant Slack permalink unfurl.
If Slack refuses the card with a terminal error, or if 5 attempts fail, the renderer records the give-up on the card's database row. It posts one ⚠️ Couldn't deliver this task's reply warning in the thread. It never retries that card, and a restart does not re-arm it.
Slack shows a deferral as waiting, with the check-back time or the agents being watched and a latest wake-up time. Times use the requester's timezone, falling back to labeled UTC. The same card updates when the continuation reaches its final outcome. Internal notes, checks, and schedule details remain in the task log.
A continuation normally resolves its parent's waiting card in place, without posting a duplicate outcome. If it defers again, it creates a new waiting card and the previous card points to it. A continuation posts its own outcome when the original waiting card is missing or cannot be updated. Ordinary scheduled tasks without Slack context remain silent.
Terminal task output is automatically delivered through the thread's outcome card. No additional relay message is created: extra messages only appear when an agent explicitly calls slack-reply, slack-post, or slack-start-thread. When slack-reply is used, the outcome card is compacted instead of duplicating that explicit reply. These tools accept optional Block Kit blocks; when omitted they generate a mrkdwn section. Their compact context footer contains the originating agent and task without a Slack-message permalink.
A Lead follow-up or resume result replaces the card of the ask it answers, so each ask leaves one message. That card (often an ack such as "on it, asked a specialist") belongs to the Lead task that dispatched the worker, or, for a resume, the task it resumes. With two asks running at once in one thread, each result finds its own ack. When that task has no card, the newest card in the thread stands in if it answers the same Slack ask and nothing came after it. The card is replaced only when all of these are true:
- The follow-up completed or failed. A deferred or cancelled follow-up posts its own card.
- The card is from the same agent and is a plain completed result. A deferral, conclusion, delegated-child or Block Kit card is never replaced.
A quick completed follow-up edits the card in place: it finished within SLACK_CARD_MERGE_WINDOW_SEC seconds (default 120) of the card's first post, nothing (from a person or a bot) came after the card, and the merged text fits one card. The card then shows the ask's own answer and the newest follow-up's answer, and one footer links both tasks. An edit sends no notification, so every other follow-up (slower, failed, or with a message after the card) posts its answer as a new reply, which notifies the requester, and then deletes the card. If Slack refuses the delete, the card is edited down to ✅ Done ↓ (or ❌ Failed ↓) instead.
Set SLACK_RENDER_V2_QUIET_LEAD_THREADS=true to keep Lead threads to the Lead's replies: a Lead deferral posts no ⏳ waiting card, and a successful Lead follow-up that ends without slack-reply posts no card; failed or cancelled follow-ups and resumed asks still post their cards. See Quiet Lead threads.
Set SLACK_REPLY_FOOTER_ENABLED=false to hide the task details footer from outcome cards, agent replies, and replies mirrored from Sessions. The footer is enabled by default. Reply content, citations, and attachments still appear.
Answer feedback
SLACK_FEEDBACK_BUTTONS puts Slack's native 👍/👎 buttons under each final outcome card. It is on by default. Set it to false, or turn off Slack answer feedback in Settings → Configuration, to remove them. It applies without a restart. Deferral (⏳) cards, timed-out conclusions and acks whose delegated work is still running get no buttons: the result that replaces an ack carries them. If Slack refuses the buttons, the card posts without them.
A click from an allowed person in the task's channel stores one row in the reserved KV namespace slack-feedback, at key <taskId>/<slackUserId>, so a person's later click on the same answer replaces their vote. The row holds vote (up or down), votedAt, and the task's agentId, profile, model and modelTier. A row also names the voter's Slack user ID and the task's channel and thread, so only a Lead agent can read the namespace: GET /api/kv/_/slack-feedback with the Lead's X-Agent-ID (add ?prefix=<taskId>/ for one task), or kv_list on that namespace as the Lead. Other agents and calls with no agent get 403, and no agent can write the namespace.
Tree, outcome, and explicit agent message timestamps are persisted in slack_messages, so the renderer can reuse messages after a restart.
Outcome cards answer live work; the renderer never backfills history. A task that finished more than SLACK_CONCLUSION_TIMEOUT_MIN minutes ago (at least one hour) gets no new outcome card, even when its thread renders again. A delegated ask's conclusion card stays eligible for that window after the closure's timeout. A Lead deferred wake also gets no card of its own when its answer already reached the thread: it called slack-reply, or the bot replied in the thread after the wake was created.
Delegated-Result Delivery and the Deferred Conclusion Card
Set SLACK_RENDER_V2_DELEGATION=true (requires SLACK_RENDER_V2=true) to opt in to a lifecycle built around each ask's closure: the ask task plus every delegated task, transitive child, follow-up task, resume task, and reroute-decision task reachable from it in the same thread.
- Tree glyphs. Each task line shows one state glyph — queued 🕒, blocked ⛔, starting ▶️, running 🔄, stalled ⚠️, paused ⏸️, done ✅, failed ❌, cancelled 🚫, superseded ↪️ — recomputed on every tick. The thread header summarizes the closure as working, stalled, waiting, stopped (the last task to end was cancelled), done, done with failures, or concluded with unfinished work. Glyphs ship under
SLACK_RENDER_V2alone; they do not require the delegation flag. - Child result cards. A terminal delegated task (
completedorfailed, not afollow-uporreroute-decisioncontrol-plane task) gets its own card in the thread once its output has nowhere else to go — capped at 3 new cards per thread per tick and 10 per ask closure. A child that already delivered its answer withslack-replydoes not get a duplicate card; children past the cap appear as a one-line digest in the conclusion card instead. - Deferred conclusion card. The ask's own outcome card does not post while its closure is open. It posts once every closure member is terminal and the closure has been quiet for
SLACK_CONCLUSION_SETTLE_SECseconds, or once the closure has been idle forSLACK_CONCLUSION_TIMEOUT_MINminutes, whichever comes first. A settled conclusion lists each child's result under a Results section; a timed-out conclusion is marked "Concluded with unfinished work" and links every still-open member. Cards remain immutable once finalized — the deferral changes only when the card is written, not the immutability contract. - Reaction gate. The trigger message's checkmark reaction now flips only when the ask's conclusion card finalizes, not when the ask's own task completes. Outcome mapping: any failed closure member →
x; a timed-out closure →warning; otherwise →white_check_mark. A closure where every member is cancelled and none failed still resolves towhite_check_mark— a cancellation is not a failure. - In-flight threads. The first tick with the flag on stamps
delegation_activated_at. An ask created before that stamp keeps the pre-delegation behavior: its own outcome card, no child cards, and the reaction gate keyed to its own completion. An ask created after the stamp gets the new lifecycle. One thread can carry both kinds of ask at once. - Rollback. Set
SLACK_RENDER_V2_DELEGATION=false. The next tick reverts every closure to the pre-delegation gate; any ask that was deferred while the flag was on finalizes immediately under the old rule, so no thread is left stranded.
Hide task trees while keeping outcome cards
Set SLACK_RENDER_V2_TASK_TREE_ENABLED=false, or turn off Show task tree in Slack threads
in Settings → Configuration. It defaults to On and requires SLACK_RENDER_V2=true.
Outcome cards, delegated results, completion reactions, native working status, and task
processing continue independently of tree messages, including when tree delivery fails.
The setting applies live. Existing trees remain as history and stop updating. Re-enabling resumes threads with unfinished task work and reuses their existing tree where possible. It does not create or update trees for threads that completed while hidden, even after a restart or while their outcome delivery is retried. A later ask reactivates its thread and can include earlier tasks in the tree. Tree writes already sent to Slack may finish after disabling takes effect; queued writes and retries are cancelled.
The saved global setting overrides deployment env at boot and reload. Removing the saved value restores the deployment value or the On default. With V2 disabled, this preference has no effect on the legacy renderer and remains saved for when V2 is enabled again.
Opt out of the renderer
Set SLACK_RENDER_V2=false to use the legacy per-task assignment/progress/completion renderer. Leaving it unset enables V2 streamed outcome cards; task trees have their own setting.
Rich Block Kit Messages
The v2 tree uses mrkdwn inside footer-weight context blocks, which keeps every task ID clickable. Outcome and explicit agent messages use Block Kit where it adds structure:
- Context blocks for the compact provenance footer
- Section blocks for explicitly supplied agent content
- Markdown is automatically converted to Slack's
mrkdwnformat
Interactive Actions
The legacy renderer's task messages include interactive buttons when SLACK_RENDER_V2=false:
- Follow-up — Opens a modal to send a follow-up message to the same agent, creating a new task with dependency on the completed one
- View Full Logs — Links to the task detail page in the dashboard
- Cancel — Shows a confirmation dialog before cancelling an in-progress task
Assistant Sidebar
The bot supports Slack's Assistant sidebar for direct conversations:
- Open the sidebar in any channel or DM to start a conversation
- Suggested prompts help you get started ("Check agent status", "Assign a task", "List recent tasks")
- Follow-up messages in assistant threads route to the same agent that handled the original task
- Assistant-thread messages that only @mention another user are ignored unless they also mention the swarm bot, preventing accidental task creation from co-mentions like
@Devin are you here? - Files shared in assistant threads — with or without a caption — reach the task as attachments (see Attachment Handling)
- The assistant shows the working status while the agent is working (with the legacy renderer, a typing status that handles permission errors in non-assistant threads)
Progress Updates
When task trees are enabled, the engine reflects progress by updating the thread tree. Agents can choose to send a distinct message with slack-reply, but routine start, progress, completion, and failure receipts are not posted automatically.
Reading Messages
Agents can read Slack threads using slack-read:
- By task ID (reads the thread associated with a task)
- By channel ID (leads only, for channel history)
slack-read and the worker thread-context helpers extract all message layers together: top-level text, legacy attachments, and Block Kit blocks. That means alert threads from tools like Datadog, PagerDuty, and GitHub keep both the short summary and the richer body content (fields, context, action URLs) instead of silently dropping everything outside the root text.
Posting Messages
The lead agent can post messages to channels using slack-post. By default each call creates a new top-level message. To run a multi-message conversation under a single Slack thread, the lead first calls slack-start-thread to create the parent message, then passes the returned ts as threadTs on subsequent slack-post calls — keeping the channel tidy and the conversation discoverable.
Managing Channels
Lead agents can manage the Slack channel lifecycle through three MCP tools:
slack-create-channel— create a public or private channel. Slack naming rules are applied and the normalized name is returned.slack-invite-to-channel— invite up to 100 workspace users. Users who are already members are treated as a successful no-op.slack-archive-channel— archive a channel. Already-archived channels are a successful no-op, while Slack's general channel remains protected.
These operations require lead privileges plus channels:manage for public channels and groups:write for private channels. If Slack reports a missing scope, update slack-manifest.json, apply the manifest, and reinstall the app before retrying.
Updating or Deleting Messages
Lead-gated Slack mutation tools can also manage an existing swarm-authored message after it has been posted:
slack-update— replace the text or blocks of an existing message in a channel or threadslack-delete— remove an existing message when follow-up automation or cleanup needs it
These mutation tools follow the same public-channel auto-join behavior as the other Slack tools, but they stay lead-only because they change already-published Slack state.
Channel Membership
If the bot is not yet a member of a public, internal channel, slack-read, slack-post, slack-reply, and slack-start-thread automatically join it (via the channels:join scope) and retry — no manual /invite needed. Private channels and external Slack Connect channels cannot be self-joined: the tools return a clear error asking you to invite the bot with /invite @<bot-name> first.
External (Slack Connect) channels
Set SLACK_BLOCK_EXTERNAL_CHANNELS=true (global swarm config, default false) to keep the bot out of channels shared with another organization. A channel is external when Slack reports is_ext_shared or is_pending_ext_shared for it, or when the event carries is_ext_shared_channel. Enterprise Grid org-shared channels stay internal. The key is read on every event, so a change on Settings → Configuration applies without a restart.
When the flag is off, an external channel works like any other: an ask and the Lead's follow-ups on it post their outcome cards in the thread.
When the flag is on:
- Inbound guard. Messages, assistant threads, Work Object previews, follow-up buttons, and
/agent-swarm-statusin an external channel create no task and return no task data. This guard works even when the bot cannot leave. - Leave on join or share. When the bot joins an external channel (
member_joined_channel), or a channel the bot is in becomes shared (channel_shared), the swarm callsconversations.leaveand posts an alert toSLACK_ALERTS_CHANNEL. - Outbound guard. Every Slack write the swarm makes is checked at the Slack client: tool posts, replies, edits and file uploads, progress updates, streamed outcome cards, assistant status, and alerts. A write to an external channel fails with
external_channel_blocked. The toolsslack-post,slack-reply,slack-start-thread,slack-read,slack-update, andslack-upload-filereturn a clear error. A task that is already running in an external channel stops posting there as soon as the flag is on. - Fail closed. When Slack cannot tell the swarm whether a channel is external (for example,
conversations.infofails), the swarm blocks the channel as unverified and tries again on the next event or write. Direct messages and internal channels stay usable while Slack answers. - Boot scan. At start, the swarm posts one alert for each external channel the bot is already in. It does not leave them; a human decides.
Required Slack setup: bot scopes channels:manage (leave a public channel) and groups:write (leave a private channel), and bot events member_joined_channel, channel_shared, and channel_unshared. slack-manifest.json includes them. After you change an existing app, reinstall it to the workspace. Without the scopes, every leave fails, but the inbound and outbound guards still block all work in the channel.
The alert looks like this:
:no_entry: Swarm bot in external Slack channel #partner-channel (C0123456789)
Trigger: joined | shared | boot-scan
Leave: left | failed (<slack error code>) | not attempted (report only)
Inbound guard: active. The swarm creates no task from this channel.A failed (missing_scope) alert names the missing scope. The swarm posts at most 1 alert per channel and trigger per hour. The dedupe is stored in the database, so a restart does not repeat alerts. A failed alert post is retried on the next trigger.
Slack admin check: Slack sends no event before a member adds the bot to a channel, so the swarm can only act after the join. Ask a workspace admin to check the Slack Connect and app management settings for a control that limits where the app can be used. On plans other than Enterprise Grid, Slack Connect permissions limit only the external organization, not your own members.
To check the current state before you turn the flag on, run the read-only report:
SLACK_BOT_TOKEN=xoxb-... bun scripts/slack-external-channel-report.ts
# total=132 external=0User Filtering
By default, all Slack users can interact with the bot. To restrict access:
# Only users with matching email domains
SLACK_ALLOWED_EMAIL_DOMAINS=company.com,partner.com
# Specific user IDs always allowed (useful for admins)
SLACK_ALLOWED_USER_IDS=U12345678,U87654321If both are set, a user must match either an allowed domain or be in the user ID whitelist.
Bot messages and workflows
The swarm drops every message posted by a bot. To let an alerting tool (Sentry, Datadog, PagerDuty) start slack.message workflows, list its bot in SLACK_WORKFLOW_BOT_IDS per channel:
# Comma-separated CHANNEL_ID:BOT_ID pairs
SLACK_WORKFLOW_BOT_IDS=C0123ABCD:B0SENTRY1,C0123ABCD:B0DDOG001- A listed bot's post in its listed channel emits
slack.messagewithbotIdset. The same bot in another channel is dropped. - It only starts workflows. It never creates an agent task or reaches agent routing, even when it @mentions the bot.
- The swarm's own bot is always dropped, even when listed, so its replies cannot loop.
- User filtering does not apply to bot posts. External channel blocking and left threads still do.
- The value is read on each message, so a change applies without a restart. A malformed entry is rejected when saved.
Find a bot's bot_id in the message JSON (bot_id field) or with bots.info. Unset keeps the default: every bot message is dropped.
Attachment Handling
Files a user shares with the bot (images, voice memos, documents) become task attachments, in channel mentions and in assistant threads alike, and with or without accompanying text:
- The API server downloads each file from Slack with the bot token (requires the
files:readscope). - It stores the file through the active file provider (agent-fs, or the local provider) as a task attachment — the same kind of attachment a file uploaded from the dashboard creates. The worker's task prompt includes a ready-to-run command to fetch it.
- The task is created in
draftand becomes claimable only once its attachments are stored, so an agent never starts before the file exists. - An audio file or a Slack voice clip is transcribed into the task description under its metadata line, as a
[Transcript of <file>]block, when a transcription key is available:TRANSCRIPTION_API_KEY, or an ElevenLabs, OpenAI or Groq key the swarm already has (see Voice notes). Without a key, the line says no transcription provider is configured. A failed call is noted the same way, and the task is still created.
Each file also appears in the task description as a metadata line (filename, MIME type, size, Slack file ID). When a file can't be attached, the bot replies in the thread naming the file and the reason. A file that is larger than the 50 MB attachment limit or fails to download is also marked (not attached: <reason>) on its metadata line. A storage error happens after the description is written, so that file is reported only in the thread reply, and the task has no attachment for it.
Limitations:
- With
ADDITIVE_SLACKon (the default), follow-ups that are buffered (rather than turned into a task right away) carry only the metadata line, marked as not attached, and the bot says so in the thread. - With thread steering enabled, a lead follow-up that includes files creates a follow-up task instead of steering the running session, because steering only carries text.
- When the bot reads earlier messages of a thread for context, messages that contain only a file are skipped.
Leaving a thread
An agent calls slack-leave-thread when a thread no longer needs the swarm: people are talking among themselves, someone tells the bot to stop, or the work is done. The swarm then ignores every message in that thread that does not @mention the bot. The check runs in code before the slack.message workflow event, buffering, routing, or any model call, so no workflow starts, no task is created and nothing is posted. Replies already buffered when the thread is left are dropped too. The next message that @mentions the bot clears the state and is handled as usual. Other threads are unaffected, and leaving posts nothing to Slack.
A person can do the same without waiting for an agent: reply !leave in the thread (an @mention of the bot before it is allowed). The swarm leaves the thread in code, with no task, workflow event, or model call, and the !leave message is never buffered as a follow-up. Only the sender sees the confirmation, an ephemeral "Left this thread. @mention the swarm to bring it back." !leave works only in a thread the swarm is part of: one with a task, assigned or not, or one the swarm started. Elsewhere it is an ordinary message. It is a text command rather than a slash command because Slack does not allow custom slash commands in threads, so no Slack app setup is needed.
Set SLACK_LEAVE_THREAD_DISABLE=true to turn leaving off. !leave is then an ordinary message and /agent-swarm-help stops listing it. New agent sessions do not get the tool, and a session that already has it gets an error naming the flag when it calls it. Scripts always see the tool and get the same error while the flag is set. A global config change applies without a restart. Threads left before the flag was set stay left until someone @mentions the bot.
File Handling
Agents can upload and download files via Slack:
slack-upload-file— Upload a file to a Slack channel or threadslack-download-file— Download a file from Slack by file ID or URL
For task-scoped uploads, slack-upload-file preserves the visible conversation thread: channel tasks upload under the original Slack thread, and Slack DMs prefer the user-facing DM tree root instead of an internal progress-message thread when both exist.
Both tools run on the API server, so a file they download is stored where the agent's container can reach it:
- From a task,
slack-download-filestores the file as an attachment of that task. This covers an explicittaskId, or the task the agent is working on. The result includes a ready-to-runfetchCommandthat downloads the bytes into the container.slack-readenables files by default when reading throughtaskIdorinboxMessageId(turn it off withincludeFiles: false). DirectchannelIdreads default toincludeFiles: false, including calls made from a task. PassincludeFiles: trueto download and attach their files. A file the task already holds is reused, not stored twice. - Without a task (for example, from a script), the file is saved on the API server's disk:
slack-download-fileusessavePath, which must be inside/workspace/shared/downloads/(default/workspace/shared/downloads/{agentId}/slack/), andslack-readuses/app/shared/downloads/slack/. The bot token is sent only to the download URL that Slack returns for the file. The result says the path is on the API server. Worker containers can only read it if your deployment mounts the shared volume at that path on the API.
Related
- Environment Variables — Slack configuration variables (
SLACK_BOT_TOKEN, etc.) - Task Lifecycle — How Slack messages become tasks
- GitHub App Integration — Another external task source
- Linear Integration — Bidirectional ticket tracking with Linear
- Sentry Integration — Automated error triage from Sentry
- x402 Payments — Enable agents to make crypto micropayments
Integrations
External tools the swarm can talk to — issue trackers, chat platforms, error monitoring, email, and more.
GitHub App Integration
Connect your GitHub repos to Agent Swarm — AI agents auto-trigger on @mentions, issue assignments, and labels via webhooks. Full setup guide with permissions, event handling, and bi-directional sync.