Pi Agent: CLI Reference & Slash Commands
Last updated: 2026-08-31
The CLI is Pi Agent's "cockpit" — know your commands, take control.
1. Global Options
BASH
pi-agent [options] [command]
Options:
--version Show version
--help Show help
--config <path> Specify config file path
--verbose Verbose output
--quiet Quiet mode
--debug Debug mode
2. Core Commands
(1) chat - Interactive Chat
BASH
pi-agent chat [options] [message]
Options:
--provider <name> Specify LLM provider
--model <name> Specify model
--skill <name> Load skill
--system <prompt> System prompt
--session <name> Restore session
--context <file> Load context file
--sandbox Enable sandbox mode
(2) run - Non-Interactive Execution
BASH
pi-agent run [options] <prompt>
Options:
--input <file> Read input from file
--output <file> Output to file
--format <type> Output format (text|json|markdown)
--skill <name> Use skill
--stream Stream output
--timeout <seconds> Timeout
(3) config - Configuration Management
BASH
pi-agent config set <key> <value>
pi-agent config get <key>
pi-agent config list
pi-agent config validate
3. Tool & Skill Commands
(1) skills
BASH
pi-agent skills list
pi-agent skills show <name>
pi-agent skills create <name>
pi-agent skills install <package>
pi-agent skills remove <name>
(2) tools
BASH
pi-agent tools list
pi-agent tools show <name>
pi-agent tools test <name>
(3) ext
BASH
pi-agent ext list
pi-agent ext install <name>
pi-agent ext update <name>
pi-agent ext remove <name>
pi-agent ext create <name>
pi-agent ext publish <name>
4. Session Commands
BASH
pi-agent sessions list
pi-agent sessions show <name>
pi-agent sessions delete <name>
pi-agent sessions export <name>
pi-agent sessions search <query>
5. Package Commands
BASH
pi-agent pkg search <query>
pi-agent pkg install <name>
pi-agent pkg update [name]
pi-agent pkg remove <name>
pi-agent pkg list
pi-agent pkg info <name>
pi-agent pkg build <name>
pi-agent pkg validate <name>
pi-agent pkg publish <name>
6. Slash Commands (Interactive Mode)
| Command | Description | Example |
|---|---|---|
| /help | Show help | /help |
| /exit | Exit | /exit |
| /clear | Clear conversation | /clear |
| /model | Switch model | /model deepseek-reasoner |
| /provider | Switch provider | /provider openai |
| /tools | List tools | /tools |
| /use | Enable tool | /use shell |
| /unuse | Disable tool | /unuse search |
| /skill | Load skill | /skill code_review |
| /save | Save session | /save session.json |
| /load | Load session | /load session.json |
| /context | Show context | /context |
| /history | Show history | /history |
| /retry | Regenerate | /retry |
| /edit | Edit last message | /edit |
| /theme | Switch theme | /theme dark |
| /trust | Set trust | /trust readonly |
| /cost | Cost stats | /cost |
| /branch | Create branch | /branch experiment |
7. Common Combination Examples
Example 1: Code Review Workflow (Difficulty: ⭐)
BASH
pi-agent chat --skill code_review --system "You are a Python expert"
# In interactive mode:
# /use file_reader
# /use search
# Review main.py code quality
# /save review_20260828.json
# /exit
Example 2: Pipe Batch Processing (Difficulty: ⭐⭐)
BASH
find . -name "*.py" -exec echo {} \; | pi-agent run --skill code_review "Review file list"
FAQ
Q Too many commands to remember?
A Type /help in interactive mode for slash commands. Use
pi-agent --help for global commands.Q Command abbreviations?
A Some commands support abbreviations:
pi-agent c = pi-agent chat, pi-agent r = pi-agent run.Q JSON output for scripts?
A Add
--format json: pi-agent run "question" --format json.Summary
- Core CLI: chat, run, config
- Management: skills, tools, ext, sessions, pkg
- 20+ slash commands for interactive mode
- JSON output supported for script integration
Exercises
- Basic (Difficulty: ⭐): Complete: create session → chat 3 rounds → save → reload.
- Intermediate (Difficulty: ⭐⭐): Use
pi-agent runwith pipes to batch-review Python files. - Advanced (Difficulty: ⭐⭐⭐): Write a shell script wrapping common Pi Agent CLI combos for one-click review+fix+test.