Skip to content
kadireren7Public

Repository files navigation

PatchFrog

PatchFrog is a source-available AI code review engine for GitHub — static analysis, an AI reviewer, and a deterministic context engine, published as real GitHub PR reviews. Self-host it with your own AI provider credentials, or use PatchFrog Cloud (planned / under development).

CI status Python 3.12+ License: Elastic License 2.0 (source available)

What it does

PatchFrog installs as a GitHub App and reviews pull requests. It combines:

  • Static Analysis Engine — ruff, semgrep, cppcheck, and clang-tidy adapters over Python, C, and C++, with toolchain-aware result identity.
  • Context Engine — deterministic, non-LLM selection of the surrounding code a finding needs (symbol graph, cross-file extern resolution), so the reviewer sees exactly the relevant context and nothing more.
  • AI Reviewer — two cooperating specialist agents (Correctness, Security — see docs/agent-orchestration.md) reviewing the same shared, deterministic evidence, plus an independent critic; validates and explains candidate findings (identification, root cause, impact, fix) with calibrated confidence, never raw scores, with cross-agent duplicate/contradiction handling before anything reaches a PR.
  • Incremental Review + Review Memory — re-reviews only what changed; unrelated files, unchanged symbols, and already-carried findings are never re-sent to the provider. Renames, moves, and ambiguous matches are handled explicitly, never guessed.
  • Publishing — findings are posted as a real GitHub PR review: one summary comment plus inline comments on the diff, safe-by-default (dry-run unless explicitly enabled), idempotent against retries.
  • Feedback Loop — polls reactions, replies, /patchfrog commands, and thread state to measure usefulness and correctness signals over time, without ever webhook-driving off endpoints the App isn't granted.
  • Quality Evaluation Harness — a committed benchmark corpus with a golden baseline (precision/recall, clean-case pass rate, incremental-safety, critic on/off, context-ablation) gates every change before merge.

A published review looks like:

🐸 PatchFrog review

🐸 HIGH · security — Password logged in plaintext

the raw password is interpolated directly into a log line...

Requirements

  • Python 3.12+
  • PostgreSQL, Redis
  • A GitHub App installation (webhook + REST access to the target repository)

Quickstart

New to PatchFrog? docs/quickstart.md is the one canonical path from a fresh clone to a real GitHub App review on a real pull request -- GitHub App creation, webhook setup, provider configuration, and the patchfrog ops doctor/patchfrog ops preflight diagnostics that tell you what's still missing before you open a PR to find out. See docs/external-beta.md first for exactly what you're setting up (self-hosted only -- PatchFrog Cloud is planned, not available today) and its current limitations.

Local development

docker compose up -d postgres redis   # or point at your own instances
pip install -e .
alembic upgrade head

Run the CLI directly against a local checkout:

python -m patchfrog.cli index /path/to/repo
python -m patchfrog.cli analyze /path/to/repo
python -m patchfrog.cli review /path/to/repo --base main
Command Purpose
index Index a local repository checkout
analyze Run static analysis (requires index first)
context Build a deterministic context bundle for a finding or file/line
review Run the AI reviewer against the diff since --base
review-history Inspect incremental review and finding-memory history
publish Plan (default) or publish a completed review run as a GitHub review
feedback Sync/inspect/export reaction and command feedback signals
ops Health/doctor checks, per-repo preflight, recovery, usage, installation management
eval Run the quality evaluation harness against the benchmark corpus

Full command help: python -m patchfrog.cli --help.

Testing

ruff check .
mypy . --strict
pytest

The default suite is deterministic and never requires provider credentials or makes paid provider calls. Real-Postgres concurrency/schema tests skip locally when the documented test database is unavailable; CI requires that database and fails if it cannot be used. Host-isolation and distributed-verifier cases are reported as optional skips when their explicit bwrap/prlimit/Redis prerequisites are absent. See docs/ci-health.md for the suite contracts and reproducible commands.

Architecture and brand

See docs/brand.md for identity/tone guidelines and asset usage, docs/product-boundary.md for the self-hosted vs. PatchFrog Cloud architecture, and the docs/ directory for phase-by-phase design notes.

License

PatchFrog is source-available under the Elastic License 2.0 (ELv2) -- you can read the code and self-host it under the license's terms. See docs/licensing.md for what ELv2 means in practice, and TRADEMARK.md for name/logo/bot-identity usage. PatchFrog Cloud is the hosted product for teams who'd rather not run their own infrastructure.

Releases

Packages

Contributors

Languages