A self-evolving, unattended AI programming bot powered by Claude Code.
claude-bot monitors GitHub issues, implements them autonomously via Claude Code, runs tests, opens PRs, reviews its own code, and merges — with no human in the loop. When idle, it patrols your repositories for bugs, outdated dependencies, and improvement opportunities, and files issues for itself to fix.
The bot is a seed: once deployed, each instance drifts toward its own codebase as it implements, patrols, and iterates. Two deployments of the same initial version will evolve differently over time.
Note: This is an early release. The core loop (schedule → implement → test → PR → merge) is stable, but several subsystems (Feishu integration, self-update deploy gate, cross-repo patrol) still have rough edges. See the open issues for known bugs.
- Autonomous implementation — picks up issues labeled
claude, implements them with Claude Code, runs tests, opens a PR, performs AI code review, and merges - Patrol — every 2 hours when idle: scans repos for bugs, anti-patterns, outdated deps, research opportunities, and cross-repo coherence gaps; files issues for itself to fix
- Self-introspection — clusters recurring errors from its own logs, files
self-fixissues, and re-queues blocked jobs once a fix merges - Self-update — pulls its own source on every merge to
main, deploys atomically, rolls back on failure - Watchdog — auto-restarts failing services, detects queue deadlocks, files alerts to GitHub
- Rate-limit recovery — backs off gracefully when the AI provider is overloaded, resumes automatically
scheduler.py Poll GitHub, enqueue jobs, AI priority + dependency analysis
worker.py Claim jobs, run Claude Code, test, PR, review, merge
patrol.py Idle-time code review / research / iteration patrol + self-introspection
watchdog.py Extended watchdog: auto-file self-fix issues, re-queue on fix merge
self_edit.py Cross-process lock preventing restarts while bot edits itself
bot_lease.py GitHub-comment lease gate — prevents double-claiming across instances
model_registry.py Provider / model configuration
provider.py Rate-limit state machine
bin/
self-update.sh Closed-loop deploy: fetch → gate → rsync → restart → verify → rollback
watchdog.sh Service monitor, daily token report, backup, queue deadlock detection
bash-guard.sh PreToolUse hook — blocks git push, publish, ssh, secrets reads
preflight.sh Startup config validator
smoke.py Post-deploy smoke canary
.claude/
agents/ implementer, reviewer, deep-reviewer agent definitions
settings.json Permission deny list + PreToolUse hooks
systemd/ Service and timer unit files
migrations/ Incremental SQLite schema migrations (idempotent)
repos.yml Monitored repositories configuration
profiles.yml Deployment profiles (production, staging, minimal, dev)
- A Linux VPS with
systemd,python3.11+,sqlite3,git,gh(GitHub CLI) - A GitHub account with a fine-grained PAT (
repo,issues,pull_requests,workflows) - An AI provider API key (Claude/Anthropic or compatible endpoint)
- Optional: Feishu/Lark or Telegram for notifications
-
Clone this repo to your VPS:
gh repo clone YOUR_ORG/claude-bot /srv/claude-bot-src
-
Configure — copy and fill in the env file:
cp claude-bot.env.example /etc/claude-bot/claude-bot.env $EDITOR /etc/claude-bot/claude-bot.envAt minimum set:
GH_TOKEN,SELF_FIX_REPO,ALERT_REPO,SELF_INTROSPECTION_REPO,TRUSTED_BOT_LOGINS, and your AI provider credentials. -
Configure repos — edit
repos.ymlto list the repositories you want the bot to monitor. See the file for the format. -
Deploy:
VPS=user@your-vps-host ./deploy.sh
-
Check status:
systemctl status claude-scheduler claude-worker@1 journalctl -u claude-worker@1 -f
Add the claude label to any GitHub issue in a registered repository. The bot will pick it up within POLL_INTERVAL seconds (default: 120).
Additional labels:
claude-hard— use the stronger/more expensive model tierclaude-ultracode— use maximum-effort mode (token-expensive)claude-no-automerge— implement and open a PR, but do not auto-mergeclaude-docs— documentation-only change
See claude-bot.env.example for all configurable variables with descriptions. The most important ones:
| Variable | Required | Description |
|---|---|---|
GH_TOKEN |
Yes | GitHub fine-grained PAT |
SELF_FIX_REPO |
Yes | Repo where the bot files self-fix issues |
ALERT_REPO |
Yes | Repo where the watchdog posts alerts |
SELF_INTROSPECTION_REPO |
Yes | Repo for the self-introspection patrol |
TRUSTED_BOT_LOGINS |
Yes | Your GitHub login (comma-separated) |
ANTHROPIC_AUTH_TOKEN |
Yes | AI provider API key |
ANTHROPIC_BASE_URL |
Yes | AI provider base URL |
PROVIDER |
Yes | Provider identifier (see provider.py) |
- The Feishu/Lark integration (
feishu_bot.py) requires manualREPO_ALIASESconfiguration for issue routing. - The self-update deploy gate can be overly conservative — use
touch /srv/claude-bot/watchdog/self-update.urgentto force a deploy. - Cross-repo patrol requires
ORG_COHERENCE_ORGto be set and a GitHub org with visible repos. - The bot runs as
rootin the reference deploy (seedeploy.yml); for production use, create a dedicated low-privilege user and adjustReadWritePathsin the systemd units. - Test coverage is good for core scheduling/worker paths but thin for the self-update and Feishu integration.
See docs/philosophy.md for the design rationale.
MIT