lrv is a local review UI for unified diffs. It reads a diff from stdin,
--cmd, or --file, opens a browser UI backed by Monaco or the
diffs library, and prints submitted comments to stdout
as JSON or text. It can also show comments from a phabricator/github revision,
or review comments generated by another tool.
Its purpose is to easily show the diff created by an AI agent to a human, that can comment on it. The comments are fed back to the agent.
Install:
cargo binstall lrv
# or
cargo install lrvlrv supports three review workflows:
- Review local code changes.
- Review existing Phabricator comments inline.
- Run a local LLM self-review first, then show those generated comments to the author.
Local changes:
git diff | lrv
git diff --staged | lrv
git show HEAD | lrv
lrv --cmd "jj diff --git"
lrv --file changes.patchPhabricator review comments:
PHABRICATOR_API_KEY=... git show HEAD | lrv --phab-revision D123456Local LLM self-review:
# The driving agent reviews the diff first and writes review-notes.json.
git diff > /tmp/lrv.diff
lrv --file /tmp/lrv.diff --review-notes-file review-notes.jsonTo review a commit series (all commits in a branch at once):
lrv --series "trunk()..@" # jj revset
lrv --series "main..HEAD" # git range
lrv --series "HEAD~5..HEAD" # last 5 commitsThe UI shows a commit strip for navigating between commits. Comments track which commit they belong to and are grouped per commit in the output.
Useful flags:
--series <RANGE> Review a jj revset or git range as a commit series
--no-open Don't auto-open a browser
--format text Print comments as text instead of JSON
--title "..." Show a custom title in the header
--review-notes-file notes.json
Render pre-existing review notes inline with the diff;
can be repeated
--phab-revision D123456
Render Phabricator review comments inline with the diff
--config-dir Print the config directory path and exit
--list-reviews List review sessions stored in the local comment database
--recover [<ID>] Print a stored session's comments (default: the most recent)
--bind <ADDR> Bind a specific address (default: 127.0.0.1)
--public Bind on all interfaces
--tailscale Also bind detected Tailscale IPv4 addresses
Network exposure:
- By default,
lrvbinds to127.0.0.1, so only your machine can reach it. - In practice,
lrv --tailscaleusually listens on both127.0.0.1:<port>and your local Tailscale100.x.y.z:<port>. lrv --public --tailscaleusually listens on0.0.0.0:<port>plus any detected Tailscale100.x.y.z:<port>.--public,--bind 0.0.0.0, and--tailscaleexpose the review UI and diff contents over plain HTTP with no auth.- Only use those flags on trusted private networks or Tailscale peers you trust.
Notes:
- Finish prints comments to stdout and ends lrv. When an agent runs
lrv, that stdout is how the comments reach it, so the agent must not pipe, redirect, or backgroundlrv's output. - Every comment is also recorded in a SQLite database as it is made, so a
review survives losing the browser tab, the
lrvprocess, or the terminal output. Uselrv --list-reviewsandlrv --recover [<ID>]to get it back. The database lives next to the config (comments.dbin the platform data directory);LRV_COMMENT_DBoverrides its path. - Review notes are display-only annotations. They reserve space below the
target line in the diff and are not included in submitted review output.
--review-notes-fileaccepts a JSON array of objects withfile,line,side, andbody; optional fields includeauthor,date,source_url, andcommit_idx. - For a local LLM pre-review, the agent should review the diff before starting
lrv, write its findings as review notes JSON, and pass that file with--review-notes-file. The author can then Address, Reply, or Ignore those local reviewer comments in the UI before finishing. - Edit accepts an agent note with replacement text for Finish, Publish and recovery; Undo discards the edit and restores the original.
- Phabricator notes use
PHABRICATOR_API_KEYorPHABRICATOR_TOKEN, falling back to the token in~/.arcrc(written bymoz-phab install-certificate); setPHABRICATOR_BASE_URLor pass--phab-base-urlfor non-Mozilla instances. lrv --versionprints the current version and can warn if a newer release exists.
Add notes to a review that is already open by running this from the repository:
lrv --add-notes review-notes.json
# Or: cat review-notes.json | lrv --add-notes -The notes appear without a reload. Repeating the command skips duplicates
and reports {"added":0,"skipped":N}.
Review notes JSON shape:
[
{
"file": "src/file.rs",
"line": 42,
"side": "new",
"body": "Comment text shown inline.",
"author": "Local LLM review"
}
]Attach an agent with Connect Agent, or start lrv yourself
and ask your agent to listen with lrv --listen from the same repository.
The header shows the agent's status while its poll is open and for up to
five minutes afterwards by default (LRV_AGENT_LEASE_SECS, default 300
seconds).
The Discuss button or Mod+Alt+Enter in either comment form sends the text
straight to the agent. Its reply appears inline under the discussion; Reply
continues the thread. Discussions are never drafted, submitted or published,
and disappear when lrv exits. They are disabled in public mode (--public
or --bind 0.0.0.0, HTTP 403), and allowed with --tailscale alone. The
commit-message view doesn't offer Discuss yet.
Convert opens a review comment draft at the thread's location. Type a comment,
or use Summarize while an agent is listening to fill the draft, then edit it.
Save removes the thread and adds an ordinary review comment; Cancel keeps the
thread unchanged. Summary requests (summarize: true on a follow-up) and replies
(summary: true with discussion_id) stay hidden in the thread.
Delete removes a discussion thread and its agent replies; the agent receives a
discussion_deleted event telling it to stop work on the thread and not reply.
Agent replies are notes with discussion_id naming the root discussion
(use thread_id from a follow-up event). Send them with --add-notes, not
--review-notes-file. Finish ends the review: comments go to the terminal
that started lrv, and a pending listener reports ended. Attached agents handle review requests and discussions and never receive the final review.
When Phabricator is available, Publish D123 beside Finish follows the selected commit. It opens a dialog for that revision's verdict and overall comment. Publishing keeps the review open; the commit strip marks published revisions with ✓. Finish excludes published comments and includes the published URLs. Convert discussions to comments before Finish to keep them.
Click Connect Agent beside Finish to start a local claude or codex
CLI (installed and authenticated on the server machine). Choose a provider and
optionally a model and effort; empty fields use the CLI defaults. Once the agent
is attached, Request Review in the commit bar asks it to review the current
commit. It posts findings only against that commit, then listens again.
Your choices are remembered in this browser.
The button is replaced by a Connected badge whose dot is green while the
agent listens and pulses amber while it reviews or answers a discussion; the
text stays the same. Failed launches show an error when you reopen the
popover, including the agent log path if the process exited. While it runs, the
agent's progress (messages and tool calls) is echoed to lrv's stderr with an
[agent] prefix. Only one agent can be launched at a time. The button is
unavailable in public mode.
lrv supplies private temporary diff files for every commit and removes them on shutdown, after allowing the agent to exit and killing it if necessary. A launched agent stays in its listen loop until the review ends; long sessions may require its CLI's automatic context compaction.
Settings (theme, font, view mode) are saved to ~/.config/lrv/config.toml.
lrv ships with GitHub, Solarized, Firefox DevTools, and the built-in Monaco themes. To add your own, drop any VS Code theme JSON file into the themes/ subdirectory of your lrv config directory:
mkdir -p "$(lrv --config-dir)/themes"
cp my-theme.json "$(lrv --config-dir)/themes/"lrv --config-dir prints the platform-correct path (~/.config/lrv on Linux, ~/Library/Application Support/lrv on macOS, %APPDATA%\lrv on Windows).
The theme appears in the Settings dialog under Custom on the next launch. VS Code themes are widely available:
- VS Code Marketplace — themes ship as
.vsixfiles (zip archives); the JSON is inside underthemes/ monaco-themesnpm package — 30+ themes already in Monaco format
Prerequisites:
- Rust toolchain
- Node.js + npm
just- Playwright Firefox for e2e:
just setup-e2e
Main workflows:
just build
just test-unit
just test-e2e
just cicargo build / cargo run will rebuild the embedded web bundle automatically when frontend inputs change.
You can still run npm run build:web directly if you only want to rebuild the frontend bundle.
The browser UI uses Monaco for the file-by-file diff editor. The stacked diff view and the sidebar file tree are intentionally delegated to Pierre's components:
@pierre/diffsrenders the stacked diff. It is loaded lazily only when stacked mode is opened, and syntax highlighting runs through the library worker asset.@pierre/treesrenders the sidebar file tree.
Keep the Monaco path separate from the stacked path. Changes to file selection, review note placement, comment rendering, or theme variables may need updates in both modes.
Licensed under either of:
- Apache License, Version 2.0
- MIT license
See LICENSE-APACHE and LICENSE-MIT.
Pushing a vVERSION tag publishes the crate to crates.io and builds GitHub
release binaries. The tag must match the version in Cargo.toml. Maintainers
can use just release VERSION (or major, minor, or patch) to bump the
version and push the tag. Crates.io trusted publishing requires a trusted
publisher for padenot/lrv, workflow publish-crates.yml, and the GitHub
Actions environment crates-io. No local crates.io token is needed.
The Publish crates workflow can also be run manually with dry_run enabled
to verify authentication and packaging. To retry an upload, enter the release
tag in release_tag and disable dry_run; an already published version is skipped.