Skip to content

Commands ​

code-assist supports slash commands — typed as /command in the prompt. Commands are either local (executed immediately on the client) or prompt (expanded into an API query).

Command Types ​

TypeEnum ValueBehavior
LocallocalRuns client-side logic, returns TextCommandResult, CompactCommandResult, or SkipCommandResult
PromptpromptExpands to API messages via get_prompt_for_command(), then submitted to the model
Local JSXlocal-jsxLike local, but returns rich UI components (TUI widgets)

Command Sources ​

Commands can be loaded from multiple sources, identified by CommandLoadedFrom:

SourceDescription
bundledShips with code-assist core
managedOrganization-managed commands
skillsUser-defined skills (see Skills)
pluginLoaded from installed plugins
mcpProvided by MCP servers
commands_DEPRECATEDLegacy command format

Built-in Commands ​

Session Management ​

CommandTypeDescription
/clearlocalClear the conversation history and start fresh
/compactlocalCompact the conversation to reduce token usage. Returns CompactCommandResult with the summarized context
/resumelocalResume a previous session. Supports entrypoints: cli_flag, slash_command_picker, slash_command_session_id, slash_command_title, fork
/statuslocalShow current session status — model, turns, token usage, cost

Permission & Mode Control ​

CommandTypeDescription
/permissionslocalView and manage permission rules (allow/deny lists)
/allowed-toolslocalList tools currently allowed without confirmation
/planlocalToggle plan mode — the model can only read and analyze, not write
/modellocalSwitch the active model (e.g., claude-sonnet-4-6, claude-opus-4)

Configuration ​

CommandTypeDescription
/configlocalView or modify runtime configuration
/settingslocalOpen the settings file in your editor
/memorylocalView loaded CLAUDE.md files and memory entries
/envlocalShow environment variable overrides

Development Workflow ​

CommandTypeDescription
/reviewpromptReview the current diff or staged changes
/commitpromptGenerate a commit message and create a commit
/prpromptCreate a pull request with generated title and body
/testpromptRun the project's test suite and analyze results
/lintpromptRun linters and fix issues
/simplifypromptReview changed code for reuse, quality, and efficiency

Code Understanding ​

CommandTypeDescription
/explainpromptExplain a file, function, or concept in the codebase
/searchpromptSearch the codebase for a pattern or concept
/diagrampromptGenerate a mermaid diagram of architecture or flow

Agent & Task Management ​

CommandTypeDescription
/agentlocalSpawn a sub-agent with a given prompt
/tasklocalCreate or manage background tasks
/looplocalRun a command on a recurring interval (e.g., /loop 5m /test)
/schedulelocalCreate or manage scheduled remote agents (cron triggers)

Help & Debugging ​

CommandTypeDescription
/helplocalShow available commands and usage
/versionlocalShow the code-assist version
/debuglocalToggle debug mode (verbose API logging)
/costlocalShow cumulative token usage and estimated cost
/doctorlocalRun diagnostics (API connectivity, tool health, etc.)

Command Anatomy ​

Every command is a CommandBase dataclass with these fields:

python
@dataclass
class CommandBase:
    name: str = ""                  # Slash command name (without /)
    description: str = ""           # Short description
    command_type: CommandType        # local, prompt, or local-jsx
    is_hidden: bool = False         # Hidden from /help listing
    aliases: list[str] = []         # Alternative names
    argument_hint: str | None       # Placeholder for arguments
    when_to_use: str | None         # Hint for the model on when to invoke
    immediate: bool = False         # Execute without waiting for Enter
    is_sensitive: bool = False      # Redact from logs
    user_invocable: bool = True     # Can the user type this directly
    availability: list[str] = []    # "claude-ai" and/or "console"

Using Commands ​

Basic usage ​

> /help

With arguments ​

> /commit -m "fix: resolve null pointer in query loop"

Prompt commands with context ​

> /review src/code_assist/core/query.py

TIP

Prompt commands are expanded into API messages before being sent to the model. The model sees the expanded content, not the raw slash command. This means prompt commands can leverage the full tool ecosystem.

Command Result Types ​

Local commands return one of three result types:

TextCommandResult ​

python
TextCommandResult(type="text", value="Current model: claude-sonnet-4-6")

Displayed directly to the user.

CompactCommandResult ​

python
CompactCommandResult(
    type="compact",
    compaction_result={"summary": "...", "token_reduction": 4200},
    display_text="Compacted conversation: saved 4,200 tokens",
)

Replaces the conversation history with a compacted version.

SkipCommandResult ​

python
SkipCommandResult(type="skip")

Command handled silently — no output shown and no message sent to the model.

Command Availability ​

Some commands are restricted by user type:

  • claude-ai — available to OAuth subscribers using the Claude AI service.
  • console — available to users with a Console API key.
  • Commands with an empty availability list are available to everyone.

WARNING

Commands marked disable_non_interactive = True cannot be used in headless/CI mode. Commands marked supports_non_interactive = True explicitly work in that context.

Research and educational use only. Inspired by Claude Code by Anthropic. All original rights reserved by Anthropic.