---
name: rudu
description: Drive a live Rudu diff-review app session from the CLI. Open working-tree, commit, branch, or pull-request diffs; inspect local changes; steer the user's view; and manage inline review notes. Use when the user has Rudu installed and wants an agent-guided diff review.
---

# Rudu

Rudu is a desktop diff-review app. The app window belongs to the user — never ask the user to click things for you. Use `rudu diff`/`show`/`patch` to choose what the app displays and `rudu session *` to inspect or steer a Working Tree Review.

If `rudu session list` reports no sessions, open Rudu on the checkout first:

```bash
rudu /path/to/repo        # launches or focuses the app on that checkout
```

## Workflow

```text
1. rudu /path/to/repo                                  # open the app on the checkout
2. rudu session list                                   # confirm the session is live
3. rudu session review --repo .                        # file/line structure, no raw patch
4. rudu session navigate --repo . --file X --new-line N   # additions; use --old-line N for deletions
5. rudu session comment add --repo . --file X --new-line N --body "..."
6. rudu session comment list --repo . --type user       # read the human's inline notes
7. rudu session comment reply --repo . --note ID --body "..." # answer in the same thread
```

All output is JSON. `--repo <path>` matches a session by its checkout root; use any subdirectory of the checkout (e.g. `--repo .` from inside it). If exactly one session exists, `--repo` may be omitted.

## Commands

### Open

```bash
rudu <path>          # open/focus the app on a checkout (relative paths OK)
rudu skill path      # print the installed path of this skill file
```

### Clean checkout versus pull request

Opening a checkout with `rudu <path>` shows only uncommitted Working Tree changes. A clean PR checkout therefore shows no files until you explicitly open the PR's branch diff.

For a pull request, run the command from the actual PR repository root—not a parent workspace repository:

```bash
cd "$(git -C /path/to/pr-checkout rev-parse --show-toplevel)"
git diff --name-only origin/main...HEAD   # confirm the range has the expected files
rudu diff origin/main...HEAD             # full PR diff
```

Use the PR's real base branch (`main`, `master`, etc.). `rudu show HEAD` opens only the latest commit, not the full PR. Do not manufacture a temporary patch when a Git revision range expresses the diff.

### Choose any Git diff

Use Git's own revision syntax instead of inventing source flags:

```bash
rudu diff                         # unstaged + untracked
rudu diff --staged                # staged
rudu diff HEAD                    # staged + unstaged + untracked
rudu show                         # latest commit
rudu show HEAD~1                  # selected commit
rudu diff main...HEAD             # merge-base/PR-style branch diff
rudu diff HEAD~3..HEAD -- src     # commit range limited by pathspec
rudu diff before.ts after.ts      # two files
rudu patch change.patch           # patch file
some-command-producing-patch | rudu patch -
```

These commands open a selected diff without mutating Git state. The developer can add local notes in the UI; Rudu scopes them to that exact diff revision. `session review` and `session comment` commands remain scoped to the Working Tree Review.

### Inspect

```bash
rudu session list
rudu session review [--repo <path>] [--include-patch]
```

- `review` returns `{checkoutId, branch, headSha, files: [{path, staged, unstaged, untracked}]}`
- add `--include-patch` only when you truly need the raw unified diff; prefer reading files from disk since you are already in the worktree

### Navigate

```bash
rudu session navigate [--repo <path>] --file <path> (--new-line <n> | --old-line <n>)
```

Scrolls the app's diff view to that file and line. Navigate before commenting so the user sees the code you're discussing. Use `--new-line` for additions and `--old-line` for deletions; line numbers are 1-based.

### Comments

```bash
rudu session comment add [--repo <path>] --file <path> (--new-line <n> | --old-line <n>) --body <markdown>
rudu session comment reply [--repo <path>] --note <id> --body <markdown>
rudu session comment delete [--repo <path>] --note <id> [--note <id> ...]
rudu session comment delete [--repo <path>] --all
rudu session comment list [--repo <path>] [--file <path>] [--type agent|user|all]
```

- `comment add` starts a new inline thread, marked agent-authored
- `comment reply` answers the listed note in its existing thread and inherits its file, side, and line range
- `comment delete --note` accepts one or more IDs; deleting a root note also deletes its replies
- `comment delete --all` deletes every local note in the selected checkout, including human notes; list first
- Use `comment reply`, not `comment add`, when answering a human note
- Use `--new-line` for new notes on additions and `--old-line` for new notes on deletions
- `--type user` returns notes the human typed in the app — your input channel from them
- Default `--type` is `all`

## Guiding a review

1. `review` to understand what changed
2. `navigate` to the first interesting file/line
3. `comment add` explaining intent, risks, or follow-ups — in the order that tells the clearest story, not file order
4. Don't comment on every file — highlight what the user wouldn't spot themselves
5. Check `comment list --type user` for human-authored notes before finishing
6. Answer those notes with `comment reply --note <id>` so the response stays in the same thread

## Common errors

- **"Rudu is not running"** — open it: `rudu <path>`
- **"no session matches repo"** — the checkout isn't open in Rudu; run `rudu <path>` first
- **"file not in the working-tree diff"** — the file has no changes vs HEAD; check `review`
