Output and exit codes
AbstractA review ends in one of six states. The command line writes a JSON report to stdout and exits 0 or 2. With --post, or from the poller, it also publishes one comment on the reviewed head. This page lists every state, every field, and the comment's exact shape.
Six states
| State | Exit status | When |
|---|---|---|
over-budget | 2 | The estimate is above the limit. The model was not called. |
estimate | 0 | --estimate was given. The model was not called. |
model-unavailable | 2 | The model failed, timed out, or returned an answer the reviewer rejects. |
partial | 2 | A path was left out, or a check could not run. |
reviewed | 0 | The model ran, and nothing is incomplete. |
empty | 0 | There was no text to review, and nothing is incomplete. |
The second line of every posted comment is one of these words.
The JSON report
cursor-review writes one JSON object to stdout. When it catches an error it writes nothing to stdout, and prints cursor-review: <message> on stderr.
| Key | Present | Holds |
|---|---|---|
provider | Always | cursor, claude or codex |
source | Always | The change's address, or the repository path |
head | Always | The full commit that was reviewed |
model | Always | The model named, or <provider>-default |
estimated_input_tokens | Always | The estimate. 0 when there is no text to review. |
max_input_tokens | Always | The limit in force |
state | Always | One of the six states |
findings | Always | The model's findings, at most three. Each has path, line, end_line, title and message. |
omitted | Always | The sorted paths outside the review's coverage |
checks | Always | ShellCheck, actionlint and any Go analysis. One entry per file, with its state, its findings, and a reason when it could not check. |
static_checks | When any ran | Hadolint, zizmor and OSV-Scanner. One entry per file, with its source (ci or local), its state, its findings and a reason. |
cache_hit | Always | Whether the model's answer came from the cache |
model_invocations | Always | How many model calls the review made: 0 or 1 |
model_usage | Always | The usage the provider CLI reported, or null |
qualgen | With history | Its state, the advisories, the unscreened paths and the history_head |
error | model-unavailable | What went wrong |
cursor_team_id | Cursor with a team | The team billed |
publication | With --post | posted-or-already-present, or failed |
Cost and coverage quotes a complete report from a real --estimate run, with each field annotated.
The posted comment
A review posts at most one comment, as an ordinary comment on the reviewed head. Its lines follow a fixed order:
- A header: the provider's name, then
review of, then the full commit. - The state.
- Each model finding: its path and line, then the finding's title and message.
- One line on what became of the model:
Skipped <provider>. Estimated prompt <n> tokens exceeds the limit of <m>., or<provider> could not complete the review., or, when there are no findings,No model findings in the reviewed scope. - Each local check that could not run, and the findings of those that did.
- A
Static checksblock: one count per tool, then up to 30 entries. - A history block: its title, then up to 20 entries.
- Each path outside the review's coverage.
- A blank line, then credit to PR-Agent.
Where the backticks come from
Paths come from the pull request. Titles and messages come from the model. The comment sets each one as code, using a backtick run one longer than the longest run inside it.
A path chosen to look like a mention, or a message written to look like a link, is therefore posted as literal text. The reviewer's identity never posts a live mention or a link on a contributor's behalf.
A comment, assembled
The comment below is illustrative. Every line follows a template from the source, and the change is made up. It shows a review with one model finding, a check that could not run, a check finding, both blocks and one omitted path.
partial review.- Cursor review of 9c1f0ab2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8
Comment 1, on line 1: The header: provider, then the full commit.
- partial
Comment 2, on line 2: The state.
src/app.py:42 —Unhandled None.parse() can return None.Comment 3, on line 3: A model finding. Path, line, title and message, each set as code.
- actionlint: could not check
tool unavailableComment 4, on line 4: A local check that could not run, with its reason.
scripts/deploy.sh:12 —SC2086Double quote to prevent globbing and word splitting.Comment 5, on line 5: A finding from a check that did.
- Static checks
- hadolint: 1 CI, 0 local, 1 findings, 0 incomplete.
Comment 6, on line 8: Each tool's count: how many files came from CI, how many ran locally, the findings, the incomplete ones.
- zizmor: 0 CI, 1 local, 0 findings, 1 incomplete.
hadolint (ci) Dockerfile:3 — DL3007 Latest tag usedComment 7, on line 10: One Hadolint finding, from a CI report.
zizmor (local) .github/workflows/ci.yml — could not check: source unavailable or scanner failedComment 8, on line 11: zizmor's one file could not be checked, so the review is partial.
- Qualgen history advisories (baseline 3b9e21c7d4a0)
Comment 9, on line 14: The history block names the commit its history was mined from.
src/app.py — reference-rot: historically coupled to partner.pydocs/new.md — insufficient history or unable to screen- Outside review coverage:
docs/readme.mdComment 10, on line 18: A file the model never saw.
- Review tooling built on PR-Agent.
Comment 11, on line 20: The only link the reviewer posts.
What a comment leaves out
| Limit | In the comment | In the report |
|---|---|---|
| 30 scanner entries | Then a line saying how many were omitted | The full list under static_checks |
| 20 history entries | Then a line saying how many were omitted | The full list under qualgen |
| 450 characters per scanner entry, 500 per history entry | Cut | The full text |
Reading the exit status
| Exit status | Meaning |
|---|---|
| 0 | The requested review or estimate completed in full, including a review with findings |
| 2 | Partial coverage, a budget refusal, a model or tool error, or a publication failure |
Inspect state, checks and findings when a pipeline reads the report.