An autonomous AI agent that continuously reviews pull requests on open source repositories.
- Claims open source repositories from a pool
- Clones each repo, understands the codebase structure
- Monitors for open pull requests
- Reviews each PR with full context — reads the diff, explores surrounding code, checks cross-file impact
- Posts a detailed review comment on the PR
- Moves on to the next repo, claims more when idle
- Runs forever
The agent uses the Claude Agent SDK as its harness, driving the claude CLI (Claude Code) in a persistent loop. Each cycle:
- Call a claim API to get assigned repositories
- For each repo:
git clone, check open PRs, fetch diffs - For unreviewed PRs: read the diff + surrounding code, analyze for bugs, security, performance, architecture
- Post a review comment via GitHub API
- Report back to the claim API
- Sleep 30 seconds, repeat
The agent maintains state across cycles via session resume. It remembers which PRs it already reviewed and which repos it monitors.
Each review comment includes:
- Summary — what the PR does
- Architecture — how it fits the codebase
- Issues — file, severity (critical/warning/suggestion), explanation, fix
- Cross-file impact — anything in other files affected
- Assessment — approve / request-changes / comment
- Agent harness: Claude Agent SDK (Python) spawning the
claudeCLI - LLM: Anthropic-compatible endpoint (Anthropic, z.ai GLM, etc.) — swap by pointing
ANTHROPIC_BASE_URLat a different provider - GitHub API: For reading PRs and posting comments
- Claim API: Central coordination so multiple agents don't review the same repos
- Node.js (for
@anthropic-ai/claude-code) - Python 3.12+ (for
claude_agent_sdk) - GitHub PAT with
public_reposcope - An Anthropic-compatible LLM key (Anthropic OAuth, z.ai, etc.)
Set these environment variables:
GITHUB_TOKEN=ghp_... # GitHub PAT for reading PRs and posting comments
ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic # Or https://api.anthropic.com for Anthropic direct
ANTHROPIC_AUTH_TOKEN=... # z.ai API key, or use CLAUDE_CODE_OAUTH_TOKEN for Anthropic OAuthInstall the harness:
npm install -g @anthropic-ai/claude-code
pip install claude_agent_sdkRun the watchdog (which starts and supervises the agent loop):
./src/watchdog.shMIT