Agent Code Review

AI-powered code review agent for GitHub Pull Requests.
Overview
Agent Code Review is a tool for posting AI-assisted code reviews to GitHub PRs. It supports three usage modes:
- Go SDK β Programmatic access for integration into other tools
- CLI β Command-line interface for scripts and manual use
- MCP Server β Model Context Protocol server for Claude Code integration
Reviews are posted as a GitHub App, appearing as PlexusOne Code Review[bot], clearly distinguishing AI-assisted reviews from human reviews.
Note: This is a community project by PlexusOne. It is not an official Anthropic product.
Features
- π€ GitHub App Integration β Reviews posted as a bot, not your personal account
- π¦ Go SDK β Programmatic API via
pkg/review
- β¨οΈ CLI β Full-featured command-line interface
- π MCP Server β Native integration with Claude Code
- π Multi-Agent Spec β Agent definition follows the multi-agent-spec format
Installation
CLI
go install github.com/plexusone/agent-code-review/cmd/acr@latest
Go SDK
go get github.com/plexusone/agent-code-review
Prerequisites
Option 1: GitHub App (Recommended)
-
Create a GitHub App (see GitHub App Setup)
-
Configure authentication:
export GITHUB_APP_ID=123456
export GITHUB_INSTALLATION_ID=12345678
export GITHUB_PRIVATE_KEY_PATH=~/.config/gogithub/private-key.pem
Or create ~/.config/gogithub/app.json:
{
"app_id": 123456,
"installation_id": 12345678,
"private_key_path": "~/.config/gogithub/private-key.pem"
}
Option 2: Personal Access Token
export GITHUB_TOKEN=ghp_xxxxxxxxxxxx
CLI Usage
# List open PRs
acr list -o owner -r repo
# Get PR details
acr get 123 -o owner -r repo
# Get PR diff
acr diff 123 -o owner -r repo
# Post a review
acr review 123 -o owner -r repo -e APPROVE -b "LGTM!"
acr review 123 -o owner -r repo -e REQUEST_CHANGES -f review.md
echo "Great work!" | acr review 123 -o owner -r repo -e COMMENT
# Add a comment
acr comment 123 -o owner -r repo -b "Thanks for the contribution!"
# Run as MCP server
acr serve
Environment Variables
| Variable |
Description |
GITHUB_OWNER |
Default repository owner |
GITHUB_REPO |
Default repository name |
GITHUB_TOKEN |
Personal access token (fallback auth) |
GITHUB_APP_ID |
GitHub App ID |
GITHUB_INSTALLATION_ID |
GitHub App installation ID |
GITHUB_PRIVATE_KEY_PATH |
Path to GitHub App private key |
Go SDK Usage
package main
import (
"context"
"log"
"github.com/grokify/gogithub/auth"
"github.com/plexusone/agent-code-review/pkg/review"
)
func main() {
ctx := context.Background()
// Create client with GitHub App auth
cfg, _ := auth.LoadAppConfig()
client, _ := review.NewClientFromAppConfig(ctx, cfg)
// Or with token auth
// client := review.NewClientFromToken(ctx, "ghp_xxxx")
// Post a review
result, err := client.CreateReview(ctx, &review.ReviewInput{
Owner: "owner",
Repo: "repo",
PRNumber: 123,
Event: review.EventApprove,
Body: "LGTM! Great work.",
})
if err != nil {
log.Fatal(err)
}
log.Printf("Review posted: %s", result.HTMLURL)
}
MCP Server Usage
Add to your Claude Code MCP configuration:
{
"mcpServers": {
"code-review": {
"command": "acr",
"args": ["serve"]
}
}
}
| Tool |
Description |
review_pr |
Post a full code review (approve/comment/request-changes) |
comment_pr |
Add a general comment to a PR |
line_comment |
Comment on a specific line in the diff |
get_pr_diff |
Fetch PR diff for analysis |
get_pr |
Get PR metadata |
list_prs |
List open PRs in a repository |
GitHub App Setup
-
Go to Settings β Developer settings β GitHub Apps β New GitHub App
-
Configure:
| Field |
Value |
| Name |
PlexusOne Code Review (or your preferred name) |
| Homepage URL |
https://github.com/plexusone/agent-code-review |
| Webhook |
Disable (not needed for local use) |
-
Set permissions:
| Permission |
Access |
| Pull requests |
Read & Write |
| Contents |
Read |
| Metadata |
Read |
-
Generate and download a private key
-
Install the app on your repositories
-
Note your App ID and Installation ID
Reviews include a footer for transparency:
## Code Review Summary
[Review content...]
---
π€ Powered by Claude β’ PlexusOne Code Review
Project Structure
agent-code-review/
βββ cmd/acr/ # CLI application
β βββ main.go
β βββ cmd/
β βββ root.go
β βββ review.go
β βββ comment.go
β βββ diff.go
β βββ get.go
β βββ list.go
β βββ serve.go
βββ pkg/review/ # Go SDK
β βββ review.go
βββ internal/mcp/ # MCP server implementation
β βββ server.go
βββ specs/agents/ # Agent definition (multi-agent-spec)
β βββ code-reviewer.md
βββ go.mod
βββ go.sum
βββ LICENSE
βββ README.md
Dependencies
- gogithub β GitHub API wrapper with App authentication
- go-sdk β Official MCP Go SDK
- cobra β CLI framework
License
MIT
π€ Powered by Claude β Built by PlexusOne