AI Agent Slash Commands: The Complete Cross-Tool Guide (2026)
Published 2026-08-22 · by Shortcut Tools · every command below is verified against official documentation in our AI prompt reference (776 entries, 23 platforms).
What is a slash command in an AI agent?
A slash command is a literal, typeable token that changes what the agent does without natural-language ambiguity: /compact compresses the conversation, /model switches models, /diff shows pending changes. Unlike a prompt, a slash command is part of the tool's documented surface - it exists or it doesn't. That is also why they are worth cataloging as structured data: they can be verified against official docs, and they change with releases.
Most agents actually expose several prefix grammars, not just /. Claude Code documents five input prefixes: / for commands, ! to run a shell command and feed its output back to the model, @ to reference files, : and ? for quick actions and help. Cursor pairs slash commands with @ context mentions (@Branch, @Commit, @Terminals), and Copilot leans on # scope tokens (#selection, #function, #file) plus @ participants like @terminal.
How do the core session commands compare?
| Task | Claude Code | Cursor | Aider | OpenClaw | Hermes Agent |
|---|---|---|---|---|---|
| New session | /clear | /clear | /clear | /new | /new (alias /reset) |
| Compress context | /compact | /summarize | - | /compact | - |
| Branch / explore | /fork | - | - | - | /branch (alias /fork) |
| Undo last step | /rewind | /rewind | /undo | - | /undo |
| Show changes | /diff | - | /diff | - | /diff |
| Cost / usage | /cost /usage | - | /tokens | openclaw status --usage | - |
/compact even accepts free-form instructions about what to preserve.Which AI tool has the most slash commands - and what is each one good at?
Claude Code (111 entries) has the deepest surface: session state (/resume, /rewind, /fork), context budgeting (/context all, /autocompact), review at selectable effort (/code-review low through ultra, with --fix to apply findings), and goal-driven runs (/goal, /loop).
OpenClaw (66) is the chat-gateway specialist: the agent lives behind Discord, Slack, Telegram or WhatsApp, so its commands include channel docks, device pairing, and a strict split between /config (validated writes to disk) and /debug (runtime-only overrides that vanish on restart).
Codex CLI (58) and Aider (43) stay close to git: Aider's /commit, /diff, /git treat the repository as the source of truth, and its /architect and /ask modes separate planning from editing.
Hermes Agent (34 commands) reads like a superset of the genre - session branching with /branch, and /worktree for isolated git worktrees - while Cursor (37) and Copilot (31) optimize for the editor: fewer commands, stronger context tokens.
Three workflows, keystroke by keystroke
1. Review a branch before opening the PR (Cursor)
@Branch → /ask "anything risky in this diff?" → @Commit before committing
@Branch attaches the full diff against main - the context a review question actually needs - and /ask keeps the agent explaining instead of editing. A final @Commit pass catches the stray debug line file-by-file reading misses.
2. Keep a long Claude Code session affordable
/context all → /compact focus on the API refactor → /autocompact 150k → /cost
Inspect what the session holds, compact with instructions, then let /autocompact handle it automatically at a token threshold. /cost mid-task catches runaway loops before the invoice does.
3. Try a risky idea without losing your thread (Hermes Agent / Claude Code)
/branch spike-idea → work → /undo or /rewind if it fails
Branching the conversation is cheaper than re-explaining context in a fresh session. Claude Code spells it /fork; Hermes accepts both.
How do I add an MCP server from the command line?
MCP is the connective tissue between everything above. Claude Code drives the whole lifecycle from the CLI:
claude mcp add github --transport http https://... --header "Authorization: Bearer ..."
claude mcp add mydb --scope project -- npx -y @modelcontextprotocol/server-postgres
claude mcp list · claude mcp get mydb · claude mcp remove mydb
--scope project writes the server into .mcp.json at the repository root so your team gets it with the checkout (Claude asks for approval before using checked-in servers; claude mcp reset-project-choices makes it ask again). claude mcp serve flips the direction and runs Claude Code itself as a stdio server other clients can consume. OpenClaw manages the same concern in-chat with its /mcp family. Full token list - config fields, transports, OAuth flags, output-limit env vars - in our MCP reference.
AGENTS.md vs CLAUDE.md vs .cursorrules: which instruction file do I write?
| File | Read by | Notes |
|---|---|---|
AGENTS.md | Codex, Cursor, Gemini CLI, Aider, Zed, Warp, Devin, Copilot coding agent, and more | Open standard; in a monorepo agents read the nearest file up the tree |
CLAUDE.md | Claude Code | Project memory; edit in-session with /memory; user-level at ~/.claude/CLAUDE.md |
.cursor/rules/*.mdc | Cursor | Current format; legacy single-file .cursorrules still read |
.github/copilot-instructions.md | Copilot | Repo-wide; scoped *.instructions.md files add per-path rules |
GEMINI.md / CONVENTIONS.md | Gemini CLI / Aider | Aider loads conventions read-only via --read |
AGENTS.md and symlink the tool-specific names to it - ln -s AGENTS.md CLAUDE.md. One source of truth, every agent satisfied.Does the same idea apply to image and video tools?
Yes - the tokens just look different. Midjourney steers with parameters: --seed for reproducibility, --sref and --oref for style and subject consistency, --draft to explore at half cost and --hd to commit resolution to the winner. Stable Diffusion WebUI has an actual prompt syntax: (word:1.2) explicit weighting, uppercase BREAK to control token chunking, [from:to:when] to swap concepts mid-sampling, and AND for composable subjects. Video APIs like Kling, Vidu and PixVerse expose the layer as JSON fields where the model value gates which other parameters are even legal - the most common source of "why is my parameter ignored" confusion.
Frequently asked questions
Are slash commands the same across tools?
No. A few names recur (/clear, /diff, /model) but each tool documents its own set, and aliases differ - Hermes Agent's /branch is Claude Code's /fork. Always check the per-tool reference.
Where does this data come from?
Every entry is a literal token taken from official vendor documentation, with a source link on each table. The same data is machine-readable through our JSON API and MCP server.
How current is it?
Pages carry dateModified and we re-verify against the docs on every update; when a vendor changes a command surface, the reference changes with it.
Browse the complete reference: AI Prompt Commands & Parameters - 776 entries across 23 platforms.