cr code (short for coderabbit code), you follow the work, steer it, and push the result or open a pull request with it. You can also hand off a local Codex or Claude Code session. For scripts and coding agents, see Drive tasks from scripts and coding agents. For every option, see the command reference.
A task is one unit of cloud work on a repository, with its own history and page in the web app. Each instruction you send runs as a turn of the task.
Requirements
- CLI 0.9.0 or later. Run
cr update.cr code handoffandcr code skills importwork from 0.8.1. - A CodeRabbit SaaS login. Run
cr auth login, thencr auth orgin an interactive terminal to select an organization. API key, self-hosted, and SSO workspace logins are not supported. - Access. Coding Agent must be enabled for your organization, and you need access to the repository. See Access and billing.
Quick start
--stacked it opens a pull request against that branch instead (Push changes). The first push can pause for a GitHub authorization in your browser. Closing the live view never stops the task. Add --plan to review a plan before any code changes (details).
Start a task
- Prompt. An argument, or
-for standard input. An interactive terminal asks for one if you omit it. --planstarts in Plan mode: the agent writes a plan for review instead of changing code.--resumestarts the task and opens the live view in one command, the same as runningcr code resume <task-id>next.
Follow and steer a task
cr code resume opens a live view of the task. --last opens your most recently updated task for this repository; with no task, the command lists your ten most recent tasks to pick from. The view, which cr code new --resume also opens, needs an interactive terminal. Closing it with /exit never stops the task.
Commands accept a task ID or a task URL such as https://app.coderabbit.ai/code/tasks/<task-id>, read from the region and organization of your current login (for another region, run cr auth login --region eu first). Shell completion completes task IDs you listed or opened.
In the view you can:
- Type a message. During a turn it joins or queues behind the running turn; otherwise it starts a new turn. Start with
//to send a literal/. - Add guidance to the running turn with
/steer <text>, or stop it with/cancel. - Answer the agentās blocking questions. Answers to sensitive questions are hidden as you type.
- Mention a file with
@and at least two characters of its path, once the taskās environment is ready. - Type
/for suggestions; see the slash command reference.
Stop a running turn
cr code cancel stops the running turn and drops queued messages. The task stays open, and a new message starts a new turn.
List and inspect tasks
cr code ls lists the 20 most recently updated tasks in the selected organization. By default it lists only your tasks; --all adds other peopleās tasks that you can see. Archived tasks are not listed, but show can read them.
--repo <path>lists the tasks of the repository that matches theoriginremote of the checkout at that path.--status <state>filters by the state shown in the web task list:needs_attention,ready_for_review,running,completed, orcanceled.
cr code show shows the status, repository, delivery, patch, plan, result, and pull request health of a task.
Review and approve a plan
A task started with--plan ends with a plan instead of code changes. Run /implement in the cr code resume view to implement the latest plan, or implement it from the task page in the web app. It needs a finished plan with no open plan comments, no running turn, and no queued messages.
cr code plan shows the latest finalized plan. --approve records your approval of that plan version; it does not start implementation. If the plan changed after you read it, approval fails: run cr code plan <task-id> to read the new version. For plan approvals in the web app, see Review a plan.
Push changes
cr code push delivers the ready changes of a task. By default, CodeRabbit commits them onto the working branch and pushes, as Commit and push does in the web app. --stacked pushes them to a new branch and opens a pull request against the working branch, as Create PR does. A stopped or interrupted turn can still leave a patch, and cr code push delivers that partial work. See Choose how changes land.
GitHub can first ask you to authorize CodeRabbit. In an interactive terminal, the command prints the authorization URL, opens it when it can, and waits up to 10 minutes while you approve in a browser signed in to CodeRabbit with the same GitHub account. Without a terminal, it prints the URL and stops; run it again after you approve.
- Waiting. The command stops waiting after 15 minutes and reports that the push is still running. The push continues, and
cr code showshows the result. Ctrl-C stops only the wait. - Failure. The command shows the reason from the repository, such as the CodeRabbit GitHub App not being allowed to change
.github/workflows. Fix the cause, then push again. - Reruns. Rerunning is safe: a running push is waited for, and already-pushed changes are reported without a new push request. While a turn runs or messages are queued, the command asks you to wait.
Let Autopilot deliver and fix
Autopilot publishes a taskās changes when the agent finishes, then fixes CodeRabbit findings, failing required CI checks, and merge conflicts. Turning it on lets it publish changes and push follow-up fixes without asking you.on starts Autopilot, off stops it, and status shows its state. resume starts a new repair cycle after Autopilot pauses; on does not resume a paused Autopilot.
Pass either a task or --pr: a pull request number in the repository that matches your checkoutās origin, or a GitHub pull request or GitLab merge request URL. With --pr, on and resume can create an Autopilot task when you have no delivered task for that pull request.
More cr code commands
Continue a local session in the cloud
cr code handoff hands a local coding session off to a new cloud task.
origin remote. The cloud task must be able to fetch the selected commit, so commit and push first. Untracked files count as changes, so keep the summary and plan files outside the repository or commit them.
--summary <path>is required;-reads standard input.--plan <path>is the primary implementation plan file.- Uploads. The summary, the optional plan, and a session transcript when the command finds one, such as your current Codex or Claude Code session. Review these files first. Each attachment is limited to 25 MiB. A missing transcript or a failed transcript upload is a warning, not a failure.
Ask a side question
cr code ask puts a question to a side chat of the task and prints the answer. A side chat reads the taskās conversation and repository but does not change the task, and a running turn keeps running.
The answer includes a turn ID. Pass it to --follow-up to keep asking in the same side chat, with the context of earlier questions. cr code ask canāt close a side chat, so use --follow-up to keep asking in the one you opened. A task can have 3 open side chats, and an idle one expires after 24 hours.
Import local skills
cr code skills import uploads local agent skills to your cloud Coding Agent skill library, in the organization you selected with cr auth org. To install CodeRabbit skills into your local coding agent instead, use cr skills.
SKILL.md. Review the selected files and destination before you confirm.
--scope personal|organization. New skills are personal within the selected organization by default;organizationshares them with it.- Non-interactive imports need a path and
--yes. With--yesand no--scope, new skills are personal and existing skills keep their visibility. - Same name. Importing a skill you own with the same name publishes a new version.
SKILL.md, limits, and sharing, see Coding Agent skills.
Slash command reference
Commands marked (billed) start agent work. Commands that say āAsks firstā need ay; press Enter to keep things as they are. /push does not ask.
Run
/help in the view for the full list.
Drive tasks from scripts and coding agents
Everything below is for scripts and coding agents. For the general agent-mode contract, see Agent mode output and exit codes.Before you script this
Before you script this
- A person signs in first. Run
cr auth login(browser) andcr auth org(interactive terminal) on that machine. There is no non-interactive login: API key, self-hosted, and SSO workspace logins fail withunsupported_auth, no selected organization fails withorganization_required, andcr auth org --agentonly lists organizations. - Always pass
--agent, right after the full command name, as incr code new --agent ā¦orcr code autopilot on --agent ā¦. Everycr codecommand exceptskills importaccepts it. The CLI also switches to JSON whenstdoutis not a terminal and it detects a coding-agent environment (for exampleCLAUDECODE,CODEX_SANDBOX,CURSOR_AGENT,GEMINI_CLI, orCR_CLI_AGENT=<name>), but only an explicit--agentturns argument errors into JSON. Incr code new, put--agentbefore--plan, or an argument error prints as plain text onstderrand exits with1. - Use explicit task IDs, not
--last, which picks the most recently updated task and can change between runs. commandfields start withcoderabbit, the same binary ascr. Onauthenticate, a person runscommand(it opens a browser sign-in). Onauthorize_github, a person opens theurl; after they approve, reruncommand. Onanswer_questionwith ananswerTemplate, donāt runcommand(it holds a literal<answer-json>placeholder): runcr code resume --agent <task-id> --answer '<json>'with the filled-in template. Onanswer_questionwith a nullanswerTemplate,commandis interactive: never run it; give it to the user.
How the stream works
How the stream works
- Records. One JSON object per line, each with a
type.status,complete, anderrorrecords have astatus; on anerrorrecord it is the error code.action_requiredrecords have anaction, andmessageis human-readable text. The first record is astatusrecord withstatus: "beta_notice"and afeedbackUrl.resumealso writestracerecords with akindsuch asagent_message,command,file_change, orturn_end. - Liveness.
resume,new --resume, andaskwrite astatusrecordwaitingafter 45 seconds without other output.pushwritesdelivery_waitingon progress and every 45 seconds.cancel,handoff,plan,autopilot,ls, andshowwrite none, so size CI idle timeouts with the limits below. - The last record decides. Branch on its
type, then itsstatusoraction. Use the exit code only as a cross-check, because exit1and4each cover records that need different handling. Exit0iscomplete, butpush_in_progressandcancel_pendingare not final. Exit1iserror, oraction_requiredforauthenticateandauthorize_github. Exit3isanswer_question. Exit4isaction_required: for theresumeaction, reruncr code resume --agent <task-id>; forread_answer, never rerunask. A signal interrupt exits130or143with no last record. If the last record has astatusoractionthat this page does not list, stop and ask a person. - Commit points. Save these records as they arrive, and never rerun the command that wrote one (exceptions are under Retry safely):
task_submitted(new, withtaskIdandurl),creating_task(handoff),message_sent,steer_sent,answer_sent, andquestion_sent. A genericerrorrecord has notaskId, so keep it from earlier records. agentMinutes. The last record of a turn (completewithturn_completed, orerrorwith aturn) hasagentMinutes: the gross agent minutes of the turn, rounded to two decimals, not billed minutes. It isnullwhen the run did not see the turn run and end, or the minutes did not arrive in time.
Outcomes by command
Outcomes by command
āNot finalā marks outcomes that need a follow-up command.The command sends at most one of
newhandoffThe statuses are checking_repository, uploading_files, and creating_task.The earlier
cr handoff form still works, but its human-readable output changed in 0.8.1; update scripts that parse the old output.resume (watch, -m, --steer, --answer)-m, --message, --steer, and --answer; all require --agent and accept - for standard input. -m joins the running turn, queues behind it, or starts a new turn. --steer adds guidance to the running turn. --answer takes the answerTemplate JSON of an answer_question record with each answer filled in. The run follows the resulting turn until it ends, the agent asks a blocking question, or 9 minutes pass. Without a send option, it reports the latest turn.cancelaskNothing is billed before
question_sent, except after ask_failed, where billing is unknown. Records after it carry sideChatId, turnId, and clientOperationId. cr code show does not show side chats.planpush (default and --stacked)autopilotls and showBoth only read, so rerun them freely.Any
cr code commandTasks the CLI canāt change. Workspace tasks are read-only:
cancel and ask fail with task_read_only, and resume fails with it only when you send. Tasks on the previous Coding Agent runtime fail resume and cancel with task_read_only and ask with side_chat_unavailable. Automation tasks fail with unsupported_task. Continue these in the web app.Retry safely
Retry safely
- Never rerun a command after it wrote a commit-point record; follow the task with
cr code resume --agent <task-id>instead. Exceptions:message_droppedandsteer_not_deliveredmean the send did not land, so send again.handoffhas no task ID beforetask_created: aftercreating_task, donāt rerun. Runcr code ls --agent --repo .and give the result to a person. - No last record? If a run was killed or crashed (or exited
130or143), use the records you saw. If you saw no commit point fromneworhandoff, a task may still exist: checkcr code ls --agent --repo .before rerunning. - After
-m, keep theclientOperationIdfrommessage_sent. If the run that sent the message ends with a turn whoseturn.queueItemIdequals it, that turn is yours. If it differs, your message joined the turn that was already running, and that outcome covers it. After an exit-4rerun, a turn whoseturn.queueItemIdis not yours means your message may still be queued: rerun without a send option a few seconds later, at most three times, then report to a person. Never resend-m. - Safe to rerun:
ls,show,planwithout--approve, andpushwith identical flags, unless the last record wasdelivery_failed,delivery_conflicts, orpush_rejected. Donāt reruncancelto wait.
When to stop and ask a person
When to stop and ask a person
- Sensitive question.
answer_questionwith a nullanswerTemplateand acommand: give the usercommand(coderabbit code resume <task-id>, interactive) to run and answer there. Never run it or collect the answer yourself. - Question on a workspace task.
answerTemplateandcommandare both null: give the user the web app link frommessage. - Authorization, login, and billing.
authorize_github,authenticate,unsupported_auth,organization_required, andbilling_required. - Get a personās OK before delivering changes (
push), approving a plan (plan --approve), turning on Autopilot or resuming it (it publishes and pushes follow-up fixes on its own), runningcancel(it drops queued messages), pushing partial work afterturn_failed,turn_canceled, orturn_interrupted, or answering a question you would have to guess.
Limits
Limits
Whatās next
Work with a running task
Follow, steer, and review a task in the web app, including plans and proposed patches.
Deliver a task's changes
Compare the delivery modes and see how Autopilot publishes and fixes changes.
CLI command reference
Look up every
cr code command and option, generated from the CLI help output.