Pi Agent Slash Command Handbook
The following is a quick reference table for all built-in slash commands in Pi Agent interactive mode.
Accounts & Authentication
The commands in this section are used to log in to and log out of AI providers. Credentials are stored in ~/.pi/agent/auth.json.
| Command | Function | Example |
|---|---|---|
| /login | Log in to AI provider | On first use, enter /login and select Anthropic from the list to complete subscription login. |
| /logout | Log out and clear credentials | No parameters; run this before switching to another provider or API key authentication to avoid interference from old credentials. |
Model Management
The commands in this section are used to switch models, adjust reasoning levels, and manage the model list available when cycling with Ctrl+P.
| Command | Function | Example |
|---|---|---|
| /model | Open model selector | After opening the selector, type sonnet to filter and press Enter to select. Press Ctrl+S to save it as the startup default. |
| /thinking | Switch reasoning level | No parameters; in the level list, switch from medium to high. Press Ctrl+S to save as startup default. |
| /scoped-models | Manage the model list available for Ctrl+P | No parameters; when you only want to cycle among a few models, use it to select your frequently used models. |
| /llama | Manage llama.cpp local models (see the chapter "Working with llama.cpp Local Models") | No parameters; open the model menu, select an unloaded model and press Enter to load it, or select a loaded model and press Enter to unload it. |
Session Management
The commands in this section are used to create, resume, name, navigate, and compact sessions.
| Command | Function | Example |
|---|---|---|
| /new | Start a new session | No parameters; when the current direction is not working, open a clean session and start over. |
| /resume | Resume a historical session | After restarting the terminal, enter /resume and select the last session from the list to continue. |
| /name <name> | Set the current session name | /name Refactor authentication module, then quickly locate it by name in the /resume list. |
| /session | View session information | Run once before and once after compaction to compare token usage and cost changes. |
| /tree | Open session tree browser | After trying two implementations for the same problem, use it to jump back to a previous node and take another path. |
| /fork | Fork a new session from historical messages | Use this when you want to restart from the 3rd round of questions without affecting the current session. |
| /clone | Clone the current branch to a new session | Before asking the AI to make major code changes, /clone to keep a copy so you can roll back anytime if something goes wrong. |
| /compact | Manually compact the context | Without parameters, it compacts using the default strategy; you can also use `/compact focus on security changes` to specify the summary focus. |
Content Operations
The commands in this section are used to copy, export, import, and share session content.
| Command | Function | Example |
|---|---|---|
| /copy | Copy the AI's last reply | No parameters; use this when you want to paste the solution into an issue or document. |
| /export <file> | Export as HTML or JSONL file | /export ~/Desktop/session.html |
| /import <file> | Import a JSONL session file | /import session.jsonl |
| /share | Upload as a private GitHub Gist and share | No parameters; after running, it generates a shareable HTML link for a private Gist. |
Settings & Management
The commands in this section are used to adjust settings and maintain the running environment.
| Command | Function | Example |
|---|---|---|
| /settings | Open settings panel | No parameters; use it when you want to adjust reasoning level, theme, or transport protocol. |
| /trust | Save project trust decision | Run this after confirming the project source is trustworthy to avoid the trust prompt appearing on every startup. |
| /reload | Hot reload all resources | Run this after modifying extension or Skill code without needing to exit and restart. |
| /hotkeys | Show keyboard shortcuts list | No parameters; view this when you forget which shortcut corresponds to an action. |
| /changelog | Show version changelog | Run this after upgrading to quickly see what changes this update brings. |
| /quit | Exit Pi Agent | No parameters; sessions are auto-saved, so exiting won't lose records. |
Extension Commands
Extensions can register custom commands.
Skills are automatically registered as/skill:namecommands.
Prompt templates are invoked via/template-name.
| Command type | Format | Example |
|---|---|---|
| Extension command | /command-name | /stats |
| Skill command | /skill:skill-name | /skill:brave-search |
| Prompt template | /template-name | /review |
Shell Commands
Start with ! or !! in the input box to directly execute terminal commands without exiting Pi Agent.
| Prefix | Function | Example |
|---|---|---|
| ! | Execute command, send output to AI | !npm test, let the AI continue fixing based on the test failure information. |
| !! | Execute command, do not send output to AI | !!cat ~/.zshrc, just view the content yourself without consuming context. |