CC
Claude Code
v2.1.88
Claude CodeCommands Module

Commands Module

110 files · ~8K lines

101 Slash Commands — from /compact to /stickers. Each command owns its own directory and handler function. Commands are the user's direct control interface, separate from the LLM-controlled tool system.

⌨️

Commands are Human, Tools are Claude

When you type /compact, you're calling a command. When Claude runs BashTool, it's using a tool. Commands bypass the LLM entirely and call services directly — no permission check required.

101 Commands — Color-Coded by Category

Every slash command, grouped by category. Each color is a different functional area.

Context Management
/compact/clear/context/summarize/trim/history+ more
Configuration
/model/temperature/config/fast/slow/api-key/timeout+ more
MCP Servers
/mcp/mcp-restart/mcp-logs/mcp-add/mcp-remove/mcp-inspect+ more
Help & Diagnostics
/help/doctor/status/debug/version/info/env+ more
Cosmetic & Fun
/stickers/color/voice/dream/penguin/theme/fun+ more
Session Control
/exit/quit/reset/new/abort/kill+ more
101 commands total. Each command lives in its own directory under commands/ with its own handler, argument parser, and output renderer. No shared command bootstrap — each is fully self-contained.

Command Categories

101 commands grouped by what they do.

Context Management
/compact/clear/context/summarize

Control what's in the context window. /compact triggers summarization, /clear resets entirely.

Configuration
/model/temperature/config/fast

Change model, tune parameters, adjust session settings mid-conversation.

MCP Servers
/mcp/mcp-restart/mcp-logs/mcp-add

List connected MCP servers, view their tools, restart failed connections, tail logs.

Help & Diagnostics
/help/doctor/status/debug

Dynamic help from registered commands, environment diagnostics, connection status.

Cosmetic & Fun
/stickers/color/voice/dream

Collectible companion stickers, terminal color themes, voice input, /dream for free-form generation.

Session Control
/exit/quit/reset/new

Terminate or reset the current session. /exit with a summary, /quit immediate.

Command Lifecycle — '/' to Execution

The path from user keypress to command handler call.

1
User types '/'
The REPL input handler detects a leading slash. It immediately shows command autocomplete suggestions from the registered command list.
2
QueryEngine intercepts
Before the input reaches the LLM, QueryEngine's input handler checks if it starts with '/'. If yes, it routes to the command subsystem instead.
3
Command lookup
The command name is extracted and matched against registered commands (case-insensitive, prefix completion). /comp matches /compact.
4
Handler execution
The command's handler function runs with the parsed arguments. It can call services directly, mutate session state, or render output to the terminal.
5
Result display
The command's output is rendered in the REPL. Some commands show inline results; others (like /compact) may show a progress indicator and then continue.

Commands vs Tools — Key Distinction

Commands
Triggered byUser types /command
CallerHuman
PipelineDirect service access, no permission check
Example/compact → calls services/compact directly
Tools
Triggered byLLM generates tool_use block
CallerClaude (LLM)
Pipelinevalidate → checkPermissions → invoke → render
ExampleBashTool → 5 security layers → subprocess

Hidden Gems — The Unusual Commands

These commands reveal that Claude Code wants to be charming, not just functional.

/dreamhidden gem

A free-form creative generation command. Sends the prompt directly to Claude without the system prompt constraining it to coding mode. For creative writing, brainstorming, or just chatting.

/stickersfully shipped

Browse and equip collectible companion pets — cats, dogs, crabs, rockets. They appear in the terminal as ASCII art stickers. Fully implemented cosmetic feature in production.

/voicespeech-to-text

Activates voice input mode via the system microphone. Speech-to-text transcribed and sent as a regular message. The REPL shows a recording indicator.

/penguineaster egg

Renders ASCII art of a penguin in the terminal. No other function. Ships in production. Someone on the Claude Code team really likes penguins.

Key Files

commands/compact/~8KB

/compact — triggers context compaction with a user summary

commands/model/~5KB

/model — switch LLM model mid-session

commands/mcp/~10KB

/mcp — manage MCP server connections, list tools, restart servers

commands/stickers/~6KB

/stickers — browse and equip cosmetic sticker companions

commands/doctor/~8KB

/doctor — environment diagnostics, dependency checks, config validation

commands/help/~4KB

/help — dynamic help text generated from registered commands