DEV Community

Hamza
Hamza

Posted on Originally published at tekmag.thsite.top

How to Use GitHub Copilot CLI for Terminal-Based AI Coding

Originally published at https://tekmag.thsite.top/how-to-use-github-copilot-cli-for-terminal-based-ai-coding/

GitHub Copilot CLI is a terminal-native coding agent that Plans, executes, reviews, and remembers work across sessions without leaving the command line. It reached general availability on February 25, 2026, and ships with every Copilot subscription tier from Free to Enterprise. This guide covers installation, the three core working modes, GitHub integration, extensibility through MCP servers, skills, and plugins, plus the advanced features that make it practical for long-running work.

Key Takeaways

  • Copilot CLI went GA on February 25, 2026, after a public preview that began in September 2025. It is included in all Copilot tiers: Free, Pro, Pro+, Max, Business, and Enterprise.
  • Install it with npm (Node.js 22+), WinGet, Homebrew, or a one-line shell script. Homebrew, WinGet, and script installs update automatically.
  • Press Shift+Tab for plan mode, which writes a structured plan to plan.md before any code changes. Autopilot mode executes the full workflow without per-step approval.
  • /fleet runs the same task across parallel subagents, & delegates work to a cloud agent, and /resume switches between local and remote sessions.
  • Extend it with custom MCP servers, plugins installed from GitHub repos, markdown agent skills, and preToolUse/postToolUse hooks for policy enforcement.
  • Sessions persist in ~/.copilot/session-state/, and auto-compaction at 95% of the context window keeps long runs from hitting limits.

Introduction

GitHub Copilot CLI is an autonomous coding agent that lives in your terminal. It reads your codebase, edits files, runs builds and tests, and iterates until a task is done. You set the level of control: approve every action, review a plan first, or let it run end to end.

The GA release on February 25, 2026 followed a public preview that started in September 2025, with hundreds of improvements shipped in between. The tool targets developers who want agentic coding in the shell rather than in an IDE chat panel, and it works on macOS, Linux, and Windows. The terminal AI agent race has several players: if you already use Anthropic's offering, our guide to Claude Code in 2026 breaks down how that tool fits into developer workflows. Copilot CLI differentiates through GitHub integration: it operates directly on issues and pull requests, and it inherits your organization's governance policies out of the box.

Installation

Copilot CLI is distributed five ways, each with different maintenance behavior:

  • npm: npm install -g @github/copilot, which requires Node.js 22 or newer.
  • WinGet (Windows): winget install GitHub.Copilot.
  • Homebrew (macOS): brew install --cask copilot-cli.
  • Shell script: curl -fsSL https://gh.io/copilot-install | bash.
  • Standalone executables, plus built-in availability in the default GitHub Codespaces image and as a Dev Container Feature.

Homebrew, WinGet, and shell script installations update automatically; npm installs need an explicit update. After installing, run copilot in a project directory and authenticate. GitHub's docs describe three sign-in paths: the OAuth device flow, reuse of an existing GitHub CLI token, and GITHUB_ASKPASS for CI/CD pipelines where no interactive terminal exists. Once authenticated, the CLI automatically picks up your organization's Copilot policies and governance settings.

Core Modes

Four ways of working cover nearly all use cases.

Interactive mode is the default: a chat-style conversation in which Copilot reads your repository, proposes edits, and runs commands. You approve each action before it lands on disk.

Plan mode is one keystroke away. Press Shift+Tab and Copilot switches to a read-first workflow: it analyzes the request, asks clarifying questions, and writes a structured implementation plan to plan.md in the session folder. You review and approve the plan, then watch execution. This mode pairs well with spec-driven development, and our walkthrough of GitHub's Spec-Kit shows how to feed structured specifications into coding agents like this one.

Autopilot mode, the other Shift+Tab state, removes per-step approval. Copilot executes tools, runs commands, and iterates until the task is complete. Use it for work you trust it to handle end to end, not for the first run on an unfamiliar codebase.

Non-interactive mode runs scripted. copilot -p "your prompt" executes a single task and exits, and adding -sp prints only the result with no progress chatter. That makes it suitable for CI jobs and shell pipelines.

Underneath all four modes, Copilot delegates to built-in specialized agents: Explore for fast codebase analysis, Task for running builds and tests, Code Review for change analysis, and Plan for implementation work. Multiple agents can run in parallel, which you control explicitly through /fleet (covered below).

GitHub Integration

The integration goes deeper than git commands. Copilot CLI ships with GitHub's MCP server built in, so it can search issues, analyze labels and activity, and summarize scope without context hunting. A typical workflow starts from the backlog: assign two or three issues, watch Copilot map the relevant files, and move from triage to implementation inside the shell.

For organizations, the governance story matters as much as the features. The CLI inherits existing Copilot policies: administrators control model availability through policy settings, network access management defines per-subscription API endpoints, and HTTPS proxy support covers restricted environments. Business and Enterprise licenses get access with no additional billing, but an administrator must enable the CLI in the Policies page first. On the security side, every file change and command execution requires explicit approval before it applies, and preToolUse hooks let teams enforce file access rules, argument sanitization, and custom approval flows at the tool-call level.

Extensibility: MCP, Skills, and Plugins

Copilot CLI is a platform, not a fixed toolset, and the extension surface has four layers.

Model Context Protocol servers connect external tools and services. The built-in GitHub server covers the basics; custom servers reach into anything with an API. GitHub also maintains a registry of partner and community MCP servers. If your workflow needs domain-specific data feeding the agent, an MCP server is the standard way to attach it.

Plugins bundle MCP servers, agents, skills, and hooks into a single installable unit from a GitHub repo. The command is /plugin install owner/repo. Community plugins cover everything from linter integrations to deployment workflows.

Agent Skills are markdown files that teach Copilot specialized workflows. They live in .github/skills/, ~/.copilot/skills/, or .agents/skills/, load automatically when relevant, and work across the Copilot coding agent, Copilot CLI, and VS Code. A skill for your team's release process, for instance, keeps the agent consistent without re-explaining the steps every session.

Custom agents use .agent.md files with their own tools, instructions, and MCP servers, creatable through an interactive wizard. GitHub also publishes a guided module for building applications with Copilot CLI, which is a reasonable first project for a team that wants to learn the extension model hands on.

Advanced Features

The features that separate a session tool from a working environment all sit in the command set.

/fleet runs the same task across multiple subagents in parallel and converges the results into one decision-ready output. You choose what gets applied. For "which approach is right" questions, racing approaches against each other beats asking one model twice.

Background delegation: prefix any prompt with & and the work goes to Copilot's cloud coding agent while your terminal stays free. /resume then switches between local and remote sessions, so a task can start locally and finish on the cloud without losing context.

Review and undo: /diff shows syntax-highlighted, inline diffs of everything the session changed, with line-specific comments that can be submitted as structured feedback. /review analyzes staged or unstaged changes directly in the CLI as a pre-commit sanity check. Press Esc twice to rewind file changes to any previous snapshot in the session.

Memory: when a conversation nears 95% of the context window, Copilot compacts the history in the background, so sessions run as long as the task needs. Repository memory carries learned conventions, patterns, and preferences across sessions, and cross-session memory lets you ask about past work, files, and pull requests. Raw session data (events, workspace state, plan, checkpoints, and file snapshots) persists in ~/.copilot/session-state/{session-id}/ for inspection.

Terminal UX

The terminal experience is where daily use happens, and the GA release invested heavily here.

Model choice is per session. Switch with /model; available models include Claude Opus 4.6, Claude Sonnet 4.6, GPT-5.3-Codex, and Gemini 3 Pro, with Claude Haiku 4.5 for fast tasks. GPT-5 mini and GPT-4.1 cost no extra premium requests on your subscription. Reasoning effort and reasoning visibility (toggle with Ctrl+T) are both configurable. We covered the wider multi-vendor model strategy in GitHub Copilot's multi-vendor model move, and the CLI applies the same logic at task granularity.

Layout and input options: an alt-screen mode (currently an /experimental feature) gives a full-screen UI with mouse text selection, Page Up/Down scrolling, and a footer status bar. /theme offers GitHub Dark, GitHub Light, and colorblind-friendly variants. The CLI respects your $SHELL, the ! prefix runs commands directly in the shell, and Ctrl+X or Ctrl+E opens your preferred editor for longer prompts. Keybindings follow UNIX conventions (Ctrl+A/E/W/U/K, Alt+arrows), Ctrl+Z suspends and resumes, and ? opens a quick help overlay. Accessibility support includes a screen reader mode and a responsive layout for narrow terminals.

Conclusion

Copilot CLI at GA is a complete environment rather than a chat box: plan first, execute autonomously, review diffs, rewind mistakes, run agents in parallel, and pick the model per task. Pricing is built into the tiers you already have. Each agent interaction draws from your plan's AI Credits allowance, and no separate CLI charge exists for Free, Pro, Pro+, Max, Business, or Enterprise. Administrators on Business and Enterprise simply enable the CLI in the Policies page.

Where it fits depends on your workflow. If you want a terminal agent that is polished, integrated with GitHub, and lighter on autonomy, Copilot CLI is the one to set up first. If your daily work centers on deep, multi-file refactors, compare it against Claude Code. One adjacent gap: it still can't see your screen, and OpenCode Senses shows how a vision plugin closes that gap for text-only coding agents. The natural next step is to install it on one machine, run a real issue through plan mode, and let the plan.md workflow decide whether it earns a place in your loop.

{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [
{
"@type": "Question",
"name": "How much does Copilot CLI cost?",
"acceptedAnswer": {
"@type": "Answer",
"text": "It is included in every GitHub Copilot plan: Free, Pro, Pro+, Max, Business, and Enterprise. Each interaction with the agent draws on your plan\u2019s AI Credits allowance; there is no separate CLI charge. Business and Enterprise users need an admin to enable the CLI in the Policies page."
}
},
{
"@type": "Question",
"name": "Which operating systems are supported?",
"acceptedAnswer": {
"@type": "Answer",
"text": "macOS, Linux, and Windows. It runs locally, inside GitHub Codespaces, and as a Dev Container Feature. Homebrew, WinGet, and shell script installations update themselves automatically."
}
},
{
"@type": "Question",
"name": "Does it work with editors other than VS Code?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Yes. Copilot CLI operates independently in your terminal and modifies files that any editor can open, which makes it useful for editors without official Copilot extensions. It also runs in the VS Code integrated terminal and chat panel if you prefer that setup."
}
},
{
"@type": "Question",
"name": "How does it handle security and governance?",
"acceptedAnswer": {
"@type": "Answer",
"text": "It inherits your organization\u2019s existing Copilot governance policies, model availability controls, and network access settings. Every file change and command execution requires explicit approval, and preToolUse hooks let admins enforce file access policies and argument sanitization before tools run."
}
}
]
}

Frequently Asked Questions

How much does Copilot CLI cost?

It is included in every GitHub Copilot plan: Free, Pro, Pro+, Max, Business, and Enterprise. Each interaction with the agent draws on your plan's AI Credits allowance; there is no separate CLI charge. Business and Enterprise users need an admin to enable the CLI in the Policies page.

Which operating systems are supported?

macOS, Linux, and Windows. It runs locally, inside GitHub Codespaces, and as a Dev Container Feature. Homebrew, WinGet, and shell script installations update themselves automatically.

Does it work with editors other than VS Code?

Yes. Copilot CLI operates independently in your terminal and modifies files that any editor can open, which makes it useful for editors without official Copilot extensions. It also runs in the VS Code integrated terminal and chat panel if you prefer that setup.

How does it handle security and governance?

It inherits your organization's existing Copilot governance policies, model availability controls, and network access settings. Every file change and command execution requires explicit approval, and preToolUse hooks let admins enforce file access policies and argument sanitization before tools run.


References

  1. GitHub Copilot CLI is now generally available (GitHub Changelog, Feb 25, 2026)
  2. Getting started with GitHub Copilot CLI (official docs)
  3. GitHub Copilot CLI feature page and FAQ
  4. Adding agent skills for GitHub Copilot CLI (official docs)
  5. Best practices for GitHub Copilot CLI (official docs)

Top comments (0)