Skip to content

Slack bot: plan the implementation #882

Closed

Description

@kantord

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/mecatl at 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 @mention starts 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/stopStream for real token streaming from Converse. Community reports say this works in DMs but fails in channels with missing_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 final chat.postMessage for v1 if it's still broken — without blocking on Slack fixing it.
  • CancelRun wires to Slack's native stop button. Subscribing to agent_session_stopped gets the button for free while processing; 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 PendingAsk transitions the session to suspended (documented as "needs clarification or a tool approval") plus Block Kit approve/deny buttons in the thread; clicking resumes and transitions status back. Slack's suspended gives 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 --mock first, real mecated once the SDK path is proven. Same offline-first discipline as ADR 0253's mocking testkit and mecademo.
  • 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 suspended status, 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


Fully or partially written by an AI agent.

Activity

  1. self-assigned this
    on Aug 31, 2026
  2. samuv commented on Sep 11, 2026

    @samuv
    Contributor

    The implementation plan is complete and recorded in
    sdk/typescript/examples/slack-bot/DESIGN.md. The reference implementation
    landed in #995. Ongoing Slack work is tracked under #1395.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions