# Reviewing changes

> See what changed, and have zelk review uncommitted work, a branch or a commit for defects.

zelk can show you what changed in your repository, and review a change for
the defects it introduces. A review runs read-only, in plan mode, whatever
mode you are in.

## See what changed

In the terminal UI, **Diff** in the palette shows the uncommitted changes.

## Review in the terminal UI

**Review…** in the palette asks what to review:

- **Uncommitted changes**: staged, unstaged and untracked files.
- **Against a branch…**: the commits on this branch since it left the base
  branch you name.
- **A commit…**: the changes one commit introduced.

The review runs as a session of its own, beside the conversation, and opens
with its report when it ends. Wait for a run to end before starting one.
To stop a review, return to the prompt and press Esc or click the footer's
stop shortcut. Esc first closes an open menu or file finder.

## Review from the command line

```sh
zelk exec review                          # staged, unstaged and untracked changes
zelk exec review --base main              # the branch's commits since its merge base with main
zelk exec review --commit HEAD            # what the last commit introduced
zelk exec review --commit HEAD --title "Parser fix" "Focus on concurrency"
zelk exec review -o findings.json         # also write the findings as JSON
zelk exec review --json -o findings.json  # events as JSON Lines, findings to the file
```

Give at most one of `--uncommitted`, `--base` and `--commit`; with none,
the review takes the uncommitted changes. Quoted text after the flags, and
piped input, focus the review. A branch review compares the merge base to
`HEAD` and leaves out uncommitted edits.

zelk gathers the changed files, the diff and the contents of untracked
files itself and hands them to the model, which checks each suspected
defect before reporting it. The report lists findings by priority, from P0
to P3, each with its file and lines, how it fails and how confident the
model is, then an overall verdict:

```text
[P1] add() subtracts instead of adding — calc.py:1-2 (confidence 0.97)
The function `add(a, b)` returns `a - b`. Any caller gets the wrong result:
add(2, 3) returns -1 instead of 5. …

Verdict: incorrect
```

Files your rules deny reading, and protected paths, are listed as withheld
by policy; their contents never reach the model.

A review that ran exits 0, whatever it found, so check the findings rather
than the exit status. A clean tree, an unknown revision or a target with
nothing in it exits 2 before calling the model. Review sessions are kept
like other `exec` sessions.

## Asking in conversation

You can also ask for a review in your own words, in the terminal UI or with
piped context:

```sh
git diff main... | zelk exec "review this diff for error handling"
```

This runs as an ordinary `exec` task, in plan mode unless you give
`-mode`, without the structured findings.

## Where to go deeper

- [`zelk exec` in the CLI reference](/reference/cli/#zelk-exec)
- [Print mode and exec](/cli/print-and-exec/)
