Skip to main content
Glama
README.md
<div align="center">

<img src="assets/logo.svg" width="88" height="88" alt="Agy Review Logo" />

# Agy Review

**PR-grade inline diff review and line-level annotation studio for Google Antigravity 2.0 — 100% native MCP App.**

Zero ASAR patches · Zero CDP injection · Zero runtime dependencies · Compatible with SEP-1865 MCP Apps hosts

[![GitHub Stars](https://img.shields.io/github/stars/tone-leh/agy-review?style=flat-square&color=FACC15&labelColor=0F172A)](https://github.com/tone-leh/agy-review/stargazers)
[![CI](https://img.shields.io/github/actions/workflow/status/tone-leh/agy-review/ci.yml?branch=main&style=flat-square&label=CI&labelColor=0F172A)](https://github.com/tone-leh/agy-review/actions)
[![Node.js >= 20](https://img.shields.io/badge/node-%3E%3D20-22C55E?style=flat-square&logo=node.js&logoColor=white&labelColor=0F172A)](#quick-start-30-seconds)
[![Runtime Deps: 0](https://img.shields.io/badge/runtime%20deps-0-38BDF8?style=flat-square&labelColor=0F172A)](#architecture)
[![MCP Apps SEP-1865](https://img.shields.io/badge/MCP%20Apps-SEP--1865-818CF8?style=flat-square&labelColor=0F172A)](#cross-host-mcp-apps-compatibility)
[![Platform](https://img.shields.io/badge/platform-macOS%20%7C%20Linux%20%7C%20Windows-64748B?style=flat-square&labelColor=0F172A)](#quick-start-30-seconds)
[![License: MIT](https://img.shields.io/badge/license-MIT-10B981?style=flat-square&labelColor=0F172A)](LICENSE)

**English** · [简体中文](README.zh-CN.md) · [Quick Start](#quick-start-30-seconds) · [Workflow](#core-workflow) · [Architecture](#architecture) · [Offline Workbench](#try-without-installing-offline-workbench--cli) · [Related Projects](#ecosystem--sibling-plugins)

<br />

<picture>
  <source media="(prefers-color-scheme: dark)" srcset="assets/hero-dark.svg" />
  <source media="(prefers-color-scheme: light)" srcset="assets/hero-light.svg" />
  <img src="assets/hero-dark.svg" width="100%" alt="Agy Review PR-grade inline diff and annotation studio in dark and light modes" />
</picture>

<sub>Follows your GitHub and Antigravity light/dark theme automatically. Test locally with <code>npm run workbench</code> using built-in demo data — your daily Antigravity setup stays untouched.</sub>

</div>

> **Non-Affiliation Notice**  
> **Agy Review is an independent MIT open-source community plugin unaffiliated with Google LLC.**  
> It relies exclusively on documented Antigravity 2.0 Plugin, Lifecycle Hooks, and MCP Apps (`SEP-1865`) interfaces — zero `app.asar` patching and zero Electron/CDP injection.

---

## Why Agy Review?

Reviewing multi-file AI edits inside chat threads introduces three recurring friction points:

1. **Scattered Diffs** — Reading raw `git diff` output in terminal blocks hides file boundaries, risk signals, and review progress.
2. **Imprecise Chat Corrections** — Typing *"fix line 35 of the middleware file and also check that catch block lower down"* forces the model to guess exact spans across files.
3. **Broken Feedback Loops** — Switching to an external Git GUI breaks conversation flow and requires manual copy-pasting back into Antigravity.

**Agy Review** brings GitHub PR-style inline diff inspection directly into Antigravity's native side pane (`aux_pane`) and full-page sidebar (`global`), turning line-level review notes into exact `file:Lstart-Lend` structured prompts sent straight back to your agent.

| Capability | Terminal `git diff` | External Git GUI | **Agy Review (Native MCP App)** |
| :--- | :---: | :---: | :---: |
| Unified & Split side-by-side diff inside Antigravity | No | External window | **Native `aux_pane` + `global` iframe** |
| Click & `Shift+Click` line-range inline annotations | No | Limited | **Full CRUD persisted in `${PLUGIN_DATA}`** |
| Risk tagging (`security-sensitive`, `large`, `config`, `test`) | Manual | Manual | **Automatic per-file risk badges** |
| One-click send structured `file:Lstart-Lend` fixes to Agent | Manual copy | Manual copy | **`sendMessage` + `updateModelContext` + Copy** |
| Survives every Antigravity desktop update | Yes | Yes | **Always (100% documented official APIs)** |

---

## Core Workflow

1. **Open Agy Review** — Launch from Antigravity's Side Pane `+` menu, the Left Sidebar, or ask `/agy-review` in chat. Switch seamlessly between `Working Tree`, `Staged`, `Unstaged`, `Last Commit (HEAD~1)`, or any validated `Commit Range`.
2. **Inspect & Track Progress** — Browse the collapsible file tree (auto-adapts to a compact selector strip in narrow side panes), check off reviewed files, spot `SEC` / `LARGE` / `CFG` / `TEST` risk badges, or jump directly to source files via `Open File ↗` (`toggle-aux-pane`).
3. **Annotate Exact Line Spans** — Click any line or `Shift+Click` a span to highlight it and open an inline composer right beneath the code. Tag notes as `Security`, `Bug`, `Refactor`, `Question`, or `Nit`, and save with `⌘/Ctrl + Enter`.
4. **Ship Structured Feedback to Your Agent** — Preview the prioritized Markdown prompt in the sticky bottom Review Cart, then click:
   - **Send to Agent** (`ui/message`) to trigger targeted batch fixes immediately,
   - **Attach to Next Turn** (`ui/update-model-context`) to pin annotations as a context pill on your next message, or
   - **Copy Prompt** as an always-available universal fallback.

Example structured prompt generated by Agy Review:

```markdown
# Code Review Feedback — acme-auth-service

- **Branch**: `feat/token-refresh-guard` | **Scope**: `working`
- **Items**: 2 annotations across 1 file ([SECURITY] 1 · [BUG] 1)

## `src/auth/token-middleware.ts`

1. **[SECURITY]** `src/auth/token-middleware.ts:L35-L37`
   Remove query string `token` fallback: accept tokens strictly via the Authorization header.
   ```diff
   35 | +  const queryToken = new URL(req.url ?? '/', 'http://localhost').searchParams.get('token');
   36 | +  const rawToken = header.startsWith('Bearer ') ? header.slice(7).trim() : queryToken;
   37 | +  if (!rawToken) {
   ```
```

---

## Quick Start (30 Seconds)

### Option 1: Install via Antigravity CLI (Recommended)

```bash
agy plugin install https://github.com/tone-leh/agy-review
```

Pre-bundled zero-dependency `dist/server.cjs`, `dist/hook.cjs`, `dist/cli.cjs`, and single-file `dist/ui/app.html` (`~508 KB`) ship directly in the repository — Node.js ≥ 20 is the only runtime requirement.

### Option 2: Direct Clone into Antigravity Plugins Directory

```bash
# macOS / Linux
git clone https://github.com/tone-leh/agy-review.git ~/.gemini/config/plugins/agy-review

# Windows (PowerShell)
git clone https://github.com/tone-leh/agy-review.git "$env:USERPROFILE\.gemini\config\plugins\agy-review"
```

### Option 3: Preview or Install via Bundled CLI

```bash
# Preview install plan without modifying any files
./bin/agy-review-cli install --dry-run

# Install or cleanly uninstall
./bin/agy-review-cli install
./bin/agy-review-cli uninstall
```

---

## Cross-Host MCP Apps Compatibility

Agy Review implements the open **SEP-1865 MCP Apps** specification via `@modelcontextprotocol/ext-apps`:

- **Google Antigravity 2.0**: Unlocks full native experience — `aux_pane` side pane, `global` sidebar entrypoints, live `styles.variables` theming, `Open File ↗` (`com.google.antigravity/toggle-aux-pane`), `Send to Agent`, and `Attach to Next Turn`.
- **Other MCP Apps Hosts** (Claude Desktop, Claude Code, DSH `dsh-mcp-apps-host`, custom SEP-1865 hosts): Point any MCP host at `node dist/server.cjs --data-dir=<path>`. UI buttons automatically adapt to `app.getHostCapabilities()`, hiding unsupported host RPCs while keeping full diff inspection, inline annotations, and **Copy Prompt** active everywhere.

---

## Architecture

<p align="center">
  <img src="assets/architecture.svg" width="100%" alt="Agy Review zero-patch native MCP App architecture" />
</p>

### MCP Tools & Visibility Isolation

| Tool | Visibility | Surface | Purpose |
| :--- | :--- | :--- | :--- |
| `open_review` | Model + App | `aux_pane` + `global` | Launches the review studio (supports `{}` empty launch; lightweight summary payload keeps trajectories far below 1 MiB) |
| `get_review_summary` | Model + App | Text + JSON | Compact token-efficient diff summary with risk flags & open annotation counts |
| `app_get_diff` | **App-only** | UI | Full parsed diff hunks, untracked files, staleness checks, and viewed states |
| `app_add_annotation` / `app_update_annotation` / `app_toggle_resolve` / `app_delete_annotation` / `app_clear_resolved` | **App-only** | UI | Atomic CRUD persisted per repository and scope in `${PLUGIN_DATA}` |
| `app_mark_file_viewed` | **App-only** | UI | Persists per-file reviewed checkmarks |
| `app_build_review_prompt` | **App-only** | UI | Compiles prioritized `file:Lstart-Lend` Markdown feedback for the coding agent |

### Security & Safety Guardrails

- **Zero Shell Interpolation**: Every Git command runs via `execFileSync('git', args)` with `-c core.quotepath=false` and `--` path separators. `commitRange` inputs are strictly validated to block Git option injection.
- **Strict Default CSP Compliance**: Single-file HTML bundle with zero external scripts, zero CDN fonts, and zero external requests.
- **Atomic Persistence & Path Safety**: Annotations write via temp-file + `renameSync` inside `${PLUGIN_DATA}/sessions/` keyed by SHA-256 repository hashes, blocking path traversal and recovering cleanly from corrupted JSON.
- **Fail-Open Hooks**: `PostToolUse` and `Stop` hooks finish in milliseconds, record lightweight edit timestamps to `${PLUGIN_DATA}/review-signal.json`, and fail open on any I/O error.

---

## Try Without Installing (Offline Workbench & CLI)

Explore Agy Review inside a self-contained sandbox without modifying your daily Antigravity installation:

```bash
git clone https://github.com/tone-leh/agy-review.git
cd agy-review
npm install

# 1. Start the offline host simulator (spawns real dist/server.cjs over stdio)
npm run workbench
# Open http://127.0.0.1:4391 — switch Aux Pane (500px) / Global (1200px), Dark / Light theme,
# and inspect live simulated host messages (sendMessage, updateModelContext, toggle-aux-pane)

# 2. Or inspect a real local repository in the sandbox
node workbench/server.mjs --repo /path/to/your/repo

# 3. Inspect diffs or check bundle health from the terminal
node dist/cli.cjs status --demo
node dist/cli.cjs summary --demo
node dist/cli.cjs doctor
```

---

## Part of the Antigravity 2.0 Native Plugin Suite

1. **[agy-review](https://github.com/tone-leh/agy-review)** — PR-Grade Inline Diff Reviewer & Line-Range Annotation Studio *(this repo)*
2. **[agy-xray](https://github.com/tone-leh/agy-xray)** — Context Composition X-Ray, Token Vampire Detector & Cross-Session BM25 Time Machine
3. **[agy-guard](https://github.com/tone-leh/agy-guard)** — Local Security Guardrail, Secret-Leak Shield & Zero-Git Pre-Edit Snapshot Time Machine
4. **[agy-canvas](https://github.com/tone-leh/agy-canvas)** — Visual Artifact Reviewer with Figma-Style Coordinate Pins
5. **[agy-mem](https://github.com/tone-leh/agy-mem)** — Glass-Box Code-Anchored Long-Term Memory & Knowledge Graph with SHA-256 Drift Guard
6. **[agy-remote](https://github.com/tone-leh/agy-remote)** — Zero-Cloud Mobile PWA & 6-Channel IM Remote Approval Bridge

Also by [tone-leh](https://github.com/tone-leh): [agy-session-guard](https://github.com/tone-leh/agy-session-guard) · [hermes-context-bar](https://github.com/tone-leh/hermes-context-bar) · [stickypatch](https://github.com/tone-leh/stickypatch)

---

## Development & Verification

```bash
npm ci
npm run typecheck
npm run build
npm test
```

## License

MIT © [tone-leh](https://github.com/tone-leh)