> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/QwenLM/qwen-code/llms.txt
> Use this file to discover all available pages before exploring further.

# Session Commands

> Complete reference for all slash commands in Qwen Code

## Overview

Slash commands let you control the session, manage settings, and perform special actions without asking the AI. Commands start with `/` and are executed immediately.

```bash theme={null}
# List all commands
/help

# Execute a command
/clear

# Command with arguments
/memory add Remember that I prefer TypeScript
```

## Session Management

### /clear

Clear conversation history and start a new session.

```bash theme={null}
/clear
```

**Aliases:** `/reset`, `/new`

<Info>
  Clears the conversation history and resets the chat context, but preserves your configuration, settings, and approval mode.
</Info>

### /resume

Resume a previous session from history.

```bash theme={null}
/resume
```

Opens an interactive picker showing recent sessions with:

* Session timestamp
* First user message preview
* Fuzzy search capability

### /quit

Exit the CLI gracefully.

```bash theme={null}
/quit
```

**Alias:** `/exit`

Displays session summary:

* Total duration
* Number of turns
* Token usage statistics

### /compress

Compress context by replacing old messages with a summary.

```bash theme={null}
/compress
```

**Alias:** `/summarize`

Use when:

* Approaching token limits
* Session becomes slow
* Want to free up context for new information

<Warning>
  Compression is lossy - older details may be forgotten. Use `/memory add` to preserve important facts.
</Warning>

## Information & Stats

### /help

Display help information about Qwen Code.

```bash theme={null}
/help
```

**Alias:** `/?`

### /stats

View session statistics.

```bash theme={null}
# Overall session stats
/stats

# Model-specific usage
/stats model

# Tool usage breakdown
/stats tools
```

**Alias:** `/usage`

Displays:

* Session duration
* Total API calls
* Input/output tokens
* Cost estimates (if available)
* Tool execution counts

### /about

Show version and system information.

```bash theme={null}
/about
```

## Configuration

### /settings

Open the settings editor.

```bash theme={null}
/settings
```

Interactive editor for:

* User settings (`~/.qwen/settings.json`)
* Project settings (`.qwen/settings.json`)
* Workspace settings

### /approval-mode

Change the approval mode for tool execution.

```bash theme={null}
# Open mode picker
/approval-mode

# Set directly
/approval-mode yolo
/approval-mode default
/approval-mode auto-edit
/approval-mode plan
```

<Tabs>
  <Tab title="plan">
    **Plan Mode** - Analysis only, no modifications

    AI can:

    * Read files
    * Search code
    * Analyze and reason

    AI cannot:

    * Edit files
    * Run commands
    * Make changes

    Best for: Code review, architecture planning
  </Tab>

  <Tab title="default">
    **Default Mode** - Require approval for changes

    Prompts for confirmation:

    * File edits
    * Shell commands
    * MCP tool calls (first time)

    Auto-approved:

    * File reads
    * Code search
    * Analysis tools

    Best for: Balanced safety and productivity
  </Tab>

  <Tab title="auto-edit">
    **Auto Edit Mode** - Auto-approve file edits

    Auto-approved:

    * File edits
    * File reads
    * Code analysis

    Still prompts for:

    * Shell commands
    * Destructive operations

    Best for: Refactoring, code generation
  </Tab>

  <Tab title="yolo">
    **YOLO Mode** - Auto-approve everything

    Everything is auto-approved:

    * File edits
    * Shell commands
    * MCP tools
    * All operations

    <Warning>
      Use with caution! AI can execute any command.
    </Warning>

    Best for: Trusted environments, automation
  </Tab>
</Tabs>

<Tip>
  Press `Shift+Tab` to cycle through approval modes quickly without using the command.
</Tip>

### /model

Switch the AI model for this session.

```bash theme={null}
/model
```

Opens model picker with:

* Available models from your provider
* Model capabilities and context limits
* Current model highlighted

### /theme

Change the UI theme.

```bash theme={null}
/theme
```

Available themes:

* Light
* Dark
* High Contrast
* Solarized Light
* Solarized Dark
* Custom themes from settings

### /vim

Toggle Vim mode for input editing.

```bash theme={null}
/vim
```

Enables Vim keybindings in the input field:

* Modal editing (normal/insert mode)
* `hjkl` navigation
* Word movements (`w`, `b`, `e`)
* Line operations (`dd`, `yy`, `p`)

## Memory Management

### /memory show

Display current memory contents.

```bash theme={null}
# Show combined memory
/memory show

# Show project-level only
/memory show --project

# Show global only
/memory show --global
```

### /memory add

Add a fact to memory.

```bash theme={null}
# Add to default scope (project)
/memory add User prefers functional programming style

# Add to project memory explicitly
/memory add --project This project uses ESM modules

# Add to global memory
/memory add --global I work at Acme Corp
```

<Info>
  Memory is loaded at session start and injected into the AI's context. Use it to persist preferences, project conventions, and important facts across sessions.
</Info>

### /memory refresh

Reload memory from source files.

```bash theme={null}
/memory refresh
```

Re-reads:

* `.qwen/qwen.md` (project memory)
* `~/.qwen/qwen.md` (global memory)
* Extension-provided context files

## Data Export

### /export

Export session history to a file.

```bash theme={null}
# Export to markdown
/export md

# Export to HTML
/export html

# Export to JSON
/export json

# Export to JSONL (one message per line)
/export jsonl
```

Exported files include:

* All messages (user and assistant)
* Tool calls and results
* Timestamps
* Token usage stats
* Session metadata

### /copy

Copy content to clipboard.

```bash theme={null}
# Copy last assistant message
/copy

# Copy specific message (by index or search)
/copy 3
```

<Note>
  Requires `xclip` (Linux), `pbcopy` (macOS), or `clip.exe` (Windows) to be available.
</Note>

## Subagents

### /agents

Manage specialized subagents.

```bash theme={null}
# View subagent management
/agents manage

# Create new subagent
/agents create
```

Subagents allow:

* Delegating specialized tasks
* Parallel execution
* Domain-specific reasoning
* Isolation of concerns

See [Subagents](/features/subagents) for details.

## Skills

### /skills

List and use available skills.

```bash theme={null}
# List all skills
/skills

# Use a specific skill
/skills code-review
```

Skills are reusable prompt templates with:

* Instructions
* Context
* Tools configuration
* Examples

See [Skills System](/features/skills) for details.

## MCP Integration

### /mcp

Manage Model Context Protocol servers.

```bash theme={null}
/mcp
```

Opens MCP management dialog to:

* View connected servers
* Enable/disable servers
* Configure server settings
* View available tools from each server

See [MCP Support](/features/mcp) for details.

## Extensions

### /extensions

Manage Qwen Code extensions.

```bash theme={null}
/extensions
```

Manage:

* Installed extensions
* Extension settings
* Enable/disable extensions
* Update extensions

## Authentication

### /auth

Manage authentication settings.

```bash theme={null}
/auth
```

Configure:

* API keys
* OAuth tokens
* Provider selection
* Credentials management

## Editor Integration

### /editor

Configure external editor for file edits.

```bash theme={null}
/editor
```

Set preferred editor:

* VS Code
* Vim/Neovim
* Emacs
* Sublime Text
* Custom command

### /ide

Configure IDE integration.

```bash theme={null}
/ide
```

Manage:

* VS Code integration
* JetBrains integration
* LSP connections
* Workspace sync

## Debugging & Development

### /insight

View detailed information about the current session.

```bash theme={null}
/insight
```

Shows:

* Internal state
* Context usage
* Tool registry
* Active configurations

### /bug

Create a bug report.

```bash theme={null}
/bug
```

Generates a report with:

* Session information
* Error logs
* System configuration
* Steps to reproduce

### /docs

Open documentation in browser.

```bash theme={null}
/docs
```

**Note:** Requires a browser and internet connection.

## Advanced Commands

<AccordionGroup>
  <Accordion title="/terminal-setup">
    Configure terminal-specific settings:

    ```bash theme={null}
    /terminal-setup
    ```

    * Kitty keyboard protocol
    * Color support detection
    * Encoding settings
    * Performance tuning
  </Accordion>

  <Accordion title="/language">
    Change the UI language:

    ```bash theme={null}
    /language
    ```

    Supported languages:

    * English (en)
    * Chinese (zh)
    * Japanese (ja)
    * And more via extensions
  </Accordion>

  <Accordion title="/hooks">
    Manage lifecycle hooks:

    ```bash theme={null}
    /hooks
    ```

    Configure hooks for:

    * Pre/post tool execution
    * Session start/end
    * File operations
    * Custom integrations
  </Accordion>

  <Accordion title="/init">
    Initialize project configuration:

    ```bash theme={null}
    /init
    ```

    Creates `.qwen/` directory with:

    * Default settings
    * Memory file template
    * Recommended ignore patterns
  </Accordion>
</AccordionGroup>

## Command Availability

<Tabs>
  <Tab title="Interactive Mode">
    All commands are available in interactive mode.
  </Tab>

  <Tab title="Headless Mode">
    Only these commands work in headless mode:

    * `/compress`
    * `/memory` (all subcommands)
    * `/export` (all formats)
    * `/stats`

    Other commands require interactive UI and will error.
  </Tab>

  <Tab title="ACP Mode">
    Commands available in ACP (editor) integration:

    * `/compress`
    * `/memory` (all subcommands)
    * `/stats`
    * `/approval-mode`

    UI commands are handled by the editor.
  </Tab>
</Tabs>

## Custom Commands

You can add custom slash commands via extensions:

```typescript theme={null}
// my-extension/commands/deploy.ts
export const deployCommand: SlashCommand = {
  name: 'deploy',
  description: 'Deploy to staging environment',
  kind: CommandKind.FILE,
  action: async (context, args) => {
    // Custom logic here
    return {
      type: 'message',
      messageType: 'info',
      content: 'Deploying...'
    };
  }
};
```

See [Extension Development](/developers/extensions) for details.

## Tips & Tricks

<CardGroup cols={2}>
  <Card title="Quick Mode Switching" icon="bolt">
    Use `Shift+Tab` to cycle approval modes without typing `/approval-mode`.
  </Card>

  <Card title="Command History" icon="clock">
    Use ↑/↓ arrows to navigate command history, including slash commands.
  </Card>

  <Card title="Partial Completion" icon="wand">
    Type `/` and press Tab to see command suggestions with fuzzy matching.
  </Card>

  <Card title="Chain Operations" icon="link">
    Some commands can be chained: `/compress` then `/memory add` to optimize context.
  </Card>
</CardGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Interactive Mode" icon="window" href="/features/interactive-mode">
    Learn about the interactive UI
  </Card>

  <Card title="Approval Modes" icon="shield" href="/features/approval-modes">
    Understand permission modes in depth
  </Card>

  <Card title="Memory System" icon="brain" href="/features/skills">
    Master the memory and skills system
  </Card>

  <Card title="Headless Mode" icon="robot" href="/features/headless-mode">
    Automate with non-interactive mode
  </Card>
</CardGroup>
