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