Domain 1 of 6 · Chapter 2 of 4

Use GitHub Copilot CLI

Unlock the complete study guide.

Bundled into the existing GitHub Copilot premium course — no separate purchase.

14-day money-back guarantee — no questions asked.

Included in this chapter:

  • A coding agent that works from your terminal
  • Access: plan, policy and installation
  • First launch: from copilot to your first prompt
  • Scoping what Copilot CLI can reach
  • Permission layers: what the agent may do
  • Sandboxing: limiting what an approved action can reach
  • Interactive modes: default, plan and autopilot
  • Steering Copilot while it works
  • Slash commands control the CLI, not your shell
  • Context over time: sessions, compaction and memory
  • Reviewing and undoing CLI changes
  • Delegating work to other agents
  • The programmatic interface: one prompt, then exit
  • Generating scripts and managing files
  • Practice scenarios for Copilot CLI

Ways to run a Copilot CLI task: where the work runs and who approves each step

QuestionDefault modePlan modeAutopilot modeProgrammatic interface (-p)/delegate
Where the work runsYour machine, in an interactive session started locallyYour machine, in an interactive session started locallyYour machine, in an interactive session started locallyYour machine, one prompt then exitGitHub, in Copilot cloud agent
Who approves file changes and commandsYou, for actions not already approvedDirect project-file edits wait for plan approval; some shell commands and MCP tool calls can still run during planning (see Plan mode)Nobody per step, after you grant full permissionsRead-only operations and previously approved tools run without a new prompt; to modify or execute files, pass an approval option such as --allow-tool, because no one is present to answer a promptYou review the draft pull request
What you getA conversation you steer turn by turnAn implementation plan to review firstA task completed end to endA single result a script can consumeA branch and draft pull request
Choose it whenYou want to answer the approval prompt for actions not already approvedThe approach must be agreed before codingThe task is trusted and the environment is isolatedAutomation needs one answer without a personWork should continue with your machine off

Decision tree

Must work continue withyour machine off?Yes/delegate(Copilot cloud agent)NoIs a person present tosteer and approve?NoProgrammatic interface(copilot -p)YesMust the approach be agreedbefore code changes?YesPlan mode(review the plan first)NoTrusted task in an isolatedenvironment, no per-step approval?YesAutopilot mode(full permissions)NoDefault mode(prompts for actions not already approved)

Cheat sheet

  • Copilot CLI is an AI agent used directly from the terminal
  • Copilot CLI is available across Copilot plans but can be organization-gated
  • Copilot CLI can perform both local project work and GitHub.com tasks
  • Copilot CLI has platform-appropriate supported installation methods
  • The npm installation uses the current @github/copilot package
  • First use authenticates the CLI with the Copilot-enabled GitHub account
  • A successful CLI installation does not override an organization's disabled CLI policy
  • The gh copilot command bootstraps and launches the standalone Copilot CLI
  • The copilot command starts a conversational interactive session
  • CLI plan mode structures a task before code is written
  • Interactive steering can queue follow-ups or redirect work in progress
  • A resumed CLI session restores its conversation history
  • Autopilot mode trades per-action approval for hands-free local execution
  • Copilot CLI includes specialized agents for common terminal workflows
  • CLI delegation can move a task to Copilot cloud agent for background execution
  • CLI slash commands control the session rather than becoming shell commands
  • The context command shows how the active context window is being used
  • Context compaction summarizes history so a long CLI conversation can continue
  • Chronicle features answer questions about persisted CLI session history
  • The diff command provides an inspection surface for CLI file changes
  • The review command asks the CLI code-review agent to analyze changes
  • Rewind can roll a CLI session back to an earlier turn and restore its file changes
  • Repository memory carries validated project facts into later CLI sessions
  • Cross-session memory can answer questions about work beyond one saved transcript
  • The prompt option runs one task non-interactively and then exits
  • Programmatic file changes or commands need an explicit approval policy
  • Programmatic mode composes Copilot with scripts and automation
  • Copilot CLI requests permission before using mutating or executable tools
  • Tool allow rules should grant only the command family the task needs
  • The directory used to launch Copilot CLI defines a trusted scope
  • A sandbox reduces the filesystem, network, or host impact of CLI actions
  • Copilot CLI honors governed content-exclusion policy for context
  • Restrict Copilot CLI tools to the task
  • Copilot CLI can locate relevant project files and apply requested changes
  • Generating a script and authorizing its execution are separate decisions
  • CLI file work can be reviewed in Git before committing or opening a pull request
  • File-generation prompts should name the validation and success criteria

Unlock with Premium — includes all practice exams and the complete study guide.

Also tested in

References

  1. https://docs.github.com/en/copilot/concepts/agents/copilot-cli/about-copilot-cli
  2. https://learn.microsoft.com/en-us/credentials/certifications/resources/study-guides/gh-300
  3. https://docs.github.com/en/copilot/how-tos/copilot-cli/use-copilot-cli/overview
  4. https://docs.github.com/en/copilot/how-tos/copilot-cli/cli-getting-started
  5. https://docs.github.com/en/copilot/how-tos/copilot-cli/set-up-copilot-cli/install-copilot-cli
  6. https://github.com/github/copilot-cli/releases
  7. https://github.blog/changelog/2025-09-25-upcoming-deprecation-of-gh-copilot-cli-extension/
  8. https://github.blog/changelog/2026-01-21-install-and-use-github-copilot-cli-directly-from-the-github-cli/
  9. https://docs.github.com/en/copilot/how-tos/copilot-cli/use-copilot-cli/allowing-tools
  10. https://github.blog/changelog/2026-09-02-content-exclusions-generally-available-in-copilot-app-and-cli/
  11. https://docs.github.com/en/copilot/reference/copilot-cli-reference/cli-programmatic-reference
  12. https://docs.github.com/en/copilot/reference/copilot-cli-reference/cli-command-reference
  13. https://docs.github.com/en/copilot/concepts/about-cloud-and-local-sandboxes
  14. https://docs.github.com/en/copilot/how-tos/copilot-cli/use-copilot-cli/delegate-tasks-to-cca
  15. https://docs.github.com/en/copilot/how-tos/chat-with-copilot/chat-in-ide
  16. https://docs.github.com/en/copilot/how-tos/copilot-cli/cli-best-practices
  17. https://docs.github.com/en/copilot/concepts/agents/copilot-cli/autopilot
  18. https://docs.github.com/en/copilot/how-tos/copilot-cli/use-copilot-cli/work-with-multiple-sessions
  19. https://docs.github.com/en/copilot/concepts/agents/copilot-cli/chronicle
  20. https://github.blog/changelog/2026-02-25-github-copilot-cli-is-now-generally-available/
  21. https://docs.github.com/en/copilot/how-tos/copilot-cli/use-copilot-cli/chronicle
  22. https://docs.github.com/en/copilot/concepts/agents/copilot-memory
  23. https://docs.github.com/en/copilot/how-tos/copilot-cli/use-copilot-cli/agentic-code-review
  24. https://docs.github.com/en/copilot/how-tos/copilot-cli/automate-copilot-cli/run-cli-programmatically
  25. https://docs.github.com/en/get-started/using-git/about-git