# Slash Commands

Slash commands are built-in commands for Pythinker Code, used to control sessions, configuration, and debugging. Enter a command starting with `/` in the input box to trigger.

::: tip Shell mode
Many slash commands are also available in shell mode, including `/help`, `/exit`, `/version`, `/agents`, `/editor`, `/theme`, `/changelog`, `/feedback`, `/report-error`, `/export`, `/import`, `/task`, `/settings`, `/statusline`, `/restore`, `/trust`, `/worklog`, `/context`, `/tools`, `/accessibility`, `/keys`, `/tui`, `/thinking`, and `/hooks`.
:::

## Help and info

### `/help`

Display help information. Shows keyboard shortcuts, all available slash commands, and loaded skills in a fullscreen pager. Press `q` to exit.

Aliases: `/h`, `/?`

### `/version`

Display Pythinker Code version number.

### `/changelog`

Display the changelog for recent versions.

Alias: `/release-notes`

### `/feedback`

Submit feedback to help improve Pythinker Code. You will be prompted to enter your feedback and submit it. If the network request fails or times out, the command automatically falls back to opening the GitHub Issues page.

### `/report-error`

Submit a report about an error you hit, with a snapshot of recent failures. The runtime keeps a process-local ring buffer of the last 10 handled errors; this command prints them, lets you add a free-form comment, and submits both to the feedback endpoint. If submission fails, it falls back to opening the GitHub Issues page. See [Telemetry & error reporting](./telemetry.md#report-error-slash-command) for details.

Aliases: `/report`

### `/agents`

List the available subagent types, showing each agent's name, when to use it, its default model, and its tool posture.

## Account and configuration

### `/login`

Log in or configure an API platform. After execution, first select a platform:

- **Pythinker**: Automatically opens a browser for OAuth authorization
- **Other platforms**: Enter an API key, then select an available model

After configuration, settings are automatically saved to `~/.pythinker/config.toml` and reloaded. See [Providers](../configuration/providers.md) for details.

Alias: `/setup`

::: tip
This command is only available when using the default configuration file. If a configuration was specified via `--config` or `--config-file`, this command cannot be used.
:::

### `/logout`

Log out from the current platform. This clears stored credentials and removes related configuration from the config file. After logout, Pythinker Code will automatically reload the configuration.

### `/model`

Switch models and thinking mode.

This command first refreshes the available models list from the API platform. When called without arguments, displays an interactive selection interface where you first select a model, then choose whether to enable thinking mode (if the model supports it).

After selection, Pythinker Code will automatically update the configuration file and reload.

::: tip
This command is only available when using the default configuration file. If a configuration was specified via `--config` or `--config-file`, this command cannot be used.
:::

### `/editor`

Set the external editor. When called without arguments, displays an interactive selection interface; you can also specify the editor command directly, e.g., `/editor vim`. After configuration, pressing `Ctrl-O` will open this editor to edit the current input content. See [Keyboard shortcuts](./keyboard.md#external-editor) for details.

### `/theme`

Switch the terminal color theme. Pythinker Code provides dark and light color palettes, defaulting to dark.

Usage:

- `/theme`: Show the current theme
- `/theme dark`: Switch to dark theme
- `/theme light`: Switch to light theme

After switching, the configuration is saved to `config.toml` and the shell reloads automatically. The light theme adjusts colors for diff highlights, the task browser, the prompt completion menu, the bottom toolbar, and MCP status indicators to work well on light terminal backgrounds. You can also set `theme = "light"` directly in your config file — see [Config files](../configuration/config-files.md).

Alias: `/color`

### `/statusline`

Customize the status line (the footer under the prompt): choose which segments are shown, adjust the footer's visual style, and optionally add an external status command.

Usage:

- `/statusline`: Open the interactive status line settings menu (falls back to the static configuration table while a turn is streaming)
- `/statusline show` (aliases `list`, `view`): Show the current status line configuration table
- `/statusline on` / `/statusline off`: Enable or disable the customizable status line (off renders the stock footer)
- `/statusline segments <id,...>`: Choose the segments to show, e.g. `/statusline segments cwd,git,model`. Run `/statusline segments` with no ids to list every segment id, its zone, and its current state
- `/statusline style fancy` / `/statusline style plain`: Set the footer visual style — `fancy` renders colors, separators, and the context bar; `plain` keeps a monochrome text-only footer
- `/statusline bar-width <4-20>`: Set the width (in cells) of the context progress bar
- `/statusline budget <usd>` / `/statusline budget none`: Set or clear an optional session cost budget in USD; when set, the cost segment renders `$spent/$budget`
- `/statusline command <argv...>`: Set an external command whose first stdout line is shown in the footer (refreshed periodically; run without a shell; killed after `command_timeout_ms`). Setting a command also adds the `command` segment if not already shown
- `/statusline command none`: Clear the external command

Available segment ids: `spinner`, `model`, `cost`, `speed`, `effort`, `cwd`, `git`, `diff`, `flags`, `context`, `tokens`, `elapsed`, `limits`, `clock`, `command`. Settings persist under `[tui.statusline]` in `config.toml`; `PYTHINKER_STATUSLINE=0` disables the status line for a session. The footer style defaults to `fancy`.

### `/settings`

Open the interactive settings panel. Without arguments it opens the panel; the read-only and quick-toggle forms are also available.

Usage:

- `/settings`: Open the interactive settings panel
- `/settings show` (aliases `list`, `view`): Print a read-only settings table (theme, TUI style, default model, telemetry, default thinking, turn recaps, default YOLO/plan mode, config file path)
- `/settings recaps on` / `/settings recaps off`: Toggle per-turn recaps

Alias: `/config`

### `/tui`

Show or set the TUI rendering style.

Usage:

- `/tui`: Show the current TUI style
- `/tui card`: Use the `card` style (highlighted user messages and bordered tool cards)
- `/tui pythinker`: Use the legacy worklog-based rendering

The setting is persisted to `config.toml` (under `[tui]`) and the shell reloads. You can also override at runtime with `PYTHINKER_TUI_STYLE=pythinker`.

### `/thinking`

Switch the thinking effort level via an interactive picker.

### `/keys`

List the keyboard shortcuts from the active semantic keymap. See [Keyboard shortcuts](./keyboard.md) for the full reference.

Alias: `/keybindings`

### `/accessibility`

Show or update accessibility and plain-output preferences. Settings persist with the session state.

Usage:

- `/accessibility`: Show the current preferences
- `/accessibility plain` / `/accessibility rich`: Toggle plain (text-only) output (`on` / `off` are accepted aliases)
- `/accessibility no-animation` / `/accessibility animation`: Disable or enable animations
- `/accessibility ascii` / `/accessibility unicode`: Choose ASCII or Unicode symbols

Alias: `/a11y`

### `/trust`

Show or update the workspace trust safe mode for the current session.

Usage:

- `/trust`: Show the current trust and safe-mode state
- `/trust on`: Trust the workspace and disable safe mode (aliases `yes`, `trust`)
- `/trust off`: Untrust the workspace, enable safe mode, and disable auto-approval (aliases `no`, `untrust`, `safe`)

### `/stats`

Show the usage statistics dashboard (tokens and cost by provider/model), read from `~/.pythinker/sessions/`.

Alias: `/history`

### `/update`

Check for and optionally install the latest Pythinker Code version.

Alias: `/upgrade`

Running `/update` opens a menu: *Check for updates now* (the default, so a bare
`/update` + Enter checks immediately) or *Auto-update on startup*, which shows
the current state and jumps to the toggle.

Use `/update auto on` or `/update auto off` to turn silent startup auto-updates
on or off (persisted to the `auto_update` config field); `/update auto` with no
argument opens an interactive On/Off picker, with the cursor defaulted to the
current setting. When an external override is active — the
`PYTHINKER_CLI_NO_AUTO_UPDATE` kill-switch or a source checkout — it is surfaced
as the reason and outranks the setting, and `/update auto` reports that
read-only state instead of opening the picker. The same toggle is available in
`/settings`, and `pythinker info` reports the auto-update status.

### `/reload`

Reload the configuration file without exiting Pythinker Code.

### `/debug`

Display debug information for the current context, including:
- Number of messages and tokens
- Number of checkpoints
- Complete message history

Debug information is displayed in a pager, press `q` to exit.

### `/usage`

Display API usage and quota information for the current model's provider, showing usage with progress bars and remaining percentages.

Usage:

- `/usage`: Show usage for the active model's provider (falls back to all providers when no model is active)
- `/usage all`: Show usage for every configured provider
- `/usage <provider-key>`: Show usage for a specific provider
- `/usage --json`: Output the report as JSON

Aliases: `/status`, `/cost`

### `/mcp`

Display currently connected MCP servers and loaded tools. See [Model Context Protocol](../customization/mcp.md) for details.

Output includes:
- Server connection status (green indicates connected)
- List of tools provided by each server

### `/hooks`

Display currently configured hooks. See [Hooks](../customization/hooks.md) for details.

Output includes:
- Event types and counts of configured hooks
- Help message (if no hooks are configured)

### `/context`

Show the current context, checkpoint, and compaction status: context tokens, context window size, usage percentage, number of checkpoints, plan-mode state, and the context file path.

### `/tools`

List the tools available to the agent along with the active permission posture (the permission profile name, whether file and shell mutations are allowed, and each tool's description). Append `audit` (`/tools audit`) for a note on how external MCP/wire/plugin tools are gated in read-only, plan, review, and verify profiles.

## Session management

### `/new`

Create a new session and switch to it immediately, without exiting Pythinker Code. If the current session has no content, the empty session directory is automatically cleaned up.

### `/sessions`

List all sessions in the current working directory, allowing switching to other sessions.

Aliases: `/resume`, `/session`

Use arrow keys to select a session, press `Enter` to confirm switch, press `Ctrl-C` to cancel. Press `Ctrl-A` to toggle between showing sessions for the current directory only or across all directories.

### `/title`

View or set the current session title. The configured title is shown in the `/sessions` list, making it easier to identify and find sessions.

Alias: `/rename`

Usage:

- `/title`: Show the current session title
- `/title <text>`: Set the session title (max 200 characters)

After the first conversation turn, the title is automatically derived from the user message; once manually set with this command, auto-generation will no longer overwrite it.

### `/undo`

Roll back to a previous turn and retry. An interactive selector shows all historical turns with the user message (truncated to 80 characters). After selecting a turn, Pythinker Code forks a new session containing all conversation history **before** that turn and pre-fills the selected turn's user message into the input box for re-editing. The original session is always preserved.

Use arrow keys to navigate, `Enter` to confirm, `Ctrl-C` to cancel.

::: tip Use case
When the API returns a truncated or malformed response that breaks the session, use `/undo` to roll back to a turn before the problem and retry without abandoning the entire session.
:::

### `/fork`

Fork a new session from the current one, copying the entire conversation history. The original session remains unchanged, and the new session becomes the active session. Useful when you want to branch out and try a different direction from the current state.

### `/export`

Export the current session context to a Markdown file for archiving or sharing.

Usage:

- `/export`: Export to the current working directory with an auto-generated filename (format: `pythinker-export-<first 8 chars of session ID>-<timestamp>.md`)
- `/export <path>`: Export to the specified path. If the path is a directory, the filename is auto-generated; if it is a file path, the content is written directly to that file

The exported file includes:
- Session metadata (session ID, export time, working directory, message count, token count)
- Conversation overview (topic, number of turns, tool call count)
- Complete conversation history organized by turns, including user messages, AI responses, tool calls, and tool results

### `/import`

Import context from a file or another session into the current session. The imported content is appended as reference context, and the AI can use this information to inform subsequent interactions.

Usage:

- `/import <file_path>`: Import from a file. Supports common text-based formats such as Markdown, plain text, source code, and configuration files; binary files (e.g., images, PDFs, archives) are not supported
- `/import <session_id>`: Import from the specified session ID. Cannot import the current session into itself

### `/clear`

Clear the current session's context and start a new conversation.

Alias: `/reset`

### `/compact`

Manually compact the context to reduce token usage. You can append custom instructions after the command to tell the AI which information to prioritize preserving during compaction, e.g., `/compact preserve database-related discussions`.

When the context is too long, Pythinker Code will automatically trigger compaction. This command allows manually triggering the compaction process.

### `/restore`

List or restore file mutation checkpoints recorded during the session. Each checkpoint captures a file before a tool modified or created it.

Usage:

- `/restore`: List recent restore points (ID, tool, path, and whether the file was modified or created)
- `/restore <id>`: Restore the file captured by the given restore point
- `/restore latest`: Restore the most recent restore point

Alias: `/rewind-files`

### `/worklog`

Show a compact session activity timeline: a count of wire signal types seen this session, the most recent signals, and recent file restore points.

### `/recap`

Recap recent Pythinker sessions.

Usage:

- `/recap`: Recap recent sessions
- `/recap <period>`: Recap a specific period — `today`, `yesterday`, `week`, or a `YYYY-MM-DD` date

### `/memory`

Show the project memory, or manage the approval-gated memory inbox.

Usage:

- `/memory`: Print the current project memory snapshot
- `/memory inbox`: List staged memory inbox candidates (requires `memory.consolidation = true` in your config)
- `/memory inbox scan`: Generate inbox candidates from the session
- `/memory inbox approve <id>`: Approve a staged candidate
- `/memory inbox reject <id>`: Reject a staged candidate

Alias: `/mem`

## Skills

### `/skill:<name>`

Load a specific skill, sending the `SKILL.md` content to the Agent as a prompt. This command works for both standard skills and flow skills.

For example:

- `/skill:code-style`: Load code style guidelines
- `/skill:pptx`: Load PPT creation workflow
- `/skill:git-commits fix user login issue`: Load the skill with an additional task description

You can append additional text after the command, which will be added to the skill prompt. See [Agent Skills](../customization/skills.md) for details.

::: tip
Flow skills can also be invoked via `/skill:<name>`, which loads the content as a standard skill without automatically executing the flow. To execute the flow, use `/flow:<name>` instead.
:::

### `/flow:<name>`

Execute a specific flow skill. Flow skills embed an Agent Flow diagram in `SKILL.md`. After execution, the Agent will start from the `BEGIN` node and process each node according to the flow diagram definition until reaching the `END` node.

For example:

- `/flow:code-review`: Execute code review workflow
- `/flow:release`: Execute release workflow

::: tip
Flow skills can also be invoked via `/skill:<name>`, which loads the content as a standard skill without automatically executing the flow.
:::

See [Agent Skills](../customization/skills.md#flow-skills) for details.

## Workspace

### `/add-dir`

Add an additional directory to the workspace scope. Once added, the directory is accessible to all file tools (`ReadFile`, `WriteFile`, `Glob`, `Grep`, `StrReplaceFile`, etc.) and its directory listing is shown in the system prompt. Added directories are persisted with the session state and automatically restored when resuming.

Usage:

- `/add-dir <path>`: Add the specified directory to the workspace
- `/add-dir`: Without arguments, list already added additional directories

::: tip
Directories already within the working directory do not need to be added, as they are already accessible. You can also add directories at startup via the `--add-dir` option. See [`pythinker` command](./pythinker-command.md#working-directory) for details.
:::

## Others

### `/btw`

Ask a quick side question without interrupting the main conversation. Available both when idle and during streaming.

Usage: `/btw <question>`

The side question runs in an isolated context: it sees the conversation history but does not modify it. Tool calls are disabled — the response is text-only, based on the model's existing knowledge of the conversation.

During streaming, the response appears in a scrollable modal panel overlaying the prompt area. Use `↑`/`↓` to scroll, `Escape` to dismiss.

::: tip
This command is only available in interactive shell mode. Wire and ACP clients can use the `BtwBegin`/`BtwEnd` wire events with the `run_side_question()` API.
:::

### `/init`

Analyze the current project and generate an `AGENTS.md` file.

This command starts a temporary sub-session to analyze the codebase structure and generate a project description document, helping the Agent better understand the project.

### `/plan`

Toggle plan mode. In plan mode, the AI can only use read-only tools to explore the codebase, writing an implementation plan to a plan file and submitting it for your approval. See [Plan mode](../guides/interaction.md#plan-mode) for details.

Usage:

- `/plan`: Toggle plan mode
- `/plan on`: Enable plan mode
- `/plan off`: Disable plan mode
- `/plan view`: View the current plan content
- `/plan clear`: Clear the current plan file

When plan mode is enabled, the prompt changes to `📋` and a blue `plan` badge appears in the status bar.

### `/goal`

Set a thread goal the agent pursues across turns until it is verifiably complete. The objective persists in the session, is re-injected as a continuation reminder on later turns, and survives context compaction. The agent derives concrete success criteria up front, refuses to shrink scope to an easier task, and only marks completion through the `UpdateGoal` tool after an evidence-based completion audit (or `blocked` after a strict blocked audit) — you then confirm with `/goal clear` or reactivate with `/goal resume`.

Usage:

- `/goal <objective>`: Set (or replace) the thread goal and start working toward it
- `/goal` or `/goal view`: Show the current goal and its status
- `/goal pause`: Keep the goal but stop pursuing it
- `/goal resume`: Resume a paused, completed, or blocked goal
- `/goal clear`: Remove the goal (also how you confirm completion)

With `goal.auto_continue = true` in the [config](../configuration/config-files.md#goal), the agent automatically starts follow-up turns toward the active goal after each of your messages (up to `goal.max_continuations`), stopping as soon as the goal is marked complete or blocked.

### `/best-practices`

Inject the full engineering best-practices profile (operating principles, context gathering, scoping and assumptions, design and implementation, code-change discipline, version-control safety, testing strategy, debugging methodology, security and secrets, agent operational discipline, subagent orchestration, todo hygiene, progress updates, verification before done, final-answer style) into the session context. The guidance applies for the rest of the session without consuming a turn.

A condensed subset of this profile is always active in the default system prompt — every agent role inherits it without running the command. `/best-practices` layers the full, expanded rules on top for sessions that need the complete profile.

Usage:

- `/best-practices`: Inject the full guidance
- `/best-practices <section>`: Inject a single section, e.g. `/best-practices testing` or `/best-practices debugging`
- Alias: `/bp`

### `/learn`

Review the session for reusable lessons — user corrections, non-obvious error resolutions, workarounds, conventions discovered the hard way — and persist them to the per-project memory store (and the repo's lessons file when one exists). Lessons are distilled as trigger rules ("when X, do Y"), one pattern per entry; trivia and one-time issues are skipped.

Usage:

- `/learn`: Review the whole session
- `/learn <focus>`: Steer extraction toward a specific mistake or topic, e.g. `/learn the polling mistake`

### `/task`

Open the interactive task browser to view, monitor, and manage background tasks.

Alias: `/tasks`

The task browser is a three-column TUI:

- **Left column**: Task list showing task ID, status, and description
- **Middle column**: Detailed information for the selected task, including ID, status, description, timestamps, exit code, etc.
- **Right column**: Output preview showing the last few lines

Supported keyboard shortcuts:

| Shortcut | Action |
|----------|--------|
| `Enter` / `O` | View the selected task's full output in a pager |
| `S` | Request to stop the selected task (requires confirmation) |
| `Tab` | Toggle filter mode (all / active tasks only) |
| `R` | Refresh the task list |
| `Q` / `Esc` | Exit the browser |

The task browser automatically refreshes every second, showing real-time task status changes.

::: tip
Background tasks are started by the AI using the `Shell` tool with `run_in_background=true`. The system automatically notifies the AI when background tasks complete.
:::

### `/yolo`

Toggle YOLO mode. When enabled, permission approvals are dangerously skipped — all tool calls are automatically approved and a yellow YOLO badge appears in the status bar; enter the command again to disable. YOLO only removes approval friction — the agent can still reach you via `AskUserQuestion`. `/yolo` and `/auto` are independent.

::: warning Note
YOLO mode dangerously skips all permission approvals. Make sure you understand the potential risks.
:::

### `/auto`

Toggle auto mode (no user present). When enabled, auto mode auto-approves all tool calls and additionally auto-dismisses any `AskUserQuestion` the agent sends — so the agent makes its own judgment instead of waiting for a reply that will not come. An orange `auto` badge appears in the status bar independently of the YOLO badge; enter the command again to disable.

::: warning Note
Auto mode skips all approval confirmations and removes the clarifying-question safety net. Only use when you genuinely cannot be at the terminal.
:::

### `/web`

Switch to Web UI. Pythinker Code will start a Web UI server and open the current session in your browser, allowing you to continue the conversation in the Web UI. See [Web UI](./pythinker-web.md) for details.

### `/reports`

Open session reports in the Agent Tracing Visualizer (alias: `/dashboard`). Pythinker Code will start the visualizer server and open the current session's tracing view in the browser, where you can inspect Wire event timelines, context messages, and usage statistics. See [Agent Tracing Visualizer](./pythinker-dashboard.md) for details.

## Command completion

After typing `/` in the input box, a list of available commands is automatically displayed. Continue typing to filter commands with fuzzy matching support, press Enter to select.

For example, typing `/ses` will match `/sessions`, and `/clog` will match `/changelog`. Command aliases are also supported, such as typing `/h` to match `/help`.
