Skip to content

CLI reference ​

One diffo binary serves both sides of the review: you open reviews with it, and the agent that wrote the code drives the feedback loop through it. The Agent Skill teaches your agent everything on this page.

bash
diffo [options]           # open (or resume) the review for this repo
diffo <target> [options]  # review against a branch, or review a pull request
diffo <command> [...]     # manage the server, or talk to the review
diffo help [command]      # help for one command

Nothing needs installing: npx -y @diffohq/diffo resolves a fresh CLI on every run. The examples below write diffo for brevity.

Every command runs from inside a git repository and is safe to re-run. Feedback lives in the review, not in any process, so an interrupted command loses nothing.

Commands at a glance ​

CommandSideWhat it does
difforeviewerOpen (or resume) the review for this repo
diffo <target>reviewerReview against a branch, or review a pull request
diffo pr <ref>reviewerReview a pull request, spelled out: the same as diffo <ref> when the target is a PR
diffo statusreviewerIs a server watching this repo, and where
diffo stopreviewerStop this repo's server
diffo cleanreviewerRemove the worktrees Diffo made for pull requests
diffo setupreviewerRegister Diffo with the coding agents on this machine
diffo telemetryreviewerSee, turn off, or turn on anonymous usage data
diffo pollagentWait for the reviewer's feedback
diffo replyagentReply to a thread
diffo commentagentStart a thread in the agent's own voice
diffo layersagentSplit the changeset into layers to read in order
diffo endagentDetach from the review
diffo reviewer --suggestagentFlag that the change deserves a reviewer agent; you decide
diffo reviewer --set <id>agentSay which set of reviewer agents fits the change; starts nobody
diffo join --role <id>reviewer agentTake a seat in a running review as a reviewer in that role
diffo resolve <threadId> --as <name>reviewer agentClose a thread that reviewer opened
diffo progress --as <name> --message "<line>"reviewer agentSay what it is doing; shown in the reviewer agents sidebar, and brings back your unread messages
diffo chat --as <name> --message "<text>"reviewer agentAnswer you in your private conversation with it; the author agent never sees it
diffo helpbothHelp for the CLI, or for one command
diffo help prbothHelp for reviewing a pull request: the spellings, the worktree, what gh needs

Opening a review ​

bash
diffo                     # the working tree vs HEAD
diffo main                # everything since forking from main (same as --base main)
diffo https://github.com/acme/widgets/pull/482   # a pull request; also acme/widgets#482, #482, 482
diffo pr 482              # the same, spelled out
diffo --no-open -p 4949   # a fixed port, no browser
OptionWhat it does
--base <branch>Review everything since forking from <branch> (merge-base). Default: the working tree vs HEAD
-p, --port <port>Port to serve on. Default: the port this repo last used, else the first free one
--no-openDon't open the browser. What an agent should always pass
--foregroundKeep the server in this terminal (Ctrl-C stops it) instead of leaving a background one behind

The command prints the changeset summary and the review URL, then returns immediately, leaving a background server that keeps watching after the terminal (or the agent session) that opened it is gone. Run it twice in the same repo and the second run points you at the existing review rather than starting a second one.

A background server self-stops after 30 minutes in which no browser tab and no agent poll used it. See DIFFO_IDLE_TIMEOUT_MS to change or disable that. --foreground never self-stops.

Untracked files are included, so brand-new agent output shows up as an addition rather than not at all.

Reviewer commands ​

diffo status ​

bash
diffo status
diffo status --json

Prints the changeset summary, the server behind it (port, pid, version), and the review URL. --json prints one object instead, either the server behind the review:

json
{ "running": true, "port": 4949, "pid": 51234, "version": "0.0.1", "url": "http://localhost:4949" }

or, when nothing is watching this repo:

json
{ "running": false }

Exits 0 when a server is watching this repo and 1 when none is, so it works as a shell condition.

diffo stop ​

Asks this repo's server to shut down cleanly, falls back to a signal if it lingers, and clears its registration. Stopping nothing is still a success.

The review itself survives: threads live in SQLite, and the next diffo picks them back up.

diffo clean ​

bash
diffo clean            # remove worktrees whose review is over
diffo clean --force    # the ones with uncommitted changes too
diffo clean --all      # every worktree Diffo made

Lists every worktree Diffo made for a pull request and removes the ones whose review is over: the PR was merged or closed, the review was pruned, or the directory is gone. A worktree is kept and named when it has uncommitted changes, when its state could not be checked, or when a Diffo server is still reviewing in it; --force removes those too. A worktree git could not remove stays listed for the next run. See Reviewing a pull request.

diffo setup ​

Registers Diffo with the coding agents on this machine, and installs the Agent Skill that teaches them when to open a review and how to behave inside one. It never touches an agent that isn't installed, never overwrites anything that isn't Diffo's, and is safe to re-run.

One row per client, each with a status:

StatusMeaning
registeredWired up. Restart or reload that client so it discovers Diffo
manualOne step needs your hands; the row says which. Re-run diffo setup afterwards
absentThat client isn't installed here
failedSomething went wrong; the row says what

Exits 1 if any row failed, otherwise 0.

Which clients, and how each is wired, is in Getting started, along with the manual equivalent of every row if you'd rather do it by hand.

You don't need to re-run setup after an upgrade: opening a review refreshes the skill copies it installed.

diffo telemetry ​

bash
diffo telemetry [status|on|off]

Anonymous usage data: two small events per review, on by default, announced in the review page before the first one is sent. status (the default) prints whether it is on, why it is off, and where the data goes. off stops reporting on this machine for good and deletes the machine's random id; on starts again with a fresh one. Usage data lists every field.

DIFFO_TELEMETRY_DISABLED=1 or DO_NOT_TRACK=1 turns it off without touching the setting, and wins over it; so does CI.

Agent commands ​

These are the whole agent protocol. Any agent that can run a shell command can drive the loop; the agent protocol is the full reference behind it.

All five talk to this repo's server, starting one if none is running.

diffo poll ​

bash
diffo poll

Blocks until the reviewer acts, then prints one JSON payload naming the threads to act on, and exits 0. Whitespace heartbeats every 15 seconds keep the connection alive; a single poll is capped at 30 minutes.

json
{ "status": "feedback", "kind": "threads", "threadIds": ["t-3"], "prompt": "…", "next_step": "…" }

status is one of feedback (the only one that carries work), timeout, quiet (twenty polls in a row brought nothing from the reviewer: stop and ask the user whether to keep listening), superseded (another session took the review), or ended. A feedback payload's kind is threads (individual sends), finish (the reviewer is done reading), layers (the reviewer asked for layers; see diffo layers), or cleared (they started the review over).

Run it attended: as a tracked background task when its completion wakes the session on its own, otherwise in the foreground without ending the turn, and never detached: a payload delivered to a process nobody is reading never reaches the agent. Safe to re-run any time; delivery is at-least-once, so a poll that dies mid-write re-delivers instead of dropping feedback.

diffo reply <threadId> ​

bash
diffo reply t-3 --message "Fixed: the guard now covers the empty case."
echo "$long_reply" | diffo reply t-3

Posts one message into a thread, rendered as GitHub-flavored Markdown in the reviewer's UI (a ```mermaid fence draws a diagram, a ```changeset-map fence Diffo's live map of the change). Thread ids come from poll payloads.

OptionWhat it does
-m, --message <text>The reply. Omit it to read the message from stdin
--moreAn interim reply: a follow-up on this thread is promised, so the reviewer keeps seeing the agent at work
--askIn a reviewer agent's thread only: hand it to you for a decision (what the product should do, a trade-off, a risk only you can accept, a disagreement the agents cannot settle). The reply says the question, the options and the agent's pick. The thread is marked Needs your decision and neither agent writes in it until you reply or resolve it. Either agent may use it; everything else they settle between them
--suggest-reply <one line>Offer the reviewer their answer. It appears as ghost text in their reply box; Tab takes it, and they still press send. For a message that ends in a decision that is theirs ("want me to extract this?" → --suggest-reply "yes, extract it"), never for one that only reports
--pr-comment <text>Pull requests only. Attach the review comment the reviewer would leave the author: in their voice, to the author, as GitHub will show it (Markdown; a ```suggestion block when the fix is local to the anchored lines). It appears under the reply with Add as PR comment draft, Edit and Dismiss; nothing posts until the reviewer submits. The agent's evidence stays in --message. Refused off a pull request. See Reviewing a pull request

Prints { "ok": true, "threadId": "t-3", "state": "…", "next_step": "…" }. An unknown thread id fails with exit 1. Each run posts a message, so don't re-run a reply that succeeded.

diffo comment [<file>] ​

bash
diffo comment src/server/db.ts --line 88 --message "This lock ordering looks wrong to me."
diffo comment --message "Worth a second pair of eyes on the whole migration."

Opens a thread as the agent, anchored to a line, a file, or, with no file, to the whole changeset. For something the agent noticed in its own work, or context that helps the read.

OptionWhat it does
-m, --message <text>The comment. Omit it to read the text from stdin
--line <n>Anchor to a line. Needs a file argument
--suggest-reply <one line>Offer the reviewer their answer as ghost text in the reply box, taken with Tab. Same rule as on reply: only when the comment proposes something and the call is theirs
--pr-comment <text>Pull requests only. The review comment the reviewer would leave the author about this, same rules as on reply. For a finding the agent can show, never a hunch

Prints { "ok": true, "threadId": "t-1", "next_step": "…" }.

An agent-started thread is inert until a human replies into it: it doesn't count toward the reviewer's outstanding feedback and isn't flushed by Finish review.

diffo layers ​

bash
diffo layers --suggest "the parser change explains the rest"   # at open: this read benefits from layers
diffo layers --json '{"preset":{"id":"importance"},"layers":[{"title":"Bad input now parses to null instead of throwing","files":[{"path":"src/parse.ts","highlight":["41-46"]}]},{"title":"Call sites and tests","kind":"background","files":["src/parse.ts","src/cli.ts","src/parse.test.ts"]}]}'
cat layers.json | diffo layers --stdin

Splits the changeset into layers: each with a title that states what it now makes true, a two-sentence summary (a diagram when it helps), and the lines that belong to it. The reviewer reads one layer at a time; files no layer lists gather in a trailing Since your review layer until the agent re-posts. Layers has the doctrine: when to suggest, how to title and order, what a summary may say.

Exactly one of:

OptionWhat it does
--suggest ["<why>"]Flag, without writing them, that this read benefits from layers. The optional reason is one line, quoted to the reviewer next to the offer
--preset <id>With --suggest only: the reviewer's preset that fits this change. The Layers tab opens on it. One that is not on is dropped, and the output's note says so
--json '<post>'Post the layers: { "preset", "layers": Layer[] }, or a bare Layer[] for layers following no preset. A preset id the reviewer does not have is dropped, and the ack's note says so. Replaces the whole list; ids are kept for titles that match, so the reviewer's place survives a re-post
--stdinThe same payload, piped

preset is { id, picked?, why? }: the preset the layers follow (a built-in's id, or one of the reviewer's), picked when the ask left the choice to the agent, and why its one line on the choice. Layers has when each applies.

A layer is { title, summary?, kind?, files, decisions? }. files holds repo-relative paths, as strings or as { "path", "note"?, "highlight"? } where the note is one line on why the file is in this step, and highlight the head-side lines the step is about within the file ("40", "12-18", or a list of up to thirty), lit in the pane with the rest dimmed. A highlighted entry holds only the hunks its highlight touches; a highlight that touches none is ignored. kind is "mechanical" (the layer changes no behaviour, and its files render folded) or "background" (what the reviewer skips: tests, docs, styling, generated files and whatever else the preset sends there; listed whole, it holds what the review layers left of its files, and the reviewer sees it folded under one row at the foot of the tab). A bare path is the whole file; path:from-to (head-side lines) is the hunks that range touches, for a file whose hunks belong to different steps — list it with its own range in each step that has a part of it. A path listed whole in one layer and by range in another fails the post. Unknown paths are accepted and show nothing until the file lands.

decisions is optional and holds at most five { text, detail?, at? }: text one short line, detail one sentence more, and at where it lives: "path", "path:line" or "path:from-to" (head side), or a list of up to three such places when the decision spans hunks. A sixth decision, a fourth place or a malformed at fails the post the same way a bad file does. Layers has what earns a line.

A title that is empty or used twice, an empty file list, an absolute or ..-escaping path, a kind other than mechanical or background, or more than five decisions fails with exit 1 and names the layer at fault (layer 2 ("Callers"): needs a non-empty "files" list). Nothing is stored on a failed post.

Prints { "ok": true, "layers": 4, "next_step": "…" } after a post — with an uncovered list when the post leaves changed lines or files in no layer ([{ "path": "src/a.ts", "ranges": ["88-95"] }, { "path": "src/b.ts" }]: the head-side lines no layer claims, or a path alone for a file no layer names), and a next_step that asks for a re-post with them placed — and { "ok": true, "suggested": true, "next_step": "…" } after a suggestion. suggested is false when layers already exist: there is nothing left to suggest, and the next step says to re-post instead.

The reviewer's Ask the agent for layers button, and Layer again over existing layers, reach the agent as a kind: "layers" poll payload whose prompt asks for exactly this post and lists every file with its hunks' head-side line ranges, so splitting a file is copying a range. Add to layers reaches it the same way with a shorter prompt: the layers as they stand and what is outside them, to re-post with the additions. A post concludes the request.

diffo preset ​

bash
diffo preset list
diffo preset show <id>
diffo preset update <id> --json '{"instructions":"…"}' --message "Routes first now, as you asked."
… | diffo preset update <id> --stdin --message "…"
diffo preset reply <id> --message "Putting tests first would hide the contract they pin. Want it anyway?"

The reviewer's layers presets (see What the layers are for), and the conversation about each one in the Layers presets dialog. A reviewer's message reaches the agent as a kind: "preset" poll payload with the preset as it stands and the messages so far.

CommandWhat it does
listEvery preset, built-ins first, with on (offered, and open to the agent's pick) and builtIn, plus the default (agent, or a preset id)
show <id>One preset with its four fields, and its conversation
update <id>Sets the fields sent (name, blurb, whenToUse, instructions; any subset, each capped), makes the preset when nobody has it yet (a name at least), and refuses a built-in's id. --message is the agent's line on what changed; it shows in the conversation with an undo
reply <id>A message in the conversation that changes nothing

An empty or non-string field, nothing to change, a built-in's id on update, or a new preset without a name fails with exit 1 and says which. update prints { "ok": true, "preset": { "id", "name" }, "next_step": "…" }.

diffo role ​

bash
diffo role list
diffo role show <id>
diffo role update <id> --json '{"focus":"…"}' --message "Memory is in now, as you asked."
… | diffo role update <id> --stdin --message "…"
diffo role reply <id> --message "Should it look at memory too, or only time?"

The reviewer's roles for reviewer agents, and the conversation about each one on the Reviewer agents page, the same way diffo preset works for presets. A reviewer's message reaches the agent as a kind: "role" poll payload with the role as it stands and the messages so far. A new role talks under a draft key (draft-…) until the agent makes it under an id of its own, taken from the role's name.

CommandWhat it does
listEvery role, built-ins first, with builtIn, plus the default (general)
show <id>One role with its three fields, and its conversation (a draft key shows the conversation only)
update <id>Sets the fields sent (name under 32 characters, blurb one line under 120, focus under 2000; any subset), makes the role when nobody has it yet (a name and a focus at least), and refuses a built-in's id or a draft key. --message is the agent's line on what changed; it shows in the conversation with an undo, and in the built-in's or draft's conversation that asked for the role
reply <id>A message in the conversation that changes nothing; a draft key answers a new role's conversation

A field over its limit, nothing to change, a built-in's id or a draft key on update, or a new role without a name and a focus fails with exit 1 and says which. update prints { "ok": true, "role": { "id", "name" }, "next_step": "…" }.

diffo end ​

Detaches the calling session politely. If another session is the attached agent, nothing is touched and the output says so: { "ok": false, "reason": "not-owner", "ownerPid": 51234 }. Safe to re-run.

Reviewer agent commands ​

A review can hold more than the agent that wrote the change. A second AI session can join it as a reviewer agent: it reads the diff, leaves comments the way a person would, and the author agent answers them. The agents work a thread out between them, and you step in where they cannot.

You bring one in from the review page: + Reviewer in the top bar, or Reviewer agents in Settings. Pick the role it reads the change in, then either ask your agent to start it (it runs as a sub-agent and is handed one fixed line, so the agent that wrote the change never briefs its own reviewer), or copy that line into any other agent session. A different tool gives the most independent read.

A role is what a reviewer looks for: general (the default), security, tests, simplicity, or one you write in that dialog (a name and what it looks for, saved for every review). Whatever its role, a reviewer is told how to review when it joins: comment only on what matters and what it can show, one finding per thread. Nothing caps how many threads it opens; that brief is what keeps it short. A role narrows the focus; it changes none of the rules below.

A reviewer agent runs the same commands under a name, with --as <name>. join gives each new reviewer a short name of its own (juno, remy, …), never one the review has had, so two reviewers in one role are two reviewers and a new one never inherits another's threads or conversation. The role is what it looks for; the name is who it is. join --as <name> is for coming back under its own name after a restart:

CommandWhat it does
diffo join --role <id>, diffo join --as <name>Take a seat in the review already running for this repo, and print the role's focus, how to review, what is under review, the threads already there, and the next step. It never starts a review.
diffo comment [<file>] [--line <n>] --as <name> -m "…"Open a thread as that reviewer. It goes to the author agent at once, with no Send.
diffo poll --as <name>Wait for an answer on a thread that reviewer opened: the author agent's, or yours. Prints "status": "idle" when nothing of its own is left to wait for.
diffo reply <threadId> --as <name> -m "…"Answer in a thread it opened, one message per turn.
diffo resolve <threadId> --as <name>Close a thread it opened.
diffo diff --as <name> [<file>…]Print the change as a unified diff: the hunks you read on the page, every file or the ones named. You see which files each reviewer read this way.
diffo covered --as <name> [--skipped <file>]…Before it stops: the changed files it did not read (none when it read them all). Shown in its view beside the files it fetched.
diffo progress --as <name> --message "<line>"Say what it is doing, in a few words. A status line for you, never a comment. When you wrote to it from the reviewer agents sidebar, your messages come back under messages.
diffo chat --as <name> --message "<text>"Answer you, privately: into your conversation with it in the sidebar. It opens no thread, and the author agent never sees it.

The rules, enforced by the server:

  • A reviewer agent writes in and closes only threads it opened. The author agent closes none. You can close or reopen any.
  • A thread you reopened, or wrote in without sending, is yours until you send it: a reviewer agent can neither answer nor close it, and does not see your unsent words. Its poll keeps waiting for them.
  • You can write to a reviewer agent from the reviewer agents sidebar, in a private conversation the author agent never sees. Its poll returns "status": "message" with your words under messages (or its next progress carries them); they steer its review but never widen what it may run. It answers with diffo chat.
  • You can stop a reviewer agent from the reviewer agents sidebar: its session is told to end (its poll returns "status": "stopped"), and it stays in the list with what it did and your conversation with it. Delete also takes it off the list, with its log and conversation. Either way its review threads stay, its commands are refused until it joins again, and its name is never given to another reviewer.
  • A thread holds three rounds between a reviewer agent and the author agent (a round is a reviewer-agent message the author agent answered). After the third it stops, is marked Needs you, and neither agent may write in it until you reply or resolve it.
  • The two agents settle threads on their own: the author agent fixes what is right and the reviewer agent closes the thread. Either one hands a thread to you only when it needs your decision (reply --ask); it is then marked Needs your decision and waits for your word.
  • A reviewer agent keeps listening while any of its threads waits on you, and for five minutes after its last one closes, so your reply or message still reaches it. Then it stops.
  • A reviewer agent's comment is another AI's feedback: the author agent may disagree with it, and only your word is final.
  • Branch and working-tree reviews only, on this machine. Not pull requests.

The agent that wrote the change never brings a reviewer in on its own. It can suggest one, diffo reviewer --suggest "<why>" --role <id>, and the + Reviewer button then reads as that suggestion until you start it or pass.

A set is a few reviewer agents for one kind of change: Refactor, New API or command, UI change and more, plus any you make on the Sets tab of the Reviewer agents page. When a review opens, the author agent says which set fits, diffo reviewer --set <id> "<why>". That starts nobody and shows nothing on the page: when you open + Reviewer, that set's agents are already ticked, with the agent's reason beside them, and you change the ticks or start them. To have + Reviewer open on a set of your choosing, whatever the change, make it the default on the Sets tab; the agent is then not asked.

Reviewer agents only read the checkout: they never edit a file, and never stage, reset, stash or commit. Only the author agent changes files. diffo help reviewer is the reviewer agent's whole protocol on one page.

Help and version ​

CommandWhat it does
diffo --help, -hThe full usage page
diffo help <command>Help for one command, including its output shape
diffo help agentThe agent's whole protocol on one page
diffo help reviewerThe reviewer agent's whole protocol on one page
diffo help prReviewing a pull request: the target spellings, the worktree, and what gh needs
diffo --version, -vPrint the version

-h works after a command too: diffo comment -h is the same as diffo help comment.

An unrecognised command is an error with a suggestion (diffo repyl offers reply), not a silent no-op.

Environment variables ​

VariableEffect
DIFFO_DBPath to the state file. Default ~/.diffo/diffo.db
DIFFO_IDLE_TIMEOUT_MSIdle budget before a background server self-stops. 0 or off disables it. Default: 30 minutes for a background server, off in the foreground
DIFFO_SERVER_LOGWhere a background server writes its log. Default ~/.diffo/logs/<repo>-<hash>.log
DIFFO_TELEMETRY_DISABLEDSet to 1 to send no usage data. DO_NOT_TRACK=1 and CI do the same
DIFFO_TELEMETRY_DEBUGSet to 1 to write every usage-data payload to the server log before it is sent
DIFFO_PUBLIC_URLThe address a reverse proxy serves the server at, with {port} for its port: https://diffo-{port}.devbox.internal. diffo prints it as the review link and accepts that host alongside loopback. Read at server start. See Security
DIFFO_DAEMONInternal. Set by the CLI on the server it spawns; don't set it yourself

Exit codes ​

CodeWhen
0Success
1Any failure: not a git repo, a bad flag, no server for status, an unknown thread id for reply, a failed row in setup

Errors go to stderr as diffo: <what went wrong>. Machine-readable output (--json, and every agent command) goes to stdout on its own, so it stays pipeable into jq.

See also ​

Released under the Apache-2.0 License.