Dev.to AI 🤖 Ai 👁 0 📖 9 min read

Vigil: an AI code reviewer that proves every finding, never merges, and stops when you say so

TL;DR. Vigil is an autonomous GitHub pull-request reviewer, my entry for AgentWare 2026 (Developer Workflow track). It does five things: watches a repository and reviews every new push on its own; publishes only findin

Vigil: an AI code reviewer that proves every finding, never merges, and stops when you say so

TL;DR. Vigil is an autonomous GitHub pull-request reviewer, my entry for AgentWare 2026 (Developer Workflow track). It does five things:

  • watches a repository and reviews every new push on its own;
  • publishes only findings it can prove against the diff;
  • cannot merge, approve or push;
  • stops on command, and takes back the review it had staged;
  • leaves a hash-chained, Ed25519-sealed trace that anyone can verify.

One command checks all of it, with no API key, in about 50 seconds:

git clone https://github.com/pal-123456789/vigil && cd vigil
uv sync --frozen && make judge      # 19/19 checks, raw output written to evidence/

The problem: easy to start, hard to trust

Wiring a language model to a pull request takes an afternoon. Trusting the result is the hard part, for three reasons:

  1. Invented findings. The model says "SQL injection on line 40", and nobody can tell whether line 40 even exists in the diff.
  2. Write access is a loaded gun. A bot token that can comment usually can approve, merge or push too. One prompt injection hidden in a PR description, and the agent acts on it.
  3. No receipt. When something goes wrong, there is no record of what the agent saw, decided and did.

So I designed Vigil around a single question: could you let this run unattended on your repository? Every feature below is an answer to part of that question. Each answer is enforced by code, not by asking the model to behave.

The shape of a run

The nine-phase pipeline

A run is a linear state machine with exits: INIT → PLAN → GATHER → ANALYZE → VERIFY → ACT → SUMMARIZE → DONE.

  • Any phase may leave early, either to ESCALATE (a human decides) or to ABORTED.
  • No phase is ever entered twice. There are no loops for a confused model to spin in.
  • Every phase writes a checkpoint, so a crashed run can resume from the last one: same trace, restored budget, and no write repeated.

The final status is derived, not asserted. A killed run is aborted, never done. A run that lost its model says degraded{capability:"llm"} rather than pretending everything was fine.

Usefulness: analyzers first, the model second, proof always

Eight deterministic analyzer rules run first and are never skipped:

  • SQL built from strings;
  • eval;
  • shell=True;
  • pickle on untrusted input;
  • TLS verification switched off;
  • swallowed exceptions;
  • committed secrets;
  • changes to protected paths.

They need no key and no network, so a run without a model still produces a real review. That is the difference between degraded and useless.

The model is asked for findings in a strict schema. Each finding must then pass the grounding gate before anyone sees it:

  • the file must be in the diff;
  • the line must exist on the side the model claimed;
  • the quoted evidence must actually appear on that line.

An invented finding is dropped. make judge demonstrates both outcomes: a real quote is kept, a fabricated one is rejected.

If a hardened sandbox is available, VERIFY runs the PR's tests in it: no network, read-only root, non-root user, tree mounted read-only. If no sandbox is available, the review says the tests were not run. Silence would read as "tests passed".

The output is exactly one COMMENT review, with inline comments capped per file and a section saying what was not checked.

Guardrails: one door, in a fixed order

The dispatch order

Every tool call, without exception, goes through one dispatcher. The order of its gates is the safety property:

  1. The budget is charged at proposal. A runaway loop is refused, not discovered on the invoice.
  2. The intent is written to the trace before anything can fail. No action goes untraced, even if the process crashes.
  3. The arguments are validated strictly (extra="forbid").
  4. The policy decides. Sixteen rules, first match wins, default DENY.
  5. The idempotency ledger runs. A write already done is skipped, and a write in doubt is reconciled with the forge, never blindly retried.
  6. The kill switch is checked last, with no await between that check and the handler.
$ uv run vigil policy show
policy pol-0.1.0: 16 rules, first match wins, default DENY
    1  R-MERGE            DENY
    2  R-FORBIDDEN        DENY
    3  R-DISCARD          ALLOW
    ...
    7  R-LLM              DENY
    8  R-PLAN             DENY
  9.5  R-REVIEW-EVENT     DENY
   10  R-REVIEW           ALLOW
   ...

A few rules worth calling out:

  • R-LLM denies any remote write the model proposes. Only code may write.
  • R-PLAN requires every call to name a plan step that declared that tool, so injected text can't add a step.
  • R-REVIEW-EVENT means a review is COMMENT or nothing. APPROVE is denied by policy, refused again by the handler, and impossible in the GitHub client.

If a run collects too many denials, it fires its own kill switch.

The kill switch, and what it undoes

Kill and withdraw

Four channels feed one cancel token:

  • vigil kill;
  • the dashboard's KILL buttons;
  • a ~/.vigil/STOP latch;
  • a per-run kill file polled every 200 ms.

Stopping is the easy half. The review is staged (a pending review nobody else can see) and only submitted at the end. A kill in between triggers compensation: the pending review is withdrawn through a discard_review tool, which is itself checked by the policy engine (only this run's own review, only from code).

The hard cases are handled explicitly:

  • The kill lands while the create request is in flight. The review id is unknown, so the abort path searches for pending reviews carrying the run's hidden marker.
  • The forge is unreachable. The run records review_left_pending or review_outcome_unknown and never reports success.

The audit trail: a receipt anyone can check

The hash-chained trace

Every event goes through the same steps:

  1. secrets are redacted first, so the trace can be public;
  2. the event is canonicalised (vigil-canon/2: sorted keys, fixed float precision, NaN refused);
  3. it is hashed together with the previous event's hash.

The run ends in a seal holding the head hash, the event count and an Ed25519 signature. With an operator key, the public half is declared inside the chain, so verification proves who wrote it, not just that nobody changed it.

$ uv run vigil audit verify tampered.jsonl
BROKEN  tampered.jsonl
first bad seq 11
reason        line 11: hash mismatch (content was altered)

In offline and replay modes the clock is fixed and timing fields are zeroed, so the same input produces byte-identical traces. Replay is a record of the run, not a second opinion.

Mission Control (vigil monitor) streams phases, tool calls, policy decisions and cost live over SSE. It has per-run KILL buttons and a one-click chain verification. It binds to loopback only, and its kill routes refuse cross-origin requests.

Reliability: assert recovery, not survival

  • Retries: exponential backoff with deterministic jitter, so replays stay reproducible, and Retry-After is respected as a floor.
  • Circuit breaker: when the provider is down, calls fail fast and the run degrades to the analyzers.
  • Durable outbox: a review whose POST failed is kept, fsynced, and retried with the same idempotency key, so it can never be posted twice.
  • Crash resume: vigil resume --stale, with leases and heartbeats.

The chaos tests don't assert "it didn't crash". They assert the findings are still there, the review was still posted, the degradation is recorded, and nothing was pushed. You can rehearse an outage with one environment variable:

$ VIGIL_CHAOS=llm:permanent@0 uv run vigil run --repo fake:fx03 --pr 3 --mode replay
review      rev_1 (SUBMITTED)
status      done
reasons     chaos_active, llm, verify

Measuring it honestly

Scoreboard Result
vigil score --mode offline (analyzers only) recall 100% (10/10), precision 100% (10/10)
vigil score --mode replay (+ recorded model answers) recall 100% (10/10), precision 91.7% (11/12)
make judge from a fresh clone 19/19 checks, no API key, no Docker
Ablation: input screening switched off organizer traps caught drops from 19/20 to 0/20

Three caveats, stated up front:

  • The corpus is small. It is fourteen fixtures: ten labelled defects and four clean controls where any finding counts as a false positive. That is a demonstration, not a benchmark, so every rate is printed with a Wilson interval: 10/10 reads as 100% (95% CI 72%-100%).
  • The replay "miss" is real. The model found a genuine issue the labels don't name. I count it against precision anyway, because a corpus that scored it as correct would be marking its own homework.
  • The numbers are reproducible. Every one comes from a command you can run, and the three scoreboards are never mixed.

What went wrong (the best part)

The repo keeps a NEARMISS.md log: every defect found while building, with the evidence and the test that now holds it. Some favourites:

  • The verdict tool lied. An early make judge grepped pytest's output for "passed". It matched 2 failed, 716 passed and reported PASS. It now uses pytest's exit code.
  • The dashboard had never worked in a browser. Every HTTP route was tested and green. One JavaScript syntax error killed the whole page, so the only part a human actually sees was dead. Now a test runs the page's script through node --check.
  • 51 of 82 settings did nothing. That included the per-run budget cap, which read a field that didn't exist. They were either wired up or deleted, and a test now fails if any setting goes unread.
  • A setting was "read" because its name appeared in a docstring. VIGIL_CHAOS passed that same coverage test without doing anything. It was found while writing the runbook, by running the sentence it documented.
  • Resume existed as a design, not a command. It had an event kind, a lease table and tamper-checked checkpoints, but nothing you could type. A design is finished when someone can type the command.

The common thread: a check that can't fail is worse than no check. Every guard in the project was proven to fail against a planted defect before it was trusted. That includes the docs checker, which resolves every link and anchor and fails if a setting is undocumented, and the site checker, which forbids sentences that stopped being true.

Honest limits

  • The judged path runs on bundled fixtures, so it needs no token and no network. The real GitHub client was tested against an in-memory GitHub using GitHub's REST shapes, and run against a real public PR (psf/requests#7502) in shadow mode, which composes the exact review and writes nothing.
  • Model findings need a key. Without one, you get the analyzers plus recorded model answers in replay mode.
  • No autofix, no push, no labels, no approve. Deliberately: there is no code path for any of them.
  • A forge that is unreachable during a kill can leave a pending review. That review is visible to nobody but the bot, and the outcome is recorded rather than hidden.

How it was built

Vigil was built in the hackathon window with AI coding agents working under a written rulebook (CLAUDE.md / AGENTS.md in the repo). The rules included:

  • red/green proof for every fix (the new test must fail on the old code);
  • scoreboards that must not move unless the change says why;
  • no secrets in git, checked by gitleaks on every push;
  • every number in the docs generated from, or checked against, the code.

The agents wrote a lot of the code. The rules, the checks and the refusal to trust an unproven claim are what made the result something I'm willing to put my name on.

Try it

git clone https://github.com/pal-123456789/vigil && cd vigil
uv sync --frozen
uv run vigil run --repo fake:fx03 --pr 3 --mode offline --trace-dir traces
uv run vigil audit verify traces/run.jsonl
make judge

GitHub logo pal-123456789 / vigil

Autonomous GitHub PR reviewer that reviews, proves, and never merges

If you break it, I'd genuinely like to hear how. The project is built on the assumption that a claim is only as good as the check behind it.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.