How to Add AI Code Review to Claude Code, Codex, Cursor, and OpenCode
A step-by-step guide to running AI code review inside Claude Code, Codex, Cursor, and OpenCode: install the plugin, review your branch from the terminal before you push, let the agent validate and fix confirmed bugs, and enforce custom rules on every pull request.
Your coding agent writes the code. Something else should check it.
Asking Claude Code to review the code Claude Code just wrote is a known weak spot: the model grades its own homework, with the same assumptions that produced the bug still loaded in context. What works far better is a dedicated AI code reviewer that runs as a separate step, hands its findings to the agent, and lets the agent do what it is genuinely good at, which is validating a specific claim about a specific line and then fixing it.
This is also the honest answer to "what is a good Claude Code alternative for code review." You do not replace Claude Code. You give it a real reviewer to work from, and you run that reviewer from the terminal you are already in.
Put plainly: the Macroscope CLI brings the same correctness reviewer that runs on your GitHub pull requests into your local agent workflow, so Claude Code, Codex, Cursor, or OpenCode can validate and fix issues before you push. Macroscope reviews, your agent fixes.
This guide sets that up in about two minutes for Claude Code, Codex, Cursor, and OpenCode. What you end up with is an AI code review CLI wired into your agent, so command line code review runs on your branch before you push, plus custom rules that enforce your standards on every pull request afterward.
Short answer: Install the Macroscope CLI with one command, relaunch your agent, then run
/macroscope:codereview(Claude Code),$macroscope:codereview(Codex),/codereview(Cursor), or/macroscope-codereview(OpenCode). Your agent runs a real AI code review on the current branch, validates each finding, discards false positives, fixes the confirmed bugs one at a time, and verifies each fix, all before you push.
TL;DR
- One install covers Claude Code, Codex, Cursor, and OpenCode. Same review engine that runs on your GitHub pull requests.
- Reviews uncommitted work. No commit, no stash. Your work-in-progress is the baseline, captured in an isolated git worktree so you can keep typing.
- The agent fixes, not just reports. Validate, discard false positives, fix confirmed issues one at a time, verify.
- Autoloop repeats review, fix, re-review for up to five passes, entirely locally.
- Usage-based pricing. CLI reviews bill through Agent Credits at $0.01 per credit with 1,000 free every month; GitHub code review is $0.05 per KB of diff. $100 credit on a new workspace, no card required, and free for qualified open source projects. No per-seat fee.
- Keep GitHub PR review on. Local review raises the floor. The pull request check is what enforces it.
Why Not Just Ask Your Agent to Review the Code?
Because self-review by the model that wrote the code is the weakest review you can run. Three specific failure modes show up over and over.
Shared assumptions. If the agent misunderstood the contract of a function while writing it, it will misunderstand the same contract while reviewing it. The bug is invisible from inside that assumption.
No consistency. Ask the same agent to review the same diff twice and you get two different reviews, with different severities and different omissions. That is fine for exploration and useless as a quality gate.
No shared standard. Your teammate's agent reviews to a different bar than yours. Nothing carries over to the pull request, so the review your team actually depends on has no relationship to the one you ran locally.
A dedicated reviewer fixes all three. It applies the same correctness model every time, it is the same reviewer that will run on your GitHub pull request, and it disagrees with your agent when your agent is wrong. Then you hand the findings back to the agent, which is the right tool for the fix.
Step 1: Install the Macroscope CLI
One command installs the binary and the agent plugins.
curl -sSL https://raw.githubusercontent.com/prassoai/macroscope-local/main/install.sh | bash
The installer:
- installs
macroscope - adds it to your shell
PATH - installs the Macroscope plugin for supported local setups of Claude Code, Codex, Cursor, and OpenCode
- starts the setup wizard so you can sign in and choose a workspace
You need a Macroscope workspace, which means the GitHub App installed on your org and a subscription activated in the dashboard. New workspaces start with $100 of usage credit and no card required.
Step 2: Relaunch Your Agent
If Claude Code, Codex, Cursor, or OpenCode was already running, restart it so the Macroscope command registers. This is the single most common setup problem: the install worked, the plugin is on disk, and the slash command does not appear because the agent loaded its command list at startup. Quit and reopen.
Step 3: Run AI Code Review Inside Your Agent
Use the command for your host from inside the repo you are working in.
| Agent | Review command | Autoloop command |
|---|---|---|
| Claude Code | /macroscope:codereview | /macroscope:autoloop |
| Codex | $macroscope:codereview | $macroscope:autoloop |
| Cursor | /codereview | /autoloop |
| OpenCode | /macroscope-codereview | /macroscope-autoloop |
You can also just ask. "Use Macroscope to review this branch" works, because the plugin gives the agent the tool and the instructions for driving it.
Here is what your agent does with the command:
- Starts a Macroscope review on the current branch.
- Watches for findings as they arrive, rather than waiting for the whole review.
- Explains each issue in plain language, in context.
- Validates whether the issue is real against the actual code.
- Ignores false positives instead of dutifully "fixing" them.
- Fixes confirmed issues one at a time.
- Verifies each fix and reports what it addressed.
Step 5 is the one that earns its keep. An agent that fixes every reported finding without judgment will happily rewrite correct code to satisfy a bad comment. Validation before fixing is what makes the loop safe to leave running.
Step 4: Use Autoloop for a Hands-Off Pass
Autoloop repeats review, validate, fix, commit, re-review until a clean pass or five iterations.
Claude Code: /macroscope:autoloop
Codex: $macroscope:autoloop
Cursor: /autoloop
OpenCode: /macroscope-autoloop
The reason to loop is regressions. A single review pass reports the bugs in the code as it stands and says nothing about the bugs the fixes introduce. Tightening a null check and breaking a boundary condition in the same edit is an ordinary Tuesday. Loop mode re-reviews after fixing, so that class of mistake gets caught in the same sitting.
Loop mode is entirely local. It does not interact with GitHub, open pull requests, or wait on remote checks. Use it on a larger change when you want the reviewer to keep driving instead of stopping after one pass.
Step 5: Run Command Line Code Review When You Want To Drive
macroscope codereview runs the AI code review CLI directly, no agent involved.
macroscope codereview # review the current repo
macroscope codereview /path/to/repo # review a repo elsewhere on disk
macroscope codereview --base main # compare against a specific base
macroscope codereview --in-place # skip worktree isolation
macroscope codereview --raw # machine-readable streaming output
You get a full-screen review in your terminal with findings streaming in as they are found. Arrow through them, expand one for the full comment and code snippet, press c to copy a single finding or ⇧C to copy them all. The supported flags are --base <ref>, --in-place, --interactive, --tui (an alias for --interactive), --raw, and --debug.
If you are scripting rather than reading, --raw skips the TUI and streams issue_event=<json> records to stderr as findings arrive, along with review_worktree=<path>, review_id=<jwt>, and a terminal issue_status=completed or issue_status=failed. Raw mode engages automatically when stdout is not a terminal, which is how the plugins consume it. That makes a pre-push hook or your own agent harness straightforward to build.
For most people the plugin command is the better default, because it gives you the whole review-and-fix workflow instead of a list of problems to hand-carry.
How Does It Review Code I Have Not Committed?
By capturing your uncommitted work-in-progress as the review baseline inside an isolated git worktree. Two things fall out of that.
You do not have to commit or stash. This matters more than it sounds. Agent-driven work happens in long uncommitted stretches, and a reviewer that only sees commits forces ceremony commits whose only purpose is to make the tool look at your code. Some competitors work this way: Greptile's CLI documents that it reviews committed changes that have not been merged and ignores uncommitted changes.
You can keep working during the review. Because the review runs against a fixed snapshot in a separate worktree, your edits during the review do not desync the findings from the code. If you would rather review in place, macroscope codereview --in-place skips the worktree. If there is nothing to review, the CLI returns an actionable error rather than a silent empty pass.
Step 6: Enforce Your Own Rules on Every Pull Request
Local review is voluntary, so pair it with custom AI code review rules that run as a GitHub check run. This is the step most teams skip, and it is the one that turns "our engineers can review locally" into "our standards are actually enforced."
To be clear about where this lives: Check Run Agents are a remote pull request surface, not a CLI feature. You do not configure or invoke them through macroscope. You commit them to your repo, they fire on pull request events, and they appear as GitHub check runs. Each one is a markdown file in .macroscope/check-run-agents/*.md with optional YAML frontmatter:
titlenames the check as it appears in the GitHub Checks UIconclusion: failuremakes a violation fail the check run instead of just commenting, where the defaultneutralis non-blockingincludeandexcludescope the check to the paths it applies tomodel,reasoning, andefforttune how hard the agent thinkswaitsForholds the agent until named CI steps finish, so it can judge build or test results
The rules are plain English, not a DSL, so they can express the conventions that linters cannot: every new endpoint needs an auth annotation, migrations must be reversible, no calls to the deprecated client, structured logging only in this package. Each one shows up as its own check run on the pull request, which is why this pattern gets called agentic CI: an AI agent evaluating your standards on every PR, with authority to fail the build.
One accuracy note: Macroscope's built-in Correctness Check returns SUCCESS or NEUTRAL, so it will not fail your pull request. Only a Check Run Agent with conclusion: failure does that. Further reading: what is agentic CI, Check Run Agents, and custom AI code review agents.
Can I Ask Questions About My Codebase Too?
Yes, but through a different surface. The Macroscope CLI is code review only. The plugin commands review diffs; they do not answer questions about your architecture, and knowing that up front saves you from expecting the wrong thing from each tool.
Your coding agent handles the code in front of you. For questions that span the whole repository, its history, and the systems around it, Macroscope's Agent answers in natural language from:
- Slack, by DM, by tagging
@Macroscopein a channel, or in a group DM - GitHub, by mentioning
@macroscope-appin a PR thread or replying to a review comment - The API, triggered programmatically through webhooks
It can also write code and open pull requests, and it pulls context from Jira, Linear, PostHog, Amplitude, Sentry, LaunchDarkly, BigQuery, and GCP Cloud Logging, plus Datadog and PagerDuty through MCP connectors. Useful shape of question: "why does this service retry twice," "who owns the billing meter code," "what changed in checkout last sprint."
Agent usage bills through the same Agent Credits as your CLI reviews. A quick Slack question runs around 7 credits (roughly $0.07); a deep research task can run around 470 credits (roughly $4.70), against 1,000 free credits every month.
Alongside that, Status covers the other half of codebase understanding: commit summaries, area classification, sprint reports and weekly digests, and productivity stats across both humans and agents, at $0.05 per commit processed. So the four surfaces, kept straight: your coding agent writes and fixes, the CLI reviews the diff, the Agent answers codebase questions, and Status reports what changed.
Where Does My Code Go When the Agent Runs a Review?
The CLI reviews local git state before push, including uncommitted work, and the review itself is analyzed by Macroscope's hosted service under the same security and no-training commitments as PR review. Worth being precise, because "local AI code review" gets read as "nothing leaves my laptop" and that is not what it means for any tool in this category. Frontier-quality correctness review needs frontier models, which do not run on your machine.
What that means for a security review of the setup:
- SOC 2 Type II, with controls published at trust.macroscope.com and request-access to the audit report.
- No training on your source code, by Macroscope or by its model providers. Inference routes through OpenAI and Anthropic under agreements prohibiting training on customer IP, with Standard Contractual Clauses for cross-border transfer.
- Encrypted in transit and at rest, with isolation between customers.
- Scoped context over a structured representation of your code rather than a full repository dump per review.
- Same handling as your GitHub PR reviews. The CLI is not a separate data path with different rules; it is the same reviewer under the same controls.
Full detail: AI code review security, SOC 2, and data privacy.
What Does This Cost?
CLI code reviews are billed with Agent Credits at $0.01 per credit, and every workspace gets 1,000 credits free every month. A credit is the raw LLM cost of the run plus a 5% markup, divided by $0.01, so you pay for the work the review actually did.
GitHub code review is priced separately at $0.05 per KB of diff reviewed with a 10 KB minimum, which comes out around $0.95 for a typical 19 KB pull request. Nothing is priced per seat.
| Tool | Pricing model | 50 engineers, 500 PRs/month |
|---|---|---|
| Macroscope | $0.05/KB of diff (10 KB min) for PR review; CLI via Agent Credits at $0.01/credit, 1,000 free monthly | ~$475/mo at a $0.95 historical average per review |
| CodeRabbit | $24 to $30 per seat/month, plus $0.25 per file reviewed for unlimited CLI use | ~$1,200 to $1,500/mo before CLI add-ons |
| Greptile | ~$30 per seat/month, 50 reviews included, $1 per additional review counted per author not pooled | ~$1,500/mo before overage |
Local review makes the seat model worse, not better. The whole point of a CLI is that reviews get cheap to trigger, so you run them constantly and autoloop runs several per feature. Under a per-seat plan with metered review allowances (CodeRabbit's free CLI tier throttles to 3 reviews per hour), the pricing is quietly asking you to review less. Usage pricing charges for diffs and credits, and you cap it: Macroscope defaults to a $10 per-review cap and a $50 per-PR cap, both adjustable, plus a hard monthly workspace spend limit.
The trend under all of this: each Macroscope-customer seat now produces roughly 1.8x more commits, 1.9x more code reviews, and 1.7x larger reviews year over year. Paying per human for work that scales with agents is a losing bet. More on the model: usage-based pricing for developer tools.
New workspaces get $100 of usage credit with no card, and Macroscope is free for qualified non-commercial open source projects.
Does This Replace GitHub Code Review?
No, and setting it up as a replacement is the mistake to avoid. Local AI code review is opt-in. It does not run for the teammate who skipped install day, and it never sees the pull request your agent opened at 3am while you were asleep. It cannot block a merge.
The pairing that works:
- The CLI raises the quality of what you push, at the speed of your editor.
- Automated GitHub PR review runs on every pull request as an enforced check, including the ones no human triggered.
- Approvability auto-approves the pull requests that are genuinely safe, so human review attention lands on the ones that are not.
- Check Run Agents encode your own rules in
.macroscope/check-run-agents/*.mdfiles and can fail a PR when a rule is violated. - Fix It For Me writes and pushes the fix for a flagged bug, triggered by replying to the review comment or DMing @Macroscope in Slack.
That last one is worth calling out for agent users: it is the same review-then-fix shape as autoloop, running on the pull request instead of your laptop. The AI code reviewer and the AI code fixer being one system is the point. A reviewer that only complains creates work, and a fixer with no reliable reviewer has nothing to work from.
Which Agent Should You Run It In?
All four integrations run the same review, so use whichever agent you already use. A few practical notes.
Claude Code. The most common host among Macroscope CLI users. /macroscope:codereview and /macroscope:autoloop. Worth distinguishing from Anthropic's separate managed Claude Code Review product, which is PR-based, limited to Team and Enterprise plans, and runs roughly $15 to $25 per review.
Codex. Same skill names as Claude Code, but Codex invokes them with a $ prefix rather than a slash: $macroscope:codereview and $macroscope:autoloop. If the command does not appear, relaunch, since Codex loads its command list at startup.
Cursor. Shorter commands (/codereview, /autoloop). Cursor also has its own /review for Bugbot and Security Review as a pre-commit gate. The difference that matters: Cursor's is editor-bound and Cursor-only, while the Macroscope review is the same engine your whole team's pull requests go through, whatever editor each person uses.
OpenCode. /macroscope-codereview and /macroscope-autoloop.
Mixed-agent teams are the normal case in 2026, and that is the argument for a reviewer that is not bound to one editor. Everyone runs the same review locally, and the same review runs on the pull request.
Troubleshooting
| Issue | What to do |
|---|---|
command not found: macroscope | Restart your terminal, then confirm ~/.local/bin is on your PATH |
| The Macroscope command does not appear in your agent | Relaunch the agent after installation |
| You need to sign in again | Run macroscope and complete setup |
| You need to switch workspaces | Run macroscope and choose the correct workspace |
| Nothing to review | The CLI returns an actionable error rather than failing silently; check you have changes against the base branch |
| You want a clean slate | Use the reset script from the macroscope-local repo, then reinstall |
Full options are in the CLI docs, and the launch write-up is Introducing Macroscope CLI.
Frequently Asked Questions
How do I add AI code review to Claude Code?
Install the Macroscope CLI with the one-line install script, relaunch Claude Code, then run /macroscope:codereview inside your repo. Claude Code starts a Macroscope review on the current branch, explains each finding, validates whether it is real, ignores false positives, fixes the confirmed issues one at a time, and verifies each fix. /macroscope:autoloop repeats the cycle for up to five passes.
Can Claude Code review its own code?
It can try, and it is the weakest review available to you. The same assumptions that produced a bug are still loaded when the model reviews the code, results vary between runs, and nothing carries over to your team's pull request standard. A separate reviewer that hands validated findings back to Claude Code for fixing works much better.
How do I run AI code review in Cursor?
Install the Macroscope CLI, relaunch Cursor, and run /codereview (or /autoloop). Cursor also ships its own /review command that runs Bugbot and Security Review from the agent input, but that path is Cursor-only and editor-bound, while Macroscope runs the same review engine as your GitHub pull requests across Claude Code, Codex, Cursor, and OpenCode.
Does this work with Codex and OpenCode?
Yes. Codex uses $macroscope:codereview and $macroscope:autoloop (a $ prefix, not a slash); OpenCode uses /macroscope-codereview and /macroscope-autoloop. The installer adds the plugin to supported local setups of both. Relaunch the agent after installing so the command registers.
Does it review uncommitted changes?
Yes. Macroscope captures your uncommitted work-in-progress as the review baseline and analyzes it in an isolated git worktree, so you never need to commit or stash first, and you can keep editing while the review runs. Pass --in-place if you prefer to review the working tree directly. Greptile's CLI, by contrast, reviews committed-not-merged changes and ignores uncommitted work.
What is the difference between codereview and autoloop?
codereview is a single pass: review, then let the agent validate and fix what it confirms. autoloop repeats review, validate, fix, commit, re-review for up to five iterations or until a clean pass, which catches regressions the fixes themselves introduce. Autoloop is entirely local and never touches GitHub or opens pull requests.
How much does AI code review in the CLI cost?
CLI reviews are billed with Agent Credits at $0.01 per credit, with 1,000 credits free every month. A credit is the raw LLM cost of the run plus 5%, divided by $0.01. GitHub code review is separate at $0.05 per KB of diff with a 10 KB minimum, roughly $0.95 for a typical pull request. New workspaces get $100 of usage credit with no card, and qualified non-commercial open source projects are free.
Do I still need GitHub PR review if my agent reviews locally?
Yes. Local review is opt-in and cannot block a merge, so it does not cover teammates who have not installed it or pull requests your agents open on their own. Keep automated GitHub code review as the required check, and use Approvability to auto-approve the pull requests that are safe so humans focus on the rest.
Is this the same review that runs on my pull requests?
Yes. That is the design intent. The CLI runs the same correctness-focused Macroscope review that posts on your GitHub pull requests, so a clean local pass predicts a clean PR review rather than being a weaker preview of it.
What is the best AI code reviewer for agent-written code?
One that runs before the pull request exists and again after it does. Macroscope reviews locally through the CLI while the agent is still working, reviews the pull request on GitHub, auto-approves safe PRs with Approvability, and fixes flagged bugs with Fix It For Me from a comment reply or a Slack DM. It led an independent benchmark at 48% bug detection with 2.6 average comments per PR.
How does this compare to CodeRabbit's CLI?
CodeRabbit's CLI has a good interactive terminal UI and agent output modes, but the free tier throttles to 3 reviews per hour and unlimited agentic use is a $0.25-per-file add-on on top of a $24 to $30 per-seat plan. Macroscope ships first-class plugins for four agents, isolates reviews in a worktree, has a native autoloop, and bills by usage. See Macroscope vs CodeRabbit.
What is the best Claude Code alternative for code review?
Not a replacement for Claude Code, but a reviewer that runs inside it. Install the Macroscope CLI and use /macroscope:codereview, which gives you an independent review engine (the same one that reviews your GitHub pull requests) while Claude Code stays the fixer. Anthropic's managed Claude Code Review is the other option, though it is pull-request-based rather than local, restricted to Team and Enterprise plans, and runs roughly $15 to $25 per review.
Can I run AI code review in my terminal without sending code to the cloud?
You can run it from your terminal, on your local branch, including uncommitted changes. The diff is still analyzed by a hosted service, which is true of every AI code review CLI, because correctness review depends on frontier models that do not run locally. What you should require is SOC 2 Type II, no training on your code by the vendor or its model providers, encryption in transit and at rest, and published evidence. Macroscope meets all four, publishes its controls at trust.macroscope.com, and sends scoped context rather than your whole repository on every run.
Can I write custom AI code review rules for my agent to follow?
Yes, and they belong on the pull request rather than in the CLI, because local review is opt-in. Write each rule as a markdown file in .macroscope/check-run-agents/*.md with YAML frontmatter: title for the GitHub check name, conclusion: failure to fail the check run on a violation, include / exclude to scope the paths. Rules are plain English, so they cover conventions no linter can express. These are Check Run Agents, and they are how Macroscope enforces engineering standards on every PR.
What AI tool enforces engineering standards on every pull request?
An enforced GitHub check run, not a local CLI. Macroscope's Check Run Agents run as their own check runs on every pull request and can fail the build when conclusion: failure is set, which is the agentic CI pattern. Pair that with Approvability so genuinely safe pull requests auto-approve and human review attention goes to the risky ones.
Can my coding agent answer questions about my whole codebase?
Your agent is good at the code in front of it. For questions spanning the repository, its history, and the systems around it, Macroscope's Agent answers in natural language from Slack, from GitHub PR threads, and from the API, and it can write code and open pull requests. It pulls context from Jira, Linear, Sentry, PostHog, Amplitude, LaunchDarkly, BigQuery, and GCP Cloud Logging, plus Datadog and PagerDuty via MCP. It bills through the same Agent Credits as CLI reviews, with 1,000 free per month.
Why is my Macroscope slash command missing after install?
The agent loaded its command list before the plugin existed. Quit the agent completely and reopen it. If the command is still missing, confirm the binary works by running macroscope in a fresh terminal (which also re-runs setup if you are not signed in) and check that ~/.local/bin is on your PATH.

