# Discord Bot Usage Guide ## Overview The Claude Discord Coordinator bot routes Discord messages to Claude CLI instances with persistent session management and project-specific configurations. ## Architecture - bot.py: Main Discord bot with message routing (244 lines) - Integration: Uses ClaudeRunner, SessionManager, and Config modules - Trigger: Requires @mention to activate (safer MVP approach) ## Features Implemented 1. Message Routing - Listens for @mentions in configured channels - Routes messages to appropriate Claude instance based on channel-to-project mapping - Strips bot mention before sending to Claude 2. Session Management - Creates new sessions for first-time channel interactions - Resumes existing sessions for returning users - Saves user metadata (user_id, user_name) with each session - Updates activity timestamps on each interaction 3. Error Handling - Graceful error messages on Claude CLI failures - Handles empty messages (mention-only) - Handles empty Claude responses - Full exception logging 4. Response Formatting - Chunks long responses to fit Discord 2000-character limit - Uses ResponseFormatter for proper message splitting - Shows typing indicator while Claude processes ## Running the Bot export DISCORD_TOKEN="your-discord-bot-token" export CONFIG_PATH="/path/to/config.yaml" python -m claude_coordinator.bot ## File Locations - Implementation: /opt/projects/claude-coordinator/claude_coordinator/bot.py - Tests: /opt/projects/claude-coordinator/tests/test_bot.py - Config: /opt/projects/claude-coordinator/config.yaml - Sessions DB: ~/.claude-coordinator/sessions.db