A prompt for DIY Claude Tag based on Claude agent SDK A developer has published a detailed architecture for a DIY Slack bot that gives every thread its own dedicated Claude Code session running in a disposable container, built on the Claude Agent SDK. The design uses deterministic thread sessions and a per-channel router, with deployment via Docker Compose and a rootless Docker daemon for isolation. The bot aims to provide reliable, context-aware AI assistance in Slack without stalling channel delivery. Build me a Slack bot that gives every Slack thread its own dedicated Claude Code session running in a disposable container, using the Claude Agent SDK @anthropic-ai/claude-agent-sdk on Bun/TypeScript. This is a specific, proven architecture — follow it closely. Here is the design, piece by piece: Two kinds of Claude sessions, both built on the Agent SDK's streaming query API: - Thread sessions workers — the workhorses. Every human @mention of the bot deterministically spawns a dedicated Claude Code session bound to that thread. No model decides whether a mention gets a session — the mention path is pure host code, so it can never be talked out of answering. A thread that ever had a session keeps being Claude's: if a reply arrives after the session idled out and died, a fresh session is rebuilt and seeded with up to ~50 messages of thread history as context. Session IDs are derived from the thread ts, so a rebuilt session shares an identity and transcript — see below with its predecessors. - A per-channel router — one long-lived Agent SDK session per channel that only judges ambient main-chat traffic unaddressed top-level messages . It has no data tools and can speak only at the channel's top level, never inside a thread. Its toolset is exactly: send message top-level only , react , spawn thread session , spawn channel session posts a top-level "anchor" message, then spawns an ordinary thread session bound to it — this is how an automation or wake with no human message to thread under still gets real work done; the anchor becomes the session's own headline to keep updated via edit , and do nothing . Every router turn must end with exactly one terminal action — silence is a tool, and an empty turn is indistinguishable from a hung session. Handled mention/rebuild events also reach the router marked as handled , as non-waking context so it doesn't double-answer. Anything beyond a one-message answer — code reading, multi-step research, anything touching a repo — must spawn, because a thinking router stalls delivery for the whole channel. - Deployment is docker compose up with two services: an app container the host process — Bolt gateway, HTTP API, session lifecycle and a dind service docker:28-dind-rootless whose nested rootless Docker daemon runs all worker containers. The host machine's Docker never runs a worker. The app talks to the inner daemon via DOCKER HOST: tcp://dind:2375 on the private compose network nothing published; no TLS . rootlesskit needs privileged: true on the outer dind container to set up user namespaces, but everything inside runs unprivileged — a worker escape lands as an unprivileged user inside a sandbox daemon. - Bind mounts of worker data resolve on the inner daemon's filesystem, so the memory tree and transcript dir are volume-mounted into the dind service at fixed paths e.g. ./memory:/memory , ./.claude-sessions/sdk-transcripts:/sdk-transcripts and the app names those same paths when it creates worker mounts. - The host spawns a worker with docker run -d --name