/revdiff:revdiff optional: ref(s), "all files", or file pathfrom revdiff
Reviews diffs, files, and documents with inline annotations in a TUI overlay. Works in git, hg, and jj repos. Answers questions about revdiff usage, configuration, themes, and keybindings.
Ships in revdiff. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Review diffs with inline annotations using revdiff TUI in a terminal overlay. Works in git, hg, and jj repos (auto-detected).
--only mode)If the user asks a question about revdiff (configuration, themes, keybindings, installation, usage) rather than requesting a review session, consult the reference files in references/ and answer directly. Do NOT launch the TUI for informational questions.
references/install.md — installation methods and plugin setupreferences/config.md — config file, options, colors, chroma themesreferences/usage.md — examples, key bindings, output formatIf the user says things like "locate my review", "use my latest revdiff annotations", "pull up the review I just did in another terminal", or "what did I annotate earlier" — the user ran revdiff outside this plugin flow and wants Claude to process the stored annotations. Read the most recent file from the persistent history directory via the helper script, then process the annotations through Step 3.5 classification as if they had come from a fresh launcher call:
${CLAUDE_SKILL_DIR}/scripts/read-latest-history.sh
The script resolves the history dir from $REVDIFF_HISTORY_DIR (default ~/.config/revdiff/history), finds the repo subdir via VCS root basename (jj/git/hg), and prints the newest .md file whose path: header names the current checkout (a directory header must equal the repo root; a single-file --only header without git matches when the file sits directly in the root). Each history file contains a header (path, refs, and — when available — a git commit hash), the annotations in ## file:line (type) format, and the raw git diff for annotated files. The commit: line and diff block are captured from git only; in hg/jj repos the diff block will be empty and no commit hash is recorded. See references/usage.md "Review History" section for directory layout, stdin/only handling, and override options.
The history file is also the recovery path when a review is cut short by a lost connection: on signal termination (a SIGHUP from a dropped SSH/tmux client, or a SIGTERM) revdiff saves the current annotations to history — never the -o output — so read-latest-history.sh still recovers them.
When the user asks to open an in-session review in revdiff (the conversation already contains review comments produced earlier in the session), write those comments to a temp file (e.g. /tmp/revdiff-review-XXXXXX.md) using the format documented in references/usage.md ("Output Format" section), then run the normal launcher flow (Step 1 ref detection, Step 2 invocation) with --annotations=<temp-path> appended. Step 3 onward handles the curated annotations as usual.
Some review targets are not the current repo state: a GitHub PR diff, a patch file on disk, or git format-patch -1 --stdout output. Feed the unified diff to revdiff --stdin and the input is parsed as a real multi-file diff (one tree entry per file, hunk navigation, per-file annotations) instead of a context-only buffer. revdiff auto-detects the unified-diff signature; on a malformed patch the input falls back silently to raw-text mode.
Use this instead of the normal launcher flow when:
gh pr diff output", or supplies a patch URL/pathHand the diff to the launcher as a file with --stdin-file=PATH, a launcher option that feeds the file to revdiff as --stdin. Never pipe or redirect into the launcher: under Claude Code's sandbox a pipe or redirect keeps the whole command sandboxed, which blocks every backend.
f=$(mktemp "${TMPDIR:-/tmp}/revdiff-input-XXXXXX") && gh pr diff 123 > "$f" && echo "$f" || { rm -f "$f"; false; }
git format-patch -1 --stdout works the same way. A patch file already on disk needs no copy: use its path directly./abs/path/printed/by/resolver/launch-revdiff.sh --stdin-file=/path/printed/in/step/1
--stdin is mutually exclusive with refs, --staged, --only, --all-files, --include, --exclude, and --annotations, so do not combine with the Step 1 ref detection — go directly to Step 3 once the launcher returns. Annotations come back keyed by the real file paths from the diff (not by --stdin-name).
All-files mode: If $ARGUMENTS matches "all files", "all-files", or "browse all files" (with optional "exclude " parts), use all-files mode:
--all-files to the launcher--exclude=<prefix>--all-files --exclude=vendorDirectory review mode: If $ARGUMENTS is a single token that looks like a path (starts with /, ~/, ./ or ../, or contains /) and names a directory (test -d "$ARGUMENTS", e.g. /abs/path/to/subrepo or ./plugins/foo), the user is naming a repository to review, not a file: make it absolute with (CDPATH= cd -- "$ARGUMENTS" && pwd -P), replacing a leading ~/ with $HOME/ before both commands since a quoted ~ is not expanded, pass the result as --dir=<abs-path> and follow the --dir paragraph in Step 2, including running the ref detection below from inside that directory. This check runs before file review mode, which would otherwise turn the path into --only=<path>. A bare word such as docs is not a directory review even when that directory exists, since it can also be a branch name: leave it to the file and ref rules below.
File review mode: If $ARGUMENTS is a single token that points at a file on disk (e.g., docs/plans/feature.md, /tmp/notes.txt, README.md, main.go, file.blah), treat it as file review:
test -f "$ARGUMENTS" — if the file exists, it's file review mode/ or ./, or contains / and has a file extension (e.g., src/app.go), even when the file is not yet reachable from the current directory--only=<filepath> (no ref argument)main — both a branch name and a potential filename without extension) → prefer ref mode; ask the user only if neither test -f nor git rev-parse --verify resolvesRef mode: If $ARGUMENTS contains explicit ref(s) (e.g., HEAD~1, main, or main feature for two-ref diff), use as-is.
Auto-detect: If no ref provided, run the smart detection script:
${CLAUDE_SKILL_DIR}/scripts/detect-ref.sh
The script outputs structured fields:
branch, main_branch, is_main, has_uncommitted, has_staged_onlysuggested_ref — the ref to pass to revdiff (empty = uncommitted changes)use_staged — if true, pass --staged to the launcher (staged-only changes detected)needs_ask — if true, ask the user before proceedingWhen use_staged: true, pass --staged to the launcher. This means all changes are in the index (staged) with nothing unstaged — without --staged, revdiff would show an empty diff.
When needs_ask: true (on a feature branch with uncommitted changes), use AskUserQuestion:
When needs_ask: false, use suggested_ref directly:
--staged (staged changes)HEAD~1 (last commit)When you are launching revdiff for the user (e.g., right after a refactor or analysis), pass --description="..." so the info popup (i key) explains what the change is and what to look at — markdown is supported. For longer prose, write the markdown to a temp file and pass --description-file=/tmp/revdiff-desc-XXXXXX.md. The two flags are mutually exclusive; both are optional. Skip when there's no useful context to add.
When the recent change likely created new untracked files (new packages, new test files, new docs, new scripts that haven't been git add-ed yet), pass --untracked so those files appear in the tree. Use this in working-tree mode (no ref, no --staged); skip it for ref-to-ref reviews where untracked files are not part of the historical diff.
Pass --word-diff when the change is mostly small edits inside existing lines (renames, signature or argument changes, refactors that rewrite part of a line), so the changed words are highlighted within each paired add/remove line. Skip it when the change mostly adds or removes whole blocks. The W key toggles the same highlighting during the review.
When the review target is a repository other than the current working directory (the change spans several repos, or the user names a repo path), launch once per repository and pass --dir=<abs-path> to the launcher. <abs-path> must be absolute: the shell does not expand ~ after --dir=. Run the Step 1 ref detection from inside that directory: (cd <abs-path> && ${CLAUDE_SKILL_DIR}/scripts/detect-ref.sh). Relative paths in the other arguments (e.g. --only) resolve from <abs-path>, and the returned annotation paths are relative to that repository.
Pass --start-at-change only when the user explicitly asks for that cursor preference; never infer it automatically.
Pass --filter-unreviewed only when the user asks for the tree limited to files not marked reviewed; never infer it automatically. The F key toggles the same filter during the review.
Pass --cross-file-motion only when the user explicitly asks for cursor motion to continue into adjacent files; never infer it automatically.
Pass --stop-at-annotations only when the user explicitly asks for [ and ] to also stop at annotations outside hunks; never infer it automatically.
Run the launcher through the override-chain resolver, in two separate Bash calls:
"${CLAUDE_SKILL_DIR}/scripts/resolve-launcher.sh" launch-revdiff.sh "${CLAUDE_PLUGIN_DATA}"
It checks user → bundled (see references/install.md for override paths) and prints the first-found absolute path. If it exits nonzero (error: launcher not found in override chain: launch-revdiff.sh), stop and report its stderr; the override file is missing or not executable./abs/path/printed/by/resolver/launch-revdiff.sh [base] [against] [--dir=/abs/path] [--staged] [--untracked] [--word-diff] [--filter-unreviewed] [--cross-file-motion] [--stop-at-annotations] [--only=file1] [--all-files] [--exclude=prefix] [--description=text|--description-file=path]
Resolve again for every launch. Keep the second call a plain command, with no $VAR expansion, command substitution, pipe, redirect or cleanup in it: Claude Code's sandbox blocks every backend (osascript for Ghostty and iTerm2, a local socket for the rest), and Claude Code exempts a command from the sandbox only when every part of it matches the user's */launch-revdiff.sh* exclusion (see references/install.md).
IMPORTANT — long-running command: The launcher blocks until the user finishes reviewing in the TUI overlay, which can exceed the default bash tool timeout on many harnesses. Set the bash timeout parameter to the maximum your harness allows (e.g. 1800000 or higher on OpenCode) on the launcher call; the resolver returns in milliseconds. Do NOT use run_in_background for this — background-task handling is unreliable for interactive TUI launchers (processes may be killed unprompted, and polling loops can leave the session idle after the review finishes). If the review outlasts the timeout cap, the fallback in Step 3 handles it.
Disconnect-resilient tmux window mode: when running under tmux, prefix the launcher with REVDIFF_TMUX_WINDOW=1 to open revdiff in a persistent, server-owned tmux window instead of a client-owned display-popup. The review then survives a dropped SSH or tmux client — reattach and it is still there. This is a launcher environment variable, not a revdiff flag.
Herdr.app overlay: Herdr.app and herdr are different backends; the launcher detects Herdr.app by $HC_TERMINAL_ID and opens revdiff as an overlay over the window. If you hide the review overlay, reopen the revdiff-… terminal from the Agents list in the sidebar; the agent waits until you quit revdiff.
Pane-scoped overlay (herdr): when running under herdr, REVDIFF_HERDR_PANE=1 opens revdiff in a zoomed split of the agent's own pane instead of a new fullscreen tab, keeping the agent pane one keypress away. The user sets it in the environment; it falls back to the tab overlay on an older herdr CLI. This is a launcher environment variable, not a revdiff flag.
Pane-scoped overlay (agterm): when running in an agterm split, REVDIFF_AGTERM_PANE=1 opens revdiff in the agent's own pane instead of over the whole session, leaving the sibling pane live and visible. The user sets it in the environment; it is ignored outside a split. This is a launcher environment variable, not a revdiff flag.
Floating panel (agterm): REVDIFF_AGTERM_SIZE_PERCENT=N (1-100) opens the session-wide agterm overlay as a floating panel at N percent of the session, keeping the agent's chat visible around the review. The user sets it in the environment; a pane-scoped overlay ignores it. This is a launcher environment variable, not a revdiff flag.
The script:
The bundled launcher sets REVDIFF_EXIT_CODE_ON_ANNOTATIONS; exit 10 means annotations were captured and is not a launcher failure. Treat other nonzero statuses as failures. On those failures the launcher relays revdiff's own stderr — report that text verbatim instead of guessing which argument was at fault.
Collecting launcher output: In the normal case the launcher returns synchronously with annotations on stdout — process them as described below. If the bash tool reports exit 10, read stdout and process it as annotations; do not call it a failure. If the bash tool instead reports a timeout (on Claude Code the task keeps running in the background after the 10-minute cap; on other harnesses it may be killed outright), only the launcher process died, but revdiff itself is still open in the overlay and no annotations are lost: revdiff writes them to disk the moment the user quits, and O flushes them any time. Do NOT retry the launcher. Use the fallback:
O flush, quit-to-save); the user does not need them. Say something like: "The process waiting on your revdiff review timed out and exited — that's harmless, and any annotations you made are safe. Whenever you're done, message me and tell me to either load your annotations and continue, or that you're done and want to stop." Do NOT assume they want to load; quitting with no annotations, or choosing to stop, is a valid outcome.O and switched back).$TMPDIR when set, falling back to /tmp):
output_file="$(find -H "${TMPDIR:-/tmp}" -maxdepth 1 -type f -name 'revdiff-output-*' -user "$(id -u)" -mmin -120 -exec ls -t {} + 2>/dev/null | head -1)"
if [ -n "$output_file" ] && [ -f "$output_file" ]; then
cat "$output_file"
fi
"${CLAUDE_SKILL_DIR}/scripts/read-latest-history.sh" and process the annotations from its ## Annotations section (see "Using Existing Review History"). The script looks up the repository it runs in, so after a --dir launch run it inside that directory: (cd <abs-path> && "${CLAUDE_SKILL_DIR}/scripts/read-latest-history.sh"). Only if both are empty did the user quit without annotating.Under Herdr.app a hidden overlay is still open: reopen revdiff-… from the Agents list.
Both reads return complete content: revdiff writes the output file atomically on exit, and the history entry is complete before the process exits. That guarantees no partial read, not that the file belongs to this review. The lookup only considers your own files and excludes files older than two hours, but a recent leftover or a second review of yours live under one $TMPDIR can still be the newest match.
A reviewer may also keep revdiff open on purpose and press O to flush the current annotations to the same output file mid-session, without quitting. The flush uses the same atomic write, so the fallback read above still returns a complete file. When the user says something like "I flushed my notes, go ahead" while the overlay is still open, read the most recent output file exactly as in the timeout fallback and process the annotations; do NOT relaunch revdiff. After you finish the code changes, the reviewer reloads with R and continues in the same session. No launcher flags change for this — the launcher already passes an output file, and O reuses it.
If the script produces output, the user made annotations. The output format is:
## file.go:43 (+)
use errors.Is() instead of direct comparison
## store.go:18 (-)
don't remove this validation
Each annotation block has:
## filename:line (type) — which file and line, (+) = added, (-) = removed, (file-level) = file noteSplit annotations into two categories:
Explanation requests — annotation matches either rule (case-insensitive):
??, ???, etc.) — a language-neutral shortcut for "please explain"explain, remind, describe, what is, what are, how does, how do, clarifyThese are questions the user wants answered, not code changes.
Code-change directives — everything else. These are instructions to modify code.
If explanation requests are found:
Answer each explanation request — read the referenced code, generate a clear markdown explanation
If there are also code-change directives in the same batch, note them as pending (they carry over to Step 4 after the explanation loop)
Enter the explanation loop:
a. Write the explanation to a temp markdown file (e.g., /tmp/revdiff-explain-XXXXXX.md)
b. Launch revdiff with --only=/tmp/revdiff-explain-XXXXXX.md via the launcher script — this opens the explanation as a scrollable markdown view with TOC sidebar
c. If user quits without annotations → explanation accepted, clean up temp file, proceed:
--dir, if the review used one)
d. If user annotates the explanation → these are follow-up questions or clarification requests. Read the annotations, refine/extend the explanation markdown, write updated temp file, go back to step (b)The explanation loop continues until the user quits without annotating. This allows a natural back-and-forth dialogue where the user can ask for more detail or corrections on specific parts of the explanation.
If no explanation requests — all annotations are code-change directives, proceed directly to Step 4.
Enter plan mode (EnterPlanMode) to analyze code-change annotations:
After plan approval, fix the actual source code. Each annotation is a directive.
After fixing (or after "Continue review" from Step 3.5), run the launcher script again with the same ref and the same --dir, if the review used one. The user can:
When the script produces no output, no annotations were captured. Inform the user and stop the review workflow. This result alone does not authorize further mutations. Prior explicit user instructions still apply.
User: "revdiff HEAD~1"
→ launch revdiff in tmux popup with HEAD~1 diff
→ user annotates: "handler.go:43 - use errors.Is()"
→ user quits
→ annotations captured
→ enter plan mode: "add errors.Is() check at handler.go:43"
→ user approves
→ fix applied
→ re-launch revdiff HEAD~1
→ user sees fix, quits without annotations
→ "No annotations were captured."
User: "revdiff HEAD~3"
→ launch revdiff in tmux popup with HEAD~3 diff
→ user annotates: "server.go:72 - explain what this mutex protects"
→ user quits
→ annotation classified as explanation request (starts with "explain")
→ Claude reads server.go:72, generates markdown explanation
→ writes to /tmp/revdiff-explain-XXXXXX.md
→ launch revdiff --only=/tmp/revdiff-explain-XXXXXX.md (explanation view with TOC)
→ user reads explanation, annotates: "what about the race condition on line 80?"
→ Claude refines explanation, rewrites temp file
→ re-launch revdiff --only=/tmp/revdiff-explain-XXXXXX.md
→ user reads updated explanation, quits without annotations
→ explanation accepted, clean up temp file
→ re-launch revdiff HEAD~3 (back to diff review)
→ user quits without annotations
→ "No annotations were captured."
User: "revdiff all files exclude vendor"
→ launch revdiff with --all-files --exclude=vendor
→ user browses all tracked files, annotates as needed
→ same annotation loop as above
User: "revdiff docs/plans/feature.md"
→ test -f docs/plans/feature.md succeeds → file review mode
→ launch revdiff with --only=docs/plans/feature.md (context-only view, no ref)
→ user annotates prose: "section 'Open questions':3 - drop this, resolved"
→ user quits
→ same annotation loop as above (applies to the file content)
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub umputun/revdiff --plugin revdiffOther plugins' skills for the same job