GitHub Copilot CLI puts a full AI coding agent in your terminal. No editor required, no tab-switching: you describe the work, it reads your code, plans the change, edits files, runs the tests, and opens the pull request. This guide covers the install, the three modes, parallel work with /fleet, handing tasks to the cloud with /delegate, scripting with -p, and the safety settings that stop it doing something you will regret. Every fact below was verified against GitHub’s official documentation and pricing pages on 23 November 2026.
What GitHub Copilot CLI actually is
Copilot CLI is a terminal-native agentic coding assistant from GitHub. You start it with copilot inside a project folder, then talk to it in plain language. It can explore a codebase, answer questions, fix bugs, add features, run commands, and work with GitHub issues and pull requests without you leaving the shell.
That is a different product from the old gh copilot suggest / explain extension, which only suggested single shell commands. The old extension is superseded. Copilot CLI is a full agent: it plans multi-step work, edits files, and iterates until the tests pass.
Three things make it worth learning rather than just using Copilot in your editor: it lives where the work happens — your terminal already has git, your test runner, and your deploy scripts, and the agent can use all of them; it speaks GitHub natively, with the GitHub MCP server preconfigured so it can read issues, search pull requests, and open a draft PR from the CLI; and it runs several vendors’ models, switchable mid-session with /model, with your own API keys and local models via Ollama, vLLM, or Foundry Local supported since April 2026.
How much it costs: AI Credits, not subscriptions alone
Copilot CLI is included with every Copilot plan, from Free to Enterprise. If your Copilot comes from an organisation, an admin must enable the CLI policy in the organisation’s settings. There is no separate charge for the CLI itself — but every interaction draws on your plan’s AI Credits allowance.
GitHub replaced the old premium-request counting with token-based AI Credits on 1 June 2026. One AI credit is worth $0.01, and each model charges credits at its own per-token rate. The individual plans, as listed on GitHub’s plans page in November 2026:
| Plan | Price | Monthly AI Credits | Notes |
|---|---|---|---|
| Free | $0 | Limited chat and agent usage | 2,000 code completions a month; automatic model selection only; no cloud agent |
| Pro | $10/month | 1,500 ($15 value) | Unlimited completions; full model picker; coding agent included |
| Pro+ | $39/month | 7,000 ($70 value) | Premium models; heavier agent workflows |
| Max | $100/month | 20,000 ($200 value) | Full-time agent workflows; priority access to premium models |
Business costs $19 per user per month and Enterprise $39 per user per month, each contributing credits to a shared pool. Extra credits beyond your allowance cost $0.01 each, and you can set a spend budget. Prices and credit amounts change — check GitHub’s plans page before you subscribe. The practical point: the Free plan is enough to learn the CLI properly, and Pro at $10 a month is the sensible starting point if you use an agent most days.
Install GitHub Copilot CLI
Pick one install method. The npm route works everywhere; the other two are the native package managers.
# Cross-platform — needs Node.js 22 or later
npm install -g @github/copilot
# macOS / Linux — Homebrew
brew install --cask copilot-cli
# Windows — WinGet
winget install GitHub.Copilot
Check it installed:
copilot --version
Your first session
Change into a project directory, then start the CLI:
cd ~/projects/my-api
copilot
Three things happen on the first run, and each one matters:
- Trust prompt. Copilot asks whether you trust the files in this folder, because during the session it may read, modify, and execute files in and below it. Choose “Yes” for this session only unless you are sure the folder will always be safe. Only ever run the CLI in a directory you trust.
- Login. Enter
/loginand follow the browser flow to authenticate with your GitHub account. You only do this once. - First prompt. Try something that teaches you how the agent sees your code:
Give me an overview of this project.
Copilot will not change your files without your explicit approval. Every edit and every command that modifies or executes something — touch, chmod, node, sed — produces a permission prompt first. You can approve once, approve for the session, or reject it and tell Copilot to take a different approach. Rejecting is safe: it ends the current operation and waits for your next instruction.
The three modes: interactive, plan, autopilot
Press Shift+Tab to cycle modes. This one shortcut is the difference between a chatbot and an agent you can trust with real work.
Interactive mode (default)
Conversational. Copilot asks before each action and you approve tool use step by step. Use it for exploration, questions, and anything you want to watch closely.
Plan mode
Copilot analyses your request, asks clarifying questions, and builds an implementation plan before writing any code. Use it for anything that touches more than one or two files. A good first move on an unfamiliar repo:
/plan
Add rate limiting to the login endpoint, 5 attempts per email per 15 minutes
Read the plan. Push back on the parts that are wrong. Only then let it build. The ten minutes you spend arguing with the plan are cheaper than the hour you spend untangling a confident implementation of the wrong design.
Autopilot mode
Copilot works through a task — implementation, testing, iteration — without waiting for input after each step. Enter it with Shift+Tab twice, or start it directly:
copilot --autopilot --yolo --max-autopilot-continues 10 -p "Fix the failing tests in packages/auth"
Autopilot is powerful and exactly as dangerous as it sounds. The --max-autopilot-continues flag caps how many times it can keep going on its own, and --yolo (also --allow-all) removes per-step approval. Use autopilot on a branch, with tests, and never with --yolo outside a sandbox — see the safety section below.
Everyday workflow: the commands you will actually use
Point the agent at the right files
Use @ followed by a relative path to add a file’s contents to your prompt as context:
Explain @config/ci/ci-required-checks.yml
Fix the bug in @src/app.js
Start typing a path and the CLI offers completions; arrow keys select, Tab completes. You can also attach images and PDFs to a prompt — drag and drop, paste from the clipboard, or reference with @ — when the active model supports image input. Supported types are JPEG, PNG, GIF, WEBP, PDF, HEIC, and HEIF. A screenshot of a failing UI is often faster than describing the problem in words.
Review before you merge
/review runs the code-review agent over your staged and unstaged changes, focused on genuine issues rather than noise. Follow it with /pr, which views, creates, and fixes pull requests directly from the CLI. The loop most developers settle into is: explore, plan, implement, /review, fix, /pr.
Handy shortcuts
| Shortcut | What it does |
|---|---|
Esc |
Cancel the current operation (press twice quickly while it is thinking) |
Ctrl+C |
Cancel if thinking, clear input, or exit |
Ctrl+L |
Clear the screen |
Ctrl+T |
Show or hide the model’s thinking |
@ |
Mention a file to include as context |
/ |
Show slash commands |
? |
Show tabbed help |
↑ / ↓ |
Navigate command history |
!command |
Run a shell command directly, without calling the model |
The ! prefix is underrated: !git status or !npm test runs immediately, with no model call and no credits spent.
Resume where you left off
Sessions are saved. Resume the most recent one with:
copilot --continue
Or pick from saved sessions with --resume or the /resume slash command. You can even start a Copilot cloud agent session on GitHub and bring it into your local CLI later.
Parallel work with /fleet
/fleet is how you split a multi-step plan across subagents that work in parallel. The main agent acts as orchestrator: it analyses your prompt, breaks it into subtasks, checks their dependencies, and assigns the independent ones to subagents. Each subagent gets its own context window, so it can focus on its slice without carrying the whole conversation.
The workflow GitHub documents is: enter plan mode with Shift+Tab, describe the feature and refine the plan, then accept it and run /fleet implement the plan. Monitor the subagents with /tasks — open a task’s details with Enter, stop a runaway task with k, clear finished items with r.
/fleet earns its keep when the work genuinely splits: frontend shell, API handlers, tests, and docs can often move at once. It is the wrong tool for sequential work — if step two depends on step one’s output, the orchestrator has to wait anyway, and you have paid for parallel agents to stand in a queue. Two honest costs: each subagent interacts with a model independently, so a fleet run consumes more AI Credits than the same work done by one agent; and merging four agents’ output back into one coherent change is your job, not theirs. Review the combined diff with /review before you trust it.
Handing work off with /delegate
When you want to stop babysitting entirely, /delegate pushes the task to Copilot’s cloud agent on GitHub:
/delegate complete the API integration tests and fix any failing edge cases
Or prefix any prompt with &:
& complete the API integration tests and fix any failing edge cases
Copilot commits your unstaged changes as a checkpoint in a new branch it creates, then the cloud agent opens a draft pull request, makes changes in the background, and requests a review from you. You get a link to the pull request and the agent session, and the work keeps running even if you shut your laptop. The cloud agent is a paid-plan feature — Free-plan users don’t get it — and a delegated session is still your responsibility: read the draft PR like you would a colleague’s, because that is effectively what it is.
The difference between the two handoff modes, in one line: autopilot runs locally and you watch it; /delegate runs remotely and you come back to a draft PR.
Scripting with -p: the CLI as a Unix tool
You don’t have to start an interactive session at all. Pass a prompt with -p and Copilot answers directly in your terminal:
copilot -p "In Git, how can I apply a commit from another branch"
Add -s to print only Copilot’s response, with no usage information — the flag combination scripts expect:
copilot -sp "Summarise the changes in the last three commits as a changelog entry"
That makes the CLI composable with the rest of your shell:
# Explain the file you are about to review, before opening it
copilot -sp "Explain @src/payments/webhook.ts in two paragraphs" > /tmp/webhook-notes.md
# Generate a commit message from the staged diff
git diff --cached | copilot -sp "Write a conventional-commit message for this diff"
# A nightly check wired into cron (keep the prompt narrow and the model cheap)
copilot --mode autopilot --max-ai-credits 50 \
--allow-tool='shell(npm test)' --allow-tool='write' \
-p "Run the test suite and open a draft PR fixing any failures"
Two warnings for scripted use. First, -p output is not deterministic, and models retire — GitHub removed Claude Opus 5 and GPT-5.6 Terra from Copilot on 16 November 2026. Pin the model with --model in scripts and never let a script commit or deploy without a human-readable diff in between. Second, -p still spends AI Credits, so a cron job that runs every five minutes will quietly eat your allowance.
Make it yours: instructions, agents, skills, hooks, and MCP
The CLI gets dramatically better once you teach it your project’s conventions. GitHub gives you five layers, and they stack.
Custom instructions
Write your project’s rules in Markdown and they are automatically included in prompts while you work in that repository:
- Repository-wide:
.github/copilot-instructions.md - Path-specific:
.github/instructions/**/*.instructions.md - Agent files:
AGENTS.md
If you already maintain a CLAUDE.md or AGENTS.md for another agent, Copilot CLI reads the same file — one instructions file can serve every agent you use. Keep it short and enforceable: stack, test commands, commit style, and the three things the codebase does differently from the framework defaults.
Custom agents
A custom agent is a specialised version of Copilot for one workflow: a security auditor, a docs writer, a refactoring specialist. The CLI ships with built-in agents — Explore, Task, General purpose, Code review, Research, and Rubber duck, which the model consults automatically as a constructive critic. Invoke one with /agent, name it in a prompt, or pass it on the command line with copilot --agent=refactor-agent --prompt "...".
Define your own in Markdown agent profiles at user level (~/.copilot/agents), repository level (.github/agents), or organisation level (the /agents directory in the .github-private repository). On a naming conflict, the system-level agent wins over the repository-level one, which wins over the organisation-level one.
Skills give Copilot a procedure for a specialised task — instructions, scripts, and resources it pulls in automatically when a prompt matches the skill’s description. Hooks run custom shell commands at key points in a session (sessionStart, preToolUse, postToolUse, userPromptSubmitted, agentStop). A preToolUse hook that greps a proposed command for DROP TABLE or a production hostname is the cheapest safety net in this whole guide.
MCP servers
Copilot CLI ships with GitHub’s MCP server already configured, which is how it reads issues and merges pull requests. Add more servers from the terminal:
copilot mcp add --transport http sentry https://mcp.sentry.dev/mcp
Or from inside a session with /mcp add and Ctrl+S to save. Server definitions live in mcp-config.json in ~/.copilot by default (change the location with the COPILOT_HOME environment variable).
Context management: don’t let the conversation eat itself
Long sessions rot. The model forgets the plan, repeats questions, and starts editing files it already fixed. Three commands keep that under control:
/usage— session statistics: AI Credits used, session duration, lines of code edited, and token usage per model./context— a visual overview of current token usage./compact— manually compresses conversation history to free up context.
Copilot also compacts automatically in the background when the conversation approaches roughly 80% of the token limit, and it pauses at about 95% until compaction finishes. Treat automatic compaction as a rescue, not a strategy: when a session’s context is mostly old work, start a fresh one with a one-paragraph summary of where you are.
Safety: permissions, sandboxes, and the –yolo rule
An agent that can run shell commands in your repo needs guardrails, and Copilot CLI gives you four, in increasing strength.
1. Per-action approval (default). Every file change and command asks first. Stay in this mode while you learn what the agent does with your codebase. Never save a permanent approval for a destructive command: approving rm once “for this location” lets Copilot delete any file in that directory without asking again.
2. Assisted permissions. Turn it on with /permissions assisted and a model assesses eligible permission requests, automatically approving the ones it judges safe. Your existing permissions and enterprise rules still apply, and anything it can’t judge still comes to you. This is the right middle ground for daily work.
3. Local sandboxing. /sandbox enable restricts what the commands and tools Copilot runs on your behalf can access — filesystem, network, and system capabilities. Note the detail: it sandboxes the tools, not the CLI itself.
4. Cloud sandbox. copilot --cloud runs the whole session in a cloud sandbox instead of on your machine. Use it when the work involves untrusted code — a random repo, a dependency you haven’t vetted, a prompt injection in a README.
And the rule that matters most: --allow-all and --yolo grant broad permissions without a model safety review and can let destructive commands run with no individual approval. Only use them in a sandboxed or otherwise isolated environment — a throwaway container, a cloud sandbox, a repo you can delete and re-clone. Deny rules and enterprise restrictions still apply even with --yolo, but that is a backstop, not a plan.
Check what you are about to approve: the permission prompt shows the exact command, and a plausible-looking sed can rewrite more than you expect. And keep secrets out of the conversation — don’t paste API keys into prompts, and remember the agent can read any file in a trusted directory, including .env.
Copilot CLI vs Claude Code: the honest comparison
Most readers will be choosing between these two, so here is the short version. Copilot CLI wins on choice and price: several vendors’ models on one plan, a free tier, Pro from $10 a month (Claude Code starts at $20 a month on Claude Pro), and BYOK plus local models since April 2026. Its home turf is GitHub — issues, pull requests, and the cloud agent are built in. Claude Code wins on breadth: it runs in the terminal, VS Code, JetBrains, a desktop app, the web, and mobile, with scheduled cloud tasks and GitHub Actions or GitLab CI support. Both have plan mode, subagents, project instruction files, and a scripting mode.
The deciding question is simple: if your work lives on GitHub and you want the cheapest capable agent, start with Copilot CLI. If you want one agent everywhere, including your phone, Claude Code is the better fit. Nothing stops you using both — they read the same AGENTS.md.
7 mistakes to avoid
- Running it in a folder you haven’t vetted. The trust prompt is a security boundary, not a formality. A cloned repo with a malicious prompt in its README can talk to the agent.
- Using
--yoloon your real machine. Autopilot plus allow-all on a repo with production credentials is how you delete a database on a Tuesday. Sandbox it or skip it. - Skipping plan mode on multi-file work. Interactive mode is for questions. Anything that touches three or more files deserves a plan you have read and argued with.
- Using
/fleetfor sequential work. Parallel agents on dependent tasks just bill you more credits to wait in line. - Letting context rot. Check
/contextbefore a long session goes sideways. A fresh session with a good summary beats a compacted one. - Scripting
-pwithout pinning the model. Models retire — Opus 5 and GPT-5.6 Terra left Copilot on 16 November 2026. Pin with--modeland always put a human-readable diff between the agent and any commit or deploy. - Never checking
/usage. Credits are real money at $0.01 each. A fleet run or a scheduled prompt you forgot about shows up here first.
Start small: install it, log in, and ask it to explain a repo you know well. Use plan mode on a real task, write a ten-line .github/copilot-instructions.md, and run /review on your own PR before a human sees it. By the end of the week you will know whether the CLI earns a place in your daily workflow — and /usage will tell you exactly what it cost to find out.
Facts verified 23 November 2026 against GitHub’s official Copilot CLI documentation and GitHub’s plans page as reported by independent pricing trackers. Prices, credit allowances, and model availability change — confirm them on GitHub before you subscribe.
Further Reading & References
- Getting started with GitHub Copilot CLI — GitHub Docs
- Using GitHub Copilot CLI — GitHub Docs
- Delegating tasks to Copilot — GitHub Docs
- Delegating and parallelizing work with agents — GitHub Docs
- How to Use GitHub Copilot CLI — fast.io
- Claude Code vs GitHub Copilot CLI (2026) — exploreai.directory
- GitHub Copilot (App & CLI) — LLM CLI Training
- GitHub Copilot Pricing (November 2026) — DevHunt
- Claude Code vs Cursor: Which AI Coding Assistant Should You Actually Pay For? — HowToShipIt
- How to Run Multiple AI Coding Agents in Parallel with Git Worktrees — HowToShipIt



