Built-in Slash Commands

Built-in slash commands are REPL meta-commands (typed /name at the prompt) that control the session itself — context, model, auth, config — instead of sending text to the model.

Why it matters

A slash command is intercepted by the client and never costs a model round-trip the way a prose request does, so /clear or /model is instant and free. They are the control plane of a session: without /compact and /clear your context window silently fills (see managing-context-clear-compact); without /permissions and /model you can’t change how the agent behaves mid-task. Knowing the built-ins is the difference between fighting the REPL and steering it.

How it works

Any line whose first non-space char is / is parsed locally; type / alone to open a fuzzy-searchable menu of every command (built-in + custom). Built-ins are grouped roughly by concern:

CommandEffect
/helplist commands; /status shows version, model, account
/clearwipe conversation context (fresh start)
/compactsummarize history to reclaim window space
/contextvisualize token usage of the window; /cost shows $
/modelswitch model (see choosing-a-model)
/configopen settings TUI (see settings-json-hierarchy)
/initscaffold a CLAUDE.md from the repo
/memoryedit memory files (see claude-md-project-memory)
/permissionsview/edit allow-deny rules (allow-deny-rules)
/agentsmanage subagents (what-are-subagents)
/mcpmanage MCP servers (adding-mcp-servers)
/hooksconfigure lifecycle hooks (hooks-overview-lifecycle)
/add-dirgrant access to another directory
/resumereopen a past session (resuming-continuing-sessions)

Others: /login /logout, /vim, /doctor, /terminal-setup, /bug, /pr-comments, /review. The exact set grows by version — /help is the source of truth.

Example

> /context        # 78k / 200k used — getting full
> /compact        # summarizes thread → drops to ~12k
> /model sonnet   # downshift for cheap bulk edits
> /clear          # done with this task, start clean

Four free, instant actions that would otherwise need a restart or burn tokens.

Pitfalls

  • /clear is irreversible — it discards context with no undo; use /compact if you might still need the history.
  • /compact is lossy. The summary can drop a detail the agent needed; for a hard pivot prefer /clear plus a crisp re-brief.
  • Slash only at line start. A / mid-sentence is literal text, not a command — handy, but easy to misjudge.
  • Built-in vs custom name clash. A custom command can’t shadow a built-in; pick distinct names (see custom-slash-commands).

See also