# Rectifier CLI

`rectifier review` sends changes from your checkout to rectifier and prints the review. You do not have to push, and
you do not need a pull request.

## Install

```bash
uv tool install imbik-rectifier     # or: pipx install imbik-rectifier
uv tool upgrade imbik-rectifier     # to upgrade
```

The CLI needs Python 3.10 or later, and git.

## Requirements

- `RECTIFIER_CLI_TOKEN` set to a token from the [CLI tokens page](https://app.rectifier.imbik.ai/#tokens), or a machine signed in with
  [`rectifier login`](#signing-in).
- A checkout of a repository in a GitHub organization, GitLab group or Bitbucket workspace that your account connected.
- `origin` on `github.com`, `gitlab.com` or `bitbucket.org`. SSH aliases work.
- The command uploads the commits that your `origin/*` branches lack. If they are old, run `git fetch origin` first.
- Rectifier deletes what the command uploads within 3 weeks.

## CLI tokens

- The CLI tokens page shows a new token once. Rectifier stores a hash of it and its last 4 characters.
- Tokens expire after 7 days, 30 days, 90 days (the default), 1 year, or never.
- You can revoke your tokens on the [CLI tokens page](https://app.rectifier.imbik.ai/#tokens). An admin can see and revoke every token in
  the organization.
- If you leave the organization, rectifier revokes your tokens for it.
- A token can review only its own organization's repositories.

### Signing in

`rectifier login` signs this machine in without a token in your environment. It opens the dashboard's sign-in page in
your browser and waits. On the page, check that the code and the host name match your terminal, pick your organization,
and approve. The sign-in lasts 10 minutes. With `--no-browser`, the command prints the link and opens nothing.

The token lasts 90 days and is saved for your user only, in `~/.config/rectifier/`
(`%LOCALAPPDATA%\rectifier\` on Windows). It replaces the token this machine saved before, and rectifier revokes the
earlier one if it is yours in the same organization. The command prints the account and the user it signed in to. If
`RECTIFIER_CLI_TOKEN` is set, the CLI uses it instead.

`rectifier whoami` prints the account and the user the CLI speaks for, and where its token came from.
`rectifier logout` revokes the saved token and deletes it. It leaves `RECTIFIER_CLI_TOKEN` alone: revoke that one on the
dashboard's CLI tokens page.

## CLI commands

| Command | Reviews |
| --- | --- |
| `rectifier review` | The branch since it left the default branch |
| `rectifier review abc123` | One commit |
| `rectifier review --last 3` | The last 3 commits, as one change |
| `rectifier review abc123..def456` | A range, as one change |
| `rectifier review --uncommitted` | Staged, unstaged and untracked changes |

`rectifier review` reviews the whole branch each time you run it, including the commits an earlier review read. To
review only the commits you added since your last review, use `--last N` or a range such as `abc123..HEAD`.

### Options

| Option | Effect |
| --- | --- |
| `--full`, `--light` | Ask for a full review, or a light review, which is faster. With neither, the default review type in Settings applies: a full review unless it is set to light. `--watch` runs a full review unless you pass `--light`; for some accounts, `--watch` reviews are light unless you give `--full`. See [Reading the review](#reading-the-review). |
| `--base REF` | Compare against `REF` (a commit hash or a branch name) instead of the default branch. With `--uncommitted`, also include the commits since `REF`. |
| `--path PATHSPEC` | With `--uncommitted`, send only the changes that this git pathspec matches. Give it again for more. See [Uncommitted changes](#uncommitted-changes). |
| `--post` | Post the review on the branch's open pull request. See [Posting](#posting). |
| `--confirm CODE` | Send the files an earlier run listed, without asking again. If there is no terminal, for example under Claude Code, `--uncommitted` prints this command with its code. See [Uncommitted changes](#uncommitted-changes). |
| `--force` | Run a new review, even if rectifier reviewed the same commits in the last hour |
| `--json` | Print JSON instead of markdown |
| `-C DIR` | Review the checkout in `DIR` |
| `--no-wait` | Queue the review, print its job and exit. `rectifier status <job> --wait` waits for it and saves the report. |
| `--account SLUG`, `--user ID` | Refuse to send the review if this machine's token is for another account or another person |

Environment: `RECTIFIER_CLI_TOKEN`, your token (required unless you signed in with `rectifier login`), and
`RECTIFIER_URL`, the service (leave it unset).

### Waiting for a queued review

`rectifier status <job>` says where a review is: waiting, running and how far, or ended. Once it has ended, the command
prints the report and saves it as `rectifier review` does. With `--wait`, it waits for the end first. It starts no
review, so you can run it again at any time, for example after `--no-wait`. It takes `--json` and `-C DIR` as `rectifier
review` does. Rectifier keeps a review's result for an hour after it ends.

### Listing your reviews

`rectifier reviews` lists your account's reviews: waiting first, then running, then the ones that ended, newest first.
Each line says what was reviewed, who asked, when, what it found and where to read it. A review that `rectifier review`
sent ends with its job, for `rectifier status`. `--repo org/name`, `--pr N` and `--status` narrow the list, `--json`
prints the service's JSON, and the last line gives the command for the next page, with `--before`.

### Reading a pull request review's findings

`rectifier report --pr N` prints the findings that Rectifier posted on pull or merge request N, laid out as a
`rectifier review` report, so you or your coding agent can fix them. Each finding has its file and line, its severity,
its title and text, and whether it blocks. The report does not have a finding's impact or its message for an agent.

`--pr` reads the newest review of that pull request that completed: one round, at the commit the report's first line
names. A newer review that is still running or did not complete is not read. The repository is the checkout's, or the
one `--repo org/name` names. On Azure DevOps, `--repo org/project/name` is needed. `rectifier report <id>` reads one
review by the `id` that `rectifier reviews --json` gives. `--json` prints JSON.

Reading many reviews one after another, for example from a script, can run past your account's share of requests.
Reading a review's findings, when the service throttles it (429), answers 502, 503 or 504, or drops it, is asked again,
up to 5 asks in all, waiting 3, 6, 12 and 24 seconds, or longer when the service asks, with a line on stderr for each
wait. Reading one review at a time, rather than several at once, makes a wait less likely.

The report shows each finding at the severity of the posted review. Whether a finding blocks follows your "Request
changes at" [setting](pr-reviews.md#settings) as it is now. Each CLI token of your account can read every pull and
merge request review of the account. Rectifier keeps a review's findings for 90 days. For a review that `rectifier
review` sent, use `rectifier status <job>`.

### Saying whether a pull request review finding is real

`rectifier report` prints an id for each finding. `rectifier verdict <review> <finding> <label>` records what the
finding is. `<review>` is the review's `id`, as `rectifier report <id>` takes it. The labels are those of
[`rectifier scan-verdict`](#saying-whether-a-deep-scan-finding-is-real), with `out-of-scope` in place of `wont-fix`:

| Label | Meaning |
|---|---|
| `real` | A real defect. |
| `not-real` | Not a defect. |
| `out-of-scope` | A real defect, but in code or of a kind you do not want reviewed. |
| `already-known` | A real defect that you already knew of. |

`--note "..."` adds why, in a sentence or two, and `--json` prints the service's JSON. A later answer on the same
finding replaces the earlier one, and `rectifier report` shows the answer beside the finding. Rectifier uses the
answers to measure how many of the findings it reports are real. Each CLI token of your account can answer for every
pull and merge request review of the account.

### Reading your Deep Scans' findings

`rectifier scans` lists your account's finished Deep Scans, newest first. Each line has the repository, its code host,
when the scan finished, its findings by severity, the commit it read, and the scan's id. `--json` prints the service's
JSON.

`rectifier scan-report <id>` prints the findings of one scan: each finding's severity, title, file and lines, what it
is, why it is a defect, and a link to the code at the commit the scan read. `rectifier scan-report --all` prints those
of the newest finished scan of each repository, the scans that "Download all findings" on the Deep Scans page reads.
With `--json`, it prints `{"scans": [{"scan", "report"}], "skipped"}`, for a coding agent to go through.

Rectifier deletes a scan's report after 30 days unless your account's plan keeps reports, and a deleted scan's
report is gone. Such a report cannot be read: `rectifier scan-report <id>` exits 2. `--all` does not read a report that
had already expired when it listed your scans; it reads the newest older scan of that repository whose report is kept,
if there is one. `skipped` holds only a report that expired or was deleted after the list was read. A read the service
throttles (429), answers 502, 503 or 504, or drops is asked again a few times first. Any other failure, or one that
lasts, stops `--all` with exit code 2 and nothing on stdout. Each CLI token of your account can read every Deep Scan of
the account.

A scan of a large repository can read only its core, and a scan leaves out files it takes as generated, vendored, built
or docs. The report says so under its heading, as the Deep Scans page does, and with `--json` in the report's
`scanned`, `left_out` and `marks_read`.

### Saying whether a Deep Scan finding is real

`rectifier scan-report` prints an id for each finding. `rectifier scan-verdict <scan> <finding> <label>` records what
the finding is, with one of these labels:

| Label | Meaning |
|---|---|
| `real` | A real defect. |
| `not-real` | Not a defect. |
| `wont-fix` | A real defect you will not fix: of low value to you, in test or dead code, or of a kind you do not care about. |
| `already-known` | A real defect that you already knew of. |

`--note "..."` adds why, in a sentence or two, and `--json` prints the service's JSON. A later answer on the same
finding replaces the earlier one, and `rectifier scan-report` shows the answer beside the finding. Rectifier uses the
answers to measure how many of the findings it reports are real. Each CLI token of your account can answer for every
Deep Scan of the account.

### Experimental options

| Option | Effect |
| --- | --- |
| `--local` | Review a git repository that is on no code host Rectifier reads, such as one with no remote. See [Local-only git repositories](#local-only-git-repositories). |
| `--tfvc` | Review the pending changes in a TFVC workspace. See [TFVC workspaces](#tfvc-workspaces). |
| `--changeset N`, `--shelveset NAME` | With `--tfvc`, review a checked-in changeset or a shelveset instead of the pending changes. |
| `--watch` | Review the branch and its uncommitted changes again 30 s after each change, until you stop the command. Each finding prints as one line. See [Watching a checkout](#watching-a-checkout). |

### Uncommitted changes

`--uncommitted` lists the files that it will send, and asks you to agree before it sends them. It never sends ignored
files. If there is no terminal, for example under Claude Code, it sends nothing. It prints the list and a command like
this one, and exits with code 3:

```bash
rectifier review --uncommitted --confirm 7f3a9c
```

Run that command when you agree. If a listed file changed since, the command stops and lists the files again.

To send only some of your uncommitted changes, add `--path` with a git pathspec. Give it again for more. As in git,
a path is read from the folder you run the command in, or from `-C`. A pathspec that starts with `:!` leaves its files
out:

```bash
rectifier review --uncommitted --path src/ --path docs/
rectifier review --uncommitted --path ':!scratch/' --path ':!*.log'
```

`--path` does not go with `--watch` or `--local`. To keep untracked files out of every review, add them to
`.git/info/exclude`.

## Reading the review

The CLI prints the review to stdout as markdown, and its progress to stderr. It also writes the markdown and the JSON to
`.rectifier/reviews/`, which git ignores. While a review runs, `.rectifier/reviews/<job>.status` holds its latest
status line, such as `review <job>: running, 47%`. You can read that file from another terminal or a script.

When the service is sure which kind of review runs, or else when the review ends, the command says it on stderr:

| Line | When |
| --- | --- |
| `starting full review (default; --light for faster)` | You gave no `--full` or `--light`, and the review is a full review. |
| `starting light review (your account's setting; --full for a full review)` | You gave no `--full` or `--light`, and your account's setting makes the review light. |
| `starting full review` | You gave `--full`. |
| `starting light review` | You gave `--light`. |

When the kind of review is first known only at the end, the same line says `ran a full review` or `ran a light review` in place of `starting ...`.

### Exit codes

| Exit code | Meaning |
| --- | --- |
| 0 | Nothing blocks |
| 1 | A finding blocks. The "Request changes at" [setting](pr-reviews.md#settings) decides which findings block. |
| 2 | The review did not run or did not complete. The error is on stderr. For `rectifier report`, also: there is no such review, or Rectifier does not keep its findings. For `rectifier scans`: the list could not be read. For `rectifier scan-report`: there is no such scan, it has not finished, its report expired or was deleted, or a report could not be read. For `rectifier scan-verdict`: there is no such scan or finding, its report expired or was deleted, or the answer could not be sent. For `rectifier verdict`: there is no such review or finding, Rectifier no longer keeps its findings, or the answer could not be sent. |
| 3 | `--uncommitted`, `--local`, `--tfvc` or `--watch` is waiting for you to agree to what it sends |
| 4 | `rectifier status` without `--wait`, and `rectifier report`: the review has not ended yet |
| 130 | You stopped the command with Ctrl-C. A review it was waiting for continues. |

### JSON

`--json` prints the review as JSON. Rely on these fields:

| Field | Value |
| --- | --- |
| `verdict` | `"Accept"` or `"Request changes"`. Read the exit code first: a review that did not complete can still say `"Accept"`. |
| `findings[]` | Each finding. Empty for a review with no findings. |
| `findings[].severity` | `"Critical"`, `"High"`, `"Medium"` or `"Low"` |
| `findings[].title`, `.body` | The title and what is wrong |
| `findings[].file`, `.line` | Where it is |
| `findings[].blocking` | `true` if it blocks |
| `findings[].agent_message` | A message for a coding agent to fix it |
| `review.repo` | The repository path, such as `owner/name` or `group/sub/name` |
| `review.head` | The commit reviewed. With `--uncommitted`, the commit the changes sit on. |
| `review.number` | The open pull request's number, or `null` |

## Posting

- Rectifier posts nothing without `--post`.
- `--post` posts on the branch's open pull request. The pull request must have the reviewed commits. Rectifier never
  posts a review of uncommitted changes.
- The summary names the command that asked for it. For a commit or a range, it says the review read only part of the
  change.
- To post a review that ended without `--post`, run the same command with `--post` within an hour. Rectifier posts
  that review and does not review again.

## Running it again

- Ctrl-C stops the wait, not the review. Run the same command to pick it up.
- If you run the same command on the same commits within an hour of a review's end, it prints that review again. It
  says that no new review ran. Add `--force` to run a new one. If the review failed, the command runs a new one.
- After you add commits, `rectifier review` reviews the whole branch again. Use `--last N` to review only the new
  commits.
- Each `--uncommitted` run is a new review.

## Use it with a coding agent

The rectifier skill teaches your coding agent to use the CLI. The dashboard's [Connect an agent](https://app.rectifier.imbik.ai/#agents) page has
the lines to copy for each agent.

In Claude Code, install the rectifier plugin. It carries the skill and adds Rectifier's [MCP server](mcp.md):

```
claude plugin marketplace add imbik-ai/rectifier-agents
claude plugin install rectifier@rectifier
```

For other agents, `rectifier skill install` writes the skill, a `SKILL.md` file, where agents load skills for your
user:

- `~/.agents/skills/rectifier/`, which Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Amp read.
- `~/.claude/skills/rectifier/` for Claude Code, if `~/.claude` exists. If you installed the rectifier plugin for
  Claude Code, the plugin carries the skill, and the command removes this copy instead.

Start a new agent session to load it. Then ask your agent to have rectifier review your changes. The skill tells the
agent how to sign in with `rectifier login`, how to run a review, and how to act on the findings. It also covers
`--watch`.

The skill comes with the CLI. After you upgrade the CLI, run `rectifier skill install` again. `rectifier skill show`
prints the skill, for an agent that loads skills from another folder.

If your agent runs commands in a sandbox that blocks the network, such as the default sandbox of Codex or Cursor,
approve running `rectifier` outside the sandbox when the agent asks.

## Experimental features

These features can change in a later release.

### Local-only git repositories

`--local` reviews a git repository that has no remote, or that is on a host rectifier does not read. It works with each
command above. Rectifier has none of the commits of this repository, so the command uploads the repository with its
history. If the repository is over about 71 MB, it uploads only the base and the head.

The command lists what it sends and asks first, as `--uncommitted` does. If there is no `origin`, it compares the branch
with a local `main` or `master`, or with `--base REF`. Rectifier never posts a local review.

### TFVC workspaces

`--tfvc` reviews Team Foundation Version Control changes. Run it from a folder of a TFVC workspace. `tf` must be on the
PATH, as in a Developer PowerShell for Visual Studio, or `TF_PATH` must name `tf.exe`. The command also needs git.

```powershell
rectifier review --tfvc                       # the pending changes in this folder
rectifier review --tfvc --changeset 1234      # a checked-in changeset
rectifier review --tfvc --shelveset my-work   # a shelveset
```

The command sends each changed file before and after the change. It also sends the other text files of the folder, so
that the reviewer can read the code around the change. It does not send binary files or files over 1 MB. It lists what
it sends and asks first. Rectifier never posts a TFVC review. The command writes its report to
`%LOCALAPPDATA%\rectifier\`, so that TFVC does not show the report as a change.

A rename can move a file or a folder into or out of your folder. If it does, run the command from a folder that holds
both sides.

### Watching a checkout

`--watch` is for a coding agent that edits the checkout, such as Claude Code with its Monitor tool. When the checkout
has not changed for 30 seconds, the command sends the branch and its uncommitted changes for a review, as
`--uncommitted --base` does. If nothing is uncommitted, it sends the branch. One review runs at a time. If the checkout
changes while a review runs, the newest state is reviewed next. Only one watch runs in a checkout at a time: a second
one prints a line that says so and exits with code 2.

`--watch` is open to some accounts only. For any other account, each review prints a `review not sent` line that says
the watch is not open for this account. Run `rectifier review` instead.

The command prints only these lines to stdout, one for each event:

```text
watching /path/to/checkout against origin/main: a review goes 30 s after the last change; ...
suspected 6f1d3c9a2b7e4f08c5a91d3e/s1-5be0a1c2 High src/app.py:41 The title
finding 6f1d3c9a2b7e4f08c5a91d3e/1 High blocking src/app.py:42 The title (details: .rectifier/reviews/2026-10-27-101500-8d41e07-uncommitted.md)
confirmed 6f1d3c9a2b7e4f08c5a91d3e/s1-5be0a1c2 -> 6f1d3c9a2b7e4f08c5a91d3e/1
withdrawn 6f1d3c9a2b7e4f08c5a91d3e/s2-5be0a1c2
unchecked 6f1d3c9a2b7e4f08c5a91d3e/s3-5be0a1c2
unchecked 6f1d3c9a2b7e4f08c5a91d3e/s4-5be0a1c2 (stopped for a newer checkpoint)
review 6f1d3c9a2b7e4f08c5a91d3e done: 1 new finding, 0 printed before, 2 suspected, 1 withdrawn
review 7a2e4d0b3c8f5a19d6b02e4f done, read since 8d41e07: 0 new findings, 0 printed before
review 6f1d3c9a2b7e4f08c5a91d3e failed: the reason; the next change sends a new one
review not sent: the reason; the next change sends a new one
review covered by #123: its findings post on the pull request when its review ends
not sent: .env looks like a secret; take it out of the changes or add it to .gitignore, and the next review goes
```

When the service is sure which kind of review runs, or else when the review ends, the command says it on stderr:
`review <job>: full review` or `review <job>: light review`. These lines are not on stdout.

A review reads the checkout as it was when the command sent it, and its lines print a few minutes later. If the
checkout has changed since, each `finding` and `suspected` line ends with what the review read, for example
`(read 8d41e07 + uncommitted, 2 commits behind HEAD)`, or `not in HEAD's history` after a rebase or a reset. A line
whose code changed within 5 lines of it since the review read it also ends with
`(these lines changed since 1a2b3c4)`. This does not mean that the finding is fixed: look at the current code before
you act on such a line or skip it. A line about the checkout as it is now has neither.

A finding with the same file and title as one that an earlier review of the watch printed is not printed again. The
saved markdown has every finding in full. After a review fails, the command sends the same changes again after the next
change, or when you run the command again.

While a review runs, the command can print `suspected` lines. A suspected finding is one that two or more of the
review's reviewer agents found, which the review has not checked yet. Treat it as a lead: check it yourself before you
act on it. When the review ends, each suspected finding that printed gets one line that resolves it. `confirmed` names
the finding of the review that confirms it, or says `printed before` when an earlier review printed that finding.
`withdrawn` says the review did not keep it. `unchecked` says the review failed, or its result has no verdict on it, as
when the service started the review again and found its suspected findings anew. A suspected finding with the same file
and title as a finding that an earlier review printed, or a suspected one it confirmed, is not printed; one that was
withdrawn or unchecked can print again. Not every review prints suspected findings.

For some accounts, a review after the first can read only what changed since the state that the last review read,
with the whole branch there for context, as a pull request's later review reads only what changed since its last
round. The command asks for this only when the last review ended, read all of what it was sent, and had the same base
and branch. The `done` line of such a review says what it read: `read since <commit>`, or `read the whole branch` with
the reason, when the service could not read on from that state.

For some accounts, a newer state of the checkout can stop the review that runs. The command does this only while that
review has run for less than 3 minutes, and never for more than 2 reviews in a row, so a checkout that changes all the
time still gets a review that ends. A review that is still waiting to start is always replaced. The new review gets
what the stopped review's reviewer agents had found so far, and checks it again. Each suspected finding that the stopped
review printed gets one `unchecked ... (stopped for a newer checkpoint)` line. If the new review finds it again, it
prints again under the new review. If the stopped review ended before the stop reached it, its findings print as
usual.

For some accounts, when you have pushed and have nothing uncommitted, and a pull request review of that same commit is
already waiting or running, the command starts no review of its own. It prints `review covered by #123`, and the
findings post on that pull request. Wait for the pull request's review check (for example `gh pr checks 123`), then read
its review comments. Where the pull request has no review check, read the comments when the review posts. The command
prints nothing more for that state of the checkout, and sends the next change as usual.

The first run lists what it would send now and exits with code 3, as `--uncommitted` does. When you agree, run the
command that it prints, with `--confirm CODE`. The code covers the watch: the command sends later changes without
asking, and you can run the same command again to continue the watch. The code covers only the base it was given for:
with another `--base`, the command lists what it sends and asks again.

The command sends nothing while the branch and the uncommitted changes add a file, against the base, whose name looks
like a secret, such as `.env`, `*.pem` or `id_rsa`, whether the file is untracked, staged or committed. It reads only
what the changes add: a secret committed on the branch and removed again in a later commit still travels in the
history the command uploads, as with every `rectifier review`. The command also sends nothing while a merge, rebase,
cherry-pick or revert is in progress. If the command stops while it sends a review, it sends the same review again
when you run it again. If it cannot reach the service, it keeps watching and tries again. It keeps what it printed in
`.rectifier/watch.json`, and one line for each review, with its times and counts, in `.rectifier/watch.jsonl`, the
count of `these lines changed since` lines among them. That line also keeps each line the review printed: the
finding's path, line and title, the verdict on a suspected finding, and its `these lines changed since` mark as git
tree ids and hunk line numbers, with no file contents. Each request carries the watch's own timings (the quiet before
it was sent, and the wait behind a review in flight) and a random id for the watch, with nothing of your files. Stop it
with Ctrl-C. A review that is running continues, and the same command picks it up.
