Slash commands in Copilot CLI: a practical reference

Copilot CLI slash commands are prefixed instructions — like /clear or /session — that trigger context-aware actions without requiring a fresh natural language prompt each time. Type / inside Copilot CLI to list available commands. The same slash-command pattern also works in Copilot Chat and agent mode.

Unlike free-form prompts, slash commands produce deterministic, repeatable behavior. That makes them useful for controlling what files Copilot can read, which model answers, and how sessions behave — all without leaving the terminal.

Managing sessions

/clear — reset conversation context

Copilot accumulates context over a session. When that history starts polluting suggestions — say, after switching repos or tasks — /clear wipes the slate clean. Use it when responses reference old files or when you need to prevent context bleed between projects.

/exit and /quit — end the session

Both commands terminate the CLI session cleanly. Useful when wrapping up work or logging out of a shared terminal.

/session and /usage — view session metrics

These display usage data for the current session, which helps with audits, troubleshooting, and tracking model or tool activity. Output resembles:

Session ID: 221b5571-3998-47e1-b57a-552cf9078947      
Started: 11/24/2025, 11:18:54 AM  
Last Modified: 11/24/2025, 11:18:54 AM      
Duration: 50s
Working Directory: /Users/jacklynlee31
      
Usage:        
Total usage est:       0 Premium requests   
Total duration (API):  0s         
Total duration (wall): 50s        
Total code changes:    0 lines added, 0 lines removed 
    
Hit Enter or Esc to continue

Controlling file and directory scope

/add-dir — grant directory access

Restricting Copilot to specific directories keeps responses relevant and protects sensitive files. Run /add-dir to add a directory to the allowed list:

/add-dir <directory>

The command accepts the directory path directly, as in this example adding the Documents directory:

/add-dir /Users/jacklynlee31/Documents

Copilot confirms the addition:

Added directory to allowed list: /Users/jacklynlee31/Documents

/list-dirs — show allowed directories

Use this to verify what Copilot can currently access — handy for troubleshooting permission issues or reviewing scope before running other commands.

/list-dirs

The output lists permitted directories:

Allowed directories for file access:

   1. /Users/jacklynlee31
   2. /Users/jacklynlee31/Documents

   Total: 2 directories

/cwd — show or change working directory

Keeps Copilot anchored to the part of the codebase you’re actively working in. Running it without arguments shows the current working directory:

/cwd

Copilot returns the path:

Current working directory: /Users/jacklynlee31/Downloads

Supply a directory argument to switch location:

/cwd /Users/jacklynlee31/Downloads

Copilot confirms the new path:

Changed working directory to: /Users/jacklynlee31/Downloads

Configuration commands

/model — select an AI model

Multiple models are supported. Start with the default and experiment when you notice differences in speed, reasoning depth, or cost. Running /model opens an interactive selection menu:

/model

The menu lists available models; select with number keys or arrows and press Enter:

Choose the AI model to use for Copilot CLI. The selected model will be persisted and used for future sessions.

 ❯ 1. Claude Sonnet 4.5 (1x) (default) (current)
   2. Claude Opus 4.5 (Preview) (1x)
   3. Claude Haiku 4.5 (0.33x)
   4. Claude Sonnet 4 (1x)
   5. GPT-5.1 (1x)
   6. GPT-5.1-Codex-Mini (0.33x)
   7. GPT-5.1-Codex (1x)
   8. GPT-5 (1x)
   9. GPT-5-Mini (0x)
   10. GPT-4.1 (0x)
   11. Gemini 3 Pro (Preview) (1x)
   12. Cancel (Esc)

You can also bypass the menu with /model [model].

/theme [show|set|list] [auto|dark|light] — configure the terminal theme

Use show to check the current preference, set to choose auto, dark, or light, and list to see available themes:

/theme set dark

After setting the theme, Copilot asks you to restart the CLI to apply it:

● Theme preference set to: dark

   The new theme will be applied on the next restart of the CLI.

/terminal-setup — enable multiline input

Enables multiline prompts, which helps with complex instructions, large refactors, and improved formatting during extended edits:

/terminal-setup

/reset-allowed-tools — revert tool permissions

Rolls back the allowed tools set to a clean slate. Useful after role changes, demos, or experiments:

/reset-allowed-tools

Copilot shows a confirmation prompt:

The list of allowed tools has been reset.

External services and collaboration

/agent — pick a custom agent

Selects among custom agents configured for specialized tasks or integrations. Useful when switching agent configurations per repo, org, or project, or when testing third-party agents.

/delegate <prompt> — create an AI-generated pull request

This command automates code changes and opens a PR directly from the terminal. It’s intended for changes spanning multiple repos or for kicking off reviewable work quickly. For example, generating a PR to add dark mode support:

/delegate Add dark mode support

/share [file|gist] [path] — export a session

Captures the full session history for async handoffs, documenting decisions, or attaching context to issues and pull requests:

/share file /Users/jacklynlee31/Desktop

Copilot confirms the export location:

● Session shared successfully to: /Users/jacklynlee31/Desktop/copilot-session-221b5571-3998-47e1-b57a-552cf9078947.md

/login and /logout — authenticate

Use these to rotate credentials or switch accounts on shared devices.

/mcp [show|add|edit|delete|disable|enable] — manage MCP servers

Manages MCP server configuration in-place: show lists available servers, add creates a new one, edit modifies an existing entry, delete removes a server, and disable/enable toggle availability without removing configuration.

/user [show|list|switch] — manage the GitHub account

Handles account switching for multi-user machines, service accounts, or rotating between organizations:

/user show
/user list
/user switch

/help — list all commands

Shows every available slash command, useful for discovering new features or serving as an in-CLI quick reference.

A practical path forward

Slash commands turn repetitive terminal work into repeatable, controlled actions. The key advantage is explicit control: you decide what context the agent sees, what scope it operates within, and what it automates.

If you're just starting, get comfortable with the three most foundational commands first — /clear, /cwd, and /help. Once those feel natural, introduce additional commands gradually as your specific workflows demand them.

The feature set is still evolving, and your usage patterns directly inform future development. When something works well or falls short, use /feedback to tell the team what you're seeing.

Quick reference

Slash commandWhat it doesWhen to use
/clearClears session history/contextShift tasks, reset Copilot’s context, resolve confusion
/exit, /quitExits the Copilot sessionFinish a session, reset the CLI
/session, /usageShows current session and usage statsAudit activity, monitor Copilot CLI usage
/add-dir <directory>Adds allowed directory for file accessLimit scope, improve security/auditing
/list-dirsLists directories Copilot can accessConfirm or manage file access permissions
/cwd [directory]Changes/outputs the working directoryNavigate projects, limit Copilot context
/model [model]Changes Copilot AI model for the CLIExperiment, troubleshoot, optimize model behavior
/theme [show|set|list]Manage terminal output themeCustomize for environment or team standards
/reset-allowed-toolsResets allowed external toolsRemove tool permissions, reset for audits
/agentSelects a custom Copilot agentWhen using specialized agents by repo/org
/delegate <prompt>Delegates changes as a PR in a remote repositoryAutomate changes, multi-repo workflows
/share [file|gist]Shares session as markdown or GitHub GistDocument sessions, async handoff, team sharing
/login, /logoutSign in/out of Copilot in the CLIChange user, rotate credentials
/mcp [show|add|edit|...]MCP server configuration managementUpdate CI/CD proxy config, enterprise setups
/user [show|list|switch]GitHub user managementMulti-user or team CLI management
/helpLists all CLI commands and shortcutsOnboarding, discoverability
/feedbackSubmit feedback about Copilot CLIShare suggestions or bug reports with GitHub

You can start using Copilot slash commands by installing Copilot CLI or checking the official documentation.

Further reading