Slack assistant pilot
Implementation draft; not deployed or installed. This adapter is disabled unless SLACK_BOT_ENABLED=true and a dedicated Slack bot installation is configured. It reuses the existing DreamLake /agent/chat endpoint for conversation and the same permission-checked tool registry for explicitly confirmed Note/Task creation. No new agent run engine or infrastructure is created.
Conversation and authority
A signed DM is not DreamLake authorization. An authenticated, pilot-eligible DreamLake user explicitly requests a short-lived link code:
Use read-only-slack-dm for conversation only, or explicitly opt into read-create-slack-dm to allow exact Note/Task proposals and separate confirmation. The response contains a one-use code, expiresIn: 600, grantExpiresAt and mode (read-only or read-create). Send connect <code> in a direct message to the installed bot. Never send an API token or password to Slack. The granted bearer is encrypted with the existing secretbox and expires at the earlier of its own expiry or one hour; it cannot be refreshed by this adapter. This consent allows DreamLake results to be sent into that Slack DM. Slack's workspace retention rules also apply.
Ordinary top-level DM follow-ups share one conversation per Slack user/channel and DreamLake account. Explicit Slack threads have separate conversation bindings. The model uses the existing server-owned session and permission-checked tools to find and read accessible Memos, projects and sessions. Project file reads still require explicit service-account grants. Ordinary conversation has no write authority. Editing existing resources, destructive actions, session control and arbitrary agent invocation are not enabled.
A channel mention returns only a generic request to continue privately. It does not reveal whether the sender has a linked account or whether a resource exists. Channel questions are not executed or copied into a DM by this slice.
Send disconnect in the bot DM to remove that binding, or call DELETE /integrations/slack/link with your DreamLake bearer to revoke all of your Slack bindings and outstanding codes. Account revocation is checked by generation during code redemption and every worker action. Current account/team permissions and token expiry are checked again before model execution and before private reply delivery.
Explicitly confirmed creation
With read-create consent, “create a Memo from this” or “turn that into a task” can produce a proposal. The model can only propose; it cannot execute a write. The bot displays the exact namespace, project/path for Tasks, title and complete content (at most 1,800 characters). Ambiguous destinations should be clarified first. Reply create <confirmation-token> to the delivered proposal within ten minutes. The token binds that exact payload, account, grant and conversation, and is consumed once. A quoted instruction in a Memo, search result or model response cannot supply confirmation.
Confirmation dispatches one deterministic operation through POST /agent/creations, using the original human bearer, existing session, shared tool registry and durable receipts. Memos are private; Tasks use the existing project Task API and its content:create permission check (TASKS_ENABLED=true is required). The result is a real Memo or Task URL. The model is not called during this mutation and receives no broader write tools.
The shared endpoint accepts {requestId, sessionId, confirmation: "create-exact-proposal", proposal}. A proposal contains kind (note or task), namespace, name, text, and for a Task project and path. requestId is a 32-character hexadecimal identity. The server checks current pilot/account/resource permissions, fences the session, records a tool receipt and encrypts successful result metadata. Same-owner identical requests reuse the result for seven days; conflicting or interrupted requests refuse replay. An ambiguous write may already exist: inspect the session/receipt before any new create request. Failure to deliver the Slack reply never repeats the mutation.
Reliability and limits
The event receiver verifies the exact raw bytes using Slack HMAC signatures and a five-minute timestamp window. It accepts only the configured Slack app/team, human DMs and app mentions; bot, self, subtype and group-DM events are ignored. Signed challenge verification is supported. A receipt is acknowledged only after a bounded encrypted Redis job and event deduplication key are committed atomically.
- 64 KiB event envelope, 8,000-character message, 30 accepted events per Slack user/hour and at most 1,000 queued events.
- Encrypted pending events/results and deduplication state expire after seven days. Session mappings expire after 30 days; underlying DreamLake sessions follow existing retention.
- One worker step per instance; distributed per-conversation locks prevent overlapping turns. A model request has a 180-second deadline and an event claim expires after 210 seconds.
- Saved agent session IDs are recorded from the existing SSE context before consuming the answer. Output is capped at 2,800 characters in Slack and rendered as plain text with mentions/unfurls disabled.
- Queued jobs and prepared replies survive restart. A crash during model execution or message delivery becomes
uncertain; the adapter never silently repeats an ambiguous Slack post or model run. This is not an exactly-once claim. - Processing failures return a generic DM when possible. Unconfirmed delivery requires inspection; it is not automatically retried. Authenticated users can inspect their recorded event state and bounded processing error code (even after a generic failure reply is delivered) with
GET /integrations/slack/events/<event_id>; other users receive 404.
Activation prerequisites
Use the checked-in dreamlake-server/src/slack-bot/app-manifest.json for a dedicated bot app. The scopes are app_mentions:read, im:history and chat:write; events are app_mention and message.im. The intended Events API URL is https://api.dreamlake.ai/integrations/slack/events. This single-workspace pilot has no OAuth installation callback or public multi-workspace installation flow.
Configure secret names, never their values in code, logs, Memos or a PR:
SLACK_BOT_TOKEN: dedicated installation bot token.SLACK_SIGNING_SECRET: signing secret for that exact app.SLACK_TEAM_ID,SLACK_APP_ID,SLACK_BOT_USER_ID: verified installation identifiers.SLACK_BOT_ENABLED=true: opt-in only after the prerequisites are verified.
The existing JWT_SECRET, SOURCE_ENCRYPTION_KEY, REDIS_URL, OPENROUTER_API_KEY and built-in agent team policy remain prerequisites. Redis persistence/availability must be checked for the pilot; failover losing Redis state invalidates the deduplication guarantee. Do not reuse a connector user's Slack credential as the bot credential.
Any new server deployment must use the centralized fortyfive/dreamlake-infra Terraform project (dreamlake-ai/dreamlake-infra, root dreamlake-server/eks-production, stack 86aee8d5-87a5-4a22-97cd-9bfd5cf7fa02) and be coordinated with other sessions. This implementation adds no infrastructure. The existing EKS deployment workflow forwards the named Slack configuration to its Kubernetes Secret with enablement defaulting to false; deployment remains centrally coordinated. Before activation: cross-review, CI, dedicated Slack installation/configuration, consent/link UX, centralized rollout, real signed-event acceptance, permissions/revocation tests and a supervised internal pilot. The confirmed creation implementation still requires live pilot acceptance. Cross-audience channel responses and edits to existing resources remain future work. UI changes require the user’s design selection before shipping.
Protocol references: Slack request verification, Events API acknowledgements and retries, and chat.postMessage.