# AI Micro Code Reviews That Run on Commit

Right now, GenAI is like a **race car without brakes**. It accelerates fast — you describe something, and large blocks of code appear instantly.

But AI agents silently break things. They remove logic. Relax constraints. Introduce expensive cloud calls. Leak credentials. Change behavior without telling you.

**git-lrc is your braking system.** It hooks into `git commit` and runs an AI review on every diff _before_ it lands.

### Watch: git-lrc Reviewing a Commit

See how git-lrc catches issues before code ships:

- Leaked credentials
- Expensive cloud ops
- Sensitive data in logs
- Silent logic removal
- Changed behavior

## Why is This Free?

git-lrc is source-available and uses Google's Gemini API for AI reviews. Gemini offers a generous free tier — you bring your own API key, so there's no middleman billing. The LiveReview coordination service is **free for unlimited reviews.** No credit card. No trial. No "contact sales."

If AI is your accelerator, git-lrc is your braking system.

## Why git-lrc?

### AI agents silently break things

Code removed. Logic changed. Edge cases gone. You won't notice until production.

### Catch it before it ships

AI-powered inline comments show you _exactly_ what changed and what looks wrong.

### Build a habit, ship better code

Regular review → fewer bugs → more robust code → better results in your team.

## Why git-lrc plugs into git

Teams are heterogeneous: different editors, AI assistants, and hosting platforms. git is the one shared layer every engineer already touches every day.

### 1. Git is the common denominator

You cannot force one editor or one AI tool across teams, but everyone commits code.

### 2. Commit-time is the sweet spot

During coding is noisy, at PR time is late. At commit, context is fresh and fixes are cheap.

### 3. Built on habit, not hype

Adoption is highest when the workflow rides an existing habit instead of asking for a brand-new ritual.

### 4. Early micro reviews improve macro PRs

Catch issues while diffs are small, so PRs stay cleaner and reviews are faster.

### 5. Leader reality check

Standardize behavior at the layer everyone already uses: commit.

### 6. Dev-centered and org-friendly

Visible exactly when needed and invisible when not. It fits real developer flow.

If you want broad adoption, attach the review moment to the one unavoidable moment: git commit.

## Get Started

One command installs the binary and sets up hooks globally.

### 1. Install

Shell (macOS / Linux):

```sh
curl -L https://hexmos.com/ipm-install | bash && ipm i HexmosTech/git-lrc
```

### 2. Setup (~1 minute, one-time)

```sh
git lrc setup
```

Two steps, both open in your browser:

1. **LiveReview API key** — sign in with Hexmos
2. **Free Gemini API key** — grab one from Google AI Studio

Machine-wide. After this, _every git repo_ on your machine triggers review on commit. No per-repo config needed.

## How It Works

### Option A: Review on Commit (automatic)

```sh
git add .
git commit -m "add payment validation"
# review launches automatically
```

### Option B: Review Before Commit (manual)

```sh
git add .
git lrc review # AI review
git lrc review --vouch # vouch
git lrc review --skip # skip
git commit -m "add payment validation"
```

### The Review UI

- 📄 GitHub-style diff
- 💬 Inline AI comments
- 📝 Review summary
- 📁 Staged file list
- 📊 Diff summary
- 📋 Copy issues
- 🔄 Cycle through issues
- 📜 Event log

### After Review

- ✅ Commit
- 🚀 Commit & Push
- ⏭️ Skip

## The Review Cycle

The workflow that actually works:

1. Generate code with your AI agent (Cursor, Windsurf, Copilot, etc.)
2. `git lrc review` — AI reviews your changes and flags issues
3. Fix and repeat — feed issues back to your agent, review again
4. Commit when ready — accept and commit, or vouch to take responsibility

Every review is tracked in your git log with **iteration count** and **coverage**. Weeks later, your team sees exactly which commits were reviewed, vouched, or skipped.

## Review vs Vouch vs Skip
| Criteria | Review | Vouch | Skip |
| --- | --- | --- | --- |
| AI reviews the diff? | ✅ Yes | ❌ No | ❌ No |
| Takes responsibility? | ✅ Yes | ✅ Yes, explicitly | ⚠️ No |
| Tracks iterations? | ✅ Yes | ✅ Records prior coverage | ❌ No |
| Git log message | ran (iter:N, coverage:X%) | vouched (iter:N, coverage:X%) | skipped |
| When to use | Each review cycle | Done iterating, ready to commit | Not reviewing this commit |

## Git Log Tracking

Every commit gets a review status line appended to its git log message. Your team sees _exactly_ which commits were reviewed, vouched, or skipped — right in `git log`.

## Quick Reference
| Command | Description |
| --- | --- |
| lrc or lrc review | Review staged changes |
| lrc review --vouch | Vouch — skip AI, take personal responsibility |
| lrc review --skip | Skip review for this commit |
| lrc review --commit HEAD | Review an already-committed change |
| lrc hooks disable | Disable hooks for current repo |
| lrc hooks enable | Re-enable hooks for current repo |
| lrc hooks status | Show hook status |
| lrc self-update | Update to latest version |
| lrc version | Show version info |

**Tip:** `git lrc <command>` and `lrc <command>` are interchangeable.

## Security

git-lrc covers the security questions enterprise teams ask first: deployment model differences, data confidentiality, AI safeguards, supply-chain visibility, and a clear response policy.

### FAQ

### What data is sent?

Only the **staged diff** is analyzed. No full repository context is uploaded, and diffs are not stored after review.

### Can I disable it for a specific repo?

git lrc hooks disable # disable for current repo
git lrc hooks enable # re-enable later

### How would this be different from existing tools like SonarQube?

git-lrc focuses on a different layer: **Git itself.** Instead of analyzing the whole codebase through rule catalogs, git-lrc reviews the actual diffs at commit time. The goal is to help developers understand what changed, catch issues earlier, and attach review signals directly to the commit.

## Install it before your next commit.

One command. Two browser steps. Then every AI-generated commit gets reviewed automatically. Your future self will thank you.
