self-hosted · GitLab & GitHub

Code review that starts before the human queue does

Areforge runs on your own infrastructure. On every push it reviews the diff file by file, comments on the exact changed line, scores the risk, and reports the tokens it spent.

Your code and diffs never leave your network — except for the single call to the model you chose yourself.

acme/billing!482
7 files · 4 comments

feat: charge wallet on refund

PR Risk0 / 100
app/Services/OrderService.php
40 $total = 0;
41+ foreach ($order->items as $item) {
42+ $total += $item->product->price * $item->qty;
43+ }
44 return $total;
criticaln+1Line 42

This queries the relation once per item inside the loop. Eager loading before the loop brings the query count down from N+1 to 2.

🔁 Previously reported in MR !214

GitLab and GitHub
First-class on both; self-hosted GitLab is the native path for our target teams
Multiple stacks
We support a range of stacks.
One job per file
Reviewed in parallel; one failing file never blocks the rest

Fast code. Already reviewed.

Coding agents flood pipelines with massive MRs faster than a senior can sit with them. Areforge reviews the diff file by file, comments on the changed line, and scores the risk — before the human queue opens.

Bottleneck

Every MR waits for a human to become available, not for itself to be ready.

Uneven quality

Review quality tracks fatigue, experience and time pressure — not a fixed standard.

Cost

The most expensive resource on the team, senior engineering time, goes into repetitive mechanical work.

Delay

MR lifetime stretches out and releases ship slower.

Get started

One job in CI. Everything after that is automatic.

In the app you register the repository, take the token and the ready snippet, and drop it in the pipeline. Areforge leaves inline comments from the first push.

  1. 01

    CI sends the request

    The pipeline posts the MR identifier and head_sha to POST /api/v1/code-review with the repository bearer token. It gets an immediate 202 and the work happens on the queue.

  2. 02

    Worthless files are dropped

    Lock files, vendor/build/dist/node_modules, migrations, min.js/css, svg and snapshots are filtered out. Diffs below the threshold never reach the model at all.

  3. 03

    Every file, an independent review

    Each file is its own job inside one batch, running in parallel. The model is chosen per file: sensitive paths get opus, tiny diffs get haiku, everything else sonnet.

  4. 04

    Comments on the exact line, plus a risk score

    Model output is constrained to a structured schema. At the end, one note on the MR: review coverage, comment count, token usage, and the PR Risk score.

.gitlab-ci.yml
ai-code-review:  stage: review  image: curlimages/curl:latest  rules:    - if: $CI_PIPELINE_SOURCE == "merge_request_event"  script:    - >      curl -sS -X POST "$AREFORGE_URL/api/v1/code-review"      -H "Authorization: Bearer $AREFORGE_TOKEN"      -H "X-Repository-Id: $CI_PROJECT_PATH"      -H "Content-Type: application/json"      -d '{"merge_request_iid": '"$CI_MERGE_REQUEST_IID"',           "source_branch": "'"$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME"'",           "target_branch": "'"$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"'",           "head_sha": "'"$CI_COMMIT_SHA"'"}'  allow_failure: true

The token and the final snippet are generated in the app when you register a repository, with the URL already filled in. The sample below is the same shape. X-Repository-Id is the repo identifier on the git host itself.

For per-repo settings, put a .areforge.code-review.yaml on the base branch — it is never read from the PR branch, so a PR cannot weaken its own review.

Product

Four layers that work today

This is not the roadmap. Each of these already runs on GitLab and GitHub, on your own infrastructure.

01

A living map of the system, built from the MRs

When a change spans several components, a sequence diagram lands on that MR: which service calls which. The reviewer sees this change’s path in place.

Those diagrams merge over time into one repository flowchart. Edges that keep showing up are the hot paths. Developers use it for review and onboarding; product uses it as the big picture of how the system actually talks — observed from real reviews, on the repository itself.

The map lives in the app, on the repository page. A new repo stays empty until diagrams have been merged.

Sequence diagram for this MR

Mermaid, on the MR itself. Generated only when several components actually interact.

Repository system map

×6×6×3ControllerOrderServiceGatewayMailer

Each MR sequence merges into this graph over time. The count on an edge is how many MRs saw that path.

02

A risk score, before merge

A 0–100 score with reasons, and no extra model call. Critical findings, sensitive files, recurring issues, large diffs, and missing tests all land as an advisory line on the MR summary — not as a merge gate.

Average risk and high-risk MR count also show up in team KPIs.

acme/billing !482

PR Risk

68 / 100

Why this score

  • Critical finding on a payment path
  • Sensitive file touched
  • No test file in the diff

03

Tokens only go to changes that earn them

Sensitive files (payments, auth, security) get the strong model; tiny diffs get the cheap one. Ignore patterns, a diff threshold, a file cap and incremental review keep spend on the work that matters.

Usage is recorded per file and per model on the MR summary and in the app dashboard.

Model selection per file

ReviewModelSelector

  • app/Payments/ChargeWallet.php142 linessensitive path
  • app/Http/Controllers/UserController.php47 linesdefault policy
  • resources/js/Button.tsx12 linestrivial diff
  • opusstrong
  • sonnetdefault
  • haikucheap

inspectingsensitive path142 lines→opus

inspectingdefault policy47 lines→sonnet

inspectingtrivial diff12 lines→haiku

04

Memory: it will not silently repeat the same bug

If it has already reported the same finding on an earlier MR, it attaches a “I said this before” note. It never suppresses — the bug may still be open. When you resolve the thread, acceptance is recorded.

Two levels: the same file, and the same pattern across the repository.

app/Services/OrderService.phpLine 42
criticaln+1

This queries the relation once per item inside the loop. Eager loading before the loop brings the query count down from N+1 to 2.

🔁 Previously reported in MR !214

Features

What else works today

This list describes how the service behaves right now. An IDE extension, a CLI, linters and auto-fix are still on the roadmap.

Dashboard in the app

Review coverage, PR Risk, token cost by model, comment acceptance, and recurring findings — at repository, team, and organization scope. Objectives attach to the same metrics.

Incremental review

A second push on the same MR only sends the new diff since the last full review.

Stack profiles

We support widely used languages, frameworks, and CMSs, with a review profile for each stack.

Project guidance and YAML

Your own rules, path globs, and a .areforge.code-review.yaml — with no ability to override the base security principles.

Review language

You set the comment language at organization or repository scope. English is the default; Persian output works.

Organization, team, repository

Multi-tenant ownership, member invites, and KPIs at repo / team / organization scope.

Data governance & security

Your code never leaves your infrastructure

For banks, government bodies and any team that cannot hand its business logic to a foreign SaaS, this is the core difference — not a side feature.

Runs on your own infrastructure

The service comes up on the infrastructure and database you already run. Diffs and comments are never stored outside your network; the only outbound call is to the model you chose.

Hashed per-repository token

A random 48-character token is shown exactly once at registration, and only its hash is stored. Each token is scoped to exactly one repository.

Encrypted at rest

Each repository git-host access token is stored encrypted, and both it and the token hash are hidden from every JSON response.

Prompt-injection resistant

The agent has no tools and is limited to a single step. Even if a diff or MR description carries a malicious instruction, the model can only return structured JSON.

Shared rate limit

The model call limit is shared across all workers, so one large MR cannot put your model account under pressure.

Auditable trail

Every request, file and comment is recorded in your database — proof that the review happened, not just better code.

Cost control

Token cost stays in your hands, layer by layer

SaaS competitors bill per seat and keep real usage a black box. Here the filters live in your own configuration and every run reports what it spent.

  • Ignore patterns

    lock, generated, vendor, build, dist, node_modules, migrations, min.js/css, svg, snapshots

  • Minimum diff threshold

    Diffs smaller than the threshold never reach the model

  • Max file size

    Large, probably auto-generated files are skipped and flagged for manual review

  • Max files per run

    On large MRs, the biggest diffs take priority

  • Per-file model selection

    Sensitive files get opus, tiny diffs get haiku, everything else sonnet — on the same gateway

  • Incremental review

    A second push only sends the new diff since the last full review

  • Retry without double cost

    A file that already produced a result is not sent to the model again on retry

  • Transparent usage report

    Input and output tokens are recorded per file and per model on the MR summary and in the app dashboard

ROI framework

AI Cost = MR Count × Average Tokens (post-filter) × Token Price

Engineering Saving = Review Hours Saved × Senior Hourly Rate

ROI = Engineering Saving ÷ AI Cost

These numbers get filled in with data from your own project: real provider usage, monthly MR count and your team estimate of hours saved. We do not invent numbers on your behalf.

Who it is for

For teams that cannot send their code out

Data governance and token-cost transparency. Built for teams for whom a foreign SaaS is not actually purchasable or deployable.

Self-hosted GitLab teams

Your repos live on your own GitLab. One job in CI, inline comments on the same merge request. GitHub is a first-class path too.

Banks, fintech, government

Diffs and comments stay inside your network. The only outbound call is to the model you configured.

Agencies with mixed stacks

Laravel, Node.js, Next.js, Vue — each gets its own review profile. You set the output language at organization or repository scope; English is the default, Persian works.

A typical run

From push to a comment on the line

areforge review

POST /api/v1/code-review → 202 Accepted

skip composer.lock

skip database/migrations/2024_11_01_create_orders.php

review app/Services/OrderService.php · sonnet

↳ critical n+1 · line 42

↳ previously reported in MR !214

review app/Payments/ChargeWallet.php · opus

summary 7 files · 4 comments · PR Risk 68

usage recorded per file and per model

The same sample MR from the top of the page — acme/billing !482

FAQ

What people usually ask

Does our code leave our network?

No. The service runs on your own infrastructure and diffs, comments and history stay in your own database. The only outbound call is to a language model, and choosing the gateway and the model is up to you.

If AI writes the code and already knows our conventions, what is this service for?

Part of that objection is fair: things like conventions and file structure are respected the moment the code is written. But the author is not an independent reviewer. First, logic bugs, security issues and violations of project-specific business rules are not visible at writing time. Second, teams are not uniform — some people use Claude Code, some Cursor or Copilot, some write by hand; a tool-independent review at the CI level is the layer that makes them consistent. Third, enterprise and banking customers need proof that a review happened, not just good code.

Does it replace human reviewers?

No, and it is not meant to. The goal is a first-pass review layer before the MR reaches a human, so your senior engineers spend their attention on architecture and business logic rather than repetitive mechanical work.

Does it work with GitHub?

Yes. GitLab and GitHub are both first-class paths; the CI snippet for each is generated when you register the repository. The primary path of the product is still self-hosted GitLab, because that is what most of our target teams run.

Is there Persian output?

Yes. Review language is set at organization or repository scope. English is the default; Persian output works.

How is runaway token cost prevented?

Several filter layers before anything reaches the model, plus per-file model selection: sensitive files get the strong model and tiny diffs get the cheap one. Incremental review and retry without double cost as well. Real usage per run, broken down by model, is reported back to you.

Do you support local payment and official invoices?

The commercial model is built for this market: payment in local currency with a domestic invoice. Self-serve checkout is not wired yet; access and billing are arranged with you directly. That is the gap foreign competitors cannot fill.

How long does setup take?

You register the repository, get a CI token and a ready snippet, and drop it into your pipeline. That path is designed to be self-service and under 15 minutes — once you have access to the service.