A system of autonomous AI agents (Product Owner, Developer, QA, Architect) that collaborate via Discord and GitHub. Built on the Claude Agent SDK.
This is a template repository. Fork it and use Claude Code, Codex, or your favorite AI coding assistant to explore and adapt it to your needs.
Don't clone directly - fork first so you can customize freely:
- Click the Fork button at the top right of this page
- Clone your fork locally:
git clone https://github.com/YOUR-USERNAME/ai-crew.git cd ai-crew
This codebase is designed to be explored and customized with AI assistance. Open the repo with your preferred AI coding tool:
With Claude Code:
claude .With Codex or other AI assistants: Open the project and start asking questions like:
- "How does the agent system work?"
- "Where are the agent instructions defined?"
- "How do I add a new agent role?"
- "How does Discord integration work?"
Common customizations:
- Agent personalities: Edit
src/agents/*/CLAUDE.mdfiles - Add new agents: Copy an existing agent folder and modify
- Change workflows: Update the cron schedules in
ecosystem.config.cjs - Integrate different tools: Add MCP servers or modify Discord tools
The best way to extend this system is to simply ask your AI assistant to do it for you:
"Add Slack integration alongside Discord"
"Create a new Designer agent that reviews UI mockups"
"Replace GitHub Projects with Jira for work tracking"
"Add email notifications when PRs are merged"
"Create a /deploy command that triggers a deployment pipeline"
Your AI assistant can read the codebase, understand the patterns, and implement new features that integrate with the existing architecture. This is the intended workflow - you describe what you want, and the AI figures out how to add it.
Pro tip: Be specific about your requirements. Instead of "add Slack", try "add Slack integration that mirrors messages from Discord #development channel to a Slack #updates channel".
Modern LLMs can self-organize and collaborate effectively when given access to standard human collaboration tools (chat, kanban boards, code repos) without requiring explicit workflow orchestration code.
┌─────────────────────────────────────────────────────────────────┐
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ PO │ │ Dev │ │ QA │ │ Architect│ │
│ │ Agent │ │ Agent │ │ Agent │ │ Agent │ │
│ └────┬─────┘ └────┬─────┘ └────┬─────┘ └────┬─────┘ │
│ │ │ │ │ │
│ └──────────────┴──────────────┴──────────────┘ │
│ │ │
│ ┌──────┴──────┐ │
│ │ Discord │ Communication │
│ │ GitHub │ Work Tracking │
│ └─────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
- Node.js 20+
- pnpm (
npm install -g pnpm) - PM2 for process management (
npm install -g pm2) - GitHub CLI (
brew install ghor cli.github.com) - Discord bot token and server
# Install dependencies
pnpm install
# Copy environment template
cp .env.example .env
# Edit .env with your credentials
# See "Configuration" section belowCreate a .env file with:
# Discord Configuration
DISCORD_TOKEN=your-discord-bot-token
DISCORD_GUILD_ID=your-guild-id
# Cost Limits
MAX_DAILY_COST_USD=50.00# Build TypeScript
pnpm build
# Start all agents with PM2
pm2 start ecosystem.config.cjs
# View status
pm2 status
# View logs
pm2 logs
# Restart all agents
pm2 restart all| Agent | Role | Discord Role | Primary Channel |
|---|---|---|---|
| PO | Product Owner - Creates tickets, manages backlog, answers questions | @po |
#development |
| Dev | Developer - Implements features, creates PRs | @dev |
#dev-chat |
| QA | QA Engineer - Tests PRs, verifies functionality | @qa |
#dev-chat |
| Architect | Technical Lead - Research, architecture decisions | @architect |
#development |
Dev ──────┐
│
QA ──────┼──► PO ──────► Human (@human)
│
Architect─┘
Only PO escalates to the human. All other agents escalate to PO.
Agents respond to:
- Discord mentions:
@dev can you fix this bug? - Cron schedules: Periodic checks for work
- GitHub events: PR reviews, issue assignments (via polling)
- Human posts in
#development: "We need a login feature" - PO creates a GitHub issue with acceptance criteria
- PO moves issue to "Ready for Dev"
- Dev picks up the ticket, creates a branch, implements
- Dev creates PR, moves ticket to "In Review"
- QA tests the PR, approves or requests changes
- PR is merged, ticket moves to "Done"
ai-crew/
├── src/
│ ├── agents/ # Agent configurations
│ │ ├── po/CLAUDE.md # PO instructions
│ │ ├── dev/CLAUDE.md # Dev instructions
│ │ ├── qa/CLAUDE.md # QA instructions
│ │ └── architect/CLAUDE.md
│ ├── shared/
│ │ ├── runner/ # Agent execution loop
│ │ ├── tools/ # Discord tools
│ │ ├── guardrails/ # Cost tracking, cooldowns
│ │ └── auto-update/ # Self-update mechanism
│ └── index.ts # Entry point
├── docs/ # Documentation
├── data/ # Shared state, journals
├── ecosystem.config.cjs # PM2 configuration
└── package.json
# Start all agents
pm2 start ecosystem.config.cjs
# Restart specific agent
pm2 restart dev
# View logs
pm2 logs dev
# Stop all
pm2 stop all
# Set up auto-start on boot
pm2 startup
pm2 save- Discord Setup - Create bot, configure server
- GitHub Setup - Configure repository, project board
- OpenRouter Setup - Use alternative AI providers (OpenRouter, DeepSeek, etc.)
- Testing Agents - Testing strategy and guidelines
- Creating Skills - How to add agent capabilities
- Discord File Tools - File attachments in Discord
- Auto-Update - How agents self-update
- Configuration Reference - All agent config.json options
- PRD.md - Full product requirements document
# Run all tests
pnpm test
# Watch mode
pnpm test:watch
# With coverage
pnpm test:coverage| Variable | Description | Required |
|---|---|---|
DISCORD_TOKEN |
Discord bot token | Yes |
DISCORD_GUILD_ID |
Discord server ID | Yes |
MAX_DAILY_COST_USD |
Daily API cost limit | Yes |
AGENT_NAME |
Which agent to run (po/dev/qa/architect) | Yes (at runtime) |
AUTO_UPDATE_ENABLED |
Enable self-updates (default: true) | No |
- Runtime: Node.js 20+ / TypeScript
- Agent Framework:
@anthropic-ai/claude-agent-sdk - Communication: Discord (discord.js)
- Work Tracking: GitHub Projects API
- Process Management: PM2
- Testing: Vitest
- Create a feature branch
- Make changes
- Run tests:
pnpm test - Create a PR
MIT