GuidesCLICommands

Global Flags

These flags are available on all commands:

FlagShortDefaultDescription
--format <fmt>-fterminalOutput format: terminal, json, markdown
--output <file>-oSave output to a file
--verbose-vfalseVerbose output
--quiet-qfalseQuiet mode (errors only)
--agentfalseAgent mode: deterministic machine-readable output

mesrai review

Analyzes modified files for code quality issues, bugs, security vulnerabilities, and style violations.

Usage

mesrai review                          # Review working tree changes (interactive)
mesrai review [files...]               # Review specific files
mesrai review --staged                 # Review staged files only
mesrai review --branch main            # Compare against a branch
mesrai review --commit abc123          # Analyze a specific commit
mesrai review --fix                    # Auto-apply all fixable issues
mesrai review --prompt-only            # Output optimized for AI agents

Flags

FlagShortDescription
--staged-sAnalyze only staged files
--commit <sha>-cAnalyze diff from a specific commit
--branch <name>-bCompare current branch against specified branch
--rules-onlyReview using only configured rules (no general suggestions)
--fastFast mode: quicker analysis with lighter checks
--interactive-iInteractive mode: navigate and apply fixes
--fixAutomatically apply all fixable issues
--prompt-onlyOutput optimized for AI agents
--fail-on <severity>Exit with code 1 if issues meet or exceed severity
--context <file>Custom context file to include in review
--fields <csv>Select response fields (JSON/agent mode), e.g. summary,issues.file

Review Modes

Navigate files with issue counts, preview suggested fixes, and apply them one by one.

mesrai review

mesrai pr suggestions

Fetch AI-powered suggestions for open pull requests.

Usage

mesrai pr suggestions --pr-url https://github.com/org/repo/pull/42
mesrai pr suggestions --pr-number 42 --repo-id <id>
mesrai pr suggestions --pr-number 42 --repo-id <id> --severity error,warning
mesrai pr suggestions --pr-number 42 --repo-id <id> --format json

Flags

FlagDescription
--pr-url <url>Pull request URL
--pr-number <number>Pull request number (requires --repo-id)
--repo-id <id>Repository ID for the pull request
--severity <list>Comma-separated severities to include
--category <list>Comma-separated categories to include
--fields <csv>Select response fields (JSON/agent mode), e.g. summary,issues.file

mesrai pr business-validation

Validate a local diff against the business rules/acceptance criteria of a task. Useful before merging to confirm the implementation matches the task intent.

Usage

mesrai pr business-validation --task-url https://linear.app/team/issue/KC-1441
mesrai pr business-validation --task-id KC-1441 --staged
mesrai pr business-validation --task-id KC-1441 --branch main
mesrai pr business-validation --task-id KC-1441 --commit abc123
mesrai pr business-validation --task-id KC-1441 --dry-run

Flags

FlagShortDescription
--task-url <url>Task URL to append to the validation command
--task-id <id>Task ID or issue key (e.g. KC-1441) to append
--staged-sUse only staged changes
--commit <sha>-cUse diff from a specific commit
--branch <name>-bCompare current branch against a base branch
--dry-runPrint payload without executing the API call

mesrai auth

Manage authentication with the Mesrai API.

auth login

mesrai auth login                              # Interactive login
mesrai auth login -e user@mail.com -p password # Non-interactive
FlagShortDescription
--email <email>-eAccount email
--password <password>-pAccount password

auth logout

mesrai auth logout

Removes local authentication (login and team key).

auth status

mesrai auth status

Shows authentication mode, email, token validity, organizations, trial status, and usage limits.

auth team-key

mesrai auth team-key --key mesrai_xxxxx

Authenticate using a shared team API key. Can also be set via the MESRAI_TEAM_KEY environment variable.

auth team-status

mesrai auth team-status

Shows team authentication details (organization and team name).

auth token

mesrai auth token

Generates a CI/CD token for use in automated pipelines. Use with the MESRAI_TOKEN environment variable.


mesrai hook

Manage pre-push Git hooks for automatic code review before pushing.

hook install

mesrai hook install                    # Default: fail-on critical, fast mode enabled
mesrai hook install --fail-on error    # Block pushes on error severity
mesrai hook install --no-fast          # Disable fast mode
mesrai hook install --force            # Overwrite existing hook
FlagDefaultDescription
--fail-on <severity>criticalMinimum severity to block push
--fast / --no-fasttrueEnable/disable fast mode
--forceOverwrite existing hook without prompting

hook uninstall

mesrai hook uninstall

Removes the pre-push hook installed by Mesrai.

hook status

mesrai hook status

Shows hook status, fail-on severity, fast mode setting, and path.

Skipping the Hook

MESRAI_SKIP_HOOK=1 git push

mesrai decisions

Capture and persist AI agent decisions into your repository for future reference. Decisions are stored as structured markdown in .mesrai/.

decisions enable

mesrai decisions enable                                    # All agents
mesrai decisions enable --agents claude,cursor            # Specific agents
mesrai decisions enable --agents codex --codex-config ~/.codex/config.toml
mesrai decisions enable --force                           # Overwrite existing config
FlagDefaultDescription
--agents <agents>claude,cursor,codexComma-separated agent list
--codex-config <path>~/.codex/config.tomlPath to Codex config
--forceOverwrite existing modules.yml

decisions disable

mesrai decisions disable

Removes all decision hooks. Preserved data in .mesrai/ is not deleted.

decisions status

mesrai decisions status

Shows PR memory, sessions, last SHA, agent, and module config.

decisions show

mesrai decisions show                  # Current branch PR memory
mesrai decisions show auth             # Module decisions for 'auth'
mesrai decisions show feat/new-api     # PR decisions for a specific branch

decisions promote

mesrai decisions promote                                   # Current branch, all modules
mesrai decisions promote --branch feat/auth                # Specific branch
mesrai decisions promote --branch feat/auth --modules auth,users
FlagDescription
--branch <name>Branch name (default: current branch)
--modules <ids>Comma-separated module IDs (default: all matched)

Promotes PR-level decisions to long-term module memory.


mesrai config centralized

Manage centralized configuration from the CLI.

Usage

mesrai config centralized status
mesrai config centralized init [owner/repo] --sync-option <pr|manual>
mesrai config centralized sync
mesrai config centralized disable
mesrai config centralized download --out ./centralized-config.zip

Subcommands

SubcommandDescription
statusShow whether centralized config is enabled and the selected source repository
init [repository]Enable centralized config for a selected repository
syncRun centralized config sync on demand
disableDisable centralized config and clear selected repository
download --out <path>Download centralized config ZIP bundle

Flags

FlagApplies ToDescription
--sync-option <pr | manual>initSync strategy. Default is pr
--out <path>downloadRequired output path for ZIP file
--jsonall centralized subcommandsOutput structured JSON

For a complete walkthrough, see: /guides/code_review/configs/centralized_config#cli-dedicated-section


mesrai config repo

Inspect and update repository settings stored in Mesrai. Team-key auth is required. Use . to target the current repository.

mesrai config repo and mesrai config remote are aliases for the same command group.

Usage

mesrai config repo add                                   # Add current repo to Mesrai
mesrai config repo add owner/repo                        # Add a specific repo
mesrai config repo list                                  # List configured repos
mesrai config repo show                                  # Show current repo settings
mesrai config repo setup                                 # Guided setup wizard
mesrai config repo set . reviewEnabled true              # Set a setting directly
mesrai config repo open                                  # Open the Mesrai dashboard
mesrai config repo add-ignore-file . "**/*.generated.ts"
mesrai config repo add-base-branch . "release/*"
mesrai config repo add-ignore-title . "^WIP:"

Subcommands

SubcommandDescription
add [repository]Add a repository to Mesrai (shortcut: mesrai config -r [repository])
listList repositories configured in Mesrai
show [repository]Show repository settings
setup [repository]Run a guided repository setup wizard
set [repository] <key> <value>Set a repository setting directly
open [repository]Open the Mesrai dashboard for advanced settings
add-pattern [repository] <field> <pattern>Add a pattern to a list field (ignore-files, base-branches, ignore-titles)
remove-pattern [repository] <field> <pattern>Remove a pattern from a list field
add-ignore-file [repository] <pattern>Shortcut: add a pattern to ignored file patterns
remove-ignore-file [repository] <pattern>Shortcut: remove an ignored file pattern
add-base-branch [repository] <pattern>Shortcut: add a base branch pattern
remove-base-branch [repository] <pattern>Shortcut: remove a base branch pattern
add-ignore-title [repository] <pattern>Shortcut: add an ignored title pattern
remove-ignore-title [repository] <pattern>Shortcut: remove an ignored title pattern

Flags

FlagApplies ToDescription
--no-promptaddSkip the post-add setup prompt

mesrai rules

Create, update, and view Mesrai Rules — structured rules that Mesrai applies during review.

Usage

mesrai rules view                                         # View all rules for your team
mesrai rules view --repo-id <id>                          # Filter by repository
mesrai rules view --uuid <rule-uuid>                      # Fetch a single rule
mesrai rules create --title "No console.log" --rule "Avoid leaving console.log in committed code" --severity high
mesrai rules update --uuid <rule-uuid> --severity critical

Subcommands

SubcommandDescription
createCreate a new Mesrai Rule
updateUpdate an existing rule
viewView Mesrai Rules

rules create Flags

FlagDefaultDescription
--title <title>Rule title
--rule <rule>Rule content/description
--repo-id <id>globalRepository ID (or global to apply to all repos)
--severity <severity>mediumlow, medium, high, critical
--scope <scope>filepull request or file
--path <glob>**/*Glob pattern for file targeting
--jsonfalseOutput created rule as JSON

rules update Flags

FlagDescription
--uuid <uuid>Rule UUID to update (required)
--repo-id <id>Updated repository ID
--title <title>Updated title
--rule <rule>Updated content/description
--severity <severity>Updated severity
--scope <scope>Updated scope
--path <glob>Updated glob pattern
--jsonOutput updated rule as JSON

rules view Flags

FlagDescription
--uuid <uuid>Fetch a single rule by UUID
--repo-id <id>Filter rules by repository ID
--jsonOutput rules as JSON

mesrai skills

Inspect and install the agent skills bundled with the CLI (Claude Code, Cursor, Codex).

Usage

mesrai skills list                                        # List bundled skills
mesrai skills install                                     # Install into detected agent roots
mesrai skills install --dry-run                           # Preview changes
mesrai skills resync                                      # Re-sync bundled skills
mesrai skills uninstall                                   # Remove bundled skills

Subcommands

SubcommandDescription
listList bundled skills available in this CLI package
syncSync bundled skills to detected local agent directories
resyncRe-sync bundled skills to detected local agent directories
installInstall bundled skills into detected agent roots (creates dirs as needed)
uninstallUninstall bundled managed skills from detected agent directories

Flags

FlagApplies ToDescription
--dry-runinstall, sync, resync, uninstallShow planned changes without writing files
For full multi-agent bootstrap, prefer the platform installer (curl -fsSL https://review-skill.com/install | bash). mesrai skills covers local re-sync and cleanup.

mesrai status

Show a consolidated Mesrai status: auth mode, organization, repository, hook, decisions, bundled skills, and CLI version.

mesrai status

Useful as a first diagnostic when something misbehaves or when onboarding a new machine.


mesrai update

Update the Mesrai CLI to the latest version from npm.

mesrai update

Resolves the correct global install command for your package manager (npm, yarn, pnpm, bun) and runs it. If an installer script was used, the CLI points you to the re-run command instead.


mesrai subscribe

Opens the Mesrai pricing/upgrade page in your browser.

mesrai subscribe

Severity Levels

Issues are categorized by severity, from most to least critical:

LevelDescription
criticalMajor security or stability issues requiring immediate attention
errorSignificant bugs or problems
warningPotential issues worth addressing
infoSuggestions and best practices

Issue Categories

CategoryDescription
security_vulnerabilitySecurity-related issues
bugPotential bugs
performancePerformance optimization opportunities
code_qualityCode quality improvements
best_practicesBest practice violations
complexityCode complexity issues
maintainabilityMaintainability concerns
styleCode style issues