AI Agent Slash Commands: A Cross-Tool Guide (2026)
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, :name: to insert an emoji by shortcode, and ? on an empty prompt to toggle the shortcut help panel. 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 | /compress |
| Branch / explore | /branch | /fork | - | - | /branch (alias /fork) |
| Undo last step | /rewind | /rewind | /undo | - | /undo |
| Show changes | /diff | - | /diff | - | /diff |
| Cost / usage | /cost /usage | - | /tokens | openclaw status --usage | /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 (over a hundred built-in commands) 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 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 and Aider 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 reads like a superset of the genre - session branching with /branch, and /worktree for isolated git worktrees - while Cursor and Copilot 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 500k → /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. Both tools call it /branch. In Hermes /fork is an alias; in Claude Code /fork copies the conversation into a separate background session instead.
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. More tokens - config fields, transports, OAuth flags, output-limit env vars - in our MCP reference.
AGENTS.md vs CLAUDE.md vs Cursor rules: 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. From v2.1.277 Claude Code also reads AGENTS.md when the repository has no CLAUDE.md |
.cursor/rules/*.mdc | Cursor | Project rules; each rule is an .mdc file and is version-controlled |
.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; in Vidu and PixVerse the model value gates which other parameters are even legal - a 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 names differ - Hermes Agent's /compress is Claude Code's /compact. 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 page. The same data is machine-readable through our JSON API and MCP server.
How current is it?
Pages carry dateModified and link their vendor source. Command sets change quickly, so the in-product command menu is authoritative for your installed version.
Browse the reference: AI Prompt Commands & Parameters.