Learn › GitHub Copilot Mastery › Copilot CLI: AI in Your Terminal

Copilot CLI: AI in Your Terminal

Intermediate 🕐 12 min Lesson 10 of 13
What you'll learn
  • Install the Copilot CLI via the GitHub CLI extension system and verify it is working
  • Use plan, autopilot, and fleet modes for different levels of task automation from the terminal
  • Explain what replaced the deprecated gh copilot suggest and gh copilot explain commands

A Terminal-Native Coding Agent

The Copilot CLI became generally available in February 2026. It is a terminal-native coding agent — not a plugin for your shell, but a first-class tool that brings the same agent capabilities you get in VS Code directly to the command line.

If you work heavily in the terminal, deploy from CI scripts, or SSH into remote machines, the Copilot CLI brings Copilot to places a VS Code extension cannot go. You describe what you want to do in natural language, and the CLI agent plans the steps, suggests the commands, and — in autopilot mode — executes them for you.

Installing the Copilot CLI

The Copilot CLI ships as a GitHub CLI extension. Install it with:

gh extension install github/gh-copilot

This requires the GitHub CLI (gh) to be installed and authenticated first. The GitHub CLI is available at cli.github.com. After installing the extension, verify it works:

gh copilot --version

The CLI uses your existing GitHub Copilot plan — no separate subscription needed.

The Three Execution Modes

The Copilot CLI offers three modes for how much control you keep versus how much you hand off:

  • Plan mode — The agent describes the steps it would take to complete the task, without executing anything. Use this when you want to understand the approach before committing to it. You can then run the steps yourself, modify the plan, or hand it back to the agent.
  • Autopilot mode — The agent executes the task autonomously. It runs commands, checks outputs, and iterates. Risky commands — deleting files, pushing to remote — are surfaced for confirmation. This is the primary way to use the CLI for real work.
  • Fleet mode — Launches parallel sub-agents that work on independent parts of a task simultaneously. Useful for tasks that can be decomposed into parallel work — for example, running linting, tests, and a type check at the same time.

What It Looks Like in Practice

Open a terminal in your project directory and run:

gh copilot "set up the project and run the test suite"

The agent reads the project structure, identifies the package manager, installs dependencies, and runs the appropriate test command. Each step shows in the terminal. Risky steps pause for your approval.

Other examples:

gh copilot "find all TODO comments in src/ and create a GitHub issue for each one"
gh copilot "build the Docker image and push it to the registry as version 1.4.2"
gh copilot "show me which tests are failing and why"

The Legacy gh copilot Commands

Before February 2026, the GitHub CLI had two simpler subcommands: gh copilot suggest (suggest a shell command from a description) and gh copilot explain (explain what a command does). These were deprecated in January 2026 when the new terminal agent launched.

If you have scripts or documentation that references gh copilot suggest, they will prompt you to upgrade when run. The new gh copilot agent replaces and extends both functions — it can still suggest and explain individual commands, but as part of a much richer agent interaction.

Custom Instructions in the CLI

The Copilot CLI reads the same .github/copilot-instructions.md file as the IDE. It also supports adding additional instruction directories through the COPILOT_CUSTOM_INSTRUCTIONS_DIRS environment variable — useful for including team-wide instruction files that live outside the repository.

Try This

In a project you know well, run gh copilot "show me a summary of the last 5 commits and identify any files that were changed in more than 3 of them". Watch how the agent uses git commands to gather the information and synthesises the answer. Then try the same request in plan mode by adding --plan and compare the approach it suggests against what it actually executes in autopilot mode.

Key takeaways
  • The Copilot CLI became GA in February 2026 as a terminal-native coding agent; it requires the GitHub CLI (gh) to be installed first
  • The legacy gh copilot suggest and gh copilot explain commands were deprecated in January 2026 — the new agent CLI replaces and extends both
  • Plan mode shows the steps the agent would take without executing; autopilot executes autonomously; fleet runs parallel sub-agents