Repository navigation
Description
Summary
Plan for #881 (the Slack bot end-to-end reference implementation for @stacklok/mecatl, #821). This replaces an earlier ADR draft (PR #884, closed without merging per Samu's feedback: this is an example app's design, not a mecatl-architecture commitment — cheap to revise, shouldn't be frozen). Treat everything below as the current plan, editable as it evolves; migrate it into a design note living next to the example code itself (e.g. sdk/typescript/examples/slack-bot/DESIGN.md) once #821 creates the SDK tree.
Two things this plan deliberately does not solve
- Whose code this reuses, if any. An informally-mentioned PoC ("a working Slackbot connected to the Claude harness," demoed via video) was referenced in the 2026-08-31 UI team sync. The only concretely-found Slack+agent work under the same author (Radoslav Dimitrov) is
stacklok/atrium's "Craig V1" (stacklok/atrium#135) — a full production system (its own agent loop, MCP gateway, OAuth, customer-shippable chart) that does not appear to use@stacklok/mecatlat all. Whether Craig and the informal PoC are the same thing, related, or unrelated is unconfirmed — still an open fact-check, needs a direct check with Rado/Samu. This plan proceeds build-fresh regardless; if the fact-check later surfaces something reusable (most plausibly Craig's Slack MCP server as a tool, not its bot shell — Craig's agent loop is a different one entirely), that's a scope reduction to make later, not a blocker now. - Identity-impersonated, multi-user approvals. A separate Slack thread (Rado) explored a bigger idea — an internally-hosted Mecatl Slack bot where the agent inherits the invoking user's Slack identity, so approvals happen on their behalf, inspired by Slack's own "Code channels" feature and the Perplexity-Computer origin story. That's materially bigger scope than this plan's goal and is explicitly out of scope here — a later, separate effort. mecatl already has the infrastructure that idea would eventually need: ADR 0204 (accept and thread a verified principal), ADR 0206 (pluggable caller-identity acceptance), ADR 0212 (ownership enforced at every access path) — worth knowing it's not a green-field problem when that effort starts, but nothing here depends on it.
The plan
Slack shipped a purpose-built Agent Sessions API in 2026 (docs.slack.dev/ai/agent-sessions/), replacing the older Assistant messaging experience (deprecated Feb 2027). Building on it — instead of hand-rolled message editing — is the core design choice:
Session-state mapping (Slack agent-session status ↔ mecatl session state):
| Slack | mecatl |
|---|---|
active |
idle (ready for next prompt) |
processing |
running |
suspended |
awaiting / PendingAsk |
closed |
completed / cancelled / failed (terminal) |
- One mecatl session per Slack thread. A new top-level
@mentionstarts a fresh session; replies in that thread continue it. Matches both platforms' own thread-scoped models. - Streaming is spiked first, not assumed. Target native
chat.startStream/appendStream/stopStreamfor real token streaming fromConverse. Community reports say this works in DMs but fails in channels withmissing_recipient_team_id— and "tag the bot in a channel" is exactly this plan's scenario, so validate directly before committing. Falls back to a single finalchat.postMessagefor v1 if it's still broken — without blocking on Slack fixing it. CancelRunwires to Slack's native stop button. Subscribing toagent_session_stoppedgets the button for free whileprocessing; the handler calls the SDK's cancel, then explicitly transitions the session status (Slack doesn't do this automatically on stop). Cheap — no new mecatl-side work.- Approval: auto-approved by default; manual approval is an explicit experiment, not a requirement. Every demo run executes under an auto-approved posture so it never blocks on a human — matching "tag it, get an answer" v1 scope. Separately, prototype the natural-looking alternative: a
PendingAsktransitions the session tosuspended(documented as "needs clarification or a tool approval") plus Block Kit approve/deny buttons in the thread; clicking resumes and transitions status back. Slack'ssuspendedgives the native "needs your input" signal but does not supply a ready-made widget — the buttons are still hand-built. Drop this without ceremony if it doesn't fit naturally; it was never required to ship v1. - Development sequencing:
mecated --mockfirst, realmecatedonce the SDK path is proven. Same offline-first discipline as ADR 0253's mocking testkit andmecademo. - Event delivery: Socket Mode. A persistent WebSocket from the bot process — no public URL, no ngrok. Fits a self-hosted dev app (create your own Slack app in dev mode, install to one workspace — no App Store listing).
- No fixed demo script. The bot relays whatever task it's tagged with to a real mecatl session.
- Code lands at
sdk/typescript/examples/slack-bot/— provisional, since that tree doesn't exist yet (Prototype @stacklok/mecatl-sdk TypeScript SDK #821 owns its real layout).
Costs, stated honestly
- Building on Slack's Agent Sessions API is a bet on a still-settling platform (the classic Assistant experience it replaces sunsets Feb 2027; the new API shipped mid-2026) — the trade is worth it for the native stop button and
suspendedstatus, but it means tracking Slack's own changelog. - The channel-streaming risk is real and unresolved until spiked — v1 may ship with a single final message instead of true streaming.
- The manual-approval experiment may simply not ship.
- Code location is provisional, subordinate to whatever
sdk/typescript/'s real layout ends up being.
See also
- Slack bot: end-to-end reference implementation for @stacklok/mecatl #881 (umbrella), Slack bot: implement once the SDK is ready #883 (implementation, blocked on Prototype @stacklok/mecatl-sdk TypeScript SDK #821), Prototype @stacklok/mecatl-sdk TypeScript SDK #821 (the SDK itself)
- ADR 0253 — the mocking testkit; shares the
mecated --mocksequencing discipline - ADR 0232 — steer-while-running, relevant if the approval/steer experiment extends to mid-run Slack replies
- ADR 0204, ADR 0206, ADR 0212 — the caller-identity infrastructure Rado's separate identity-impersonation idea would build on
Fully or partially written by an AI agent.
Activity
docs: ADR 0254 — Slack bot, mecatl's first real SDK consumer
feat(sdk): add Slack bot reference example (#883)
feat(sdk): add Slack bot reference example (#883)
samuv commentedon Sep 11, 2026
The implementation plan is complete and recorded in
sdk/typescript/examples/slack-bot/DESIGN.md. The reference implementationlanded in #995. Ongoing Slack work is tracked under #1395.