AI

GitHub Copilot CLI: 8 Slash Commands for Terminal Control

GitHub Copilot CLI: 8 Slash Commands for Terminal Control

AI · zbrandco

Bottom line: GitHub’s June 15 Copilot CLI guide documents eight slash commands that give terminal-first developers a scriptable control surface for model selection, token budgeting, session continuity, and permission hygiene — no GUI required.


GitHub published a beginner-focused walkthrough of Copilot CLI slash commands on June 15, framing them as the “control surface” developers use to steer the agent without leaving the terminal GitHub Copilot CLI for Beginners: Overview of common slash commands.

The post, authored by Kayla Cinnamon, is the third in a video-and-blog series that previously covered installation and interactive versus non-interactive modes. Its thesis: mastering these commands turns Copilot CLI from a chatbot into a scriptable, session-aware power tool that works identically across local laptops, GitHub Codespaces, and CI runners.


GitHub Copilot CLI: Slash commands as a REPL-native UI

Typing / alone opens a scrollable palette of every supported command — a design choice that mirrors language-server protocol (LSP) hover UIs but stays inside the shell. Cinnamon notes the commands let you “guide Copilot’s behavior, inspect changes, manage context, move efficiently across sessions and projects, and keep permissions tidy” GitHub Copilot CLI for Beginners: Overview of common slash commands. For developers who live in tmux or VS Code’s integrated terminal, that means zero context switches to a browser or GUI panel. The palette is discoverable, searchable, and works the same way whether you’re debugging a Kubernetes manifest or refactoring a React component.


Model switching with cost visibility

/model surfaces a picker showing each model’s capabilities, availability, and cost multiplier. The multiplier is the key signal: it tells you how many “premium” tokens a request consumes relative to the baseline model on your plan. Organizations can restrict the list via policy, so the same command doubles as a compliance check — if a model disappears, your admin likely disabled it. The table below summarizes all eight commands with their primary use and side effects.

Command Primary Use Side Effect
/model Swap reasoning engine Updates cost multiplier for session
/context Show token budget Reveals system + user token split
/compact Summarize history Shrinks context, preserves continuity
/clear Hard reset Wipes session, frees full window
/resume Rehydrate past session Loads local + remote history
/diff Show pending edits Git-style unified diff output
/cwd Change working dir Re-scopes file access
/reset-allowed-tools Revoke tool grants Clears file-edit, shell, net permissions

Token hygiene: /context, /compact, /clear

Copilot CLI enforces a context window measured in tokens. /context prints a three-line budget: tokens remaining, system overhead, and buffer headroom.

When the window fills, the CLI auto-compacts — but /compact lets you trigger summarization mid-task, useful when pivoting from refactoring to architecture discussion without starting a fresh session. /clear is the nuclear option: it discards the entire transcript, ideal for security-sensitive repos where you must ensure no prior prompts leak into the next engagement.

These three commands give you granular control over the token economy that powers every agent interaction.


Session continuity via /resume

/resume lists both local and remote sessions, the latter synced through GitHub’s cloud backend. Selecting one replays the full history — prompts, tool calls, diffs — so you can pick up a debugging thread days later on a different machine. This mirrors the worktree-based parallelism GitHub now defaults to in the Copilot app, where each agent session spins up an isolated git worktree to avoid stash thrash What are git worktrees, and why should I use them?. The CLI doesn’t create worktrees automatically, but /cwd lets you cd into one manually, giving you the same parallel-session isolation without GUI assistance.


Diffs, directories, and permission reset

/diff emits a unified diff of all file mutations staged in the current session — essentially git diff scoped to Copilot’s pending edits. /cwd (change working directory) re-roots the agent to another repo or subdirectory, handy for monorepos where you want the agent to only see the packages/api subtree. /reset-allowed-tools revokes every tool grant (file write, shell exec, network) in one shot; the next tool request re-prompts for consent. That’s a least-privilege reset when moving from a trusted internal repo to a third-party fork. Together these commands form a complete permission and visibility layer.


Why this matters for terminal-first teams

The slash-command layer is scriptable. You can alias /model gpt-4o in your shell rc, pipe /diff into delta for syntax-highlighted review, or wrap /resume in a fzf picker for fuzzy session search. None of this requires API keys or extensions — it’s native to the binary GitHub ships. For platform teams, that means the same onboarding doc works for CI runners, codespaces, and local laptops. The commands are idempotent, composable, and auditable — properties CLIs usually reserve for git itself.


The insight: slash commands as a protocol, not a menu

Treating / as a discoverable protocol — not just a help menu — changes how you compose workflows. Example: a pre-commit hook that runs /compact then /diff ensures the agent’s summary and diff are fresh before human review. A deploy script that calls /reset-allowed-tools before git push guarantees no stray tool grants survive to production.

The commands are idempotent, composable, and auditable — properties CLIs usually reserve for git itself. This protocol mindset unlocks automation that feels native to the shell.


Practical takeaway for builders

Open a terminal, type /, and pin the three commands you’ll use daily — likely /model, /context, and /diff. Add shell aliases for them:

alias cmodel='gh copilot suggest "/model"'
alias ccontext='gh copilot suggest "/context"'
alias cdiff='gh copilot suggest "/diff" | delta'

Then watch how often you stop reaching for the mouse. The control surface is already there; muscle memory is the only missing piece. Start with these three aliases today and measure how many context switches you eliminate in your first week.


Bottom line

GitHub’s slash-command layer gives you terminal-native control over model choice, token budget, session history, and permissions — all scriptable, all without leaving the shell. If you live in the terminal, learn /model, /context, and /diff first; alias them; build the muscle memory. The control surface is shipping today.

We may earn commission from affiliate links at no extra cost to you. Last updated: Jun 18, 2026.
Aira

Founding Editor and Publisher of ZBrandCo, covering artificial intelligence, open-source software, and the developer tools people actually use. Signal over hype: every story starts from a primary source and explains why it matters. ZBrandCo runs no paid reviews and no affiliate links. Tips and corrections: editorial@zbrandco.com.