All Projects
GIT SENTRY

Git Sentry

An AI git guardian that reviews every commit for free locally, then spends premium API tokens only where the diff actually demands them.

Git Sentry object

The cheapest code review is the one that never reaches a paid API.

The Problem

Sending every diff to a frontier model for review is slow and expensive, and the bill scales linearly with how often you commit. But skipping review is worse: a leaked API key, an unguarded eval(), or a SQL injection sails straight into main. Most teams pick one failure mode or the other — either they pay on every push, or they trust the author and hope.

The Approach

Git Sentry splits review into two cost layers. Layer 1 runs four local Ollama agents in parallel on every git add and git push — zero API cost, instant feedback at the keyboard. Layer 2 lives in GitHub Actions CI and calls Claude Sonnet only on the files Layer 1 flagged as complex (roughly 25% of a typical diff), so the expensive model touches a quarter of the code and skips the boilerplate.

Key Insight

Treating model spend as an architectural decision instead of a config value changed the economics entirely: routing only complex files to the API cut review tokens by about 75% while the security bar went up, not down. The local pass also gives the dual-phase scanner a free first look — instant regex catches the obvious leaks before a single token is spent, and the LLM phase reserves its budget for the OWASP and auth reasoning that regex can't do.

~75%
API Token Cut
4
Local Agents
$0
Local Review Cost
2
Scanner Phases

How it works

The architecture behind the system.

Four Parallel Local Agents

Every git add and git push triggers four Ollama agents (qwen2.5-coder:14b) running in parallel — fully local, $0 in API cost, with feedback fast enough to live in the commit loop.

Two-Layer Cost Architecture

Layer 1 reviews everything for free locally; Layer 2 in GitHub Actions invokes Claude Sonnet only on files marked complex — about 25% of the diff — for a measured ~75% reduction in API tokens.

Dual-Phase Security Scanner

Phase 1 is instant regex for API keys, eval(), and SQL/command injection. Phase 2 is an LLM deep pass covering OWASP categories and authentication logic that pattern matching can't reason about.

Deduction-Based Scoring

Each finding subtracts from the score, producing a single legible health number per change instead of an unranked wall of warnings to triage by hand.

Zero-Tolerance Push Block

Any critical-severity finding blocks the push outright. The dangerous classes — leaked secrets, injection, broken auth — never reach the remote, no override by default.

Live WebSocket Dashboard

Review results stream from SQLite over a WebSocket into a Next.js dashboard, so findings, scores, and blocked pushes surface in real time as the hooks and CI run.

Built with

TypeScriptNext.js 15Ollamaqwen2.5-coder:14bClaude Sonnet APIGitHub ActionsSQLiteWebSocket

See the code

Full source code available. See exactly how it's built.

View on GitHub