Precedent
Labs s.r.o.
← Back to home
Precedent Review · duplicate-code guardrail

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.

P precedent-review bot commented
🔁 precedent: duplicate-code check
⚠️ 1 duplicate introduced by this pull request
#Changed in this pull requestRepeats existing codeSizeKind
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
How to fix
1. call crate::orders::total_with_tax, or extract a shared helper
src/invoices.rs · line 8
🔁 Duplicate code: exact copy (227 tokens, 100% overlap)
invoices::invoice_total repeats orders::total_with_tax (src/orders.rs:22-59, pub, crate e2e_repo).
Suggestion: call crate::orders::total_with_tax, or extract a shared helper.
A pull request review: the summary comment and an inline comment on a duplicate. The finding shown is a real one.

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.

100%

of exact copies and copies with renamed identifiers found, in all 13 repositories

85.7–100%

of near-miss copies found, per repository

0

false findings on moved functions, untouched code and look-alike code from other projects

1.2 s

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.

Languages: Rust Python TypeScript JavaScript C# PowerShell

How it works

  1. 01

    Connect

    Install Precedent Review on your GitHub repository.

  2. 02

    It learns your code

    Precedent Review records what your repository already contains, so existing code is never reported as new.

  3. 03

    Every change is checked

    On every push to a pull request, the changes are compared with the code that already exists.

  4. 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

Free
  • ✓ Pull request reviews, fair-use daily limit
  • ✓ Every language and clone kind
Install

Private

Private repositories

$8 per seat / month
  • ✓ Pull request reviews in private repositories
  • ✓ Coming to GitHub Marketplace; until then by agreement
Contact us

Enterprise

Self-hosting, GitHub Enterprise Server, custom terms

Custom
  • ✓ Runs in your infrastructure
  • ✓ Custom contract and support
Contact us

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.