GitHub Copilot CLI is a coding agent that runs in your terminal. It can inspect and edit files, run commands, manage sessions, delegate tasks, and connect to GitHub and VS Code.
This GitHub Copilot cheat sheet lists CLI slash commands, keyboard shortcuts, startup flags, environment variables, permission controls, and customization options. Separate sections also include Copilot app commands and VS Code Chat references.
Last updated: October 19, 2026.
GitHub Copilot CLI Quick Reference
Use
/versionand/helpto check your installed release and commands.
Essential Commands and Shortcuts
| Command or shortcut | Action |
|---|---|
copilot | Start an interactive session |
copilot login or /login | Sign in |
copilot init or /init | Initialize repository instructions |
copilot help or /help | Open command help |
copilot app or /app | Open the Copilot app |
copilot --continue | Resume the latest session |
copilot --resume or /resume | Choose a saved session |
Shift+Tab | Switch Standard, Plan, and Autopilot |
copilot --mode=MODE | Start with a selected mode |
copilot --model=MODEL or /model | Select a model |
/diff (experimental) | Review current changes |
/undo | Undo the previous turn |
/ide | Connect to VS Code |
/exit, /quit, or Ctrl+D | End the session |
CLI Command Syntax
| Syntax | Action |
|---|---|
/command | Run an interactive Copilot command. |
@ path | Attach a file to the current prompt. |
# number | Attach a GitHub issue or pull request. |
! command | Run one local command with your terminal account’s permissions, outside Copilot agent approvals. |
! | Stay in shell mode for multiple commands. Press Esc or Ctrl+C at an empty prompt to return. |
$ | Open $SHELL on Unix or %COMSPEC% on Windows. Exit the shell to return to Copilot CLI. |
--flag | Set startup or programmatic behavior. |
COPILOT_* | Configure the process through environment variables. |
Top-Level CLI Commands
| Command | Purpose |
|---|---|
copilot | Start an interactive Copilot CLI session. |
copilot app | Open the GitHub Copilot app in the current directory or open its download page. |
copilot completion SHELL | Print tab-completion setup for Bash, Zsh, or Fish. |
copilot config | List, read, set, or remove settings from the terminal. Run copilot config --help for subcommands. |
copilot sandbox ca | Check or manage the sandbox proxy certificate authority. |
copilot help [TOPIC] | Read help for commands, configuration, billing, providers, logging, permissions, monitoring, or sandboxing. |
copilot init | Create or update repository custom instructions. |
copilot login [OPTION] | Authenticate through OAuth, a device-code flow, or a token from standard input. |
copilot mcp | Manage MCP server configurations from the command line. |
copilot plugin | Manage plugins and plugin marketplaces. copilot plugins is a legacy alias. |
copilot instruction | List custom instruction sources discovered for the current working directory. |
copilot lsp | List configured language servers outside an interactive session. |
copilot skill | List, add, remove, enable, or disable agent skills. |
copilot update | Install the latest CLI version. |
copilot version | Print the installed version and check for updates. |
Copilot CLI Slash Commands
| Command | Action |
|---|---|
/ask QUESTION, /btw QUESTION | Ask a side question that stays out of the conversation history. |
/clear [PROMPT], /new [PROMPT], /reset [PROMPT] | Start a fresh conversation, with an optional first prompt. |
/compact [FOCUS] | Summarize history and preserve the requested focus. |
/context | Display context-window usage. |
/copy | Copy the latest response. |
/cwd, /cd [PATH] | Show or change the working directory. |
/diagnose [PROMPT] | Analyze the current session log for errors or unexpected behavior. |
/refine TEXT | Rewrite rough prompt text for review before submission. |
/restart | Restart the CLI and restore the live sessions in the current process. |
/search [QUERY], /find [QUERY] | Search the session timeline. |
/help | Display the installed interactive command list. |
Sessions, history, and sharing
| Command | Action |
|---|---|
/resume [ID], /continue [ID] | Open another local or remote session. |
/rename [NAME] | Name the current session. |
/session info | Show identifiers, links, and session details. |
/session checkpoints [N] | List recent restoration points. |
/session files | List files associated with the session. |
/session plan | Display the current session plan. |
/session cleanup | Clean session data through the built-in manager. |
/session prune | Prune stored sessions. |
/session delete [ID] | Delete one saved session. |
/session delete-all | Delete all saved sessions after confirmation. |
/fork [NAME], /branch [NAME] | Fork the conversation into another session. Experimental. |
/share, /export | Create a link or export the session. |
/share file [PATH] | Export the transcript as Markdown. |
/share html [PATH] | Export the transcript as HTML. |
/share gist | Create a GitHub gist from the session. |
/share off | Stop link sharing. |
Models, reasoning, plans, and autonomy
| Command | Action |
|---|---|
/model [MODEL], /models | Select Auto or a model for the current session. Model IDs are case-insensitive and saved in canonical form. |
/model --session MODEL | Set the model for the current session only. |
/model --global MODEL | Save the default for future sessions. |
/model --repo MODEL | Save a repository model setting. |
/model --local MODEL | Save an untracked local repository model setting. |
/plan [PROMPT] | Create an implementation plan before coding. |
/autopilot [OBJECTIVE], /goal [OBJECTIVE] | Start or refocus an Autopilot objective. |
/limits | Open response-limit controls. |
/limits set max-ai-credits VALUE | Set a soft AI Credits limit per response. |
/limits unset max-ai-credits | Remove the response credit limit. |
/rubber-duck [PROMPT] | Request a second opinion on a plan, implementation, or test set. |
GitHub Copilot Model Availability
| Model | Status | Alternative |
|---|---|---|
| Gemini 4 Argon | Available on eligible plans | — |
| Gemini 3.7 Flash | Retired Oct 19 | Gemini 3.8 Flash |
| GPT-5.5 | Retired Oct 19 | GPT-5.6 Sol |
| Claude Opus 5 | Retires Nov 16 | Claude Opus 5.5 |
| GPT-5.6 Terra | Retires Nov 16 | GPT-6.1 Sol / Luna |
Agents, research, review, and delegation
| Command | Action |
|---|---|
/agent | Browse and choose a custom agent. |
/agents, /subagents | Configure subagent models. |
/tasks | Inspect background subagents and shell commands. |
/fleet [PROMPT] | Split suitable work across parallel subagents. |
/delegate [PROMPT] | Send work to a remote repository and create an AI-generated pull request. |
/research TOPIC | Run a source-backed GitHub and web investigation. |
/review [PROMPT] | Invoke the code-review agent on current changes. |
/security-review [PROMPT] | Inspect active local changes for high-confidence security defects. |
/pr view | Show the pull request for the current branch. |
/pr create | Create a pull request. |
/pr fix | Repair pull request issues. |
/pr auto | Work until the pull request reaches green status. |
/pr automerge | Work until green status, then merge under repository controls. |
Files, directories, and worktrees
| Command | Action |
|---|---|
/add-dir PATH | Grant file access and sandbox access to another directory for the current session. |
/list-dirs | Display directories approved for file access. |
/reset-allowed-tools | Clear the saved allowed-tool list. |
/permissions [default|assisted|allow-all|show] | Change or inspect the current permission mode. |
/allow-all [off|auto|show], /yolo [off|auto|show] | Control the allow-all permission mode. |
/permissions reset | Clear in-memory tool and path approvals for this session. |
/sandbox [config|status|policy|enable|disable] | Configure local sandboxing, inspect effective restrictions, or change its enabled state. |
/diff | Review working-tree changes or the branch diff. Experimental. |
/worktree [BRANCH] | Start work in a new Git worktree. |
/worktree new [PROMPT] | Open a new conversation in a new worktree. |
/move [BRANCH|TASK] | Move uncommitted changes to a new worktree. |
Configuration, extensions, and terminal controls
| Command | Action |
|---|---|
/settings, /config | Open the settings manager. |
/settings show KEY | Display the effective value of a setting. |
/settings KEY VALUE | Save a personal setting. |
/settings --repo KEY VALUE | Save an overridable repository setting. |
/settings --local KEY VALUE | Save an untracked local repository setting. |
/instructions | View and toggle loaded custom instruction files. |
/env | List loaded instructions, agents, skills, hooks, plugins, MCP servers, LSPs, and extensions. |
/plugin | Open the plugin dashboard. Use /mcp for MCP servers and /skills for skills. |
/extensions, /extension | Manage CLI extensions. Experimental. |
/lsp show | Show language-server configuration. |
/lsp test SERVER | Test a language server. |
/lsp reload | Reload language-server configuration. |
/statusline, /footer | Configure status-line fields. |
/terminal-setup | Configure multiline terminal input. |
/theme [NAME] | Select a terminal color theme. |
/vim | Toggle Vim-style editing in the input composer. |
/voice [ACTION] | Configure voice input with on, off, models, or devices. |
/app | Open the current session in the GitHub Copilot app or show its download page. |
Settings files and useful options
Personal preferences belong in ~/.copilot/settings.json. Shared repository defaults use .github/copilot/settings.json, and private repository overrides use .github/copilot/settings.local.json. Copilot ignores preference keys in config.json. That file stores application state and authentication fallback data. Inspect effective values and managed restrictions with /settings.
| Setting or command | Purpose |
|---|---|
/settings transcriptView concise | Group tool activity into expandable summaries. |
/settings editorMode vim | Enable modal composer editing. Use /vim to toggle it during a session. |
worktreePathTemplate | Set a worktree location such as ~/src/worktrees/{repo}/{branch}. Supported placeholders are {repoPath}, {repo}, {branch}, and {branchSlug}. |
/settings inlineImages false | Preview (CLI 1.0.97): Show text placeholders in place of inline images. |
/settings inlineImages true | Preview (CLI 1.0.97): Enable inline images (the default) in supported terminals including Ghostty, kitty, and WezTerm. |
Maintenance, diagnostics, and account commands
| Command | Action |
|---|---|
/changelog, /release-notes | Display release history, with optional version range or summary. |
/chronicle standup | Generate a standup from session history. |
/chronicle tips | Find usage tips from past sessions. |
/chronicle improve | Analyze session habits. |
/chronicle reindex | Rebuild the session-history index. |
/experimental [ACTION] | Manage experimental features with on, off, or show. |
/feedback, /bug | Send product feedback. |
/usage | Show per-session and per-model usage. Preview: token-billed sessions also show billed AI Credits after resume. |
/collect-debug-logs | Collect diagnostic logs for troubleshooting. |
/version | Display the installed version. |
/update, /upgrade | Install the latest release. |
/downgrade VERSION | Install a selected version on supported team accounts. |
/user show | Show the active GitHub account. |
/user list | List saved accounts and show the authentication source for each account. |
/user switch | Change the active account. |
/logout | Remove the active login. |
/clikit [COMPONENT], /tuikit [COMPONENT] | Preview internal CLI components. |
On macOS, Microsoft Entra sign-in uses the native broker when available and falls back to browser authentication. If a GitHub.com Connector needs additional GitHub CLI permissions, update the authorization when prompted and retry the connection with the same sign-in method.
Remote control and scheduled work
| Command | Action |
|---|---|
/remote | Show remote-control status. |
/remote on | Enable steering from GitHub.com or GitHub Mobile. |
/remote off | End the remote connection. |
/ide | Connect, switch, or disconnect a trusted VS Code workspace. |
/keep-alive on, /caffeinate on | Prevent sleep during an active session. |
/keep-alive busy, /caffeinate busy | Prevent sleep during agent work. |
/keep-alive DURATION, /caffeinate DURATION | Prevent sleep for a fixed period. |
/after DELAY PROMPT | Schedule one action in the current session. Experimental. |
/every INTERVAL PROMPT | Schedule a recurring action in the current session. Experimental. |
Copilot CLI Keyboard Shortcuts
Global and input shortcuts
| Shortcut | Action |
|---|---|
? on an empty prompt | Open quick help. |
Esc | Cancel the operation. Press twice to interrupt a turn. In a local session, a prompt the model has not begun answering returns to the composer for editing. |
Ctrl+C | Cancel, clear input, or exit after a second press. |
Ctrl+D | Shut down the CLI. |
Ctrl+G | Edit the prompt in the configured external editor. |
Ctrl+L | Clear the screen. |
Ctrl+Q or Ctrl+Enter | Queue input during agent work. |
Up on an empty prompt | Recall a pending steering prompt for editing in a local session. |
Ctrl+P | Browse submitted history while preserving pending prompts. |
Ctrl+E before a conversation | Choose a local or cloud run environment. |
Ctrl+R | Search input history in reverse. |
Ctrl+Space | Toggle voice dictation where the terminal and OS pass the shortcut through. |
Ctrl+V | Paste clipboard content as an attachment. |
Alt+V | Paste a clipboard image as an attachment. |
Ctrl+X, then / | Run a slash command and keep the typed prompt text. |
Ctrl+X, then e | Open typed prompt text in the external editor. |
Ctrl+X, then b | Move the active task or shell command to the background. |
Ctrl+X, then g | Collapse or expand the Autopilot goal panel. |
Ctrl+X, then h | Hide the current-session sidebar. |
Ctrl+X, then o | Open the newest link in the timeline. |
Ctrl+X, then v | Toggle voice dictation. |
Ctrl+X, then x | Close the current session. |
Ctrl+Z on Unix | Suspend the process to the background. |
Shift+Enter | Insert a newline where the terminal supports it. |
Alt+Enter on Windows/Linux | Insert a newline. |
Option+Enter on macOS | Insert a newline. |
Shift+Tab | Cycle Standard, Plan, and Autopilot. |
Tab or Ctrl+Y | Accept the current inline input completion. |
Timeline, tasks, sessions, and diff shortcuts
| Shortcut | Action |
|---|---|
Ctrl+F | Timeline: Search the timeline |
Ctrl+O | Timeline: Expand recent items |
Ctrl+E | Timeline: Expand all items |
Ctrl+T | Timeline: Toggle reasoning |
Page Up / Page Down | Timeline: Scroll |
Arrow keys | Tasks dialog: Select a task |
Enter | Tasks dialog: Open task details |
a | Tasks dialog: Toggle nested agents |
f | Tasks dialog: Show finished work |
X | Tasks dialog: Stop an active task |
R | Tasks dialog: Remove a finished task |
B | Tasks dialog: Move a synchronous task to the background |
Arrow keys | Session picker: Select a session |
Enter | Session picker: Open the selected session |
s | Session picker: Change sort order |
Tab | Session picker: Switch between local and remote sessions |
x | Session picker: Delete a session |
Esc | Session picker: Close the picker |
x (press twice) | Sessions tab: Confirm dismissal. Deletes a local session or closes a server-backed session while preserving its remote conversation. Check the footer before confirming. |
← / → | Sessions sidebar: Switch between timeline and sidebar |
Arrow keys / j / k | Sessions sidebar: Select a session |
Enter | Sessions sidebar: Switch sessions |
n | Sessions sidebar: Start a session |
x (press twice) | Sessions sidebar: Close a session |
j / k | Diff viewer: Move between lines |
h / l | Diff viewer: Change files |
g / G | Diff viewer: Jump to the start or end |
c | Diff viewer: Comment |
s | Diff viewer: Summarize comments |
b | Diff viewer: Toggle branch diff |
w | Diff viewer: Hide whitespace changes |
Copilot CLI Modes and Permissions
Standard, Plan, and Autopilot
| Mode | Behavior |
|---|---|
| Standard | The agent works interactively and follows the active permission policy. |
| Plan | The agent inspects the repository, resolves requirements, and prepares a plan before file edits. |
| Autopilot | The agent continues through tool calls and follow-up turns until completion or a configured limit. |
Permission modes and patterns
Permission patterns use Kind(argument). The :* suffix in shell(git:*) matches the command stem followed by a space. Path checks resolve symlinks and ./.. segments before matching.
| Flag | Effect |
|---|---|
--allow-tool=PATTERN | Auto-approve a matching tool. |
--deny-tool=PATTERN | Block a matching tool. Deny rules win over allow rules. |
--allow-url=URL | Approve a URL or domain. |
--deny-url=URL | Block a URL or domain. |
--add-dir=PATH | Add a readable or writable directory. |
--allow-all-tools | Approve every tool. |
--allow-all-paths | Remove path verification. |
--allow-all-urls | Approve every URL. |
--allow-all | Apply all three elevated settings. |
--available-tools=LIST | Expose only selected tools to the model. |
--no-ask-user | Remove the agent’s ability to pause for a question. |
copilot --allow-tool='shell(git:*)' --deny-tool='shell(git push)'
copilot --allow-tool='github(create_issue)'
copilot --deny-tool='write(secret.txt)'Manual Approval asks you to approve operations. Assisted Permissions uses a permission judge to assess requests against your instructions and policy, including visible shell code. An organization can disable Assisted Permissions or suppress startup bypass flags. Check the policy warning and /permissions show when a requested mode does not take effect. The timeline identifies whether a decision came from you, Assisted Permissions, policy, or unattended fallback.
Enterprise-managed permissions.limitTo restricts domain requests to an administrator-defined boundary. Personal approvals and allow-all modes cannot expand it. URLs recognized in shell requests must satisfy this boundary too. The setting does not independently restrict file reads, writes, or shell execution.
Local sandbox commands and credentials
Local command sandboxing is available through /sandbox and --sandbox. It constrains filesystem and network access on supported hosts. Shell commands and local MCP/LSP processes use operating-system restrictions. Built-in file operations check the same filesystem policy within the CLI. Remote MCP servers run outside your machine. On Windows, programs that ignore proxy settings can bypass network host rules.
| Command | Action |
|---|---|
/sandbox or /sandbox config | Open sandbox settings, including filesystem, network, and credential controls. |
/sandbox status | Check whether sandboxing is enabled for the current session. |
/sandbox policy | Inspect effective paths, network rules, developer-tool access, and managed restrictions. |
/sandbox policy npm install | Preview the developer-tool access for this command. The command is not executed. |
/sandbox enable | Enable sandboxing and save the setting when policy permits it. |
/sandbox disable | Disable sandboxing when policy permits it. If managed policy requires sandboxing but permits bypass, the opt-out applies only to this session. |
copilot sandbox ca status | Inspect proxy certificate-authority trust from your terminal. |
copilot sandbox ca create | Create the proxy certificate authority. |
copilot sandbox ca trust | Add the authority to operating-system trust. |
copilot sandbox ca rotate | Replace the authority and preserve its trust state. |
copilot sandbox ca remove | Remove operating-system trust for the authority. |
Use the Credentials tab to configure Git and gh authentication and masked environment variables. The dialog suggests possible environment secrets and lets you add approved masking hosts before saving. sandbox.credentials.envVars maps each variable name to a nonempty injectHosts array. Sandboxed processes receive placeholders. The local proxy injects real values only into HTTPS request headers sent to those hosts. Settings store variable names and host rules, not secret values.
{"sandbox": {
"credentials": {
"envVars": {
"ACME_API_TOKEN": {
"injectHosts": ["api.example.com"]
}
}
}
}}Place this configuration in ~/.copilot/settings.json and replace the example variable and hostname with your own. The variable must exist in the parent environment. Sandbox settings are personal or enterprise-managed. Repository settings cannot override them. copilot config supports credential injectHosts keys, with key completion in Bash, Zsh, and Fish. Inspect /sandbox policy after changing access rules. Local-network allowlists include localhost and loopback hosts when local-network access is enabled.
Copilot CLI Command-Line Flags
Session and terminal flags
| Flag | Purpose |
|---|---|
-C DIRECTORY | Change directory before startup. |
-i PROMPT, --interactive=PROMPT | Start an interactive session and run the first prompt. |
-n NAME, --name=NAME | Name a new session. |
--continue | Resume the newest session for the current directory, with global fallback. |
-r, --resume[=VALUE] | Open the session picker or resume by ID, prefix, or exact name. |
--connect[=ID] | Connect to a remote session. |
--remote | Enable remote steering. |
--remote-export | Export the session for read-only remote viewing. |
--attachment PATH | Attach a file to the initial prompt. |
--model=MODEL | Select a model or auto. |
--reasoning-effort=LEVEL | Set low, medium, high, xhigh, or max where available. |
--context=default|long_context | Choose a context tier for models with tiered context windows, including new and resumed ACP sessions. Confirm the allowance with /context. |
--screen-reader | Enable screen-reader adjustments. |
--no-color | Remove terminal color output. |
--mouse=on|off | Choose CLI mouse capture or native terminal selection. |
--stream=on|off | Enable or disable progressive response streaming. |
Agent, tool, MCP, and Autopilot flags
| Flag | Purpose |
|---|---|
--mcp-github-auth | Scope GitHub account authentication to approved MCP server origins. See copilot help for argument syntax. |
--collect-debug-logs | Collect diagnostic logs from the command line. |
-w, --worktree[=NAME] | Start in an isolated Git worktree. |
--agent=AGENT | Start with a selected custom agent. |
--autopilot | Enable Autopilot continuation. |
--mode=interactive|plan|autopilot | Choose the initial agent mode. |
--max-ai-credits=CREDITS | Set a soft AI Credits limit for each response. |
--max-autopilot-continues=COUNT | Limit Autopilot continuation messages. |
--available-tools=LIST | Expose only selected tools to the model. |
--excluded-tools=LIST | Hide selected tools from the model. |
--disable-builtin-mcps | Disable built-in MCP servers for the session. |
--disable-mcp-server=NAME | Disable a selected MCP server for the session. |
--enable-mcp-server=NAME | Re-enable a server disabled in saved settings for the session. |
--enable-memory | Enable memory in prompt mode. |
--plugin-dir=DIRECTORY | Load a plugin from a local directory for the session. |
--sandbox, --no-sandbox | Enable or disable local command sandboxing when policy permits it. No experimental-mode opt-in is required. |
Programmatic mode
-p runs one prompt and exits. -s prints only the agent response. --output-format=json emits JSON Lines for automation. The process waits for background agents and shell commands before exit, subject to COPILOT_TASK_WAIT_TIMEOUT_SECONDS.
Use --secret-env-vars=NAME for extra secrets that need output redaction. GitHub token values receive default redaction. --share=PATH saves a Markdown transcript after a programmatic run, and --share-gist publishes a secret gist. Session transcripts can contain source code, prompts, paths, and tool output. Inspect them before sharing.
Repository-controlled hooks, extensions, and workspace MCP servers stay disabled in prompt mode unless the folder is trusted or the matching opt-in environment variable is set. This protects unattended jobs from executable configuration committed by an untrusted repository.
copilot -sp "Summarize the request flow and list the main entry points"
copilot -p "Fix the failing unit tests and report changed files" \
--allow-tool='read,write,shell(npm test)' \
--output-format=json
copilot -C ./services/api --plan -i "Plan the authentication migration"Copilot CLI Environment Variables
Authentication, directories, and runtime
| Variable | Purpose |
|---|---|
COPILOT_GITHUB_TOKEN | Highest-priority GitHub authentication token. |
GH_TOKEN | Second-priority token. |
GITHUB_TOKEN | Third-priority token. |
GH_HOST | GitHub hostname shared with GitHub CLI. |
COPILOT_GH_HOST | Copilot-only hostname override. |
COPILOT_HOME | Configuration and state directory. Default: $HOME/.copilot. |
COPILOT_CACHE_HOME | Cache location for updates and marketplace data. |
COPILOT_EDITOR | Prompt editor checked after VISUAL and EDITOR. |
COPILOT_AUTO_UPDATE | Set false to disable automatic CLI and first-party plugin updates. |
COPILOT_ENABLE_HTTP2 | Set 1 or true to use HTTP/2 transport. |
COPILOT_ENABLE_INTERRUPTED_SESSION_RESTORE | Set 1 to enable the temporary opt-in interrupted-session restore flow. |
COPILOT_ALLOW_ALL | Set true to allow all permissions. |
COPILOT_MODEL | Select the model for the process. |
COPILOT_PLAN_THEN_AUTOPILOT | Request plan-then-Autopilot when command-line options cannot be injected. |
Context, skills, plugins, and unattended work
| Variable | Purpose |
|---|---|
COPILOT_CUSTOM_INSTRUCTIONS_DIRS | Add comma-separated instruction directories. |
COPILOT_SKILLS_DIRS | Add comma-separated skill directories. |
COPILOT_PROVIDERS_CONFIG | Point to a BYOK provider/model registry. Default: <COPILOT_HOME>/providers.json. |
PLUGINS_DASHBOARD | Set false to disable the dashboard used by bare /plugin, /mcp, and /skills. |
COPILOT_LARGE_OUTPUT_THRESHOLD_BYTES | Set the direct tool-output threshold. Default: 20 KiB. |
COPILOT_MCP_TOOL_CACHE | Set false to disable local MCP tool snapshot caching. |
COPILOT_PROMPT_FRAME | Set 1 or 0 to override the decorative prompt frame. |
COPILOT_STRIP_REASONING_ON_RESUME | Set 0 or false to retain BYOK reasoning tokens across resume. |
COPILOT_SUBAGENT_MAX_CONCURRENT | Set the process-level concurrent subagent limit within account constraints. |
COPILOT_SUBAGENT_MAX_DEPTH | Set the process-level maximum subagent nesting depth. |
COPILOT_TASK_WAIT_TIMEOUT_SECONDS | Set how long prompt mode waits for background work. |
COPILOT_WEB_FETCH_ALLOW_LOCALHOST | Set 1 to let web_fetch reach a local development server. |
GITHUB_COPILOT_PROMPT_MODE_EXTENSIONS | Set true to load project extensions in prompt mode. |
GITHUB_COPILOT_PROMPT_MODE_REPO_HOOKS | Set true to load repository hooks in prompt mode. |
GITHUB_COPILOT_PROMPT_MODE_WORKSPACE_MCP | Set true to load workspace MCP servers in prompt mode. |
PLAIN_DIFF | Set true to disable rich diff rendering. |
USE_BUILTIN_RIPGREP | Set false to use the system rg executable. |
BYOK and offline variables
Copilot CLI can use OpenAI-compatible endpoints, Azure OpenAI, and Anthropic through BYOK. Models must provide streaming and tool calling. The CLI can also use local OpenAI-compatible services such as Ollama.
For reusable multi-provider configuration, use ~/.copilot/providers.json or point COPILOT_PROVIDERS_CONFIG to another registry file. COPILOT_PROVIDER_* variables also configure a provider. A provider registry takes precedence when it defines providers or models.
| Variable | Purpose |
|---|---|
COPILOT_PROVIDERS_CONFIG | Set the BYOK provider/model registry file. |
COPILOT_PROVIDER_BASE_URL | Legacy provider API endpoint. |
COPILOT_PROVIDER_TYPE | Legacy provider type: openai, azure, or anthropic. |
COPILOT_PROVIDER_API_KEY | Legacy provider credential when the endpoint requires one. |
COPILOT_MODEL | Provider model or Azure deployment identifier. |
COPILOT_OFFLINE | Set true to stop GitHub network requests and disable telemetry. Provider traffic continues if the BYOK endpoint is remote. |
Logging and OpenTelemetry
Use --log-level=none|error|warning|info|debug|all|default and --log-dir=PATH for local logs. OpenTelemetry is disabled until an enabling variable is present.
| Variable | Purpose |
|---|---|
COPILOT_OTEL_ENABLED | Set true to enable OpenTelemetry. |
OTEL_EXPORTER_OTLP_ENDPOINT | Set the OTLP collector endpoint and enable telemetry export. |
COPILOT_OTEL_EXPORTER_TYPE | Select otlp-http or file. |
COPILOT_OTEL_FILE_EXPORTER_PATH | Write telemetry signals to a file. |
OTEL_EXPORTER_OTLP_PROTOCOL | Select http/json or http/protobuf. |
OTEL_SERVICE_NAME | Override the default github-copilot service name. |
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT | Set true to record prompts, responses, and tool data. |
Copilot CLI Customization
| Feature | Best use |
|---|---|
| Custom instructions | Persistent repository or personal rules loaded automatically. |
| Prompt files | Reusable IDE prompt templates invoked manually. |
| Custom agents | Specialist agents with their own instructions, tools, and model settings. |
| Agent skills | Task-specific procedures and resources loaded on demand. |
| Plugins | Installable bundles of agents, skills, hooks, MCP servers, and extensions. |
| Hooks | Deterministic commands at agent lifecycle events. |
| MCP servers | External tools, services, APIs, and live data. |
Custom instructions
Instruction files can import another file with a line that starts with @path. Use /instructions to inspect and toggle loaded sources. Use /env to confirm the effective customization set. --no-custom-instructions disables these files for the session.
copilot init and /init analyze the repository and create or improve .github/copilot-instructions.md. Good repository instructions record build, test, and lint commands, architecture boundaries, generated files, coding conventions, and release constraints.
Copilot CLI merges instructions found in these locations:
.github/copilot-instructions.md.github/instructions/**/*.instructions.mdand.claude/rules/**/*.md. Scope Claude rule files withpathsorapplyTofrontmatter.AGENTS.md,CLAUDE.md, andGEMINI.mdin the Git root and working directory$HOME/.copilot/copilot-instructions.md$HOME/.copilot/instructions/**/*.instructions.md- Extra directories in
COPILOT_CUSTOM_INSTRUCTIONS_DIRS
Prompt files
Prompt files live in .github/prompts/*.prompt.md and are invoked from supported IDEs. They package a repeatable prompt with variables and context for a focused action, such as test generation or an API review. Prompt files are unavailable as a native Copilot CLI customization type. Use a skill or a command file for a reusable CLI action.
Custom agents
Project agents live in .github/agents/ or .claude/agents/. Personal agents live in ~/.copilot/agents/. The file name becomes the agent ID. The required description tells Copilot when to use it. Optional fields set name, model, tools, inference behavior, and MCP servers.
Set include-custom-instructions: true in agent frontmatter to pass repository instruction files to that agent when it runs as a subagent. The default is false. Select an agent with /agent or start directly with copilot --agent=test-reviewer. A read-only agent should omit write and shell tools. Built-in agents handle exploration, command execution, code review, research, security review, and general delegated work.
---
name: test-reviewer
description: Reviews unit tests for missing cases and brittle assertions
include-custom-instructions: true
tools:
- view
- grep
---
Review tests only. Report findings with file paths and line numbers. Do not edit files.Agent skills and commands
A skill is a directory with SKILL.md. Project skills can live under .github/skills/, .claude/skills/, or .agents/skills/. Personal skills can live under ~/.copilot/skills/ or ~/.agents/skills/. A valid skill declares name and description in YAML frontmatter.
Copilot selects a relevant skill automatically, or you can invoke /release-check. Use /skills list, /skills info NAME, /skills add, /skills remove, and /skills reload for management. Individual Markdown commands under .claude/commands/ provide a lighter alternative. A command has lower precedence when a skill uses that command name.
---
name: release-check
description: Checks version, changelog, tests, and package contents before release
---
Read the project release policy. Run the documented checks and report every failure.Plugins
Open the plugin dashboard with /plugin. Use /plugin install SOURCE, /plugin update NAME, /plugin uninstall NAME, and /plugin list for plugin lifecycle management. Outside a session, copilot plugin enable NAME and copilot plugin disable NAME toggle direct installs. Marketplace subcommands add, remove, list, browse, and refresh registries.
Outside an interactive session, use copilot plugin list --json for a machine-readable plugin inventory. Use copilot skill, copilot mcp, copilot instruction, and copilot lsp for those resource types. Use the singular /plugin command inside a session.
Review a plugin before installation. A plugin can include hooks, MCP servers, agents, skills, commands, rules, and language-server configuration.
Hooks
Hooks live in .github/hooks/*.json. They run deterministic shell commands at defined lifecycle events. Suitable jobs include formatting edited files, checking commands before execution, enforcing path rules, or scanning output for secrets. Review repository hooks before trusting the checkout because they execute code.
Personal hooks can also live in ~/.copilot/hooks/*.json. Preview: declare a hooks event map in a custom agent’s YAML frontmatter to run hooks only while that agent is selected. Agent-scoped hooks run alongside other applicable hooks. Remote or organization-hosted agent definitions do not run them. Repository hooks require workspace trust, and policy restrictions apply.
---
name: formatter
description: Formats changed files
hooks:
PostToolUse:
- type: command
command: ./scripts/format-changed-files.sh
windows: ./scripts/format-changed-files.ps1
---
Format the files you change.Use existing scripts at the paths in this example. command is the fallback. windows, linux, and osx select platform-specific commands. Paths resolve from the repository root. Preview: Autopilot denies a preToolUse hook decision of ask during unattended work. Use an explicit allow or deny decision when writing a hook for that workflow.
MCP servers
Persistent personal MCP configuration lives at ~/.copilot/mcp-config.json. Repository and workspace servers can come from .github/mcp.json or .mcp.json. One-session configuration uses --additional-mcp-config=JSON or --additional-mcp-config=@FILE.
Use /mcp list, /mcp show NAME, /mcp add, /mcp edit, /mcp delete, /mcp disable, /mcp enable, /mcp auth NAME, /mcp reload, and /mcp search during a session. MCP tool calls follow the active permission policy. Review the data and operations exposed by a remote server before approving access. When server names collide, session configuration wins, followed by plugin, workspace, and personal configuration.
MCP server configuration changes apply between turns during a session. Enable or disable a server before discovery with /mcp enable NAME or /mcp disable NAME. The server does not need to be running when you change its enabled state. Use /mcp reload when you need an explicit refresh.
copilot mcp add local-tools -- npx -y @example/mcp-server
copilot mcp add --transport http team-api https://example.com/mcp
copilot mcp list --jsonGitHub Copilot App Slash Commands
The GitHub Copilot app has its own slash-command set. Type / in the app to see the commands available for the current session and repository context.
| Command | Action |
|---|---|
/af | Find installable MCP servers, skills, agents, and other extensions with Agent Finder. |
/agent | Select a custom agent for the session. |
/allow-all-tools, /yolo | Turn tool auto-approval on or show its current state. |
/attach-files | Attach files through a file picker. |
/attach-folder | Attach a folder through a folder picker. |
/autopilot [PROMPT] | Switch to Autopilot mode and optionally run a prompt. |
/chronicle | Open session-history and analysis features. |
/chronicle cost-tips | Show suggestions for reducing token use and cost. |
/chronicle improve | Suggest improvements for the instructions file. |
/chronicle reindex | Rebuild the Chronicle session index. |
/chronicle search | Search session history by keyword or topic. |
/chronicle standup | Summarize work from the previous day. |
/chronicle tips | Show personalized workflow tips. |
/clear, /reset | Clear the current transcript and open a fresh session. |
/collect-debug-logs | Create a debug archive or upload one as a secret gist. |
/compact | Summarize earlier conversation history to reduce context use. |
/context | Show context usage for the current session. |
/create-canvas [PROMPT] | Run the built-in canvas-authoring skill. |
/debug | Copy session debug JSON to the clipboard. |
/export-gist | Export the transcript to a secret gist. |
/fleet [PROMPT] | Launch multiple agents in parallel for one task. |
/fork | Fork the current session at its latest turn. |
/inbox | Open the interactive inbox widget. |
/init | Generate or improve repository instructions. |
/interactive [PROMPT] | Switch to Interactive mode and optionally run a prompt. |
/merge-to-parent | Merge work from a forked session back into its parent. |
/model, /models [MODEL] | Open model selection or select a model. |
/orchestrate [PROMPT] | Coordinate work across sessions or repositories. |
/plan [PROMPT] | Switch to Plan mode and optionally run a prompt. |
/pr-fix-checks | Work on failing pull-request checks. |
/pr-merge | Merge the current pull request when it is mergeable. |
/pr-open | Open a pull request from the current session changes. |
/pr-resolve-comments | Work on unresolved pull-request review comments. |
/remote | Enable or manage remote control for the active session. |
/rename | Rename the current chat or session. |
/research [PROMPT] | Run a research workflow and produce a cited report. |
/reset-allowed-tools | Clear session tool approvals and turn auto-approval off. |
/restart-session | Restart the active session and keep its history. |
/review | Review changes from the current session. |
/rubber-duck [PROMPT] | Request a second-model critique of the current approach or implementation. |
/security-review | Run a security review against the current changes. |
/skills | Manage agent skills. |
/spar [PROMPT] | Run an adversarial reasoning pass against the current approach. |
/spawn [PROMPT] | Create a focused child session for delegated work. |
/terminal [COMMAND] | Open a terminal panel and optionally run a command. |
/usage | Open plan usage and rate-limit details. |
VS Code Copilot Chat Reference
Chat modes and inline chat
| Mode | Use it for |
|---|---|
| Ask | Questions, explanations, and code suggestions with no autonomous repository edits. |
| Plan | Detailed implementation planning before code changes. |
| Agent | Multi-step work that reads files, edits code, runs commands, and iterates. |
| Inline chat | Focused edits to selected code in the editor. |
VS Code slash commands
| Command | Action |
|---|---|
/clear | Start a new chat and archive or mark the previous chat done. |
/explain | Explain selected code. |
/fix | Suggest a code repair. |
/help | List commands and agents in local Ask chat. |
/new, /newNotebook | Create a workspace, file, or notebook. |
/tests | Generate tests. |
/plan | Research and propose an implementation plan. |
/doc | Generate documentation comments in editor inline chat. |
/setupTests | Set up a test framework. Experimental. |
/compact, /fork | Summarize context or branch the conversation. |
/rename NAME | Rename a local chat. |
/models, /tools | Select models or configure local chat tools. |
/init | Generate workspace instructions in a local agent session. |
/agents, /instructions, /skills, /prompts, /hooks | Manage the corresponding customization. |
/create-agent, /create-instructions, /create-skill, /create-prompt, /create-hook | Generate a customization in a local agent session. |
/troubleshoot | Analyze local or Copilot CLI session debug logs. |
/debug | Open Chat Debug from the Chat view. |
/sandbox-policy | Inspect effective Copilot Agent Host sandbox restrictions. |
/NAME | Invoke a named skill or prompt file. |
VS Code Chat Variables
Type # and select a file, folder, symbol, tool, or tool set from the picker. Context items attach information. Tool references request actions. The available list depends on the active agent, extensions, and session capabilities. Tool references follow the same approval rules as other agent operations.
| Reference | Context or action |
|---|---|
#<file> | Select a file from the context picker. |
#<folder> | Select a folder from the context picker. |
#<symbol> | Select a code symbol. Open its file first. |
#selection | Attach the current editor selection. |
#search/codebase | Search workspace code. |
#search/textSearch | Search file contents. |
#search/usages | Find symbol references and implementations. |
#read/problems | Read Problems panel diagnostics. |
#execute/testFailure | Retrieve unit-test failure information. |
#read/terminalLastCommand | Read the latest terminal command and output. |
#githubRepo | Search a GitHub repository specified as owner/repo. |
VS Code chat participants
| Participant | Specialty |
|---|---|
@github | GitHub repositories, issues, pull requests, and GitHub-specific Copilot capabilities. |
@terminal | Terminal commands and visible shell context. |
@vscode | VS Code commands, settings, and editor features. |
Useful VS Code prompt patterns
/explain #selection
/fix #auth.ts Keep the public API unchanged and add a regression test.
#search/codebase Trace the request from the HTTP route to the database write. List files in execution order.
@terminal Explain the latest test failure and identify the first actionable error.
#cache.ts #cache.test.ts Add tests for expiration and concurrent reads.Select the actual files from the # picker when entering these examples. To diagnose a failed test, attach its output or use Fix Test Failure in Test Explorer.
VS Code Inline Suggestion Shortcuts
| Shortcut | Action |
|---|---|
Tab | Accept suggestion |
Esc | Dismiss suggestion |
Option+] (macOS) | Show next suggestion |
Alt+] (Windows/Linux) | Show next suggestion |
Option+[ (macOS) | Show previous suggestion |
Alt+[ (Windows/Linux) | Show previous suggestion |
Option+\ (macOS) | Trigger suggestion |
Alt+\ (Windows/Linux) | Trigger suggestion |
Ctrl+Return (macOS) | Open additional suggestions |
Ctrl+Enter (Windows/Linux) | Open additional suggestions |
Copilot CLI Workflow Examples
Explore a repository before editing
Start in Standard or Plan mode. Attach relevant files with @ and confirm the working directory with /cwd. Request evidence paths and a concrete architecture summary.
Map the application entry points, request flow, persistence layer, and test layout. Inspect files only. Return file paths and the commands used to verify your findings.Plan a multi-file change
Review the plan for migration impact, failure behavior, and test scope before switching modes. Run /rubber-duck when the change has a risky assumption or several valid designs.
/plan Add idempotency to payment creation. Preserve the public API, reuse the existing database transaction helper, include rollback behavior, and name the tests that must pass.Fix a failing test
Grant only the shell commands and paths required for the repair. Avoid global permission bypass for an unfamiliar repository.
Run the failing test in isolation. Find the first product-code defect, apply the smallest correction, rerun the focused test, then run the related test suite. Report commands and changed files.Review a change set
Inspect /diff, add line comments, and run /security-review for security-sensitive code. Commit after the change passes its required tests.
/review Focus on correctness, security, data loss, concurrency, and missing regression tests. Ignore formatting unless it changes behavior.Delegate independent work
Use parallel agents when repository areas can be investigated independently.
/fleet Inspect the API, database, and test layers independently. Return one combined implementation risk report. Do not edit files.Copilot CLI Troubleshooting
| Problem | Check |
|---|---|
| A documented command is missing | Run /help, /version, and /update. Check /experimental show and account policy. Use /diagnose for session-specific failures. |
| Login uses the wrong account | Inspect /user list for authentication sources, then /user show and token variables. An environment token overrides stored OAuth. |
| Classic PAT fails | Use OAuth or a fine-grained PAT with Copilot Requests permission. |
| Agent mode is absent | Check organization policy, account access, extension version, and the active IDE mode picker. |
| Copilot cannot read a directory | Run /list-dirs, then /add-dir PATH after reviewing the target. For sandbox denials, inspect /sandbox policy. |
| Permission prompts repeat | Inspect /permissions show. Review exact tool, path, and URL patterns. |
| Context fills too quickly | Run /context, reduce attached files, then /compact with focus instructions. |
| Wrong files are being edited | Run /cwd, inspect /env, and verify the Git root before continuing. |
| A preference is ignored | Put personal preferences in ~/.copilot/settings.json, then inspect /settings show KEY and managed restrictions. |
| A URL is blocked despite approval | Check managed permissions.limitTo and the network rules in /sandbox policy. Allow-all cannot widen a managed domain boundary. |
| Model is unavailable | Open /model. Availability depends on provider, plan, policy, and catalog. |
| Custom agents are missing | Inspect /env and /agent. Preview: 1.0.97-2 fixes discovery in repositories with more than 100 agents or deeply nested agent files. |
| MCP server fails to start | Run /mcp list, /mcp show NAME, and /mcp reload. Keep stdio logs on stderr. |
Workspace MCP is absent under -p | Trust the folder or opt in with GITHUB_COPILOT_PROMPT_MODE_WORKSPACE_MCP=true. |
| VS Code connection is absent | Open the matching trusted workspace, then run /ide. |
| Rich diff blocks text selection | Start with --mouse=off or set mouse support off in settings. |
| An autonomous run continues too long | Press Esc twice and set a continuation or AI Credits limit before resuming. |
Frequently Asked Questions
Does BYOK require a GitHub login?
No. GitHub authentication is optional when Copilot CLI uses an external or local model provider. /delegate, GitHub Code Search, and the built-in GitHub MCP server require a GitHub login. Use GitHub authentication when the session needs those hosted features.
Where does Copilot CLI store sign-in credentials?
OAuth credentials go to the operating-system credential store: Keychain Access on macOS, Credential Manager on Windows, or a supported secret service on Linux. If no credential store is available, Copilot can save the token in plain text at ~/.copilot/config.json, or under the directory set by COPILOT_HOME. Protect that file and avoid the plain-text fallback on shared systems.
How can I keep a Copilot CLI session local?
Start the session with --no-remote, set the remote configuration value to off, or disable remote access through /remote off. This prevents session syncing and remote control. A model provider receives prompts and context unless the session uses an approved local provider in offline mode.
Does /undo replace Git commits?
No. /undo restores conversation state and tracked file changes from a selected turn. Git commits support team review and preserve project history after session data is removed. Commit tested milestones during long or high-risk changes.
Official References
- GitHub Copilot CLI Command Reference
- Slash Commands for the GitHub Copilot App
- GitHub Copilot Chat Cheat Sheet
- VS Code AI Features Cheat Sheet
Related Resources
- Claude Code Commands Cheat Sheet
- Most Popular Agent Skills on GitHub for Coding Agents
- OpenAI Codex Commands Cheat Sheet










