← Blog
explainx / blog

Gemini CLI Slash Commands: Complete Reference (2026)

Every Gemini CLI slash command—/init, /plan, /compress, custom .toml commands, @file refs, and 50+ built-ins. Workflow guide from official docs.

11 min readYash Thakker
Gemini CLIGoogle CloudSlash CommandsAI CodingDeveloper Tools

MDX restores the committed source plus an HTML comment attribution; plain text bundles the rendered markdown body with the explainx.ai attribution footer.

Gemini CLI Slash Commands: Complete Reference (2026)

Gemini CLI is Google's open-source agentic terminal for reading, editing, and running code with Gemini models. Beyond natural-language prompts, it exposes 50+ built-in slash commands, custom .toml commands, @ file injection, and ! shell passthrough—giving you meta-level control over sessions, tools, memory, and workflows without leaving the terminal.

Custom slash commands shipped in July 2025—a highly requested feature that lets teams define reusable prompts in .toml files or expose MCP prompts as slash commands. This article is a complete reference from the official Commands documentation, plus custom-command authoring from the Google Cloud blog.

It is not a replacement for upstream docs. Note: Google announced migration from Gemini CLI to Antigravity CLI for some tiers in 2026—verify your install path and changelog before documenting team runbooks. See our Google Antigravity analysis for context.

For the Anthropic and OpenAI equivalents, see Claude Code commands and Codex slash commands. For open-source multi-provider TUI, see OpenCode slash commands. For editor-parity terminal agent, see Cursor CLI slash commands.

TL;DR

QuestionAnswer
How do I see all commands?Type / in the composer; run /help for full list.
Custom commands?.toml files in ~/.gemini/commands/ or .gemini/commands/
First session in a repo?/init/memory/mcp/skills/permissions
Long conversation?/stats for usage; /compress to summarize and free context
Attach files?@path/to/file in prompts (git-aware filtering)
Run shell?!git status or toggle shell mode with lone !
Project memory file?GEMINI.md via /init
Sister guides?Claude Code · Codex · OpenCode · Cursor CLI

Three prefix types: /, @, and !

Gemini CLI uses three command prefixes with different roles:

PrefixRoleExamples
/Meta-level CLI control/model, /plan, /compress, custom /review
@Inject file/directory content into prompt@src/api.ts Explain this module
!Execute shell commands!git status, ! toggles shell mode

Slash commands control the CLI itself. @ and ! are input patterns that shape what reaches the model or your system shell.


How slash commands fit a typical workflow

flowchart LR
  A[Setup /init /memory /mcp] --> B[Work /model /plan /compress]
  B --> C[Context @files /ide /directory]
  C --> D[Parallel /agents /shells]
  D --> E[Undo /restore /rewind]
  E --> F[Sessions /resume /clear /quit]

First session in a repo

StepCommandWhat it does
1/initGenerate a GEMINI.md scaffold for project-specific instructions
2/memory showInspect loaded hierarchical memory
3/permissions trustManage folder trust settings
4/mcp listList configured MCP servers and tools
5/skills listDiscover enabled agent skills

During a task

CommandPurpose
/model setChoose and optionally persist active model
/planSwitch to Plan Mode (read-only); view approved plan
/compressReplace chat context with summary to save tokens
/statsSession token usage, tool calls, performance
@<path>Inject file or directory content into prompt
/tools descList available tools with descriptions

Parallel work and subagents

CommandPurpose
/agents listList built-in, local, and remote subagents
/agents enable|disable|configControl subagent behavior
/shellsToggle background shells view for long-running processes

Before you ship

CommandPurpose
/restore [tool_call_id]Revert files to pre-tool state (checkpointing)
/rewindNavigate backward through history; revert chat and/or code
/setup-githubConfigure GitHub Actions for issue triage and PR review

Between sessions

CommandPurpose
/resumeBrowse auto-saved sessions; manage manual checkpoints
/chat save|resume|listAlias for /resume checkpoint subcommands
/clearClear terminal and visible history (Ctrl+L)
/quit or /exitExit; --delete removes session history and temp files
Live Bootcamp6 weeks

Complete AI Builder Bootcamp

Claude, Python automation & full-stack — 12 live sessions with Yash Thakker.

View bootcamp

The Complete AI Builder Bootcamp is the best AI development course for learning Claude AI, prompt engineering, Python automation, and full-stack web development. This intensive 6-week live bootcamp teaches you how to build AI-powered applications using Claude Projects, Claude Artifacts, Claude Code, and the complete Claude ecosystem. You'll master prompt engineering techniques, learn to create custom Claude connectors and MCP integrations, build Python automation workflows, develop full-stack websites with AI assistance, and create AI marketing agents.

The bootcamp includes 12 live Zoom sessions with Yash Thakker, founder of AISOLO Technologies and instructor to 350,000+ students. You'll build 8+ portfolio projects including AI playbooks, full-stack note-taking applications, Python automation scripts, marketing agents, and personal portfolio websites. The curriculum covers AI fundamentals, Claude Projects and Artifacts, Claude Co-work, Claude plugins and skills, Claude Code for Python development, full-stack development, AI marketing, and capstone projects.

Students receive 1-year access to all recordings, permanent Discord community access, a certificate of completion, and personalized career guidance. All enrollments include a 7-day money-back guarantee. This is the most comprehensive Claude AI bootcamp available, taking students from zero AI knowledge to expert AI builder in 6 weeks.


Setup, memory, and project context

CommandPurpose
/initAnalyze directory and generate tailored GEMINI.md
/memory showDisplay concatenated hierarchical memory from all GEMINI.md files
/memory refreshReload memory from global, project, and subdirectory files
/memory listList paths of active GEMINI.md files
/permissions trust [path]Manage folder trust settings
/policies listList active policies grouped by mode
/privacyPrivacy notice and data collection consent
/directory add|showMulti-directory workspace (alias: /dir)
/authChange authentication method

Memory hierarchy: Gemini CLI loads GEMINI.md from global, project/ancestor, and subdirectory locations—similar to CLAUDE.md and MEMORY.md patterns. Codex uses AGENTS.md; Gemini uses GEMINI.md.

Multi-directory: /directory add supports absolute paths, relative paths, and ~ home references. Disabled in restrictive sandbox profiles—use --include-directories at launch instead.


Model, plan, and session control

CommandPurpose
/model manageOpen model configuration dialog
/model set [--persist]Set active model
/planEnter Plan Mode (read-only); disable via general.plan.enabled
/plan copyCopy approved plan to clipboard
/compressSummarize entire chat context to save tokens
/copyCopy last Gemini output to clipboard
/stats [session|model|tools]Detailed usage statistics
/upgradeOpen Gemini Code Assist upgrade page (Google login only)

Plan mode is enabled by default. Use it the same way you'd use /plan in Codex or Claude Code—propose execution before implementation.


Session, resume, and checkpointing

CommandPurpose
/resumeInteractive session browser for auto-saved conversations
/chatAlias for /resume with same subcommands
/chat save <tag>Save manual checkpoint with tag
/chat resume <tag>Resume tagged checkpoint (project-scoped)
/chat listList manual checkpoint tags
/chat delete <tag>Delete saved checkpoint
/chat share [file]Export conversation to Markdown or JSON
/chat debugExport most recent API request as JSON
/restore [tool_call_id]Revert files to pre-tool state
/rewindReview past interactions; revert chat and/or code (Esc Esc)
/clearClear terminal screen and visible history
/quit, /exitExit CLI
/quit --deleteExit and permanently delete session history

Auto-save vs manual checkpoints: Conversations are automatically saved as you chat—run /resume to browse them. Manual /chat save <tag> checkpoints are project-scoped and stored under ~/.gemini/tmp/<project>/.

/restore vs /rewind: /restore reverts file changes from a specific tool call. /rewind navigates conversation history and can revert chat state, code changes, or both.

See Claude Code restore/checkpoint guide for the Anthropic equivalent.


Skills, MCP, extensions, and tools

CommandPurpose
/skills list|enable|disable|reloadManage agent skills
/mcp list|desc|schemaList MCP servers and tools
/mcp enable|disable|reload|authManage MCP server state and OAuth
/extensions list|install|enable|disable|updateManage Gemini CLI extensions
/tools [desc|nodesc]List available tools
/hooks list|enable|disableManage lifecycle hooks
/commands list|reloadList and reload custom .toml slash commands

Run /commands reload after adding or modifying custom commands without restarting the CLI.


IDE, editor, and TUI customization

CommandPurpose
/ide install|enable|disable|statusManage IDE integration
/editorSelect supported editor
/vimToggle Vim mode (saved to ~/.gemini/settings.json)
/settingsOpen settings editor for .gemini/settings.json
/themeChange visual theme
/terminal-setupMultiline input keybindings (VS Code, Cursor, Windsurf)
/docsOpen Gemini CLI documentation in browser
/aboutVersion info for issue filing
/bug [headline]File GitHub issue; customizable via advanced.bugCommand

Custom slash commands (.toml)

Custom commands are Gemini CLI's distinguishing feature—reusable prompts defined in TOML files, announced July 31, 2025 by Google Developer Advocates Jack Wotherspoon and Abhi Patel.

Install latest Gemini CLI

# npx (no global install)
npx @google/gemini-cli

# global npm
npm install -g @google/gemini-cli@latest

Scopes

ScopeDirectoryAvailability
User~/.gemini/commands/All projects for this user
Project.gemini/commands/Current project only (check into Git)

Minimal .toml structure

Only two keys are required: description and prompt.

# ~/.gemini/commands/plan.toml
description = "Investigates and creates a strategic plan to accomplish a task."
prompt = """
Your primary role is that of a strategist, not an implementer.
Your task is to devise a comprehensive strategic plan for: {{args}}

You MUST NOT write, modify, or execute any code.

Present your plan with: Understanding the Goal, Investigation & Analysis,
Proposed Strategic Approach, Verification Strategy, and Anticipated Challenges.
"""

Usage:

/plan How can I make the project more performant?

Template variables

SyntaxPurposeExample
{{args}}User arguments after command name/review 42 → args = 42
!{shell}Inline shell command output in prompt!{git log --pretty=format:"%s" -n 5}

PR review example (from Google Cloud blog)

# .gemini/commands/review.toml
description = "Reviews a pull request based on issue number."
prompt = """
Please provide a detailed pull request review on GitHub issue: {{args}}.

Follow these steps:
1. Use `gh pr view {{args}}` to pull PR information.
2. Use `gh pr diff {{args}}` to view the diff.
3. Understand intent from the PR description.
4. Verify title follows Conventional Commits. Recent commits:
   !{git log --pretty=format:"%s" -n 5}
5. Search the codebase if required.
6. Write a concise review encouraging strong code quality.
7. Use `gh pr comment {{args}} --body {{review}}` to post the review.
"""

Invoke with /review 123.

Namespacing

File path relative to commands/ determines the command name. Path separators become colons:

File pathCommand
.gemini/commands/test.toml/test
.gemini/commands/git/commit.toml/git:commit

Command names are case-sensitive.

After creating commands:

/commands list
/commands reload

MCP prompts as slash commands

Gemini CLI exposes MCP server prompts as slash commands automatically. The MCP prompt name and description become the command name and help text.

MCP prompt arguments support named and positional forms:

/research --topic="quantum computing"
/research quantum computing

This integrates with FastMCP Python servers and any MCP-compliant prompt provider. Reload with /commands reload after MCP server changes.


At commands (@): file injection

PatternPurpose
@path/to/file.txtInject single file content into prompt
@src/my_project/Read directory contents recursively
@README.md What is this project?File reference mid-prompt

Git-aware filtering: By default, git-ignored files (node_modules/, dist/, .env) are excluded. Configure via context.fileFiltering in settings.

Spaces in paths: Escape with backslash: @My\ Documents/file.txt

Uses the read_many_files tool internally. Binary and very large files may be skipped or truncated.


Shell mode (!): passthrough commands

PatternPurpose
!git statusRun single shell command; output shown in terminal
!ls -laExecute and return to Gemini CLI
! (alone)Toggle shell mode—commands run directly until exited

Shell mode sets GEMINI_CLI=1 in the subprocess environment so scripts can detect they're running inside Gemini CLI.

Platform: Linux/macOS uses bash; Windows uses powershell.exe -NoProfile -Command unless ComSpec is overridden.


Complete built-in slash command reference

Every built-in command from the official reference as of June 2026.

CommandPurpose
/aboutVersion info for issue filing
/agents list|reload|enable|disable|configManage subagents
/authChange authentication method
/bug [headline]File GitHub issue
/chatAlias for /resume
/clearClear terminal and visible history (Ctrl+L)
/commands list|reloadManage custom .toml commands
/compressSummarize chat context to save tokens
/copyCopy last output to clipboard
/directory add|showMulti-directory workspace (/dir)
/docsOpen documentation in browser
/editorSelect supported editor
/extensionsInstall, enable, disable, update extensions
/help, /?Display help
/hooks list|enable|disable|enable-all|disable-allManage lifecycle hooks
/ide install|enable|disable|statusIDE integration
/initGenerate GEMINI.md scaffold
/mcp list|desc|schema|enable|disable|reload|authMCP server management
/memory show|refresh|listHierarchical GEMINI.md memory
/model manage|set [--persist]Model configuration
/permissions trust [path]Folder trust settings
/plan, /plan copyPlan Mode (read-only)
/policies listActive policies by mode
/privacyPrivacy notice and consent
/quit, /exit [--delete]Exit CLI
/restore [tool_call_id]Revert file changes from tool call
/rewindNavigate conversation history (Esc Esc)
/resumeSession browser and checkpoints
/settingsEdit .gemini/settings.json
/shells, /bashesBackground shells view
/setup-githubGitHub Actions triage and PR review
/skills list|enable|disable|reloadAgent skills
/stats session|model|toolsUsage statistics
/terminal-setupMultiline input keybindings
/themeVisual theme picker
/tools [desc|nodesc]List available tools
/upgradeGemini Code Assist upgrade page
/vimToggle Vim mode for input

Custom commands: Any .toml in ~/.gemini/commands/ or .gemini/commands/ plus MCP prompts discovered at runtime.


Four-way comparison: Gemini CLI vs Codex vs Claude Code vs OpenCode

TaskGemini CLICodexClaude CodeOpenCode
Project memory/initGEMINI.md/initAGENTS.md/initCLAUDE.md/initAGENTS.md
Custom commands.toml in .gemini/commands/Skills/pluginsSkills.md in .opencode/commands/
Plan before coding/plan/plan/plancustom cmd + agent: plan
Autonomous target/goal/goalcustom cmd + agent
Free context/compress/compact/compact/compact
Switch model/model set/model/model + /effort/models
File attachment@path/mention, /ide/ide@path
Shell passthrough!command!command
Undo file changes/restore, /rewind/rewind/undo, /redo
Share session/chat share/export/export/share

Full references: Gemini CLI · Codex · Claude Code · OpenCode


Commands worth memorizing first

/init                          # GEMINI.md scaffold
/memory show                   # inspect loaded context
/model set                     # pick the right model
/plan                          # read-only planning mode
/compress                      # free context mid-session
@src/main.ts Explain this file # attach code to prompt
!git status                    # quick shell check
/agents list                   # see subagents
/resume                        # pick up yesterday's thread
/commands reload               # after adding custom .toml

Quick custom command starter

mkdir -p ~/.gemini/commands
cat > ~/.gemini/commands/plan.toml << 'EOF'
description = "Strategic plan only—no implementation."
prompt = "Create a step-by-step plan for: {{args}}. Do NOT write code."
EOF
/commands reload
/plan Refactor the auth module

Related ExplainX guides

Primary sources: Commands — Gemini CLI Docs · Custom slash commands — Google Cloud Blog · Gemini CLI GitHub


Summary

Gemini CLI slash commands span built-in session control (/model, /plan, /compress), custom .toml workflows (/review, /git:commit), MCP prompt integration, and @ / ! input patterns for file injection and shell passthrough. The .toml system—with {{args}} templating and !{shell} injection—is the most extensible custom-command model among the three major agentic CLIs.

Type /help to discover what your build exposes. Treat geminicli.com/docs as source of truth; bookmark this guide alongside the Claude Code, Codex, OpenCode, and Cursor CLI references for cross-platform work.


Command names, custom command syntax, and Antigravity migration status reflect Google documentation and the July 2025 Cloud blog as of June 11, 2026. Re-check the Gemini CLI changelog before documenting internal runbooks.

Related posts