Use GitHub Copilot from inside Claude Code for code reviews or to delegate tasks to Copilot.
This plugin is a port of openai/codex-plugin-cc, adapted to drive the GitHub Copilot CLI (@github/copilot, v1.0.79+) instead of Codex.
- Copilot CLI instead of Codex CLI. The plugin shells out to
copilotinstead ofcodex. - Process-per-job instead of a persistent app-server/broker. Copilot CLI has no daemon or JSON-RPC protocol. Every run is a one-shot, non-interactive process (
copilot -p <prompt> --output-format json) that streams a JSONL event log on stdout and exits. The companion script spawns that process, parses the JSONL stream incrementally, and reduces it into a normalized result — there is no long-lived broker connection to manage. - Client-side structured-output parsing. Copilot CLI has no server-side structured-output enforcement, so the companion parses and schema-validates Copilot's final message as JSON itself and degrades to a raw-text rendering (with an explicit parse/validation error) when that fails.
- Multi-model, not single-vendor. Copilot CLI supports
--model autoplus BYOK (bring-your-own-key) provider models, rather than a fixed OpenAI model family. There is no Codex-stylesparkalias.
/copilot:reviewfor a normal read-only Copilot review/copilot:adversarial-reviewfor a steerable challenge review/copilot:rescue,/copilot:transfer,/copilot:status,/copilot:result, and/copilot:cancelto delegate work, hand off sessions, and manage background jobs/copilot:setupto check readiness and manage the optional stop-time review gate- The
copilot-rescuesubagent (used by/copilot:rescue)
- GitHub Copilot CLI (
@github/copilot, v1.0.79 or later) - A GitHub Copilot subscription/authorization for the account or token you authenticate with
- Node.js (the companion scripts are plain ESM
.mjs)
Install the Copilot CLI:
npm install -g @github/copilotIn Claude Code, add the marketplace and install the plugin:
/plugin marketplace add apappascs/copilot-plugin-cc
/plugin install copilot@github-copilot
/reload-pluginsThen run setup:
/copilot:setup/copilot:setup reports whether Copilot is installed and authenticated. If it is missing and npm is available, it can offer to install it for you. If Copilot is installed but not authenticated, it will point you at !copilot login (see Auth below).
One simple first run:
/copilot:review --background
/copilot:status
/copilot:resultRuns a normal, read-only Copilot review of your current work.
argument-hint: [--wait|--background] [--base <ref>] [--scope auto|working-tree|branch]
- Reviews uncommitted working-tree changes by default, or a branch diff against a base ref with
--base <ref>. --scope auto|working-tree|branchselects the review target explicitly.--waitruns it in the foreground;--backgroundlaunches it as a Claude Code background task.- Not steerable — it does not accept custom focus text. If the raw arguments include extra text, the companion script rejects it and points you at
/copilot:adversarial-reviewinstead. - If neither
--waitnor--backgroundis given, Claude estimates the review size fromgit status/git diff --shortstatand asks you to pick, recommending background for anything beyond a tiny (1-2 file) change.
Examples:
/copilot:review
/copilot:review --base main
/copilot:review --backgroundUse /copilot:status to check progress and /copilot:cancel to stop a backgrounded review.
Runs a steerable review that challenges the chosen implementation, design, tradeoffs, and assumptions — not just a stricter line-by-line pass.
argument-hint: [--wait|--background] [--base <ref>] [--scope auto|working-tree|branch] [focus ...]
- Uses the same target selection as
/copilot:review(--base <ref>,--scope auto|working-tree|branch), plus--wait/--background. - Unlike
/copilot:review, it accepts free-text focus instructions after the flags. - Read-only — it does not fix code.
Examples:
/copilot:adversarial-review
/copilot:adversarial-review --base main challenge whether this caching and retry design is safe
/copilot:adversarial-review --background look for race conditions and question the chosen approachDelegates investigation, an explicit fix request, or follow-up work to the copilot-rescue subagent, which forwards the request to a write-capable Copilot task run.
argument-hint: [--background|--wait] [--resume|--fresh] [--model <model>] [--effort <none|minimal|low|medium|high|xhigh|max>] [what Copilot should investigate, solve, or continue]
- Defaults to foreground unless
--backgroundis given (or the subagent judges the task complicated/long-running and defaults to background itself). --resumecontinues the most recent resumable Copilot task session for this Claude session;--freshstarts a new one. If neither is passed and a resumable session exists, Claude asks which you want viaAskUserQuestion.--modeland--effortare passed through to the Copilot CLI run; if omitted, Copilot picks its own defaults.- Write-capable by default — this is the one command in the plugin that lets Copilot modify files, since it runs
task, notreview.
Examples:
/copilot:rescue investigate why the tests started failing
/copilot:rescue fix the failing test with the smallest safe patch
/copilot:rescue --resume apply the top fix from the last run
/copilot:rescue --model gpt-5.1-codex --effort medium investigate the flaky integration test
/copilot:rescue --background investigate the regressionYou can also just ask for a task to be delegated:
Ask Copilot to redesign the database connection to be more resilient.
Seeds a new, named, resumable Copilot session from a digest of the current Claude Code transcript, and prints a copilot --resume=<session-id> command.
argument-hint: [--source <claude-jsonl>]
Important
This is a lossy reconstruction, not a faithful session import. Unlike Codex's first-party Claude-session importer, the Copilot CLI has no native mechanism to replay a Claude transcript turn-by-turn. The companion script digests the current Claude session into a summary and seeds it as the opening prompt of a brand-new Copilot session. Exact tool calls, intermediate reasoning, and full message detail from the original session are not preserved verbatim — only what survives the digest. Do not describe this to users as an exact or complete transfer.
The plugin's SessionStart hook captures the current transcript path automatically, so --source is only needed as a manual override (and the path must resolve to a transcript the digest step can read).
Examples:
/copilot:transfer
/copilot:transfer --source ~/.claude/projects/-Users-me-repo/<session-id>.jsonlShows active and recent Copilot jobs for the current repository, including review-gate status.
argument-hint: [job-id] [--all]
Examples:
/copilot:status
/copilot:status task-abc123Without a job ID, output is rendered as a compact Markdown table. With a job ID, the full status detail for that job is shown.
Shows the stored final output for a finished Copilot job in this repository.
argument-hint: [job-id]
Examples:
/copilot:result
/copilot:result task-abc123Includes the verdict/summary/findings payload, file paths and line numbers as reported, the Copilot session ID and copilot --resume=<session-id> hint when available, and — since Copilot CLI has no server-side structured-output enforcement — the raw text plus parse/validation error if the final message didn't parse as valid JSON.
Cancels an active background Copilot job in this repository.
argument-hint: [job-id]
Examples:
/copilot:cancel
/copilot:cancel task-abc123Checks whether the local Copilot CLI is installed and authenticated, and can toggle the optional stop-time review gate.
argument-hint: [--enable-review-gate|--disable-review-gate]
- If Copilot is missing and
npmis available, offers to runnpm install -g @github/copilotfor you. - If Copilot is installed but not authenticated, points you at
!copilot login(or!copilot login --host <host>for GitHub Enterprise Cloud). --enable-review-gate/--disable-review-gatetoggle theStop-hook review gate described below.
The companion checks, in precedence order:
COPILOT_GITHUB_TOKENenvironment variableGH_TOKENenvironment variableGITHUB_TOKENenvironment variable- A local Copilot CLI credential store (
~/.copilot) or, on macOS, a Keychain entry for servicecopilot-cli— populated by the interactive OAuth device-code flow viacopilot login
There is no dedicated copilot auth status subcommand, so this is a best-effort check; it never logs or returns the token value itself.
Note
Classic PATs (ghp_...) are not supported by Copilot CLI. If you authenticate with a personal access token, it must be a fine-grained PAT with the "Copilot Requests" permission — or use an OAuth token from copilot login instead.
For GitHub Enterprise Cloud (GHEC) data residency, authenticate against your enterprise host with:
copilot login --host <host>--model <model>selects the model for a run, including--model autofor Copilot's automatic routing, or a pinned BYOK provider model name.--effort <level>selects reasoning effort. Accepted values:none,minimal,low,medium,high,xhigh,max.- Both flags are accepted by
/copilot:review,/copilot:adversarial-review, and/copilot:rescue. Leave them unset to let Copilot choose its own defaults.
/copilot:setup can enable a Stop-hook review gate that runs a targeted Copilot review of Claude's last response and blocks the stop if the review finds issues that still need fixing.
/copilot:setup --enable-review-gate
/copilot:setup --disable-review-gateThe review gate is OFF by default.
Warning
Enabling the review gate can create a runaway Claude ↔ Copilot loop and burn through usage very quickly. Each blocked stop triggers another Claude turn, which can trigger another review, and so on. Only enable it when you plan to actively monitor the session, and disable it again when you're done.
/copilot:review and /copilot:adversarial-review run Copilot with:
--allow-all-tools --deny-tool='write' --deny-tool='shell' --no-ask-user
--deny-tool always wins over --allow-all-tools. Denying the shell tool kind (not just write) is what makes this airtight — a write deny alone would not stop shell redirection tricks like sh -c "... > file".
The plugin also gathers the relevant git diff/context itself (via its own git calls) and injects it directly into the review prompt, rather than letting Copilot go read the working tree — so a review cannot modify, and does not even need to independently inspect, the working tree.
/copilot:rescue (via task) is write-capable by default and uses no deny-tool restrictions — that is the one path in this plugin where Copilot can edit files.
- Companion CLI (
scripts/copilot-companion.mjs) — the single entry point invoked by every slash command (setup,review,adversarial-review,task,transfer,task-worker,status,result,cancel,task-resume-candidate). It resolves the review target, builds the Copilot CLI argv, spawnscopilot, and renders output for both human and--jsonconsumption. - Copilot CLI driver (
scripts/lib/copilot.mjs) — resolves thecopilotbinary (project-localnode_modules/.bin/copilotfirst, then PATH), builds the shared argv (always--allow-all-tools --no-ask-user, plus the read-only deny-tool composition for reviews), spawns the one-shot process, and streams its JSONL stdout intolib/events.mjsfor incremental progress and a final reduced result. - Job registry (
scripts/lib/state.mjs,scripts/lib/job-control.mjs,scripts/lib/tracked-jobs.mjs) — jobs are tracked per workspace root and scoped to the current Claude Code session id (captured by theSessionStarthook), so/copilot:status,/copilot:result, and/copilot:cancelonly surface jobs relevant to your session/repo. - JSONL event reduction (
scripts/lib/events.mjs) — classifies and reduces the raw Copilot session-event stream (turn start/end, tool start/complete, message, reasoning, error, abort) into progress updates and a final normalized result, since Copilot CLI has no server-side structured-output enforcement of its own. - Background task worker —
--backgroundruns enqueue a job and launchcopilot-companion.mjs task-worker --job-id <id>as a detached Claude Code background process, so/copilot:status//copilot:result//copilot:cancelcan poll or stop it independently of the invoking turn. - Hooks (
hooks/hooks.json) —SessionStartrecords the Claude session id and transcript path (for/copilot:transfer);SessionEndcancels/cleans up any jobs still queued or running for that session (Copilot CLI has no persistent broker process to tear down, unlike Codex);Stopruns the optional review gate described above.
Run the test suite:
npm testRepository layout:
.claude-plugin/marketplace.json marketplace metadata (github-copilot)
plugins/copilot/
.claude-plugin/plugin.json plugin metadata (copilot)
commands/ the 8 slash commands
agents/copilot-rescue.md the rescue subagent
skills/ internal runtime/prompting/result-handling guidance
hooks/hooks.json SessionStart/SessionEnd/Stop hook wiring
prompts/ review, adversarial-review, and stop-gate prompt templates
schemas/ review-output JSON schema
scripts/ copilot-companion.mjs + lib/*.mjs + hook entry points
Licensed under Apache-2.0 (see LICENSE). This project is a derivative work of openai/codex-plugin-cc, adapted to drive the GitHub Copilot CLI instead of Codex. See NOTICE for full attribution.