Copilot CLI Handbook
Custom instructions, commands, permissions, agents, hooks, configuration, and MCP for GitHub Copilot CLI
Instruction Files
Copilot CLI can load repository, path-specific, agent, and local instructions from several official file locations. How-to: custom instructions
Common instruction locations
AGENTS.mdin the repository root, the current working directory, or directories listed inCOPILOT_CUSTOM_INSTRUCTIONS_DIRS. How-to: custom instructions.github/copilot-instructions.mdfor repository-wide instructions. How-to: custom instructions.github/instructions/**/*.instructions.mdfor path-specific instructions. How-to: custom instructions$HOME/.copilot/copilot-instructions.mdfor local personal instructions. How-to: custom instructionsCOPILOT_CUSTOM_INSTRUCTIONS_DIRSto add extra directories where Copilot CLI looks forAGENTS.mdand.github/instructions/**/*.instructions.md. How-to: custom instructions
Useful commands and flags
/init— Initialize Copilot custom instructions and agentic features for the repository. Docs: slash commandscopilot init— Initialize Copilot custom instructions for the current repository. Docs: CLI commands--no-custom-instructions— Start without loadingAGENTS.mdand related instruction files. Docs: CLI options
Interactive Commands
Session and navigation
/clear— Abandon the current session and clear history while keeping configured MCP servers available in the new session./new— Start a fresh conversation (keeps the old session backgrounded). Both accept an optional prompt to begin the new session. Docs: slash commands Release: v1.0.11 Release: v1.0.12 Blog: slash commands/resume [SESSION-ID]— Resume a previous session. Docs: slash commands/undo— Undo the last turn and revert any file changes it made. Release: v1.0.10/rewind— Open a timeline picker to roll back to any point in conversation history (also double-Esc). Release: v1.0.13/session [checkpoints [n]|files|plan|rename NAME]— Show session information and a workspace summary. Docs: slash commands/rename NAME— Rename the current session. Docs: slash commands/compact— Summarize history to reduce context usage. Docs: slash commands/context— Show context window usage. Docs: slash commands/cwd,/cd [PATH]— Show or change the working directory. Docs: slash commands Blog: slash commands/add-dir PATH— Add a directory to the allowed file-access list. Docs: slash commands Blog: slash commands/list-dirs— Show directories that already have file access. Docs: slash commands Blog: slash commands/exit,/quit— Exit the CLI. Docs: slash commands
Planning, review, and collaboration
/diff— Review changes in the current directory. Docs: slash commands/review [PROMPT]— Run the code review agent against your changes. Docs: slash commands/plan [PROMPT]— Draft an implementation plan before editing. Docs: slash commands/delegate [PROMPT]— Delegate work to a remote repository with an AI-generated pull request. Docs: slash commands How-to: CLI agents Blog: slash commands Blog: terminal workflows/share [file|gist|html] [PATH]— Export the session to Markdown, a secret gist, or a self-contained interactive HTML file. Docs: slash commands Release: v1.0.15 Blog: slash commands/changelog— Browse release notes from inside the CLI. Release: v1.0.5/pr— Create or inspect pull requests, fix CI failures, address review feedback, and resolve merge conflicts. Release: v1.0.5
Agents, models, skills, and extensions
/agent— Choose from available agents. Docs: slash commands How-to: custom agents/fleet [PROMPT]— Run parts of a task in parallel with subagents. Docs: slash commands How-to: /fleet/tasks— Inspect background tasks and subagent work created in the current session. How-to: /fleet/model,/models [MODEL]— View or change the active model. Docs: slash commands Blog: slash commands/skills [list|info|add|remove|reload] [ARGS...]— Manage skills. Docs: slash commands/plugin [marketplace|install|uninstall|update|list] [ARGS...]— Manage plugins and plugin marketplaces. Docs: slash commands/extensions— View, enable, and disable CLI extensions. Release: v1.0.5
Tools, account, and setup
/allow-all,/yolo— Enable all permissions for tools, paths, and URLs. Supportson,off, andshowsubcommands to enable, disable, or check allow-all mode. Docs: slash commands Release: v1.0.12/reset-allowed-tools— Clear previously granted tool approvals. Release: v1.0.3 Blog: slash commands/mcp [show|add|edit|delete|disable|enable|auth] [SERVER-NAME]— Manage MCP servers;/mcp authre-authenticates OAuth servers with account switching. Docs: slash commands Release: v1.0.15 Blog: slash commands/lsp [show|test|reload|help] [SERVER-NAME]— Manage language server configuration. Docs: slash commands/ide— Connect to an IDE workspace. Docs: slash commands/terminal-setup— Configure multiline terminal input support. Docs: slash commands/login,/logout— Sign in or out. Docs: slash commands/user [show|list|switch]— Manage the current GitHub account. Docs: slash commands Blog: slash commands/help,/feedback,/usage,/update,/theme,/experimental— Session help, reporting, usage, updates, UI, and feature toggles. Docs: slash commands Blog: slash commands/version— Display the CLI version and check for updates from inside the session. Release: v1.0.5
Keyboard shortcuts
@ FILENAME— Include file contents in the prompt context. Docs: shortcuts! COMMAND— Run a shell command directly. Docs: shortcutsCtrl + Xthen/— Run a slash command after you already started typing. Docs: shortcutsShift + Tab— Cycle between standard, plan, and autopilot mode. Docs: shortcutsCtrl + O,Ctrl + E,Ctrl + T— Expand recent timeline items, expand all, or toggle reasoning display. Docs: timeline shortcutsCtrl + G— Edit the prompt in an external editor. Docs: navigation shortcutsCtrl + Y— In plan mode, open the most recent research report when no plan exists yet. Release: v1.0.12Ctrl + L,Ctrl + C,Ctrl + D— Clear the screen, cancel the current operation, or shut down. Docs: shortcuts
Command-Line Commands and Flags
Core commands
copilot— Launch the interactive interface. Docs: CLI commandscopilot help [topic]— Show help for config, commands, environment, logging, or permissions. Docs: CLI commandscopilot init— Initialize custom instructions for the current repository. Docs: CLI commandscopilot update— Download and install the latest version. Docs: CLI commandscopilot version— Show version information and check for updates. Docs: CLI commandscopilot login,copilot logout— Authenticate or remove credentials. Docs: CLI commandscopilot plugin— Manage plugins and plugin marketplaces outside the interactive session. Docs: CLI commands
Automation and session control
echo "PROMPT" | copilot— Pipe a prompt into Copilot CLI for scripting and automation. How-to: programmatic use-p, --prompt=PROMPT— Run a prompt programmatically and exit after completion. Docs: CLI options Blog: terminal workflows Blog: idea to PR-i, --interactive=PROMPT— Start an interactive session and run an initial prompt. Docs: CLI options--continue— Resume the most recent session. Docs: CLI options--resume=SESSION-ID— Resume a specific session. Docs: CLI options--agent=AGENT— Pick a custom agent up front. Docs: CLI options--autopilot— Let Copilot continue autonomously in prompt mode. Docs: CLI options--max-autopilot-continues=COUNT— Cap autonomous follow-up turns. Docs: CLI options--reasoning-effort=LEVEL,--effort=LEVEL— Set reasoning depth (low,medium,high,xhigh). Docs: CLI options--output-format=text|json— Return plain text or JSONL output. Docs: CLI options--share=PATH,--share-gist— Export a programmatic session after it finishes. Docs: CLI options-s, --silent— Suppress usage statistics and print only the answer. Docs: CLI options How-to: programmatic use--no-ask-user— Disable the ask-user tool for fully autonomous runs. Docs: CLI options How-to: programmatic use
Permissions and safety
--allow-all,--yolo— Approve all tools, paths, and URLs. Docs: CLI options--allow-all-tools,--allow-all-paths,--allow-all-urls— Approve one permission category at a time. Docs: CLI options Blog: terminal workflows--allow-tool=TOOL,--deny-tool=TOOL— Pre-allow or pre-deny tool patterns. Docs: CLI options--allow-url=URL,--deny-url=URL— Control URL access. Docs: CLI options--available-tools=TOOL,--excluded-tools=TOOL— Reduce the tool surface available to the model. Docs: CLI options--disallow-temp-dir— Block automatic access to the system temp directory. Docs: CLI options
UI, output, and logging
--model=MODEL— Select the model. Docs: CLI options--banner— Show the startup banner. Docs: CLI options--plain-diff— Disable rich diff rendering. Docs: CLI options--screen-reader— Enable screen-reader optimizations. Docs: CLI options--stream=on|off— Turn streaming output on or off. Docs: CLI options--secret-env-vars=VAR— Redact extra environment variables in output. Docs: CLI options--config-dir=PATH— Override the config directory. Docs: CLI options--bash-env,--no-bash-env— ControlBASH_ENVsourcing. Docs: CLI options--experimental,--no-experimental— Toggle experimental features. Docs: CLI options--log-dir=DIRECTORY,--log-level=LEVEL— Control CLI logging. Docs: CLI options--no-auto-update— Disable automatic updates. Docs: CLI options
MCP and tooling flags
--acp— Start an Agent Client Protocol server. Docs: CLI options--additional-mcp-config=JSON|@path— Add MCP servers for the current session only. Docs: CLI options--disable-builtin-mcps— Disable built-in MCP servers. Docs: CLI options--disable-mcp-server=SERVER-NAME— Disable a specific MCP server. Docs: CLI options--enable-all-github-mcp-tools— Enable the full GitHub MCP tool surface. Docs: CLI options--add-github-mcp-toolset=TOOLSET,--add-github-mcp-tool=TOOL— Expand the GitHub MCP subset. Docs: CLI options
Permission Prompts and Tool Rules
When Copilot CLI asks for permission, these one-key responses are available. Docs: permission approvals
y— Allow once. Docs: permission approvalsn— Deny once. Docs: permission approvals!— Allow similar requests for the rest of the session. Docs: permission approvals#— Deny similar requests for the rest of the session. Docs: permission approvals?— Show more detail about the request. Docs: permission approvals
Tool rules use the Kind(argument) pattern. Deny rules always override allow rules. Docs: tool rules
# Allow all git commands except git push
copilot --allow-tool='shell(git:*)' --deny-tool='shell(git push)'
# Allow one MCP tool
copilot --allow-tool='MyMCP(create_issue)'
# Allow all tools from one MCP server
copilot --allow-tool='MyMCP'
Examples adapted from the command reference. Docs: tool rules
Configuration Files
Settings cascade from broader scopes to narrower scopes. Command-line flags and environment variables always win. Docs: config settings
~/.copilot/config.json— User-wide defaults. Docs: config settings.github/copilot/settings.json— Repository-wide shared settings. Docs: config settings.github/copilot/settings.local.json— Local personal overrides that should not be committed. Docs: config settings.claude/settings.json— Additional repository config source (loaded alongside.github/copilot/settings.json). Release: v1.0.12.claude/settings.local.json— Additional local config source (loaded alongside.github/copilot/settings.local.json). Release: v1.0.12
Common user settings
model— Default model selection. Docs: user settingstheme—auto,dark, orlight. Docs: user settingsreasoning_effort—low,medium,high, orxhigh. Docs: user settingsexperimental— Enable experimental features by default. Docs: user settingstrusted_folders— Pre-granted file access. Docs: user settingsallowed_urls,denied_urls— URL allowlists and blocklists. Docs: user settingsscreen_reader— Screen-reader mode. Docs: user settingsstream— Streaming responses. Docs: user settingsauto_update— Automatic updates. Docs: user settingsbash_env—BASH_ENVsupport. Docs: user settings
Repository-level settings
Repository settings support shared plugin behavior and startup messaging. Docs: repo settings
enabledPlugins— Declarative plugin auto-install for the repository. Docs: repo settingsextraKnownMarketplaces— Additional plugin marketplaces available in the repository. Docs: repo settingscompanyAnnouncements— Shared startup messages for repository users. Docs: repo settings
Hooks
Hook configuration files live in .github/hooks/*.json in the current working directory. Docs: hooks reference How-to: hooks
What hooks can do
- Run shell commands before or after tool use. Docs: hooks reference
- Auto-submit a prompt or slash command when a session starts. Docs: prompt hooks
- Allow, deny, ask for confirmation, or modify tool calls before they execute. Docs: pre-tool hooks
- Block an agent or subagent from finishing and force another turn. Docs: agent-stop hooks
Main hook events
sessionStart,sessionEndDocs: hook eventsuserPromptSubmittedDocs: hook eventspreToolUse,postToolUse,postToolUseFailureDocs: hook events Release: v1.0.15agentStop,subagentStopDocs: hook eventserrorOccurredDocs: hook eventsPermissionRequest— Allow scripts to programmatically approve or deny tool permission requests. Release: v1.0.16
Hook formats
- Command hooks support
bash,powershell,cwd,env, andtimeoutSec. Docs: command hooks - Prompt hooks support a
promptstring and can submit either plain text or a slash command. Docs: prompt hooks preToolUsecan returnallow,deny, orask, and can also replace tool arguments withmodifiedArgs. Docs: pre-tool hooksagentStopandsubagentStopcan returnalloworblock. Docs: agent-stop hooks
Useful recent hook updates
preCompacthooks can run before context compaction starts. Release: v1.0.5- Hooks can ask for confirmation before a tool runs. Docs: pre-tool hooks
- Hook configuration files can omit the
versionfield. Release: v1.0.5 - Plugin hooks receive
CLAUDE_PROJECT_DIRandCLAUDE_PLUGIN_DATAenvironment variables, and support{{project_dir}}and{{plugin_data_dir}}template variables in hook configurations. Release: v1.0.12
MCP Servers
Copilot CLI can load MCP servers from several places. Docs: MCP config
Configuration sources
~/.copilot/mcp-config.jsonDocs: MCP config.github/mcp.jsonDocs: MCP trust.mcp.jsonDocs: MCP trust.vscode/mcp.jsonDocs: MCP trust.devcontainer/devcontainer.jsonDocs: MCP trust
Built-in MCP servers
github-mcp-server— GitHub API actions such as issues, pull requests, commits, code search, and GitHub Actions. Docs: built-in MCPplaywright— Browser automation. Docs: built-in MCPfetch— HTTP requests. Docs: built-in MCPtime— Time utilities. Docs: built-in MCP
Transport types
local/stdio— Launch a local process withcommandandargs. Docs: MCP transporthttp— Connect to a remote streamable HTTP server viaurl. Docs: MCP transportsse— Connect to a remote Server-Sent Events server viaurl. Docs: MCP transport
Common fields
- Local servers:
command,args,tools,env,cwd,timeout,type. Docs: MCP local config - Remote servers:
type,url,tools,headers,oauthClientId,oauthPublicClient,timeout. Docs: MCP remote config filterMappingcontrols output filtering:hidden_characters(default),markdown, ornone. Docs: MCP filter
Trust model
- Built-in servers are high trust. Docs: MCP trust
- Repository, workspace, and dev-container configs are medium trust. Docs: MCP trust
- User config trust is your responsibility. Docs: MCP trust
- Remote servers are low trust and should always be reviewed. Docs: MCP trust
All MCP tool calls still require explicit permission, including read-only calls against external services. Docs: MCP trust
Skills and Custom Agents
Skills
Skills are Markdown files that extend what Copilot CLI can do. Each skill lives in its own directory with a SKILL.md file. Docs: skills
Built-in skills are now included with the CLI, starting with guides for common tasks. Release: v1.0.17
Common skill locations:
.github/skills/Docs: skill locations.agents/skills/Docs: skill locations.claude/skills/Docs: skill locations- Parent
.github/skills/directories in monorepos Docs: skill locations ~/.copilot/skills/Docs: skill locations~/.agents/skills/— Personal skill directory, aligned with VS Code Copilot extension default. Release: v1.0.11~/.claude/skills/Docs: skill locations- Extra directories from
COPILOT_SKILLS_DIRSDocs: skill locations
Useful frontmatter fields:
nameDocs: skill frontmatterdescriptionDocs: skill frontmatterallowed-toolsDocs: skill frontmatteruser-invocableDocs: skill frontmatterdisable-model-invocationDocs: skill frontmatter
Custom agents
Custom agents are specialized AI agents defined in Markdown files. You can browse them with /agent or select one up front with --agent=AGENT. Docs: custom agents Docs: slash commands Docs: CLI options
Built-in agents currently include:
code-reviewDocs: built-in agentsexploreDocs: built-in agentsgeneral-purposeDocs: built-in agentsresearchDocs: built-in agentstaskDocs: built-in agents
Custom agent locations:
.github/agents/or.claude/agents/Docs: agent locations~/.copilot/agents/or~/.claude/agents/Docs: agent locations- Plugin-provided agents Docs: agent locations
Useful frontmatter fields:
descriptionDocs: agent frontmatterinferDocs: agent frontmattermodelDocs: agent frontmattertoolsDocs: agent frontmattermcp-serversDocs: agent frontmatter
Environment Variables
Useful environment variables include:
COPILOT_MODEL— Default model. Docs: env varsCOPILOT_ALLOW_ALL— Equivalent to--allow-all. Docs: env varsCOPILOT_HOME— Override the default Copilot home directory. Docs: env varsCOPILOT_EDITOR— External editor command. Docs: env varsCOPILOT_CUSTOM_INSTRUCTIONS_DIRS— Extra instruction directories. Docs: env varsCOPILOT_SKILLS_DIRS— Extra skill directories. Docs: env varsCOPILOT_GITHUB_TOKEN,GH_TOKEN,GITHUB_TOKEN— Authentication tokens. Docs: env varsGH_HOST— Alternate GitHub host. Release: v1.0.3HTTP_PROXY,HTTPS_PROXY,NO_PROXY— Network proxy settings. Release: v1.0.3NO_COLOR— Disable terminal color. Release: v1.0.3USE_BUILTIN_RIPGREP— Switch between bundled and system ripgrep. Docs: env varsPLAIN_DIFF— Disable rich diff rendering. Docs: env vars
Observability
Copilot CLI can export traces and metrics with OpenTelemetry. Docs: OTel
- OTel is off by default. Docs: OTel
- It turns on when
COPILOT_OTEL_ENABLED=true,OTEL_EXPORTER_OTLP_ENDPOINTis set, orCOPILOT_OTEL_FILE_EXPORTER_PATHis set. Docs: OTel OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=truecaptures full prompts, responses, and tool payloads. Docs: OTel content- Content capture can expose sensitive data and should only be enabled in trusted environments. Docs: OTel content
Recent Additions Worth Knowing
Recent official releases added or improved several user-facing CLI features.
v1.0.17
- Built-in skills are now included with the CLI, starting with a guide for customizing Copilot cloud agent’s environment. Release: v1.0.17
/resumesession picker loads significantly faster, especially with large session histories. Release: v1.0.17- MCP OAuth flows now support HTTPS redirect URIs via self-signed certificate fallback for providers like Slack. Release: v1.0.17
v1.0.16
PermissionRequesthook allows scripts to programmatically approve or deny tool permission requests. Release: v1.0.16postToolUsenow runs only after successful tool calls; usepostToolUseFailurefor tool errors. Release: v1.0.16- SQL prompt tags no longer appear when the
sqltool is excluded via--excluded-toolsor--available-tools. Release: v1.0.16 - MCP tool calls display tool name and parameter summary in the timeline. Release: v1.0.16
- Deprecated
marketplacesrepository setting removed; useextraKnownMarketplacesinstead. Release: v1.0.16
v1.0.15
/share htmlexports sessions and research reports as self-contained interactive HTML files. Release: v1.0.15/mcp authcommand for re-authenticating MCP OAuth servers with account switching. Release: v1.0.15postToolUseFailurehook event for handling tool errors separately from successful tool calls. Release: v1.0.15- Device code flow (RFC 8628) as a fallback for MCP OAuth in headless and CI environments. Release: v1.0.15
- Home/End and Page Up/Page Down navigation in the diff viewer. Release: v1.0.15
- Config settings now prefer camelCase names (
askUser,autoUpdate,storeTokenPlaintext,logLevel,skillDirectories,disabledSkills); snake_case still works. Release: v1.0.15 - Removed support for
gpt-5.1-codex,gpt-5.1-codex-mini, andgpt-5.1-codex-maxmodels. Release: v1.0.15
v1.0.14
- Shift+Enter inserts a newline in terminals with Kitty keyboard protocol support. Release: v1.0.14
- CLI starts faster with parallel terminal detection, auth, and git operations. Release: v1.0.14
- V8 compile cache reduces parse and compile time on repeated invocations. Release: v1.0.14
- Reduced CPU usage during streaming by optimizing spinner rendering and task polling. Release: v1.0.14
- Removed support for
gemini-3-pro-previewmodel. Release: v1.0.14
v1.0.13
/rewindand double-Esc open a timeline picker to roll back to any point in conversation history. Release: v1.0.13- MCP servers can request LLM inference (sampling) with user approval via a new review prompt. Release: v1.0.13
Earlier releases
/undoto undo the last turn and revert file changes. Release: v1.0.10--effortas a shorthand alias for--reasoning-effort. Release: v1.0.10/allow-all(/yolo)on,off, andshowsubcommands to control allow-all mode. Release: v1.0.12Ctrl + Yin plan mode opens the most recent research report when no plan exists. Release: v1.0.12/session renamecan auto-generate a session name from conversation history when you omit the name argument. Release: v1.0.12.claude/settings.jsonand.claude/settings.local.jsonas additional repo config sources. Release: v1.0.12- Plugin hooks receive
CLAUDE_PROJECT_DIRandCLAUDE_PLUGIN_DATAenv vars plus{{project_dir}}and{{plugin_data_dir}}template variables. Release: v1.0.12 ~/.agents/skills/as a personal skill discovery directory. Release: v1.0.11/clearand/neware now distinct:/clearabandons the current session and keeps configured MCP servers available in the new session,/newstarts fresh (keeping the old session backgrounded). Both accept an optional initial prompt. Release: v1.0.11 Release: v1.0.12- Custom instructions, MCP servers, skills, and agents are discovered at every directory level from the working directory up to the git root (full monorepo support). Release: v1.0.11
/extensionsfor viewing, enabling, and disabling CLI extensions. Release: v1.0.5/prfor PR creation, inspection, review feedback, merge-conflict work, and CI follow-up. Release: v1.0.5/versioninside the interactive session. Release: v1.0.5/changelog last <N>,/changelog since <version>, and/changelog summarize. Release: v1.0.5@file mentions for absolute paths, home-directory paths, and parent-relative paths. Release: v1.0.5--reasoning-effortfor setting reasoning depth from the command line. Release: v1.0.4.devcontainer/devcontainer.jsonas another MCP configuration source. Release: v1.0.3- One-time path approval in permission dialogs. Release: v1.0.4
- OpenTelemetry instrumentation for sessions, model calls, and tool execution. Release: v1.0.4
Sources
- GitHub Copilot CLI command reference
- Adding custom instructions for GitHub Copilot CLI
- Overview of customizing GitHub Copilot CLI
- Running GitHub Copilot CLI programmatically
- Using hooks with GitHub Copilot CLI
- Speeding up task completion with the /fleet command
- Creating and using custom agents for GitHub Copilot CLI
- Use GitHub Copilot CLI agents
- GitHub Copilot CLI plugin reference
- A cheat sheet to slash commands in GitHub Copilot CLI
- Power agentic workflows in your terminal with GitHub Copilot CLI
- From idea to pull request: A practical guide to building with GitHub Copilot CLI
- Run multiple agents at once with /fleet in Copilot CLI
- GitHub Copilot CLI releases: v1.0.17
- GitHub Copilot CLI releases: v1.0.16
- GitHub Copilot CLI releases: v1.0.15
- GitHub Copilot CLI releases: v1.0.14
- GitHub Copilot CLI releases: v1.0.13
- GitHub Copilot CLI releases: v1.0.11
- GitHub Copilot CLI releases: v1.0.10
- GitHub Copilot CLI releases: v1.0.5
- GitHub Copilot CLI releases: v1.0.4
- GitHub Copilot CLI releases: v1.0.3