Commands#
This page documents all available slash commands in gptme.
Commands are entered by typing a forward slash (/) followed by the command name.
For CLI arguments and options, see the gptme CLI reference.
Overview#
gptme provides two types of commands:
Built-in commands - Core commands always available
Tool commands - Commands registered by enabled tools
To see available commands in your session, use /help.
Note
Some commands are only available when their corresponding tool is enabled.
Use /tools to see which tools are currently active.
Built-in Commands#
Conversation Management#
/log#
Show the conversation log.
/log # Show visible messages
/log --hidden # Include hidden system messages
/edit#
Edit the conversation in your default editor.
Opens the conversation as TOML in $EDITOR, allowing you to modify, delete, or reorder messages.
After saving and closing, the edited conversation is loaded.
/edit
/undo#
Undo the last action(s).
/undo # Undo last message
/undo 3 # Undo last 3 messages
/rename#
Rename the conversation.
/rename new-name # Rename to specific name
/rename # Interactive mode, enter empty for auto-generate
/rename auto # Auto-generate name using LLM
/fork#
Create a copy of the current conversation with a new name.
/fork my-experiment
/delete#
Delete a conversation by ID.
Alias: /rm
/delete # List recent conversations with IDs
/delete abc123 # Delete conversation with ID abc123
/delete --force xyz # Delete without confirmation
Note
Cannot delete the currently active conversation. Start a new conversation first.
/summarize#
Generate an LLM-powered summary of the conversation.
/summarize
/replay#
Replay tool operations from the conversation.
Useful for:
Re-executing code blocks after making manual changes
Restoring state (like todo lists) when resuming a conversation
Debugging tool behavior
/replay # Interactive: choose last, all, or tool name
/replay last # Replay only the last assistant message with tool uses
/replay all # Replay all assistant messages
/replay todo # Replay all operations for a specific tool
/export#
Export the conversation as an HTML file.
/export # Export to <conversation-name>.html
/export my-chat.html # Export to specific filename
Model & Token Management#
/model#
Show the current model or switch to a different one.
/model # Show current model info (price, context, capabilities)
/model openai/gpt-4o # Switch to specific model
/model anthropic # Switch to provider's default model
The model change is persisted to the conversation’s config file.
/models#
List the models available from your configured providers.
/models
/tokens#
Show token usage and cost information.
Alias: /cost
Displays:
Session costs (current session usage)
Conversation costs (all messages)
Breakdown by input/output tokens
/tokens
/context#
Show detailed context token usage breakdown.
Displays token counts by:
Role (system, user, assistant)
Content type (messages, tool uses, thinking blocks)
/context
Tools & Information#
/tools#
Manage and inspect tools in the current session.
/tools # List loaded tools (with hint about unloaded ones)
/tools --all # Show all available tools, including unloaded
/tools <name> # Show detailed info for a specific tool
/tools load <name> # Load a tool into the current conversation
The /tools load subcommand lets you add tools mid-conversation without restarting.
When a tool is loaded, its system prompt is injected as a message so the assistant
becomes immediately aware of the new capability.
/tools load browser # Enable the browser tool mid-session
/tools load screenshot # Add screenshot capability
Tab completion is available for tool names.
/rag#
Search your RAG index and add the top results to the conversation as context.
Requires gptme-rag to be installed and an indexed workspace. See RAG.
/rag how does authentication work?
/doctor#
Run system diagnostics to check gptme health.
Checks for common issues such as missing dependencies, misconfigured providers, and tool availability. Run this when something feels off or after a fresh install.
/doctor
/help#
Show the help message with available commands and keyboard shortcuts.
/help
Providers & Account#
/account#
Show account status and set up API providers.
Alias: /creds
Use this to check which providers are configured or run the interactive setup wizard to add or change a provider (Anthropic, OpenAI, OpenRouter, etc.).
/account # Show configured providers and active one
/account list # Same as above
/account setup # Interactive: choose and configure a provider
/account setup openrouter # Set up OpenRouter via OAuth
/account setup anthropic # Set up Anthropic with an API key
Skills#
/skills#
Browse and read the skills and lessons available in the current workspace.
/skills # Show help
/skills list # List available skills
/skills all # List skills and lessons together
/skills read <name> # Read a skill or lesson without invoking it
/skill:<name>#
Invoke a skill: its instructions are sent as your next prompt, and the assistant starts working on them right away. Anything after the skill name is passed to the skill as arguments.
Each skill is also available as a bare /<name> shortcut, unless that name is
already taken by a command or a loaded tool — /skill:<name> always works.
/skill:review src/app.py # Invoke the "review" skill with an argument
/review src/app.py # Same, via the bare shortcut
Tab completion lists available skills. See Skills for writing skills and how arguments are substituted.
Session Control#
/exit#
Exit gptme, saving the conversation.
/exit
/restart#
Restart the gptme process.
Useful for:
Applying configuration changes
Reloading tools after code modifications
Recovering from state issues
/restart
/clear#
Clear the terminal screen.
Alias: /cls
/clear
Advanced#
/impersonate#
Add a message as if it came from the assistant.
Useful for guiding the conversation or testing tool behavior.
/impersonate I'll help you with that task.
/impersonate # Interactive mode: enter text at prompt
/setup#
Run the gptme setup wizard.
Configures:
Shell completions (bash, zsh, fish)
Configuration file
Project-specific settings
/setup
/plugin#
Manage gptme plugins.
/plugin list # List discovered plugins
/plugin info <name> # Show details about a plugin
/checkpoint#
Manage workspace checkpoints for recovery.
Records the current git HEAD as a named checkpoint so you can diff or restore the workspace to that state later — useful before letting the assistant make large-scale changes or when experimenting with destructive operations.
Requires a git workspace to be configured for the session (--workspace).
/checkpoint create # Record a checkpoint at current HEAD
/checkpoint create --include-dirty # Also snapshot uncommitted changes
/checkpoint list # List all recorded checkpoints
/checkpoint diff <id> # Diff current state vs a checkpoint
/checkpoint restore <id> # Restore workspace to a checkpoint
/checkpoint restore <id> --include-dirty # Restore even with uncommitted changes (discards them)
The <id> can be a checkpoint number (1-based index) from /checkpoint list or a HEAD SHA prefix.
/snapshot#
Manage fine-grained workspace snapshots for rollback and agent tree-search.
Records any workspace state — committed or dirty — into a side-git shadow
repository. Snapshots are created automatically before and after each mutating
tool call when the auto_snapshots plugin is enabled (or
GPTME_AUTO_SNAPSHOTS=1), giving agents a full timeline of changes they can
roll back to.
This is different from /checkpoint:
/checkpointrecords a clean git HEAD; requires a committed working tree by default./snapshotrecords any state (including uncommitted changes) into a dedicated shadow repo. No clean-tree requirement.
Requires a workspace to be configured for the session (--workspace).
/snapshot create [label] # Record current workspace state (default label: "manual")
/snapshot list [--limit N] # List recent snapshots, newest first (default: 20)
/snapshot restore <sha> # Roll back workspace to a snapshot
/snapshot diff <sha> # Show diff between current workspace and a snapshot
The <sha> is the short SHA shown by /snapshot list.
Example — agent tree-search:
/snapshot create before-attempt-1
# ... let the agent make changes ...
/snapshot list
# output:
# SHA Label
# ----------------------------------------
# ab1234 before-attempt-1
/snapshot restore ab1234 # roll back; try a different approach
/backtrack#
Rewind the conversation to a named checkpoint or message index.
Saves named markers in the conversation log so you can undo a bad exchange and
retry with a corrective hint. Unlike /checkpoint and /snapshot, this
does not touch filesystem state — only the in-memory message log is
rewound. Use /checkpoint or /snapshot if you also need to restore
files.
/backtrack mark [label] # Save current position as a checkpoint (auto-label if omitted)
/backtrack list # List saved checkpoints
/backtrack <label|N> # Rewind to checkpoint label or message index N
/backtrack <label|N> --reason TEXT # Rewind and inject a corrective context message
Example:
/backtrack mark before-tool-run # save checkpoint
# ... assistant makes a wrong tool call ...
/backtrack list
# output:
# # Label Index Timestamp
# 1 before-tool-run 12 2026-06-14 10:23:45
/backtrack before-tool-run --reason "The file path was wrong; try /tmp/foo.txt instead"
Tool Commands#
These commands are provided by tools and are only available when the tool is enabled.
/commit (autocommit)#
Ask the assistant to review staged changes and create a git commit.
The assistant will:
Check
git statusandgit diff --stagedPropose a commit message following Conventional Commits
Create the commit (with confirmation)
/commit
Note
Enable auto-commit on every message by setting GPTME_AUTOCOMMIT=true.
/compact (autocompact)#
Manually trigger conversation compaction to reduce context size.
/compact # Rule-based trim (strips reasoning, truncates large tool outputs)
/compact trim # Same as above
/compact summarize # LLM-powered summarization (creates a RESUME.md and restarts context)
Two strategies are available:
trim (default) — rule-based: strips old reasoning blocks, truncates massive tool results, and compresses long assistant messages. Fast and deterministic; no LLM call. Trim only runs when the rule-based heuristic determines it is worthwhile; if the conversation is over the context limit but savings would be low, it will suggest
/compact summarizeinstead.summarize — LLM-powered: asks the model to produce a
RESUME.mdcapturing key decisions, open tasks, and relevant file paths, then starts a fresh context from that summary. More thorough but requires a model call.
Deprecated since version ``/compact: auto`` and /compact resume are deprecated aliases for trim
and summarize respectively. They still work but will emit a warning.
Note
Auto-compaction happens automatically when tool outputs exceed size thresholds.
/lesson (lessons)#
Manage the lessons system for contextual guidance.
/lesson # Show help
/lesson list # List all lessons
/lesson list tools # List lessons in a category
/lesson search <query> # Search lessons by keyword
/lesson show <name> # Show a specific lesson
/lesson refresh # Refresh lessons from disk
For more on lessons, see Lessons.
/pre-commit (precommit)#
Manually run pre-commit checks on the repository.
/pre-commit
Note
Pre-commit checks run automatically after file modifications when
a .pre-commit-config.yaml exists. Control with GPTME_CHECK=true/false.
/mcp (mcp)#
Manage Model Context Protocol (MCP) servers.
/mcp search <query> # Search for MCP servers
/mcp info <name> # Show info about a server
/mcp list # List loaded servers
/mcp load <name> # Load/start an MCP server
/mcp unload <name> # Unload/stop an MCP server
Loaded servers can also expose resources, prompts, and roots:
/mcp resources list <server> # List a server's resources
/mcp resources read <server> <uri> # Read a resource
/mcp templates list <server> # List resource templates
/mcp prompts list <server> # List a server's prompts
/mcp prompts get <server> <prompt> # Get a prompt
/mcp roots list [server] # List configured roots
/mcp roots add <server> <uri> [name] # Add a root (e.g. file:///path/to/project)
/mcp roots remove <server> <uri> # Remove a root
For more on MCP, see MCP.
Tool Shortcuts#
You can execute tool code directly using slash commands with the tool’s language tag:
/sh echo hello # Execute shell command
/shell ls -la # Same as above
/python print("hello") # Execute Python code
/ipython 2 + 2 # Same as above
This is equivalent to writing a code block:
```shell
echo hello
```
Keyboard Shortcuts#
These shortcuts work in the interactive prompt:
Shortcut |
Description |
|---|---|
|
Edit the current prompt in your editor ( |
|
Insert a newline without executing (for multi-line input) |
|
Cancel current input or interrupt running operation |
|
Exit gptme (same as |
|
Auto-complete commands, paths, and filenames |
|
Navigate command history |
Command Registration#
Tools can register custom commands using the commands parameter in ToolSpec:
from gptme.tools import ToolSpec
from gptme.commands import CommandContext
def my_command(ctx: CommandContext):
ctx.manager.undo(1, quiet=True) # Remove the command from log
print(f"Arguments: {ctx.args}")
# Optionally yield Message objects
tool = ToolSpec(
name="mytool",
desc="My custom tool",
commands={
"mycommand": my_command,
},
)
See Custom Tools for more on creating tools with commands.