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
| Question | Answer |
|---|---|
| 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:
| Prefix | Role | Examples |
|---|---|---|
/ | 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
| Step | Command | What it does |
|---|---|---|
| 1 | /init | Generate a GEMINI.md scaffold for project-specific instructions |
| 2 | /memory show | Inspect loaded hierarchical memory |
| 3 | /permissions trust | Manage folder trust settings |
| 4 | /mcp list | List configured MCP servers and tools |
| 5 | /skills list | Discover enabled agent skills |
During a task
| Command | Purpose |
|---|---|
/model set | Choose and optionally persist active model |
/plan | Switch to Plan Mode (read-only); view approved plan |
/compress | Replace chat context with summary to save tokens |
/stats | Session token usage, tool calls, performance |
@<path> | Inject file or directory content into prompt |
/tools desc | List available tools with descriptions |
Parallel work and subagents
| Command | Purpose |
|---|---|
/agents list | List built-in, local, and remote subagents |
/agents enable|disable|config | Control subagent behavior |
/shells | Toggle background shells view for long-running processes |
Before you ship
| Command | Purpose |
|---|---|
/restore [tool_call_id] | Revert files to pre-tool state (checkpointing) |
/rewind | Navigate backward through history; revert chat and/or code |
/setup-github | Configure GitHub Actions for issue triage and PR review |
Between sessions
| Command | Purpose |
|---|---|
/resume | Browse auto-saved sessions; manage manual checkpoints |
/chat save|resume|list | Alias for /resume checkpoint subcommands |
/clear | Clear terminal and visible history (Ctrl+L) |
/quit or /exit | Exit; --delete removes session history and temp files |
Complete AI Builder Bootcamp
Claude, Python automation & full-stack — 12 live sessions with Yash Thakker.
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
| Command | Purpose |
|---|---|
/init | Analyze directory and generate tailored GEMINI.md |
/memory show | Display concatenated hierarchical memory from all GEMINI.md files |
/memory refresh | Reload memory from global, project, and subdirectory files |
/memory list | List paths of active GEMINI.md files |
/permissions trust [path] | Manage folder trust settings |
/policies list | List active policies grouped by mode |
/privacy | Privacy notice and data collection consent |
/directory add|show | Multi-directory workspace (alias: /dir) |
/auth | Change 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
| Command | Purpose |
|---|---|
/model manage | Open model configuration dialog |
/model set [--persist] | Set active model |
/plan | Enter Plan Mode (read-only); disable via general.plan.enabled |
/plan copy | Copy approved plan to clipboard |
/compress | Summarize entire chat context to save tokens |
/copy | Copy last Gemini output to clipboard |
/stats [session|model|tools] | Detailed usage statistics |
/upgrade | Open 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
| Command | Purpose |
|---|---|
/resume | Interactive session browser for auto-saved conversations |
/chat | Alias for /resume with same subcommands |
/chat save <tag> | Save manual checkpoint with tag |
/chat resume <tag> | Resume tagged checkpoint (project-scoped) |
/chat list | List manual checkpoint tags |
/chat delete <tag> | Delete saved checkpoint |
/chat share [file] | Export conversation to Markdown or JSON |
/chat debug | Export most recent API request as JSON |
/restore [tool_call_id] | Revert files to pre-tool state |
/rewind | Review past interactions; revert chat and/or code (Esc Esc) |
/clear | Clear terminal screen and visible history |
/quit, /exit | Exit CLI |
/quit --delete | Exit 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
| Command | Purpose |
|---|---|
/skills list|enable|disable|reload | Manage agent skills |
/mcp list|desc|schema | List MCP servers and tools |
/mcp enable|disable|reload|auth | Manage MCP server state and OAuth |
/extensions list|install|enable|disable|update | Manage Gemini CLI extensions |
/tools [desc|nodesc] | List available tools |
/hooks list|enable|disable | Manage lifecycle hooks |
/commands list|reload | List and reload custom .toml slash commands |
Run /commands reload after adding or modifying custom commands without restarting the CLI.
IDE, editor, and TUI customization
| Command | Purpose |
|---|---|
/ide install|enable|disable|status | Manage IDE integration |
/editor | Select supported editor |
/vim | Toggle Vim mode (saved to ~/.gemini/settings.json) |
/settings | Open settings editor for .gemini/settings.json |
/theme | Change visual theme |
/terminal-setup | Multiline input keybindings (VS Code, Cursor, Windsurf) |
/docs | Open Gemini CLI documentation in browser |
/about | Version 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
| Scope | Directory | Availability |
|---|---|---|
| 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
| Syntax | Purpose | Example |
|---|---|---|
{{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 path | Command |
|---|---|
.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
| Pattern | Purpose |
|---|---|
@path/to/file.txt | Inject 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
| Pattern | Purpose |
|---|---|
!git status | Run single shell command; output shown in terminal |
!ls -la | Execute 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.
| Command | Purpose |
|---|---|
/about | Version info for issue filing |
/agents list|reload|enable|disable|config | Manage subagents |
/auth | Change authentication method |
/bug [headline] | File GitHub issue |
/chat | Alias for /resume |
/clear | Clear terminal and visible history (Ctrl+L) |
/commands list|reload | Manage custom .toml commands |
/compress | Summarize chat context to save tokens |
/copy | Copy last output to clipboard |
/directory add|show | Multi-directory workspace (/dir) |
/docs | Open documentation in browser |
/editor | Select supported editor |
/extensions | Install, enable, disable, update extensions |
/help, /? | Display help |
/hooks list|enable|disable|enable-all|disable-all | Manage lifecycle hooks |
/ide install|enable|disable|status | IDE integration |
/init | Generate GEMINI.md scaffold |
/mcp list|desc|schema|enable|disable|reload|auth | MCP server management |
/memory show|refresh|list | Hierarchical GEMINI.md memory |
/model manage|set [--persist] | Model configuration |
/permissions trust [path] | Folder trust settings |
/plan, /plan copy | Plan Mode (read-only) |
/policies list | Active policies by mode |
/privacy | Privacy notice and consent |
/quit, /exit [--delete] | Exit CLI |
/restore [tool_call_id] | Revert file changes from tool call |
/rewind | Navigate conversation history (Esc Esc) |
/resume | Session browser and checkpoints |
/settings | Edit .gemini/settings.json |
/shells, /bashes | Background shells view |
/setup-github | GitHub Actions triage and PR review |
/skills list|enable|disable|reload | Agent skills |
/stats session|model|tools | Usage statistics |
/terminal-setup | Multiline input keybindings |
/theme | Visual theme picker |
/tools [desc|nodesc] | List available tools |
/upgrade | Gemini Code Assist upgrade page |
/vim | Toggle 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
| Task | Gemini CLI | Codex | Claude Code | OpenCode |
|---|---|---|---|---|
| Project memory | /init → GEMINI.md | /init → AGENTS.md | /init → CLAUDE.md | /init → AGENTS.md |
| Custom commands | .toml in .gemini/commands/ | Skills/plugins | Skills | .md in .opencode/commands/ |
| Plan before coding | /plan | /plan | /plan | custom cmd + agent: plan |
| Autonomous target | — | /goal | /goal | custom 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
- Claude Code commands reference — Anthropic CLI counterpart
- Codex slash commands reference — OpenAI CLI counterpart
- OpenCode slash commands reference — open-source TUI counterpart
- Cursor CLI slash commands reference — Cursor terminal counterpart
- What is MCP? —
/mcpand MCP prompts as slash commands - What are agent skills? —
/skillsauthoring patterns - What is MEMORY.md? — hierarchical memory patterns
- Goal mode complete guide —
/goalon Codex and Claude Code - Loop engineering — scheduled and verification loops
- Google Antigravity vs Gemini CLI — 2026 migration context
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.