No more
duplicate code.
Coding agents rarely know what a repository already contains, so they write it again. Precedent Review reviews every pull request on GitHub, points to the code that already exists, and suggests a concrete fix.
Free for public repositories. On GitHub, the app is called Precedent Review.
| # | Changed in this pull request | Repeats existing code | Size | Kind |
|---|---|---|---|---|
| 1 | src/invoices.rs:8-45 invoices::invoice_total |
src/orders.rs:22-59 orders::total_with_tax (pub, crate e2e_repo) |
227 tokens · 100% | exact copy |
crate::orders::total_with_tax, or extract a shared helperinvoices::invoice_total repeats orders::total_with_tax (src/orders.rs:22-59, pub, crate e2e_repo).crate::orders::total_with_tax, or extract a shared helper.Three functions that do one job
parse_date turns into parse_timestamp, and then into to_datetime: three functions that do one job, and three places to fix the next bug. Code review catches some of them; the rest stay.
What a pull request gets
One summary comment
Lists every duplicate in the files the pull request touched. It is updated in place on every push instead of piling up new comments.
Comments on the lines
Each duplicate the pull request introduced gets one inline comment that links the existing code and suggests a fix. Posted once, not on every push.
A check that guards the merge
The check fails while the pull request introduces a duplicate. Duplicates already in the touched files are listed separately and never fail it.
Why Precedent Review
Only new duplicates count
Code that was already in the repository is never reported as new. Each copy the pull request introduced is reported once.
Fast on large repositories
It indexes all of django, 19.5 MB of Python, from scratch in 1.2 s. Checking changed code on 18 MB of Rust takes 14 ms at p95.
More than exact copies
Copies with renamed variables, near-miss copies with edited statements, and statement runs pasted into other functions. It recognises them after renaming and editing.
Tells you what to do
Each finding names the existing code's file, lines and symbol, the overlap, and a next step: call it, make it visible and call it, move it into a trait default method, or extract a shared helper.
Less noise
The optional semantic filter drops look-alike boilerplate that doesn't really do the same job. One comment in the code silences an intentional duplicate.
Deterministic, not generative
The same code always gets the same answer. Precedent Review never invents a finding: each one points to specific existing code and its overlap.
Measured, not claimed
We injected clones of every kind into 13 open-source Rust, Python, TypeScript and C# repositories – from serde to django and jellyfin – and the precedent engine had to find them.
of exact copies and copies with renamed identifiers found, in all 13 repositories
of near-miss copies found, per repository
false findings on moved functions, untouched code and look-alike code from other projects
to index all of django from scratch, 19.5 MB of Python
Release build on an Intel i7-10850H laptop. Every number comes from a result file in the precedent repository.
How it works
-
01
Connect
Install Precedent Review on your GitHub repository.
-
02
It learns your code
Precedent Review records what your repository already contains, so existing code is never reported as new.
-
03
Every change is checked
On every push to a pull request, the changes are compared with the code that already exists.
-
04
A fix, not just a warning
Each finding points to the existing code and says how to reuse it. Look-alike boilerplate is filtered out.
Pricing
The free plan for public repositories is available now. The paid plan will be billed through GitHub Marketplace once it is listed there; until then, private repositories are reviewed by individual agreement.
Open source
Public repositories
- ✓ Pull request reviews, fair-use daily limit
- ✓ Every language and clone kind
Private
Private repositories
- ✓ Pull request reviews in private repositories
- ✓ Coming to GitHub Marketplace; until then by agreement
Enterprise
Self-hosting, GitHub Enterprise Server, custom terms
- ✓ Runs in your infrastructure
- ✓ Custom contract and support
Questions
Where does my code go?▾
The precedent engine makes no network calls of its own: it reads the repository it reviews and writes the result to the pull request. Only if you enable the optional semantic filter does it send the code pairs of its top findings to the endpoint you choose, over verified HTTPS. The hosted GitHub App Precedent Review fetches a repository only for the duration of one review, in Google Cloud in the EU (Belgium), never stores the code, and no AI model sees it. The privacy policy has the details.
Will old duplicates fail my pull request?▾
No. Only duplicates the pull request introduced fail the check. Those already in the touched files are listed separately as pre-existing.
How do I keep an intentional duplicate?▾
Add // precedent:ignore (Rust, TypeScript, JavaScript, C#) or # precedent:ignore (Python, PowerShell) on the line above it.
Which languages does it support?▾
Rust, Python, TypeScript including TSX, JavaScript, C# and PowerShell.
Stop writing it twice
Install Precedent Review on your public repositories for free. For private repositories, your team, or running it in your own infrastructure, write to us.