loupe

module
v0.27.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2026 License: MIT

README

loupe

latest release ci codecov

loupe lets developers who review code with an AI agent decide each of the agent's findings before anything is published.

A review agent that posts straight to GitHub puts unread comments under your name. With loupe, the agent files its findings into a local draft instead. You accept, rewrite or drop each finding in a terminal review window, write the review's opening, and confirm once to post a single GitHub review. For local work, such as uncommitted changes, a plan or a spec, you decide the findings the same way, and loupe returns your decisions to the agent that applies them.

loupe's agent skills install into Claude Code, Codex, Pi and Antigravity.

Deciding each finding, then writing the review's opening sentence and sending it with one key.

Quick start

Install the binary and the agent plugin:

curl -fsSL https://secondshift-labs.github.io/loupe/install.sh | sh

The script checks the download against the release's checksum and puts loupe in ~/.local/bin. Then it installs the agent plugin, at the same release, into each of Claude Code, Codex and Pi that it finds on your PATH, and copies its skills into Antigravity when ~/.gemini/config/ exists. loupe runs on Linux and macOS, on amd64 and arm64, and needs git. loupe update updates the binary and the plugins together, and loupe uninstall removes both and keeps your review runs. Install covers the script's options, mise, release archives and GitHub Actions.

Then start your agent in a clone of the repository and ask it for a review:

Review https://github.com/owner/repo/pull/123 and hand me the findings in loupe.

The agent opens loupe review in a pane beside its own in Herdr, tmux, Orca, iTerm2 or Ghostty. Elsewhere, it asks you to run loupe review yourself.

To try the review window without a pull request or an agent, run the demo from a clone of loupe. It needs mise:

git clone https://github.com/secondshift-labs/loupe.git
cd loupe
mise trust && mise install
mise run demo

The demo opens loupe review on seeded runs against an in-memory GitHub, so nothing leaves the machine.

Usage

Review a pull request

  1. Ask your agent for a review, as in the quick start. The agent captures the pull request into a run, a local draft of one review round named like owner/repo#123@1, and files each finding into it: a title and a Markdown body, pinned to a line of the diff or general.
  2. Decide each finding in loupe review. You accept it, rewrite it, exclude it, or send it back with a note. The agent, blocked on loupe wait, gets the note, replies or edits the finding, and you see its answer in the same window.
  3. Publish. Press p in loupe review, or run loupe publish. The confirmation shows the review as it will read, with its exact Markdown one key away. You type the review's opening, and y posts one GitHub review.

This is what a published review looks like. A CI review uses the same format.

After the author pushes, ask for another round. The agent sees what you published last time and what other reviewers said, so it re-raises only what is still open. loupe publish --sticky keeps one review per pull request current.

Decide local work

Ask your agent to route its findings on local work through loupe:

Review my uncommitted changes and let me decide the findings in loupe.

The agent captures the work with loupe capture --changed, or with --files <path> for a plan or a spec. That makes a local run, such as owner/repo:local#7, with no network call. Each finding shows the change the agent will make if you accept it. Once you decide the last one, you return the run, and the agent applies what you accepted. Local work has the steps.

Count your decisions

loupe stats totals your decisions across runs: how many findings the agent filed, how many you published and how many you rejected.

loupe stats --group-by month

Configuration

loupe reaches GitHub with the token in GH_TOKEN or GITHUB_TOKEN, or else the one gh auth login stored, so a signed-in gh needs no setup.

Runs are stored under $XDG_DATA_HOME/loupe, else ~/.local/share/loupe. Set LOUPE_HOME to store them elsewhere. Environment lists every variable.

To stop your agent asking for approval at each hand-off, allow loupe handoff. Handing off in a terminal pane gives the rule.

How it works

  • Nothing posts under your name unread. Only you run loupe review and loupe publish. Both refuse without an interactive terminal, except the unattended publish that CI uses.
  • Any review agent works. loupe has no opinion on how findings are found. The agent files them through the loupe CLI, and the plugin's human-review and human-decide skills teach it the workflow. To connect a review skill you already have, see the review workflow.
  • Findings are files on disk. Each run is one directory under the data root, with no daemon, no database and no service to sign up for. Capture adds Git objects and private refs to your clone, and never changes your working files, index or branch.
  • Human and bot reviews read the same. A CI job can publish through loupe too, with no one watching. Its review uses the same comment format, is marked unattended, and never approves or blocks a merge.

Documentation

Development

loupe is written in Go. It uses mise for Go and its tools, and lefthook for git hooks. From a clone:

mise trust && mise install
mise exec -- lefthook install
mise run check

mise run check runs go vet, golangci-lint, actionlint, shellcheck, a test-hygiene check and go test ./.... Contributing covers local development, tests, commits and releases. Security says how to report a vulnerability.

License

MIT. See LICENSE.

Directories

Path Synopsis
cmd
loupe command
loupe-demo command
Command loupe-demo runs loupe against seeded review runs and an in-memory GitHub, so the review interface and the whole publish flow can be tried by hand without a pull request, credentials or network.
Command loupe-demo runs loupe against seeded review runs and an in-memory GitHub, so the review interface and the whole publish flow can be tried by hand without a pull request, credentials or network.
internal
cli
Package cli maps loupe's commands onto cobra and turns domain results and refusals into the output contract.
Package cli maps loupe's commands onto cobra and turns domain results and refusals into the output contract.
diff
Package diff is the parsed pr.diff that both location validation and the review interface read.
Package diff is the parsed pr.diff that both location validation and the review interface read.
draft
Package draft holds the review draft: findings, human decisions, send-back notes and replies.
Package draft holds the review draft: findings, human decisions, send-back notes and replies.
findingid
Package findingid orders ids like f-001 so that f-999 sorts before f-1000.
Package findingid orders ids like f-001 so that f-999 sorts before f-1000.
gitenv
Package gitenv filters the environment handed to git, shared by gitx and the test repositories.
Package gitenv filters the environment handed to git, shared by gitx and the test repositories.
github
Package github is loupe's narrow view of the GitHub REST API, behind an interface so tests can fake it.
Package github is loupe's narrow view of the GitHub REST API, behind an interface so tests can fake it.
gitx
Package gitx runs the few git commands loupe needs against the user's clone.
Package gitx runs the few git commands loupe needs against the user's clone.
local
Package local captures local work for apply mode: the changed files of a Git worktree, named files, or no file.
Package local captures local work for apply mode: the changed files of a Git worktree, named files, or no file.
markdown
Package markdown checks authored Markdown against the allowlist in docs/comment-format.md, so a body or summary cannot restructure the <details> wrapper the renderer puts around it.
Package markdown checks authored Markdown against the allowlist in docs/comment-format.md, so a body or summary cannot restructure the <details> wrapper the renderer puts around it.
mode
Package mode is the one switch on a run's kind.
Package mode is the one switch on a run's kind.
pane
Package pane opens loupe review for the human in a new terminal pane beside the agent's, in Herdr, tmux, Orca, iTerm2 or Ghostty.
Package pane opens loupe review for the human in a new terminal pane beside the agent's, in Herdr, tmux, Orca, iTerm2 or Ghostty.
publish
Package publish runs the publication state machine: gates, envelope, confirmation, one review request, receipt.
Package publish runs the publication state machine: gates, envelope, confirmation, one review request, receipt.
refusal
Package refusal is a leaf so every domain package can return refusals without importing internal/cli.
Package refusal is a leaf so every domain package can return refusals without importing internal/cli.
render
Package render composes what loupe shows and sends.
Package render composes what loupe shows and sends.
run
Package run owns the on-disk layout of review runs: paths, references, atomic writes and locking.
Package run owns the on-disk layout of review runs: paths, references, atomic writes and locking.
section
Package section places a finding in the review body's sections, so that every surface presents findings in the order the published review will.
Package section places a finding in the review body's sections, so that every surface presents findings in the order the published review will.
severity
Package severity orders loupe's four severity words so that every surface ranks findings the same way.
Package severity orders loupe's four severity words so that every surface ranks findings the same way.
stats
Package stats rolls the human gate up across runs: what the agent filed, what was published, what the human rejected and what the agent cut itself, counted the way the published loupe-meta marker counts them.
Package stats rolls the human gate up across runs: what the agent filed, what was published, what the human rejected and what the agent cut itself, counted the way the published loupe-meta marker counts them.
style
Package style is the one place terminal appearance is decided: colors, glyphs and the small layout helpers every human-facing surface shares, so the review interface and the one-shot commands look like one program.
Package style is the one place terminal appearance is decided: colors, glyphs and the small layout helpers every human-facing surface shares, so the review interface and the one-shot commands look like one program.
testutil/fakegh
Package fakegh is an in-memory GitHub REST and GraphQL server for the endpoints loupe calls, reached through the production client so request encoding is exercised end to end.
Package fakegh is an in-memory GitHub REST and GraphQL server for the endpoints loupe calls, reached through the production client so request encoding is exercised end to end.
testutil/gitfail
Package gitfail puts a git on PATH that runs the real git except where a test wants a call to fail or print nothing.
Package gitfail puts a git on PATH that runs the real git except where a test wants a call to fail or print nothing.
testutil/gitrepo
Package gitrepo builds a local stand-in for a GitHub repository: a bare remote, a user's clone of it, and a pull request head published at refs/pull/<number>/head.
Package gitrepo builds a local stand-in for a GitHub repository: a bare remote, a user's clone of it, and a pull request head published at refs/pull/<number>/head.
testutil/golden
Package golden compares output with the files under testdata/golden at the repository root, and owns the one -update flag that rewrites them.
Package golden compares output with the files under testdata/golden at the repository root, and owns the one -update flag that rewrites them.
testutil/herdrstub
Package herdrstub writes a stand-in for the Herdr command line, which loupe handoff drives to open review in a pane beside the agent.
Package herdrstub writes a stand-in for the Herdr command line, which loupe handoff drives to open review in a pane beside the agent.
testutil/refusaltest
Package refusaltest checks that an error is a loupe refusal of the expected code.
Package refusaltest checks that an error is a loupe refusal of the expected code.
testutil/screen
Package screen drives loupe's full-screen programs the way a human at a terminal does: keys go in through a pipe, and each step waits for the screen to show its result rather than for time to pass, so a test never races the program, however slowly a step such as publishing runs.
Package screen drives loupe's full-screen programs the way a human at a terminal does: keys go in through a pipe, and each step waits for the screen to show its result rather than for time to pass, so a test never races the program, however slowly a step such as publishing runs.
testutil/sgrtest
Package sgrtest reads the SGR escape sequences that styled terminal text carries.
Package sgrtest reads the SGR escape sequences that styled terminal text carries.
tui
Package tui is the human review interface: a full-screen Bubble Tea program.
Package tui is the human review interface: a full-screen Bubble Tea program.
updatecheck
Package updatecheck tells a person running an old release that a newer one exists.
Package updatecheck tells a person running an old release that a newer one exists.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL