Building Module 6 · Your Agent In Depth: Desktop App & CLI

GitHub Copilot (App & CLI)

Last reviewed

Beginner

What you'll learn

~15 min
  • Know what the GitHub Copilot app and VS Code agent mode offer without a terminal
  • Install and sign in to Copilot CLI (skip if you did it in Lesson 1.2)
  • Run the build loop (plan, approve, build, check, keep) with plan mode
  • Understand AI Credits, plans and tool approval

This is the in-depth lesson for GitHub Copilot. If Copilot is the tool you installed in Lesson 1.2, you are set up already: use this page for its modes, credits and approvals. Not your tool? Pick another from the Module 6 hub; one tool is enough.

ℹCloud Equivalent

Copilot in VS Code works inside GitHub Codespaces, so you get the full Copilot experience without a local install. See the Cloud Sandbox Cheat Sheet for pricing, or set up your sandbox.

Desktop app or CLI

The GitHub Copilot app is GitHub’s desktop agent, built on Copilot CLI: download it from GitHub’s docs for macOS, Windows, or Linux. It is included on every Copilot plan, Copilot Free ($0) among them, so a GitHub account is all you need.

You open a local folder, a GitHub repository, or a project with no repository, then work in Interactive (it checks in with you), Plan (it lays out the work for you to approve first) or Autopilot (it keeps going through a task). It can also keep Canvases, shared documents you and the agent edit together, and run Automations on a schedule. If you have the CLI, copilot app opens the app. If you already work in VS Code, Copilot’s agent mode there is another graphical way in: pick the agent from the Agent dropdown in the chat view.

Copilot CLI is GitHub’s standalone agent for the terminal (the old gh copilot suggest / explain extension is superseded). It reads your codebase, edits files, runs commands and iterates on errors, with deep GitHub integration for Issues, PRs and Actions. Copilot offers models from several makers (Claude 5.5 and Fable 5.2, GPT-6.2, Gemini 4, Microsoft’s MAI Code 2); Copilot Fusion routes each task to a suitable model, and /model shows what your plan lets you pin (supported models).

Install & sign in (skip if you already set this up in Lesson 1.2)

All you need is a GitHub account; create one free at github.com. The Copilot CLI is a standalone tool: it does not require the GitHub CLI (gh), and none of these routes needs Node.js.

Terminal window
curl -fsSL https://gh.io/copilot-install | bash

Or with Homebrew: brew install --cask copilot-cli.

Windows native: Copilot CLI needs PowerShell 6 or later, and Windows ships with the older Windows PowerShell 5.1. Install the current PowerShell first:

Terminal window
winget install Microsoft.PowerShell

Open the new PowerShell 7 (it appears in Windows Terminal and the Start menu as PowerShell, separate from Windows PowerShell), then install Copilot CLI:

Terminal window
winget install GitHub.Copilot

WSL:

Terminal window
curl -fsSL https://gh.io/copilot-install | bash
Terminal window
curl -fsSL https://gh.io/copilot-install | bash

Or with Homebrew: brew install --cask copilot-cli.

Alternative: npm (any platform, Node.js 22 or newer): npm install -g @github/copilot

Verify with copilot --version. Several releases ship each week and the CLI auto-updates. If you get “command not found,” restart your terminal, since the installer may have updated your PATH.

Sign in

Start it and follow the prompt:

Terminal window
copilot

If you’re not logged in, Copilot CLI asks you to run /login. On a local desktop that opens a browser sign-in; over SSH, in Codespaces, dev containers or headless Linux it uses the GitHub device flow, showing a one-time code to enter at github.com/login/device. If COPILOT_GITHUB_TOKEN, GH_TOKEN or GITHUB_TOKEN is set, it silently overrides the stored login. Then Copilot asks whether you trust the files in the current folder.

Plans and AI Credits

💡Copilot Free: $0

Copilot Free is open to anyone with a GitHub account. It includes the CLI, the Copilot app, up to 2,000 completions a month and an allowance of AI Credits for chat and agent work, with automatic model selection only. That makes Copilot the lowest-barrier entry point of the four tools.

GitHub meters chat and agentic work in AI Credits (one credit is $0.01, charged at each model’s per-token price); annual Pro and Pro+ subscribers stay on legacy “premium requests”. Code completions stay unlimited on paid plans.

PlanPriceNotes
Copilot Free$02,000 completions/mo; unpublished AI-Credit allowance; automatic model selection only
Copilot Student$0 (verified students)Unlimited completions; unpublished AI-Credit allowance; automatic model selection only
Copilot Pro$10/mo1,500 AI Credits/mo (worth $15)
Copilot Pro+$39/mo7,000 AI Credits/mo (worth $70); premium models
Copilot Max$100/mo20,000 AI Credits/mo (worth $200); priority access to premium models
Copilot Business$19/seat/mo1,900 AI Credits/user/mo, pooled; admin controls
Copilot Enterprise$39/seat/mo3,900 AI Credits/user/mo, pooled; knowledge bases, audit

From GitHub’s plans and usage-based billing pages; the Cloud Sandbox Cheat Sheet keeps current prices for every tool. To stop extra spend, set a Bundled AI credits budget to $0 and turn on Stop usage when budget limit is reached. Students and verified teachers can qualify for free benefits at education.github.com.

⚠Older models retire often

GitHub retires older models from Copilot in waves; the most recent, on 2026-11-16, removed Claude Opus 5 (use Opus 5.5) and GPT-5.6 Terra. If a saved setting or script names a model that no longer answers, run /model and pick a current one.

Your first build

Already built welcome.html in Lesson 1.2? You’re set. If you are trying Copilot as a second tool, run Lesson 1.2’s Step 2 in your ai-class folder.

The build loop in Copilot

The rhythm is plan, approve, build, check, keep.

Plan mode

Open copilot in your project folder, then type /plan or press Shift+Tab to enter plan mode (one press from the normal mode shows Plan at the bottom of the screen). Describe the goal in one or two sentences. Copilot writes a structured plan; since version 1.0.71 it blocks the built-in tools that would change your files. When the plan is right, pick “Accept plan and continue” and it builds. Then check the result (/review, /diff) and ask Copilot to save a checkpoint (Module 7). The four tools side by side are in the tool modes table.

Copilot also runs in programmatic mode: copilot -p "add error handling to all API routes" --allow-tool='write' runs one prompt and exits. It cannot stop to ask for approval, so name the tools it may use.

Key commands

CommandWhat it does
/helpShow available commands
/modelSwitch the underlying AI model
/contextShow current token usage
/planPlan the work before executing (or Shift+Tab)
/initScaffold custom instructions for this repository
/reviewReview your changes before you keep them (/security-review for a security pass, /diff to see changes)
/resumePick up an earlier session (copilot --continue reopens the most recent)
/usageShow usage and credit consumption
/limitsSet a soft limit on the AI Credits a session may spend (minimum 30)

Run /help for the full set; the command surface expands quickly. Copilot lists /rewind in its help, but what it restores is not documented, so ask the agent to save a checkpoint before each task and treat that as your undo.

Tool approval

Copilot CLI asks for permission before running commands or writing files. Flags change that:

Terminal window
# Allow specific tools
copilot --allow-tool='shell(git)'
# Approval prompts off: tools, file paths and web addresses (the same as --yolo)
copilot --allow-all
# Block specific tools; deny rules win even when everything else is allowed
copilot --allow-all-tools --deny-tool='shell(rm)' --deny-tool='shell(git push)'
ℹApproval prompts on or off

Started as plain copilot, it asks before running a command or writing a file you have not allowed (/permissions show tells you which approval mode it is in). This course starts practice sessions with copilot --allow-all, which turns on every permission at once without asking (what that does and does not protect). GitHub notes that automatic approval can allow destructive operations and suggests a sandbox before granting wide permissions. To be asked more often, start with just copilot.

Custom instructions

/init (or copilot init from the shell) scaffolds custom instructions so Copilot has persistent context about your project. Copilot reads .github/copilot-instructions.md, and also AGENTS.md, CLAUDE.md and GEMINI.md natively, so a brief file you keep for another tool works here too (custom instructions).

More: autopilot, delegation, scheduled prompts

Newer builds add /autopilot (keep working through a task without waiting for you between steps; the allow and deny flags still decide which tools it may use), /delegate (or start a line with &) to hand a task to Copilot’s cloud agent, which opens a draft PR (paid plans only), /fleet (parallel subagents), /tasks, /worktree, /skills and /plugin. Set a soft spend limit on an autonomous run:

Terminal window
copilot --mode autopilot --max-ai-credits 50 --allow-tool='shell(npm test)' --allow-tool='write' -p "fix the failing tests"

Scheduled prompts (/every 1h ..., /after ...) are experimental and appear only after /experimental on (schedule prompts).

🏛️In Your Field: Government Devclick to expand

Allow specific tools while blocking risky ones: copilot --allow-tool='shell(git)' --deny-tool='shell(rm)'. Copilot also understands your Issues and PRs natively, useful for agencies that track projects and compliance documentation in GitHub.

Verify it works

copilot --version should print a version number; if you get an error, make sure copilot is in your PATH.

🔧

When Things Go Wrong

Use the Symptom → Evidence → Request pattern: describe what you see, paste the error, then ask for a fix.

Symptom
'copilot' command not found after installation
Evidence
bash: copilot: command not found
What to ask the AI
"I installed Copilot CLI using npm/brew but my terminal can't find the 'copilot' command. How do I verify the installation and check if it's in my PATH? I may need to restart my terminal or add the install location to my PATH."
Symptom
Authentication fails or login loop
Evidence
Error during /login or device flow doesn't complete
What to ask the AI
"I'm trying to authenticate Copilot CLI but the login flow doesn't complete. I'm on a remote server via SSH. How do I complete the device flow authentication, and do I need any special scopes or permissions on my GitHub account?"
Symptom
Copilot says I've exceeded my usage limit
Evidence
Copilot reports that a usage limit has been reached
What to ask the AI
"I'm on the Copilot Free plan and used up my monthly allowance (completions or AI Credits). What are my options while I wait for it to reset, or how do I upgrade to a paid plan? If I need more agentic work done now, can I use Antigravity CLI's free tier as a stopgap, or buy pay-as-you-go credits?"

Key Takeaways

  • Two ways in, both free: the GitHub Copilot app (or VS Code agent mode) with no terminal, or the CLI (curl on macOS/Linux; PowerShell 7 plus winget install GitHub.Copilot on Windows); Copilot Free covers both
  • The build loop: plan, approve, build, check, keep; /plan or Shift+Tab for plan mode
  • Interactive and programmatic modes: copilot for persistent sessions, copilot -p "prompt" for one-off tasks
  • Tool approval keeps you safe: --allow-tool and --deny-tool control what the agent can do
  • Deep GitHub integration is the standout advantage: native understanding of Issues, PRs and Actions
Search lessons