百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
P

pr-af

> AI 编程
开源

#1 在 Code-Review-Bench 上的开源代码审查员

366 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

#1 在 Code-Review-Bench 上的开源代码审查员

PR-AF is the #1 open-source code reviewer on Martian Code-Review-Bench. It is built for deep code review, not shallow diff summaries: turn each PR into a task-specific review plan, spawn focused reviewer agents, ground findings in code evidence, challenge the results, and squeeze more useful review intelligence out of cheaper models. Run DeepSeek-class models for routine PRs, GLM-5.2 for deep open-model reviews, or Opus-class frontier models for major PRs — where PR-AF tops the benchmark by a wide margin.

Benchmark Position

On the 38 runnable Martian Code-Review-Bench PRs, PR-AF with GLM-5.2 is the #1 open-source reviewer in golden recall: 0.706 across 42 compared tools. It is ahead of cubic-v2 and every qodo, coderabbit, greptile, copilot, and devin variant in this snapshot.

Where PR-AF shines:

strength result
Known bug recall 0.706 golden recall — #1 open source across 42 compared tools.
More real issues found 595 independently valid findings, ~3× more than the leading commercial tools in the adjusted comparison.
Open + reproducible Single open model (GLM-5.2), public results, per-PR judge verdicts, and reproduction scripts.
Self-hosted API Run locally with Docker; trigger reviews by CLI, curl, CI, or other agents.
Model-flexible Use cheaper models for regular PRs, GLM-5.2 for open-model CI gates, and Opus-class frontier models for highest-stakes reviews.
Frontier ceiling With Opus-class commercial models, PR-AF tops the benchmark by a wide margin.
Cost position About 10× cheaper per review than closed-source tools.

Full benchmark package: benchmark/martian-code-review-bench.

One-Call DX

Trigger it with the af CLI (requires af ≥ 0.1.87) — it streams live progress and prints the result:

bash
af call pr-af.review --in '{"pr_url": "https://github.com/owner/repo/pull/123"}'

Prefer raw HTTP? Hit the API directly with curl:

bash
curl -X POST http://localhost:8080/api/v1/execute/async/pr-af.review \
  -H "Content-Type: application/json" \
  -d '{"input": {"pr_url": "https://github.com/owner/repo/pull/123"}}'

Posts inline GitHub review comments with evidence-grounded findings:

…

Custom review strategy per PR. Evidence-grounded findings. About 10× cheaper per review than closed-source tools.


Dynamic Pipeline Architecture

PR-AF does not execute a static script. It structurally morphs its own execution graph based on the topology of the incoming Pull Request.

When a PR arrives, the system dynamically compiles review dimensions — evaluating the diff through semantic, mechanical, and systemic lenses. It uses these dimensions to spawn specialized, ephemeral reviewer agents tailored exclusively to the exact context of the current PR.

Full architecture deep-dive: docs/ARCHITECTURE.md

Pipeline flow (Mermaid)

…

How It Works

PR-AF uses this multi-phase cognitive pipeline to ensure rigorous, high-fidelity reviews:

1. Evidence Grounding

If the system flags a missing validation check, PR-AF does not immediately accept it. It pulls exact caller snippets and import context from the repository, then verifies whether the finding is grounded in the code before it reaches the final review.

2. Compound Vulnerability Synthesis

Standard tools analyze code linearly. PR-AF clusters related risks across files and evaluates whether isolated findings combine into a larger systemic issue.

3. Falsifiability Gates

Before a finding becomes a GitHub comment, the system tries to invalidate it: safe behavior, intended behavior, existing mitigations, or weak evidence. Findings that survive are returned with file, line, body, suggestion, and evidence.


Ecosystem Comparison

There are excellent AI code review tools on the market. PR-AF is not designed to replace fast, interactive tools; it is designed for comprehensive CI/CD gating where accuracy and architectural depth matter more than execution speed.

Feature PR-AF (AgentField) Claude Code CLI Commercial SaaS (e.g. Codex, CodeRabbit)
Best For Deep CI/CD architectural audits Fast, iterative inner-loop development Clean GitHub UX and chat-based reviews
Cost Free / Open Source (BYOK API costs only) Pay-per-token (BYOK) ~$20 - $25 / user / month
Architecture Massively parallel cognitive pipeline Single-thread interactive loop Context retrieval + LLM review
Execution Time ~35-50 minutes Seconds to minutes ~2-5 minutes
False Positives Extremely low (Evidence Grounding) Moderate (relies on context window) Low-to-Moderate (heuristic filtering)
Compound Risks Yes (Dedicated Compound Synthesizer) Unlikely (diff-focused) Partial (depends on retrieval accuracy)

We highly recommend using Claude Code for your local development and running PR-AF as your final GitHub Actions gatekeeper.


Quick Start

Install into AgentField (af install)

Already running an AgentField control plane? Install PR-AF straight from GitHub — no clone, no local setup:

bash
af install https://github.com/Agent-Field/pr-af
af run pr-af

af install follows the repository manifest to the maintained Go package and registers it as the pr-af node with your control plane. If an older Python pr-af is installed, it is replaced in place, retaining the same node id, triggers, and node-scoped secrets. On first af run you're prompted for the required secrets — OPENROUTER_API_KEY and GH_TOKEN — which are stored encrypted and reused across every node, so you enter each only once. Then review a PR:

bash
af call pr-af.review --in '{"pr_url": "https://github.com/owner/repo/pull/123"}'

New to AgentField? Install the control plane first with curl -fsSL https://agentfield.ai/install.sh | bash, or use one of the options below.

To install the Python node deliberately, clone this repository and install the checkout as a local path. Local-path installs do not follow superseded_by:

bash
git clone https://github.com/Agent-Field/pr-af
af install ./pr-af

Deploy with Railway (fastest)

One click deploys PR-AF + the AgentField control plane + PostgreSQL. Set two environment variables in Railway:

  • OPENROUTER_API_KEY — your OpenRouter key (routes to the review models)
  • GH_TOKEN — GitHub personal access token with repo scope, for reading PRs and posting reviews

Once deployed, trigger a review against the control plane (the public endpoint requires the X-API-Key header set to your AGENTFIELD_API_KEY):

bash
curl -X POST https://.up.railway.app/api/v1/execute/async/pr-af.review \
  -H "Content-Type: application/json" \
  -H "X-API-Key: " \
  -d '{"input": {"pr_url": "https://github.com/owner/repo/pull/123"}}'

Run locally (Docker Compose)

bash
git clone https://github.com/Agent-Field/pr-af.git && cd pr-af
cp .env.example .env          # Add OPENROUTER_API_KEY, GH_TOKEN
docker compose up --build

Starts AgentField control plane (http://localhost:8080) + PR-AF agent.

bash
curl -X POST http://localhost:8080/api/v1/execute/async/pr-af.review \
  -H "Content-Type: application/json" \
  -d '{"input": {"pr_url": "https://github.com/owner/repo/pull/123"}}'

Poll for results:

bash
curl http://localhost:8080/api/v1/executions/

Configuration (environment variables)

The key knobs (see .env.example for the full list):

Variable Purpose
OPENROUTER_API_KEY LLM provider key (OpenRouter) — required
GH_TOKEN GitHub token (repo scope) for reading PRs and posting reviews
PR_AF_PROVIDER Harness provider (default aforge; use opencode to roll back)
AGENTFIELD_AFORGE_COMMAND AForge headless command (default exec) — read by the Go node's SDK adapter; the pinned Python SDK always runs exec
PR_AF_AFORGE_BIN Path to an aforge-v2 binary (default aforge)
PR_AF_HARNESS_BIN Provider-agnostic executable override
PR_AF_MODEL Harness model (default deepseek/deepseek-v4-flash-0731)
PR_AF_MAX_COST_USD Per-run cost ceiling in USD (default 2.0)
PR_AF_MAX_DURATION_SECONDS Per-run wall-clock ceiling in seconds (default 3600)
AGENTFIELD_HARNESS_IDLE_SECONDS Harness no-output watchdog window in seconds (default 360) — harness CLIs in JSON mode emit events only at completion boundaries, so long single completions look silent
PR_AF_WORKDIR Where PR checkouts live (default /workspaces); each PR gets its own -pr workspace

Both Docker images ship the released AForge CLI (fetched and checksum-verified at build time from https://agentfield.ai/downloads/aforge) and run exec by default. The Python node resolves the binary from PR_AF_AFORGE_BIN (or PR_AF_HARNESS_BIN); the maintained Go node resolves it from PR_AF_HARNESS_BIN. OpenCode stays installed in both images, so PR_AF_PROVIDER=opencode is a configuration-only rollback — no rebuild.

The image's AForge version is pinned by the AFORGE_VERSION build arg; AFORGE_BASE_URL points the fetch at a different host when needed.

GitHub Actions Integration

The easiest way to use PR-AF is to drop it into your GitHub Actions. It requires zero configuration and runs securely using GitHub's built-in GITHUB_TOKEN.

Add this workflow to your repository at .github/workflows/pr-af-review.yml. It triggers automatically whenever you add the pr-af label to a Pull Request.

…

Note: PR-AF runs a comprehensive parallel pipeline. Reviews typically take 35-50 minutes depending on PR complexity.


From the AgentField AF Ecosystem

PR-AF is one example of a larger AgentField ecosystem for building autonomous, agent-native systems.

  • SWE-AF: autonomous software factory for production ready PR
  • SEC-AF: autonomous security factory for code security review, vulnerability investigation, and evidence-grounded remediation.

From the AgentField Blog

How an AI-Native Engineering Team Does Code Review

When the writer and the reviewer are the same intelligence, the pull request gate stops doing what it was designed to do.

Read the post →


Go implementation

The maintained node lives under go/, and installing the bare repository URL gives you this implementation as pr-af on its default port 8007. The Python implementation remains available through python -m pr_af.app, the root Docker Compose stack, or the local-path install escape hatch above. The Go add-on Compose file explicitly uses pr-af-go only so both implementations can run against one control plane during a changeover. Build, run, and Docker/compose docs live in go/README.md.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Goagentfieldagentic-engineeringagentsai

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类AI 编程
定价开源

> 相关工具

G
GitHub Copilot
GitHub 官方 AI 编程助手,覆盖补全、Chat 与 Agent 模式。
C
Cursor
AI 原生代码编辑器,对话改代码、多文件 Agent 与规则体系是其核心。
S
skills
Skills for Real Engineers. Straight from my .agents directory.