Bot Configuration
The OSTwin bot provides a conversational interface for managing plans and interacting with agents through Discord, Telegram, or Slack.
Architecture
Discord / Telegram / Slack β βΌ Bot (TypeScript) βββ Connector layer β Platform adapters βββ Command router β Slash commands βββ Agent bridge β Proxies to dashboard API βββ Session manager β Per-user/channel state βββ Notifications β War-room event pushEnvironment setup
Set platform tokens in ~/.ostwin/.env:
# Dashboard connectionDASHBOARD_URL="http://localhost:9000"OSTWIN_API_KEY="your-api-key"
# DiscordDISCORD_TOKEN="your-discord-bot-token"DISCORD_CLIENT_ID="your-discord-app-id"GUILD_ID="your-server-id"
# TelegramTELEGRAM_BOT_TOKEN="your-telegram-bot-token"
# SlackSLACK_BOT_TOKEN="xoxb-your-slack-bot-token"SLACK_APP_TOKEN="xapp-your-slack-app-token"SLACK_SIGNING_SECRET="your-signing-secret"Discord setup
-
Create a Discord application at the Developer Portal. Under Bot, click Add Bot and copy the token.
-
Set permissions: Send Messages, Read Message History, Use Slash Commands, Embed Links, Attach Files.
-
Invite the bot using an OAuth2 URL with
botandapplications.commandsscopes. -
Configure tokens in
~/.ostwin/.env:Terminal window DISCORD_TOKEN="your-bot-token"DISCORD_CLIENT_ID="your-application-id"GUILD_ID="your-server-id" -
Deploy slash commands and start:
Terminal window cd bot && npm installnpx ts-node src/deploy-commands.tsnpm start
Telegram setup
-
Create a bot via
@BotFatherin Telegram. Send/newbotand copy the token. -
Configure the token:
Terminal window TELEGRAM_BOT_TOKEN="123456:ABC-DEF..." -
Start the bot. The Telegram connector activates automatically when the token is present.
Terminal window cd bot && npm start
Commands
| Command | Description |
|---|---|
/plan create | Interactive plan creation |
/plan run <path> | Execute a plan |
/plan status | Current execution status |
/plan list | List available plans |
| Command | Description |
|---|---|
/rooms | List active war-rooms |
/room <id> | Room details |
/room <id> channel | Recent messages |
/room <id> progress | Completion percentage |
| Command | Description |
|---|---|
/ping | Health check |
/memory search <query> | Search memory ledger |
/status | Overall system status |
Agent bridge
The agent bridge proxies conversations between chat users and OSTwin agents:
- Routes user messages to the appropriate war-room channel
- Waits for the agentβs response
- Formats and returns the response to the chat platform
Sessions
Per-user context: current plan, active war-room, conversation history (last 20 messages), notification preferences. Expires after 24 hours of inactivity.
Team collaboration: shared plan focus, broadcast notifications for room state changes, threaded discussions per war-room.
Notifications
The bot pushes war-room events to subscribed channels:
| Event | Notification |
|---|---|
Room enters review | βRoom-001 is ready for reviewβ |
Room passed | βRoom-001 passed QAβ |
Room failed-final | βRoom-001 failed after max retriesβ |
| Plan completed | βPlan completed β 4/4 epics passedβ |
Subscribe with /subscribe room-001 or /subscribe plan my-plan.
Connector architecture
bot/src/connectors/βββ base.ts # Abstract interfaceβββ discord.ts # Discord adapterβββ telegram.ts # Telegram adapterβββ slack.ts # Slack adapterβββ registry.ts # Auto-activates based on tokensThe registry activates connectors based on which tokens are set. Discord and Telegram can run simultaneously from a single process.