How stewart86/bobby works
Project Type & Purpose
• Bobby is a self-hosted, Dockerized Discord chatbot service.
• It listens to Discord messages, uses Claude Code (Anthropic) for AI reasoning over a user’s GitHub-hosted codebase, and can open GitHub issues for detected bugs.
High-Level Structure from File Tree
• Root files:
– index.js: main bot logic (event handlers, orchestration).
– entrypoint.sh: container startup script (initializes CLI tools).
– Dockerfile & .dockerignore: build container image.
– .env.example: environment variables template.
• .github/workflows/docker-publish.yml: CI/CD pipeline building/publishing Docker images.
• CLAUDE.md: local memory/instructions for Claude Code CLI.
• package.json: Node/Bun dependencies (discord.js, @anthropic-ai/claude-code, @octokit or GitHub CLI).
Core Components to Model
a. Docker Container
b. Discord Client Module (Discord.js)
c. Claude Code CLI / Anthropic API (AI Engine)
d. GitHub CLI / GitHub API Integration
e. Local Data Volume (/app/data, houses CLAUDE.md, cloned repo)
f. External Services:
– Discord Gateway API
– Anthropic Claude API
– GitHub API
g. CI/CD Pipeline (GitHub Actions → Docker Hub)
Component Interactions & Data Flows
• On startup:
1. entrypoint.sh runs → installs/configures Claude CLI, authenticates GitHub CLI.
2. index.js connects to Discord Gateway with DISCORD_TOKEN.
• On “@Bobby” mention:
1. Discord Gateway → Discord.js event → index.js.
2. Bot clones (or updates) GITHUB_REPO locally using GitHub CLI → local volume.
3. index.js invokes Claude Code CLI with codebase context from /app/data & CLAUDE.md → Anthropic Claude API → CLI returns AI response.
4. index.js posts response back to Discord channel or thread.
5. If bug patterns detected, index.js calls GitHub CLI (or Octokit) → GitHub API → creates GitHub Issue.
• Persistent context:
– CLAUDE.md and thread-based session IDs stored on volume.
• CI/CD:
– GitHub Actions on push → builds image → docker-publish → Docker Hub.
Architectural Patterns & Principles
• Event-Driven: Discord events trigger AI and GitHub actions.
• Modular CLI Wrappers: Abstracts AI and Git interactions through CLIs.
• Read-Only Code Analysis: No code mutations—CLI & API calls only.
• Containerization & Isolation: Single-container service per repo.
• Thread-Based Session Management: Maintains per-thread context in Discord.