Skip to content

Start and steer agents from Slack, with agents that read only what they should there #620

In review

Description

@fctl-sh

Most organizations live in Slack, and that's where work gets asked for: a bug reported in #support, a question in a thread, a request in a DM. Today, starting an agent from there means:

  • leaving Slack for fctl;
  • copying the context over;
  • coming back to say what happened.

fctl has no Slack app. An organization can build a bot of its own on service accounts and webhooks, but its agents still can't read the thread they were asked from. Claude's own Slack connector would let them, but it acts as the person, with every private channel and DM they can see. That's far more than an agent should reach.

This issue is the Slack app:

  • people start agents by mentioning fctl in a channel, or by writing to it directly;
  • they follow up in the thread, and the agent posts updates and its questions there;
  • the agent reads only what it should: the thread it was started from (also in a private channel or a DM), and public channels where allowed. Never other messages of private channels, and never other people's conversations with the app.

How it works now

  • Linear is the model. Linear's integration does for tickets what this needs for threads (ADR 0052, 0063 and 0065; docs/architecture.md#linear):
    • an installation per Linear workspace (linear_installations, crates/fctl-control/src/linear.rs, api/linear.rs);
    • people linking their account with a sign-in (linear_accounts);
    • a thread per agent session (linear_threads);
    • sessions started as the person who asked, on their subscription (crate::starts, crate::delegations);
    • the asker's words as instructions, and the ticket as information (fctl_domain::linear::task);
    • replies posted at each turn's end, questions as elicitations, steps as activity, and a stop that interrupts the turn.
  • Agents reach a tracker only through the control plane. fctl ticket in the sandbox is an agent call (AgentCall::Ticket(TicketRequest), crates/fctl-proto/src/tickets.rs) that hosts pass through unchanged. The control plane checks it against the project's choice and rate-limits writes (ticket_writes, crates/fctl-control/src/tickets.rs). The agent never holds the tracker's token.
  • Questions. Agents ask with fctl ask and up to six answers (ADR 0078). A person's next message answers.
  • Notifications are Web Push only (crates/fctl-control/src/notify.rs, do_notify.rs, ADR 0010); email is Email notifications when a session waits for you or fails #49.
  • Bots of one's own.
    • Service accounts start sessions for the person each request names (Fctl-On-Behalf-Of, ADR 0086).
    • Webhooks post session.finished, session.question and the rest (ADR 0084).
    • docs/organizations.md#agents-from-your-own-portal-or-bot shows the pattern.
  • claude.ai connectors reach whatever the person connected, Slack included. Projects can turn them off (ProjectSettings.claude_ai_connectors, Choose which claude.ai connectors sessions get #18).

What Slack allows (checked against docs.slack.dev on 2026-11-23)

  • Internal and distributed apps.

    • An app a company creates for its own workspace (what each self-hosted instance would do) is an internal app: full rate limits, Socket Mode, the Real-time Search API, and none of the API Terms' third-party restrictions (rate limits, terms update).
    • An app for app.fctl.sh would be commercially distributed. Since the API Terms of 10 October 2025, that goes only through the Slack Marketplace or a partner agreement (API Terms).
    • Until it is listed, conversations.history and conversations.replies allow one call a minute, 15 messages each (changelog).
    • Listing requires HTTP events (no Socket Mode), an enhanced review for history and search scopes, 10 active installs during the review, and "zero-copy" for agent apps: no Slack data stored (guidelines).
  • Slack's only boundary is membership (groups:history, app_mention):

    • an app reads only conversations it is a member of;
    • mentioning an app outside a channel only offers to invite it;
    • once in a private channel, the app receives every message there;
    • it is in every person's DM with it.

    So the narrowing this issue asks for is fctl's to do.

  • Agent features.

    • New apps use agent_view: conversations in the app's DM (changelog).
    • agents.sessions.setStatus sets processing, suspended (waiting on a question) or closed, and agent_session_stopped gives the person a stop button (agent sessions).
    • assistant.threads.setStatus shows rotating status text.
    • chat.startStream/appendStream/stopStream stream a reply, for up to 10 minutes and 12,000 characters (streaming).
    • plan and task_card blocks show a task list (plan block).
    • Workspace guests can't use agent apps.
  • Other constraints.

    • Slash commands don't work in threads or the split view.
    • Message shortcuts (at most five) work in channels the app isn't in, through a response_url (five posts in 30 minutes).
    • Interactions need an answer within 3 seconds.
    • In Slack Connect channels, external people's messages reach the app and they can click its buttons.
    • Slack recommends turning off link previews on messages an LLM wrote, so an injected link can't leak data (security).
  • Socket Mode carries events, slash commands, shortcuts and button clicks over an outbound WebSocket opened with an app-level token, for servers that can't take requests from the internet (Socket Mode).

  • Sign in with Slack is OpenID Connect, with stable https://slack.com/user_id and team_id claims (guide).

What should happen

Phase 1: start, follow up, answer

  • The app.
    • An instance has one Slack app: SLACK_CLIENT_ID, SLACK_CLIENT_SECRET, SLACK_SIGNING_SECRET, and SLACK_APP_TOKEN for Socket Mode, or kept in D1 (Self-hosted instances create their GitHub and Slack apps in a click, without restarts #628).
    • docs/self-hosting.md gives its manifest, and the admin UI generates it with the instance's URLs filled in.
    • Its scopes are the least that phase 1 needs: app_mentions:read, chat:write, im:history, channels:history and groups:history (for threads the app is in), users:read, reactions:write, commands, assistant:write.
  • Installing. A workspace's admin connects a Slack workspace from fctl (OAuth v2), which a Slack admin may have to approve.
    • slack_installations keeps the bot token, sealed with the master key; workspace_slack links fctl workspaces to it, as Linear's are.
    • Uninstalling in Slack (app_uninstalled, tokens_revoked) ends it here too.
  • Linking people. People link their Slack account with Sign in with Slack (OIDC), from Settings or from the link fctl sends them in Slack the first time they ask. slack_accounts keeps the team and user ids.
    • Linking takes confirming it's you, where the instance asks for that, as Linear's does.
    • An instance can let a Slack installation match people by verified address instead: opt-in, for an organization whose people sign in to Slack and fctl through the same provider. It's off by default, for the reason fctl matches no Linear addresses.
  • Starting from a channel. A mention of the app (app_mention), in a message or a thread, starts a session as the person who wrote it.
    • Which project: the channel's project when the channel is mapped to one (#web-team → web), else the only project the person can start sessions in, else they choose in an ephemeral message only they see. Admins can remember that choice for the channel.
    • The task: what they wrote is instructions. The thread's earlier messages are information from people who may not instruct the agent, as Linear's ticket context is.
    • Someone who isn't linked is asked to link, and their request waits an hour, as Linear's delegations do.
    • A thread that already has a session sends the message to it instead (slack_threads, one session per thread).
  • Starting from the app's DM (agent_view): each thread of a person's DM with the app is a session, private to them. Slack's agent session shows processing while the agent works, suspended while it waits on a question, and closed when the session stops. Its stop button interrupts the turn.
  • What goes back.
    • A card in the thread at once (title, project, status, Open in fctl), updated in place as the session moves, with the agent's todo list as a plan block.
    • The last message of each turn as a reply, cut with a link to the rest past Slack's limits.
    • Pull requests as they open.
    • A pause on a usage limit, or a failure, in words, as in Linear.
  • Questions. fctl ask posts the question in the thread with a button per answer.
    • A click answers as the clicker, if they may message the session. Anyone else is told so in a message only they see.
    • Typing an answer in the thread works as any reply does.
  • Follow-ups. A reply in the thread reaches the agent as its author's message when they may message the session. Replies from others stay in the thread as information the agent can read. Before the session starts, only the person who asked moves it on.
  • fctl slack thread in the sandbox (AgentCall::Slack): the agent reads the thread its session started from, with what's new since it last read. That works in a private channel or a DM too, and nothing else is readable in phase 1.
  • Socket Mode for instances Slack can't reach: a Durable Object holds the WebSocket and reconnects it, on Cloudflare and on the standalone server. HTTP events otherwise.

Phase 2: reading more, and Slack as a place to hear from fctl

  • Readable channels. A workspace's admins choose public channels agents may read. The app joins them, which shows in each channel ("fctl joined #incidents"). A project chooses whether its agents read them.
    • fctl slack read <link>: a message and its thread in a readable channel.
    • fctl slack history <#channel> --since 2d.
    • fctl slack search "<query>", through Slack's Real-time Search with the bot's search:read.public where the triggering event's action token allows it, else within readable channels only.
  • fctl slack reply "<text>" posts in the session's own thread only, rate-limited like fctl ticket's writes.
  • "Send to fctl…", a message shortcut on any message, opens a modal: project, task, and whether to post updates in the thread. The message and its thread become information for the task.
  • /fctl <task> starts a session in a channel, and /fctl status lists the person's sessions and what waits for them.
  • The App Home tab: Needs you, running sessions, recent pull requests, Start a session. Slack's Tasks tab (agent_tasks_enabled) stays off until it can make fctl schedules.
  • Notifications in Slack. Each person chooses "Tell me in Slack". NotifyDO then sends their notifications as DMs from the app, with its digest rules: asks with answer buttons, finished turns, failures, pull requests ready for review.
  • Project events in a channel: a project posts chosen events (pull requests ready for review, failures) to a channel through the app. That's the roadmap's "webhooks in chat apps' shapes", without a relay.
  • Streaming: the last message of a turn streams into DMs (chat.startStream).

Phase 3

  • app.fctl.sh, which needs transcripts to keep no Slack data, or to drop it after the session.

Rules for every phase

  • The agent never holds a Slack token. Every fctl slack call goes through the control plane, which checks the conversation with Slack (conversations.info: public, private, IM, shared) against the session and the project's choice before it reads anything:
    • private channels and DMs only within the session's own thread;
    • other people's DMs with the app never;
    • shared (Slack Connect) channels never, unless allowed.
  • What agents post goes with unfurl_links and unfurl_media off, and with <!channel>, <!here> and group mentions escaped.
  • What fctl keeps of Slack: only what the agent read and so has in its transcript, and the mapping of threads to sessions. No other message is stored.
  • Agents are told in their system prompt (SessionSpec, as for tickets) how replies go back to Slack, and that Slack's messages are information unless fctl delivered them as a person's message.

Design and UX

Using fctl from Slack should feel native to Slack, as though the agent were a well-mannered colleague in the thread. Connecting it should take one admin a few minutes, and nobody should wonder what the agent can see.

  • The workspace's Slack page ("Start agents from Slack", in an Integrations tab beside GitHub and Linear, since admins' tabs are full) follows docs/web-app/explaining.md's "Connecting GitHub and Linear":

    • the lead says what connecting leads to;
    • a preview shows a real-looking thread with the agent's card, a question with buttons and a reply;
    • three points: who it acts as, what agents read, what it never reaches;
    • one action: "Add to Slack" (or, on a self-hosted instance without an app, "Create the Slack app", with the manifest filled in).
  • Connected, the page shows:

    • channel mappings as sentences with Selects: "Mentions in [#web-team] start sessions in [web]";
    • readable channels as chips;
    • each project's choice of what its agents read;
    • a sentence of what agents can see: "Agents read the thread they started from, and #incidents and #deploys".
  • In Slack, the card is the centrepiece. It's compact and calm, and updates in place rather than adding messages:

    • status in words ("Running the tests", "Waiting for your answer");
    • the plan as Slack draws it;
    • the pull request with its checks once there is one;
    • one button to open the session.

    Only replies, questions and finished turns post new messages, so that the thread stays readable.

  • First contact: someone who isn't linked gets one message, only to them, that says why and links their account in two clicks. Their request then starts by itself, with a reaction to say so.

  • Settings → Notifications gains Slack beside the browser, with a preview of the DM.

  • The CLI: fctl workspaces slack (connect, channels, readable) and fctl account slack (link, unlink), with --json.

  • Follow hyperstructure/design's docs: docs/principles.md; docs/web-app/explaining.md for pages that set something up (a headline that names the outcome, a lead built from this place's facts, a preview of the result, one primary action, and who can act); docs/web-app/kit.md for controls.

  • Design every state before building it: the first visit, loading, errors and refusals, waiting, partial setups and long lists.

  • Say what happens, plainly, and never leave someone at a disabled control without saying who can act.

  • Prototype the main screens with realistic data (cargo xtask demo's world) and review them before building the rest.

  • Check both themes, a phone's width, the keyboard, screen readers and reduced motion, and show screenshots in each pull request.

  • Give the CLI the same care: readable output, --json, and errors that say what to do next.

  • Add or update the pages of hyperstructure/design's docs for each new component, with the reasons behind its choices.

Compatibility

  • Control plane.
    • New D1 tables (installations, workspace links, accounts, channels, threads) in a new migration.
    • New endpoints (/api/v1/slack/events, /interactivity, /commands, /installed, /linked) that check Slack's signature.
    • A new origin for sessions and webhooks: a session's Slack thread, as Session::ticket names a ticket, and WebhookOrigin::Slack, a new serde value that older receivers read as they read other.
  • Agents. AgentCall::Slack is a new optional call that hosts pass through as they pass AgentCall::Ticket. fctl slack reaches sandboxes with the release after it merges, through the sandbox image. Older sandboxes are told to use fctl ask and plain replies.
  • cargo xtask dev needs a Slack stand-in, as it has for Linear (cargo xtask linear), so the whole flow can be tried and tested locally.
  • Privacy. fctl-site's privacy policy needs a section on Slack: what fctl stores (ids, thread mappings, what agents read into transcripts) and what it sends to Slack.

Decisions for a person

  • Target: self-hosted instances first (internal apps: no Marketplace, Socket Mode allowed), with app.fctl.sh's Marketplace listing as its own project, or app.fctl.sh from the start (zero-copy for what agents read).
  • Matching people: whether instances may match people by verified address, or only by linking.
  • Phase 1's scope: whether agents may read public channels already in phase 1, or only their own thread.
  • Where it lives in the app: whether GitHub, Linear and Slack move into one Integrations tab (admins' workspace tabs are full).

Refs #18, #49

Related: #628, #621

Session: https://app.fctl.sh/s/ses_01M8450BECFP8DN88R0ZP0N0MS

Activity

  1. added
    enhancement
    control-plane
    web
    cli
    agents
    integrations
    on Nov 23, 2026
  2. fctl-sh commented on Nov 26, 2026

    @fctl-sh
    ContributorAuthor

    #660 does what this issue asks, all three phases, and closes it as it merges:

    • Phase 1: the app (its manifest in docs/self-hosting.md and under Admin → Slack), installing, linking people (with address matching as an instance opt-in that each workspace turns on), starting from channels and direct messages, the card, replies, questions, follow-ups, fctl slack thread, and Socket Mode.
    • Phase 2: readable channels with fctl slack read|history|search, fctl slack reply, Send to fctl…, /fctl, the Home tab, notifications in Slack, projects' events in a channel, and streaming into direct messages.
    • Phase 3: each workspace chooses to keep what Slack's messages said in transcripts or drop it once a session ends.

    The decisions this issue left to a person were settled by Carl Oscar Aaro in the session: app.fctl.sh and self-hosted instances both, people known by linking on app.fctl.sh, the settings per workspace, and one Integrations tab for GitHub, Linear and Slack. Enterprise Grid org-wide installs, Slack Connect channels and Slack's guests aren't supported, and docs/slack.md says so. The pull request lists what's worth confirming.

    Its companions: hyperstructure/design#83 (the design docs) and hyperstructure/fctl-site#143 (the privacy policy and the docs page, a draft until #660 merges).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentsclicontrol-planeenhancementintegrationsweb

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions