T3 Code × CopilotKit Channels demo
Send a coding change from Discord, let T3 Code run it on a dedicated branch and worktree, then receive status and completion back in the same Discord thread.
Demo safety: the integration is delivered only on a draft PR. Channel tasks fail closed unless a new worktree branch is created; there is no fallback that runs an agent on main.
What the demo shows
- A user mentions the Discord bot with a coding request or runs
/t3 <task>.
- The Channels adapter maps that Discord conversation to a T3 Code thread.
- T3 Code creates a unique branch such as
demo/discord/fix-login-a1b2c3d4 from the configured base branch.
- Only after the worktree exists does T3 Code start the agent turn.
- Discord receives a native status card immediately and a completion card with changed-file count when the diff is ready.
- Sending
status or pressing the status button checks the linked T3 Code run.
Setup inside T3 Code
The new Channels settings page keeps the demo setup in one place: select the project, paste the Discord application ID and bot token, choose the base branch and branch prefix, then enable the connection.
Isolation guarantees
- Every request gets a new branch and worktree before the agent starts.
- An invalid project, missing default model, missing base ref, branch collision, or worktree failure stops the request.
- The configured base branch is used only as the starting ref. It is never the agent's working checkout.
- The demo branch itself is separate from
main, and the GitHub PR remains draft.
- The Discord bot token is stored through T3 Code's secret store; it is not written into
settings.json or returned to the browser.
After saving and reloading, the token is empty in the browser and shown only as securely stored. The integration remains disabled unless the user explicitly enables and saves it.
Implementation shape
- Channel bridge: CopilotKit Channels core plus the official Discord adapter, with native cards and thread state.
- T3 Code execution: existing orchestration and Git workflow services create the thread, worktree, and agent turn.
- Completion: the existing
thread.turn-diff-completed domain event posts the final Discord card.
- Settings: a new Channels route, sidebar entry, secure token persistence, and live start/stop reconciliation.
- Future Slack support: the task operations are provider-neutral; a Slack adapter can reuse the same isolated execution path in a follow-up.
Verification completed
- Server, web, and contracts typechecks pass.
- Focused lint passes.
- 22 focused tests pass, including branch isolation and secret round-trip coverage.
- Browser validation covered project selection, save, secret redaction after reload, disabled persistence, and the configured visual state.
Demo checklist
- Check out the draft PR branch.
- Create a Discord bot and enable Message Content and Server Members intents.
- Open T3 Code → Settings → Channels and save the bot configuration.
- Enable the channel, mention the bot with a small code change, and show the isolated branch in the first response card.
- Show the corresponding T3 Code thread and worktree.
- Wait for the completion card in the same Discord thread and inspect the diff in T3 Code.