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: content/copilot/reference/copilot-cli-reference/cli-command-reference.md
+86-13Lines changed: 86 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,6 +104,7 @@ copilot completion fish > ~/.config/fish/completions/copilot.fish
104
104
| <kbd>Ctrl</kbd>+<kbd>V</kbd> | Paste from clipboard as an attachment. |
105
105
| <kbd>Ctrl</kbd>+<kbd>X</kbd> then `/`| After you have started typing a prompt, this allows you to run a slash command—for example, if you want to change the model without having to retype your prompt. |
106
106
| <kbd>Ctrl</kbd>+<kbd>X</kbd> then `e`| Edit the prompt in an external editor (`$EDITOR`). |
107
+
| <kbd>Ctrl</kbd>+<kbd>X</kbd> then `b`| Promote the running task or shell command to the background. |
107
108
| <kbd>Ctrl</kbd>+<kbd>X</kbd> then `o`| Open the most recent link from the timeline. |
108
109
| <kbd>Ctrl</kbd>+<kbd>Z</kbd> | Suspend the process to the background (Unix). |
109
110
| <kbd>Shift</kbd>+<kbd>Enter</kbd> or <kbd>Option</kbd>+<kbd>Enter</kbd> (Mac) / <kbd>Alt</kbd>+<kbd>Enter</kbd> (Windows/Linux) | Insert a newline in the input. |
@@ -113,11 +114,36 @@ copilot completion fish > ~/.config/fish/completions/copilot.fish
| <kbd>Ctrl</kbd>+<kbd>F</kbd> | Open timeline search. |
116
118
| <kbd>Ctrl</kbd>+<kbd>O</kbd> | While there is nothing in the prompt input, this expands recent items in {% data variables.product.prodname_copilot_short %}'s response timeline to show more details. |
117
119
| <kbd>Ctrl</kbd>+<kbd>E</kbd> | While there is nothing in the prompt input, this expands all items in {% data variables.product.prodname_copilot_short %}'s response timeline. |
118
120
| <kbd>Ctrl</kbd>+<kbd>T</kbd> | Expand/collapse display of reasoning in responses. |
119
121
| <kbd>Page Up</kbd>/<kbd>Page Down</kbd> | Scroll the timeline up or down by one page. |
120
122
123
+
## Session picker shortcuts
124
+
125
+
When the session picker is open (opened via `/resume` or `--continue`):
126
+
127
+
| Shortcut | Purpose |
128
+
|----------|---------|
129
+
| <kbd>↑</kbd>/<kbd>↓</kbd> | Move selection up or down. |
130
+
| <kbd>Enter</kbd> | Open the selected session. |
131
+
|`s`| Cycle the sort order: relevance → created → name → last used. |
132
+
| <kbd>Tab</kbd> | Switch between the local and remote tabs. |
133
+
|`d`| Delete the selected session. |
134
+
| <kbd>Esc</kbd> | Close the picker. |
135
+
136
+
Sessions sort by the following modes:
137
+
138
+
| Mode | Description |
139
+
|------|-------------|
140
+
|`relevance`| Scores sessions by match to the current working directory (default). |
141
+
|`last used`| Most recently modified sessions first. |
142
+
|`created`| Most recently created sessions first. |
143
+
|`name`| Alphabetical by session name; unnamed sessions sort to the end. |
144
+
145
+
Sessions already open in another window float to the top in all non-relevance sort modes. When no working-directory context is available, the `relevance` mode is skipped.
146
+
121
147
## Navigation shortcuts in the interactive interface
122
148
123
149
| Shortcut | Purpose |
@@ -147,6 +173,7 @@ copilot completion fish > ~/.config/fish/completions/copilot.fish
147
173
|`/changelog [summarize] [VERSION\|last N\|since VERSION]`, `/release-notes [summarize] [VERSION\|last N\|since VERSION]`| Display the CLI changelog. Optionally specify a version, a count of recent releases, or a starting version. Add the keyword `summarize` for an AI-generated summary. |
148
174
|`/chronicle <standup\|tips\|improve\|reindex>`| Session history tools and insights. {% data reusables.copilot.experimental %} |
149
175
|`/clear [PROMPT]`, `/new [PROMPT]`, `/reset [PROMPT]`| Start a new conversation. |
176
+
|`/clikit [COMPONENT]`| Preview CLI business components (for example, quota info). |
150
177
|`/compact`| Summarize the conversation history to reduce context window usage. See [AUTOTITLE](/copilot/concepts/agents/copilot-cli/context-management#compaction). |
151
178
|`/context`| Show the context window token usage and visualization. See [AUTOTITLE](/copilot/concepts/agents/copilot-cli/context-management#checking-your-context-usage). |
152
179
|`/copy`| Copy the last response to the clipboard. |
@@ -163,7 +190,7 @@ copilot completion fish > ~/.config/fish/completions/copilot.fish
163
190
|`/ide`| Connect to an IDE workspace. See [AUTOTITLE](/copilot/how-tos/copilot-cli/use-copilot-cli/connecting-vs-code#managing-the-connection-with-the-ide-slash-command). |
164
191
|`/init`| Initialize {% data variables.product.prodname_copilot_short %} custom instructions and agentic features for this repository. See [Project initialization for {% data variables.product.prodname_copilot_short %}](#project-initialization-for-copilot). |
165
192
|`/instructions`| View and toggle custom instruction files. |
166
-
|`/keep-alive [on\|busy\|NUMBERm\|NUMBERh]`| Prevent the machine from going to sleep: while a CLI session is active, while the agent is busy, or for a defined length of time. |
193
+
|`/keep-alive [on\|off\|busy\|DURATION]`, `/caffeinate [on\|off\|busy\|DURATION]`| Prevent the machine from going to sleep: while a CLI session is active, while the agent is busy, or for a defined length of time. Accepts durations like `30`, `30m`, `2h`, `1d` (bare numbers default to minutes). |
167
194
|`/list-dirs`| Display all of the directories for which file access has been allowed. |
168
195
|`/login`| Log in to {% data variables.product.prodname_copilot_short %}. |
169
196
|`/logout`| Log out of {% data variables.product.prodname_copilot_short %}. |
@@ -180,11 +207,12 @@ copilot completion fish > ~/.config/fish/completions/copilot.fish
180
207
|`/restart`| Restart the CLI, preserving the current session. |
181
208
|`/resume [SESSION-ID]`, `/continue [SESSION-ID]`| Switch to a different session by choosing from a list (optionally specify a session ID). |
182
209
|`/review [PROMPT]`| Run the code review agent to analyze changes. See [AUTOTITLE](/copilot/how-tos/copilot-cli/use-copilot-cli/agentic-code-review). |
210
+
|`/search [QUERY]`, `/find [QUERY]`| Search the conversation timeline. {% data reusables.copilot.experimental %} |
183
211
|`/session [info\|checkpoints [n]\|files\|plan\|rename [NAME]\|cleanup\|prune\|delete [ID]\|delete-all]`, `/sessions [info\|checkpoints [n]\|files\|plan\|rename [NAME]\|cleanup\|prune\|delete [ID]\|delete-all]`| Show session information and manage sessions. Subcommands: `info`, `checkpoints`, `files`, `plan`, `rename`, `cleanup`, `prune`, `delete`, `delete-all`. |
184
212
|`/share [file\|html\|gist] [session\|research] [PATH]`, `/export [file\|html\|gist] [session\|research] [PATH]`| Share the session to a Markdown file, interactive HTML file, or {% data variables.product.github %} gist. |
185
213
|`/skills [list\|info\|add\|remove\|reload] [ARGS...]`| Manage skills for enhanced capabilities. See [AUTOTITLE](/copilot/how-tos/copilot-cli/customize-copilot/create-skills). |
186
214
|`/statusline`, `/footer`| Configure which items appear in the status line. |
187
-
|`/tasks`| View and manage background tasks (subagents and shell sessions). |
215
+
|`/tasks`| View and manage tasks (subagents and shell commands). |
188
216
|`/terminal-setup`| Configure the terminal for multiline input support (<kbd>Shift</kbd>+<kbd>Enter</kbd> and <kbd>Ctrl</kbd>+<kbd>Enter</kbd>). |
189
217
|`/theme [default\|dim\|high-contrast\|colorblind]`| View or set the color mode. |
190
218
|`/undo`, `/rewind`| Rewind the last turn and revert file changes. |
@@ -302,7 +330,6 @@ The `--available-tools` and `--excluded-tools` options support these values:
302
330
|`ask_user`| Ask the user a question |
303
331
|`glob`| Find files matching patterns |
304
332
|`grep` (or `rg`) | Search for text in files |
305
-
|`show_file`| Present code snippets inline in the timeline. {% data reusables.copilot.experimental %} |
306
333
|`skill`| Invoke custom skills |
307
334
|`web_fetch`| Fetch and parse web content |
308
335
@@ -354,6 +381,9 @@ copilot --allow-tool='MyMCP'
354
381
|`COPILOT_SUBAGENT_MAX_DEPTH`| Maximum subagent nesting depth. Default: `6`. Range: `1`–`256`. |
355
382
|`GH_HOST`| {% data variables.product.github %} hostname for both {% data variables.product.prodname_cli %} and {% data variables.copilot.copilot_cli_short %} (default: `github.com`). Set to your {% data variables.product.prodname_ghe_cloud %} with data residency hostname. Override with `COPILOT_GH_HOST` for {% data variables.copilot.copilot_cli_short %} only. |
356
383
|`GH_TOKEN`| Authentication token. Takes precedence over `GITHUB_TOKEN`. |
384
+
|`GITHUB_COPILOT_PROMPT_MODE_EXTENSIONS`| Set to `true` to load project extensions and allow extension management tools in prompt mode (`-p`). Disabled by default to prevent running repository-controlled extension code without interactive trust. |
385
+
|`GITHUB_COPILOT_PROMPT_MODE_REPO_HOOKS`| Set to `true` to load repository hooks in prompt mode (`-p`). Disabled by default to prevent running repository-provided hook commands without interactive trust confirmation. |
386
+
|`GITHUB_COPILOT_PROMPT_MODE_WORKSPACE_MCP`| Set to `true` to load workspace MCP sources in prompt mode (`-p`). Disabled by default to prevent starting repository-controlled MCP servers without interactive trust. |
357
387
|`GITHUB_TOKEN`| Authentication token. |
358
388
|`PLAIN_DIFF`| Set to `true` to disable rich diff rendering. |
359
389
|`USE_BUILTIN_RIPGREP`| Set to `false` to use the system ripgrep instead of the bundled version. |
@@ -452,14 +482,40 @@ Use `copilot mcp` to manage MCP server configurations from the command line with
452
482
|`tools`| Yes | Tools to enable. |
453
483
|`headers`| No | HTTP headers. Supports variable expansion. |
454
484
|`oauthClientId`| No | Static OAuth client ID (skips dynamic registration). |
455
-
|`oauthPublicClient`| No | Whether the OAuth client is public. Default: `true`. |
456
-
|`oidc`| No | Enable OIDC token injection. When `true`, injects a `GITHUB_COPILOT_OIDC_MCP_TOKEN` environment variable (local servers) or a `Bearer``Authorization` header (remote servers). |
485
+
|`oauthPublicClient`| No | Whether the OAuth client is public. Default: `true`. Set to `false` for confidential clients with a stored secret. |
486
+
|`oauthGrantType`| No | OAuth grant type: `"authorization_code"` (default, browser-based flow) or `"client_credentials"` (fully headless, no browser or callback). |
487
+
|`oidc`| No | Enable OIDC token injection. When `true`, the CLI injects OIDC tokens for any `GITHUB_COPILOT_OIDC_MCP_TOKEN` or `GITHUB_COPILOT_OIDC_MCP_TOKEN_<SUFFIX>` variable referenced in the server's `env` block (local servers), or sends the token as a `Bearer``Authorization` header (remote servers). For local servers, prefer suffixed variants (for example, `${GITHUB_COPILOT_OIDC_MCP_TOKEN_MY_SVC}`) to assign a unique variable name per server. |
457
488
|`timeout`| No | Tool call timeout in milliseconds. |
458
489
459
490
### OAuth re-authentication
460
491
461
492
Remote MCP servers that use OAuth may show a `needs-auth` status when a token expires or when a different account is required. Use `/mcp auth <server-name>` to trigger a fresh OAuth flow. This opens a browser authentication prompt, allowing you to sign in or switch accounts. After completing the flow, the server reconnects automatically.
462
493
494
+
### Headless OAuth (`client_credentials` grant)
495
+
496
+
For CI or cron use cases where no browser is available, set `oauthGrantType: "client_credentials"`. This requires:
497
+
498
+
*`oauthClientId`—the static client ID issued by the MCP provider.
499
+
*`oauthPublicClient: false`—the client is confidential.
500
+
* A `client_secret` stored in the system keychain (configured once via the `/mcp` UI or by writing to the OAuth credential store).
501
+
502
+
When configured, the CLI skips the browser, callback server, PKCE, and dynamic client registration entirely. On every 401, it posts `grant_type=client_credentials` directly to the server's discovered token endpoint.
503
+
504
+
```json
505
+
{
506
+
"mcpServers": {
507
+
"headless-api": {
508
+
"type": "http",
509
+
"url": "https://api.example.com/mcp",
510
+
"tools": ["*"],
511
+
"oauthClientId": "YOUR-CLIENT-ID",
512
+
"oauthPublicClient": false,
513
+
"oauthGrantType": "client_credentials"
514
+
}
515
+
}
516
+
}
517
+
```
518
+
463
519
### Filter mapping
464
520
465
521
Control how MCP tool output is processed using the `filterMapping` field in a server's configuration.
@@ -487,6 +543,12 @@ Use `--disable-builtin-mcps` to disable all built-in servers, or `--disable-mcp-
487
543
488
544
Server names can contain any printable characters, including spaces, Unicode characters, and punctuation. Control characters (U+0000–U+001F, U+007F) and the closing brace (`}`) are not allowed. Server names are used as prefixes for tool names—for example, a server named `my-server` produces tool names like `my-server-fetch`, and a server named `My Server` produces `My Server-fetch`.
489
545
546
+
### MCP tool name sanitization
547
+
548
+
MCP server names and tool names are sanitized before being sent to the model. Characters that are invalid in tool names (anything other than `a-z`, `A-Z`, `0-9`, `-`, `_`) are replaced with `-`. Unicode characters are Punycode-encoded. The `@` symbol is also replaced with `-` to avoid conflicts with Punycode encoding.
549
+
550
+
The combined name (`serverName-toolName`) is capped at 64 characters. When truncation would create a name collision, a numeric suffix is appended (for example, `my-server-tool2`, `my-server-tool3`) to ensure uniqueness.
551
+
490
552
### MCP server trust levels
491
553
492
554
MCP servers are loaded from multiple sources, each with a different trust level.
@@ -585,7 +647,6 @@ Custom agents are specialized AI agents defined in Markdown files. The filename
585
647
| Agent | Default model | Description |
586
648
|-------|--------------|-------------|
587
649
|`code-review`| claude-sonnet-4.5 | High signal-to-noise code review. Analyzes diffs for bugs, security issues, and logic errors. |
588
-
|`configure-copilot`| varies | Built-in sub-agent for managing {% data variables.copilot.copilot_cli_short %} configuration through natural language—adding MCP servers, installing agents, and managing skills. {% data reusables.copilot.experimental %} |
589
650
|`explore`| claude-haiku-4.5 | Fast codebase exploration. Searches files, reads code, and answers questions. Returns focused answers under 300 words. Safe to run in parallel. |
590
651
|`general-purpose`| claude-sonnet-4.5 | Full-capability agent for complex multi-step tasks. Runs in a separate context window. |
591
652
|`research`| claude-sonnet-4.6 | Deep research agent. Generates a report based on information in your codebase, in relevant repositories, and on the web. |
@@ -636,7 +697,17 @@ When the CLI prompts for permission to execute an operation, you can respond wit
636
697
|`#`| Deny all similar requests for the rest of the session. |
637
698
|`?`| Show detailed information about the request. |
638
699
639
-
Session approvals reset when you run `/clear` or start a new session.
700
+
When the full dialog is shown, you can also choose from these options:
701
+
702
+
| Option | Scope | Persistence |
703
+
|--------|-------|-------------|
704
+
| Once | Single use | None |
705
+
| This location | Until manually cleared | Saved to disk per location |
706
+
| Always | Permanent | Config file |
707
+
708
+
The **This location** option appears when the CLI can determine a location key (git root or current directory). It persists the approval to disk so the same permission is automatically granted the next time you work in that directory without prompting again.
709
+
710
+
Use `/permissions reset` to clear in-memory approvals for the current session.
640
711
641
712
## OpenTelemetry monitoring
642
713
@@ -678,11 +749,12 @@ Wraps the entire agent invocation: all LLM calls and tool executions for one use
678
749
|-----------|-------------|-----------|
679
750
|`gen_ai.operation.name`|`invoke_agent`| Both |
680
751
|`gen_ai.provider.name`| Provider (for example, `github`, `anthropic`) | Both |
681
-
|`gen_ai.agent.id`|Session identifier | Both |
752
+
|`gen_ai.agent.id`|Stable agent-definition identifier when known; top-level default uses `github.copilot.default`| Both |
682
753
|`gen_ai.agent.name`| Agent name (when available) | Both |
683
754
|`gen_ai.agent.description`| Agent description (when available) | Both |
684
-
|`gen_ai.agent.version`|Runtime version | Both |
755
+
|`gen_ai.agent.version`|Agent definition version when known; otherwise runtime version | Both |
685
756
|`gen_ai.conversation.id`| Session identifier | Both |
757
+
|`enduser.pseudo.id`| Pseudonymous Copilot user identifier from `analytics_tracking_id` when available | Both |
686
758
|`gen_ai.request.model`| Requested model | Both |
687
759
|`gen_ai.response.finish_reasons`|`["stop"]` or `["error"]`| Both |
688
760
|`gen_ai.usage.input_tokens`| Total input tokens (all turns) | Both |
@@ -709,21 +781,22 @@ One span per LLM request. Span kind: `CLIENT`.
709
781
|`gen_ai.operation.name`|`chat`|
710
782
|`gen_ai.provider.name`| Provider name |
711
783
|`gen_ai.request.model`| Requested model |
784
+
|`gen_ai.request.stream`| Whether streaming mode was used (streaming only) |
712
785
|`gen_ai.conversation.id`| Session identifier |
786
+
|`gen_ai.response.finish_reasons`| Stop reasons |
713
787
|`gen_ai.response.id`| Response ID |
714
788
|`gen_ai.response.model`| Resolved model |
715
-
|`gen_ai.response.finish_reasons`| Stop reasons |
789
+
|`gen_ai.response.time_to_first_chunk`| Time to first streaming chunk, in seconds (streaming only) |
790
+
|`gen_ai.usage.cache_creation.input_tokens`| Cached tokens created |
Copy file name to clipboardExpand all lines: content/copilot/reference/copilot-cli-reference/cli-config-dir-reference.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -225,6 +225,7 @@ These settings apply across all your sessions and repositories. You can edit thi
225
225
|`ide.autoConnect`|`boolean`|`true`| Automatically connect to an IDE workspace on startup. When `false`, you can still connect manually using the `/ide` command. |
226
226
|`ide.openDiffOnEdit`|`boolean`|`true`| Open file edit diffs in the connected IDE for approval. When `false`, file edit approvals are shown only in the terminal. |
227
227
|`includeCoAuthoredBy`|`boolean`|`true`| Add a `Co-authored-by` trailer to git commits made by the agent. |
228
+
|`keepAlive`|`"on"`\|`"off"`\|`"busy"`|`"off"`| Keep-alive mode applied at CLI startup. `"on"` always prevents the system from sleeping, `"busy"` prevents sleeping only while the agent is running, and `"off"` disables keep-alive. Also configurable with the `/keep-alive` slash command. |
|`mergeStrategy`|`"rebase"`\|`"merge"`| — | Conflict resolution strategy for `/pr fix conflicts`. When set to `"rebase"`, conflicts are resolved by rebasing onto the base branch. When set to `"merge"`, the base branch is merged into the feature branch. If not configured, a picker dialog is shown. |
230
231
|`model`|`string`| varies | AI model to use. Set to `"auto"` to let {% data variables.product.prodname_copilot_short %} pick the best available model automatically. Managed by the `/model` slash command. |
0 commit comments