You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Using-GitHub-Copilot-CLI/README.md
+45-27Lines changed: 45 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,21 +4,21 @@
4
4
5
5
Welcome to a hands-on, multi-module course that takes GitHub Copilot beyond the editor and directly into your terminal as a fully autonomous coding agent. The GitHub Copilot CLI is a standalone AI-powered tool — separate from the `gh` extension — that opens an interactive chat session in your terminal, understands your local codebase, and can plan and execute complex multi-step coding tasks on your behalf.
6
6
7
-
Prepare for a practical, end-to-end experience! You will install the new `copilot` CLI, master its interactive and programmatic interfaces (including plan mode and autopilot mode), control tool permissions, manage conversation context, integrate with GitHub.com, select models, configure custom agents, and combine everything into a real-world development workflow.
7
+
Prepare for a practical, end-to-end experience! You will install the new `copilot` CLI, master its interactive and programmatic interfaces (including plan mode and auto model selection), control tool permissions, manage conversation context, integrate with GitHub.com, select models, configure custom agents, and combine everything into a real-world development workflow.
8
8
9
9
</header>
10
10
11
11
12
12
-**Who this is for**: Developers, DevOps Engineers, Platform Engineers, Software Development Managers, Testers.
13
-
-**What you'll learn**: How to install and use the standalone GitHub Copilot CLI, leverage its interactive/plan/autopilot modes, control tool approval, manage context, interact with GitHub.com, select AI models, configure custom agents, and use `gh agent-task` for remote agent tasks.
13
+
-**What you'll learn**: How to install and use the standalone GitHub Copilot CLI, leverage its interactive and plan modes, use Auto model selection, control tool approval, manage context, interact with GitHub.com, select AI models, configure custom agents, and use `gh agent-task` for remote agent tasks.
14
14
-**What you'll build**: A real-world CLI-driven workflow covering project analysis, debugging, refactoring, test generation, and agent-assisted automation using MCP integrations.
15
15
-**Prerequisites**: GitHub Copilot is available to use for free, sign up for [GitHub Copilot](https://gh.io/copilot). Basic familiarity with a terminal and Git is recommended.
16
16
-**Timing**: This module can be completed in under 90 minutes.
17
17
18
18
By the end of this module, you'll acquire the skills to be able to:
19
19
20
20
- Install, authenticate, and launch the standalone GitHub Copilot CLI.
21
-
- Use interactive mode, plan mode, and autopilot mode.
21
+
- Use interactive mode and plan mode; let Auto model selection choose the optimal model.
22
22
- Control tool approval with `--allow-tool`, `--deny-tool`, and `--allow-all-tools`.
23
23
- Manage conversation context with `/compact`, `/context`, and auto-compaction.
24
24
- Interact with GitHub.com natively — list PRs, work on issues, and create pull requests from the terminal.
@@ -56,11 +56,32 @@ This workshop uses a sample project that contains a backend API and a frontend w
56
56
- Authenticate and launch your first session
57
57
- Understand the difference between the new `copilot` CLI and the deprecated `gh copilot` extension
58
58
59
-
The **GitHub Copilot CLI** (`copilot`) is a standalone terminal application — distinct from the old `gh copilot` extension — that opens a full interactive AI chat session in your terminal. It ships with the GitHub MCP server built in, supports plan and autopilot modes, and can autonomously read files, run commands, and interact with GitHub.com on your behalf.
59
+
The **GitHub Copilot CLI** (`copilot`) is a standalone terminal application — distinct from the old `gh copilot` extension — that opens a full interactive AI chat session in your terminal. It ships with the GitHub MCP server built in, supports plan mode and auto model selection, and can autonomously read files, run commands, and interact with GitHub.com on your behalf.
60
60
61
61
> **Note**: The `gh extension install github/gh-copilot` extension was deprecated in September 2025 and archived at v1.2.0. This workshop uses the new standalone `copilot` CLI.
62
62
63
-
#### Installing the CLI
63
+
#### Prerequisites
64
+
65
+
This workshop uses two separate CLI tools:
66
+
67
+
-**`copilot`** — the standalone GitHub Copilot CLI (installed below)
68
+
-**`gh`** — the GitHub CLI, required for `gh agent-task` commands in Sections 4 and 6
69
+
70
+
Install `gh` first if you don't already have it:
71
+
72
+
**Windows:**
73
+
```powershell
74
+
winget install GitHub.CLI
75
+
```
76
+
**macOS / Linux:**
77
+
```bash
78
+
brew install gh
79
+
```
80
+
Then authenticate: `gh auth login`
81
+
82
+
---
83
+
84
+
#### Installing the Copilot CLI
64
85
65
86
1. Choose the installation method for your platform:
66
87
@@ -133,7 +154,7 @@ In the above exercises we achieved the following:
133
154
🎯 **Learning Goals**
134
155
- Use the default ask/execute mode for general coding tasks
135
156
- Switch to plan mode to build a structured implementation plan before writing code
136
-
- Enable experimental autopilot mode for fully autonomous task completion
157
+
- Enable Auto model selection to reduce rate limiting and simplify model management
137
158
- Navigate the interactive interface using slash commands
138
159
139
160
The GitHub Copilot CLI interactive session (launched with `copilot`) offers three modes. You cycle between them with `Shift+Tab`.
@@ -194,42 +215,40 @@ Plan mode is ideal for larger or less well-defined tasks. Instead of immediately
194
215
195
216
Once you are satisfied, confirm the plan and Copilot will execute each step sequentially, requesting tool approval as needed.
196
217
197
-
#### Autopilot Mode (Experimental)
218
+
#### Auto Model Selection
198
219
199
-
Autopilot mode encourages Copilot to continue working until the task is fully complete, with minimal interruption. It is available after enabling experimental mode.
220
+
Instead of manually picking a model every session, you can let Copilot automatically choose the best available model on your behalf. This reduces rate limiting and removes the mental overhead of model selection. Auto model selection is available on all Copilot plans.
200
221
201
-
7.Enable experimental mode. You can do this at any time from within an active session:
222
+
7.Open the model picker and choose **Auto**:
202
223
203
224
```
204
-
/experimental
225
+
/model
205
226
```
206
227
207
-
This setting is persisted in your config, so you only need to do this once. Alternatively, launch with the flag:
228
+
Select **Auto** from the list. With Auto enabled, Copilot picks from a pool of 1× multiplier models — currently GPT-4.1, GPT-5 mini, GPT-5.2-Codex, GPT-5.3-Codex, Claude Haiku 4.5, and Claude Sonnet 4.5 — subject to your organisation's policies and your subscription. The pool changes over time as new models become available.
208
229
209
-
```bash
210
-
copilot --experimental
211
-
```
230
+
> **Note**: Auto will never select models excluded by administrator policy, models with a premium multiplier greater than 1×, or models unavailable on your plan.
212
231
213
-
8. Press `Shift+Tab` to cycle to **Autopilot** mode.
232
+
<divalign="left">
233
+
<imgsrc="./images/005-auto-model.jpg"alt="/model picker with Auto selected in the Copilot CLI">
234
+
</div>
214
235
215
-
9. Give Copilot a self-contained task and let it run to completion:
236
+
8. To see which model handled a response, check the CLI output — the model used is reported alongside each reply.
216
237
217
-
```
218
-
Add pagination (page and pageSize query parameters) to the /weatherforecast endpoint, update the OpenAPI spec, and add xUnit tests covering edge cases.
219
-
```
238
+
9. Override Auto at any time by picking a specific model from `/model`, or set one at launch:
220
239
221
-
Copilot will work through the task, running tests and self-correcting until all tests pass — similar to Agent Mode in VS Code.
240
+
```bash
241
+
copilot --model claude-sonnet-4.6
242
+
```
222
243
223
-
<divalign="left">
224
-
<imgsrc="./images/005-autopilot-mode.jpg"alt="Copilot CLI autopilot mode running autonomously and self-correcting test failures">
225
-
</div>
244
+
> **Paid plan tip**: When using Auto on a paid plan (Pro, Pro+, Business, Enterprise), qualifying models receive a **10% multiplier discount** compared to selecting the same model manually.
226
245
227
-
> **Caution**: Each prompt in Autopilot mode reduces your monthly premium request quota. Use well-scoped prompts to avoid excessive consumption.
246
+
> **Coding agent note**: Auto model selection for `gh agent-task` (Copilot coding agent) is generally available for **Pro and Pro+ plans only** and currently selects from Claude Sonnet 4.5.
228
247
229
248
In the above exercises we achieved the following:
230
249
- ✅ Used default mode for interactive ask/execute tasks
231
250
- ✅ Used plan mode to design a multi-step implementation before writing code
232
-
- ✅ Enabled and used autopilot mode for autonomous task completion
251
+
- ✅ Enabled Auto model selection to reduce rate limiting and simplify model management
233
252
234
253
---
235
254
@@ -750,7 +769,7 @@ The complete workflow you just executed maps to a repeatable pattern for any fea
750
769
|---|---|---|
751
770
| Explore | Copilot CLI (default mode) | Map affected files with natural language |
752
771
| Design | Copilot CLI (plan mode) | Build and review a structured implementation plan |
753
-
| Build & test | Copilot CLI (default/autopilot mode) | Implement, run tests, self-correct |
772
+
| Build & test | Copilot CLI (default/plan mode) | Implement, run tests, self-correct |
0 commit comments