GitHub Copilot CLI
Terminal-first agentic coding agent from GitHub. Not just command suggestions — a full autonomous coding agent that reads your repo, plans changes, executes tasks, and iterates. GA since February 2026.
Terminal-first agentic coding agent from GitHub. Not just command suggestions — a full autonomous coding agent that reads your repo, plans changes, executes tasks, and iterates. GA since February 2026.
For IDE-based Copilot features (inline completion, chat, edits, code review), see the GitHub Copilot guide.
What Is Copilot CLI?
GitHub Copilot CLI brings the Copilot coding agent directly into your terminal. It’s architecturally different from the IDE extension:
| Aspect | Copilot IDE Extension | Copilot CLI |
|---|---|---|
| Interface | VS Code / JetBrains sidebar | Terminal (TUI) |
| Primary mode | Inline completions + chat | Agentic task execution |
| Autonomy | Suggests; you accept/reject | Plans, executes, iterates, self-corrects |
| Cloud delegation | No | Yes (& prefix sends to cloud agent) |
| Multi-model switching | Per-session in settings | Mid-session via /model |
| MCP support | Via VS Code extensions | Native (stdio + SSE) |
How it compares to other terminal agents:
| Feature | Copilot CLI | Claude Code | OpenCode |
|---|---|---|---|
| Provider lock-in | Multi-model (GPT, Claude, Gemini) | Anthropic only | Any provider + local |
| Cloud delegation | Yes (& prefix) |
No | No |
| Project instructions | copilot-instructions.md + AGENTS.md |
CLAUDE.md |
AGENTS.md |
| Skills system | .github/skills/ |
.claude/skills/ |
Custom commands |
| MCP support | Tools only (no resources/prompts) | Full (invented MCP) | Stdio + SSE |
| Open source | No | No | Yes (MIT) |
| Speed (benchmarks) | Mid | Fastest | Slowest |
Getting Started
Installation
1
2
3
4
5
6
7
8
# Install via npm (requires Node.js 22+)
npm install -g @github/copilot
# Or via Homebrew (macOS/Linux)
brew install github/copilot/copilot
# Verify installation
copilot --version
Authentication
1
2
3
4
5
# Authenticate with your GitHub account
copilot auth login
# Verify your subscription
copilot auth status
Requires any GitHub Copilot subscription: Free, Pro, Pro+, Business, or Enterprise.
First Prompt
1
2
3
4
5
6
7
8
# Interactive mode (default) — opens TUI
copilot
# Non-interactive mode — quick answer without TUI
copilot -p "explain what this repo does"
# Grant folder permissions on first run
# Copilot will ask to access the current directory
Two Operating Modes
| Mode | How to Use | Best For |
|---|---|---|
| Interactive | Just run copilot |
Multi-step tasks, exploration, coding sessions |
| Non-interactive | copilot -p "your prompt" |
Quick summaries, one-shot questions, scripting |
Core Features
1. Plan Mode
Plan mode makes Copilot analyze your request, ask clarifying questions, and build a structured implementation plan before writing any code.
1
2
3
4
5
# Toggle plan mode
Shift + Tab (cycles in and out of plan mode)
# Or use the /plan command
/plan Add OAuth2 authentication to the API
What happens in plan mode:
- Copilot analyzes the codebase for relevant files
- Asks clarifying questions (scope, constraints, preferences)
- Builds a step-by-step plan with file paths and change descriptions
- You review, adjust, approve
- Only then does it start coding
When to use it: Complex features, multi-file refactoring, anything where “just start coding” would lead to rework. Skip it for small fixes or single-file changes.
Claude Code equivalent: Claude Code’s /plan command or the Plan subagent. Same concept, different interface.
2. Delegation (Cloud Agent)
Prefix any prompt with & to delegate it to the GitHub Copilot coding agent in the cloud. This frees up your terminal for other work.
1
2
3
4
5
# Delegate a task to the cloud
& Add comprehensive test coverage for the auth module
# Equivalent slash command
/delegate Add comprehensive test coverage for the auth module
What happens:
- Task is sent to GitHub’s cloud infrastructure
- Copilot creates a branch, makes changes, opens a draft PR
- You get notified when it’s done
- Review the PR like any other
When to use it: Long-running tasks (test generation, documentation, large refactors) where you don’t want to block your terminal. Not suitable for tasks requiring frequent human judgment.
Claude Code equivalent: No direct equivalent. Claude Code runs locally and blocks the terminal.
3. Specialized Agents
Copilot automatically delegates to specialized agents when appropriate:
| Agent | What It Does | Auto-Triggered When |
|---|---|---|
| Explore | Fast codebase analysis and search | You ask “where is X?” or “how does Y work?” |
| Task | Runs builds, tests, linters | You ask to verify, test, or validate changes |
| Code Review | High-signal review of changes | You ask to review code or a diff |
| Plan | Implementation planning | You use plan mode or ask for a plan |
You don’t need to invoke these manually — Copilot routes to them based on your prompt. But you can force a specific agent:
1
2
/explore How is authentication handled in this repo?
/review Check my last commit for security issues
4. Multi-Model Support
Switch models mid-session based on what you’re doing:
1
2
3
4
5
6
7
# Switch model
/model
# Available models (as of 2026):
# - GPT-5.4 (default, balanced speed + quality)
# - Claude Opus 4.6 (deep reasoning, multi-file understanding)
# - Gemini 3 Pro (multimodal, web-grounded)
Practical model selection:
| Task | Best Model | Why |
|---|---|---|
| Quick code changes | GPT-5.4 | Fastest response |
| Complex refactoring | Claude Opus 4.6 | Best multi-file reasoning |
| Understanding visual designs | Gemini 3 Pro | Multimodal (reads images) |
| Explaining code to non-engineers | Claude Opus 4.6 | Best prose quality |
5. Memory
Copilot remembers context across sessions:
- Session memory — within a single terminal session, full conversation history
- Repository memory — learned patterns and preferences for a specific repo (persists across sessions)
- Cross-session memory — your personal preferences and working patterns
Memory is automatic. No configuration needed.
Deep Dive: Skills, Instructions & Agents in the Repo
This is the most important section for team adoption. These mechanisms let you encode your team’s conventions, workflows, and standards so that every engineer (and every AI tool) follows them consistently.
The Complete .github/ Directory Tree
Everything lives under .github/. This is the consolidated view — individual sections below explain each part:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
.github/
├── copilot-instructions.md # Always-on project-wide instructions
├── instructions/ # Path-specific scoped instructions
│ ├── backend.instructions.md # applyTo: "services/**/*.java"
│ └── frontend.instructions.md # applyTo: "web/src/**/*.tsx"
├── agents/ # Custom agent personas
│ ├── security-reviewer.agent.md
│ └── migration-helper.agent.md
├── skills/ # Workflow skills (slash commands with scripts)
│ └── deploy/
│ ├── SKILL.md
│ └── deploy.sh
├── prompts/ # Reusable prompt templates (simple slash commands)
│ ├── scaffold-component.prompt.md
│ └── prepare-pr.prompt.md
└── hooks/ # Lifecycle policy hooks
└── post-edit.sh
Quick start: Run /init inside Copilot CLI to generate a starter set of these files for your repo.
Instruction Hierarchy
Copilot CLI reads instructions from multiple locations, in this priority order:
1
2
3
4
5
6
7
1. Prompt-level instructions (what you type)
↓ overrides
2. Repository instructions (.github/copilot-instructions.md)
↓ overrides
3. Organization instructions (GitHub org settings)
↓ overrides
4. Default Copilot behavior
Repository instructions always take precedence over org-level defaults.
copilot-instructions.md — Repository-Level Instructions
The primary way to give Copilot project-specific context. Lives at .github/copilot-instructions.md.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<!-- .github/copilot-instructions.md -->
# Project Instructions
## Architecture
- Monorepo: /services (Java 21, Spring Boot), /web (React 18, TypeScript)
- Database: PostgreSQL 16 with Flyway migrations
- CI: GitHub Actions, all PRs must pass lint + test
## Coding Conventions
- No abbreviations in variable names
- Error handling: fail fast at boundaries, trust internals
- Tests: use testcontainers for integration tests, no mocks for DB
- Logging: structured JSON, never log PII
## PR Standards
- Max 400 lines per PR
- One concern per PR
- Always include test coverage for new logic
Scoped instructions: You can also create per-directory instruction files:
1
2
3
4
5
.github/
instructions/
backend.instructions.md # applyTo: "services/**/*.java"
frontend.instructions.md # applyTo: "web/src/**/*.tsx"
migrations.instructions.md # applyTo: "**/migrations/*.sql"
Each scoped file uses YAML frontmatter with an applyTo glob:
1
2
3
4
5
6
7
---
applyTo: "services/**/*.java"
---
# Backend Instructions
- Use constructor injection, never field injection
- All REST endpoints must have OpenAPI annotations
AGENTS.md — Cross-Tool Project Instructions
AGENTS.md in the repo root is the emerging cross-tool standard for project instructions. It’s read by:
- GitHub Copilot CLI (natively)
- OpenCode (natively — it’s their primary instruction file)
- OpenAI Codex (natively)
- Claude Code (via reference in
CLAUDE.md: “Read and follow AGENTS.md”)
When to use AGENTS.md vs copilot-instructions.md:
| Use Case | File | Why |
|---|---|---|
| Team uses only Copilot | .github/copilot-instructions.md |
GitHub-native, supports scoped instructions |
| Team uses mixed tools (Copilot + Claude Code + OpenCode) | AGENTS.md |
Cross-tool standard, one source of truth |
| Both | Use AGENTS.md as source of truth, add one-line reference in copilot-instructions.md |
Best of both worlds |
The Full Taxonomy — Instructions, Prompts, Skills, Agents & Hooks
Five mechanisms, five different purposes:
| Dimension | Instructions | Prompt Files | Skills | Custom Agents | Hooks |
|---|---|---|---|---|---|
| What they are | Static rules loaded at session start | Reusable prompt templates | Task-specific workflows with bundled resources | Specialized personas with constrained tools | Shell scripts enforcing hard policy |
| Activation | Always on (auto-loaded) | Manual via /command-name |
Auto-discovered by relevance | User selection, inference, or CLI flag | Automatic at lifecycle events |
| Scope | Repo-wide norms | Single interaction | Specific workflow | Entire session persona | Every action (enforcement layer) |
Key Properties
| Property | Value |
|---|---|
| GA Date | February 2026 |
| Runtime | Node.js 22+ |
| Models | GPT-5.4, Claude Opus 4.6, Gemini 3 Pro (switchable) |
| Instruction Files | AGENTS.md, .github/copilot-instructions.md, scoped .instructions.md |
| Skills | .github/skills/, .agents/skills/, ~/.copilot/skills/ |
| Custom Agents | .github/agents/*.agent.md, ~/.copilot/agents/*.agent.md |
| Hooks | .github/hooks/ (lifecycle policy enforcement) |
| Memory | User (cross-repo), Repository (cross-session), Session |
| MCP Support | Tools only (no resources/prompts), user-level config |
| Cloud Delegation | Yes (& prefix) |
| Plan Mode | Yes (Shift+Tab or /plan) |
| Cross-Tool Compatible | Shares AGENTS.md with OpenCode, Codex |
| Pricing | Included in all Copilot tiers (Free tier has limits) |