Pi Agent Interactive Mode
This chapter comprehensively introduces the core operations in Pi Agent interactive mode, including Slash commands, model management, and keyboard operations.
Slash Command Reference
Typing in the editor area/triggers automatic command completion.
The following are common built-in commands in Pi Agent interactive mode:
| Command | Function | Description |
|---|---|---|
| /login | Login provider | Select OAuth subscription or API Key provider for authentication |
| /logout | Logout | Clear stored authentication credentials |
| /model | Switch model | Open the model selector and search by name; press Ctrl+S inside the selector to save as startup default |
| /thinking | Switch reasoning level | Open the reasoning level selector; press Ctrl+S inside the selector to save as startup default |
| /scoped-models | Model scope management | Set the list of models available for Ctrl+P cycle switching |
| /settings | Settings panel | Open the built-in settings interface: reasoning level, theme, message delivery, transport protocol, etc. |
| /resume | Resume session | Select and restore from a historical session |
| /new | New session | Start a brand new conversation |
| /name | Name session | Set a readable name for the current session |
| /session | Session info | Show session file path, ID, message count, token usage, and cost |
| /tree | Session tree navigation | Jump to any node in the conversation tree to continue the conversation |
| /trust | Trust project | Save project trust decisions to avoid being asked every startup |
| /fork | Fork session | Fork a new session file from a previous user message |
| /clone | Clone session | Copy the current active branch to a new session file |
| /compact | Compact context | Manually compact conversation history to free up context window space |
| /copy | Copy reply | Copy the AI's last reply to the clipboard |
| /export | Export session | Export as HTML or JSONL file |
| /import | Import session | Import and restore session from a JSONL file |
| /share | Share session | Upload as a private GitHub Gist, generate a shareable HTML link |
| /reload | Hot reload | Reload extensions, Skills, prompt templates, themes, context files, and keyboard shortcut configurations |
| /hotkeys | Keyboard shortcut help | Show a list of all keyboard shortcuts |
| /changelog | Changelog | Show version update history |
| /quit | Exit | Exit Pi Agent |
Besides built-in commands, Extensions can also register custom commands.
Skills are automatically registered as/skill:namecommand, while prompt templates are invoked via/template-nameto call.
Model Management
Model management covers three aspects: switching models, setting the cycle switching scope, and adjusting reasoning levels.
The corresponding commands and shortcuts are introduced below.
Switch Model (/model and Ctrl+L)
Use/modelthe command orCtrl+Lopen the model selector to browse all available AI models.
In the model selector, you can search by name; after selecting, press Ctrl+S to save as startup default.
Here is a process of opening the model selector and switching models:
/model ┌ 选择模型(输入关键词过滤,↑/↓ 移动,Enter 确认): │ > anthropic/claude-sonnet-4-5 │ anthropic/claude-opus-4-1 │ openai/gpt-4o │ google/gemini-2.5-pro └ 已切换到 anthropic/claude-sonnet-4-5
The models in the list depend on the providers you have configured; the actual display may differ from the example.
Quick Cycle Switching (Ctrl+P)
Ctrl+PCycle forward through models,Shift+Ctrl+Pswitch backward.
The switching range is/scoped-modelscontrolled by the command orenabledModelssettings.
Reasoning Level (Shift+Tab)
Shift+TabCycle through reasoning levels.
The editor border color changes with the level, giving you an intuitive sense of the current reasoning depth:
| Level | Applicable scenario |
|---|---|
| off | No reasoning (general tasks) |
| minimal / low | Light reasoning (routine coding) |
| medium | Moderate reasoning |
| high / xhigh | Deep reasoning (complex problems) |
| max | Maximum reasoning (extremely complex logic) |
Press Ctrl+S in the /thinking selector to save the current level as the startup default.
Reasoning levels not supported by the model will not take effect and will not appear in the switching list.
The model's capabilities determine the upper limit of reasoning levels.
Shell Command Integration
You can run shell commands directly in the editor area without leaving Pi Agent:
| Prefix | Behavior | Output handling | Use case |
|---|---|---|---|
| ! | Execute the command and send the output to the AI | Visible to AI | Let AI view test results, lint output, git status |
| !! | Execute the command, do not send output to AI | Local display only | Open files, view environment, quick checks |
Usage example:
!npm test !git diff --stat !python -m pytest -v !!cat ~/.zshrc !!ls -la
Below, execute!npm testthe actual effect after execution: the output will be displayed locally and also handed to the AI.
!npm test > [email protected] test > vitest run PASS src/utils/format.test.ts (6 tests) 12ms PASS src/utils/parse.test.ts (4 tests) 8ms Test Files 2 passed (2) Tests 10 passed (10)
!The command output consumes the AI's context window.
If the output is large (e.g., full logs), consider using!!or redirect the output to a file and then let the AI read it.
Message Queue Deep Dive
The message queue lets you send instructions while the AI is working, greatly improving interaction efficiency:
| Message type | Shortcut | Trigger timing | Typical scenario |
|---|---|---|---|
| Steering | Enter | Inserted after all tool calls in the current round have finished executing, before the next LLM call | When the AI is executing a sequence of read → edit → bash calls and you want to correct its direction midway |
| Follow-up | Alt+Enter | Inserted only after the AI has completed all work (no more tool calls to execute) | Append new requirements after the AI finishes the current task |
| Abort and retrieve | Escape | Abort the current operation and retrieve the queued messages back to the editor area | Immediately stop when the AI goes off track, and take back the queued instructions |
| Only retrieve queued messages | Alt+Up | Do not abort the current operation, only return queued messages to the editor area | When you want to rewrite queued content but don't need to interrupt the AI |
You can, in the settings,steeringModeandfollowUpModecontrol the message sending strategy.
On Windows and WSL, Alt+Enter is often occupied by the terminal (for example, Windows Terminal binds it to fullscreen toggle by default). In that case, Ctrl+Q is actually the default for sending follow-up messages.
Editor Features
The editor area provides enhanced capabilities such as file references, path completion, and multi-line input, reducing the need to switch tools back and forth.
| Feature | Operation method |
|---|---|
| File reference search | Type @ to trigger fuzzy search of project files |
| Path auto-completion | Press Tab to auto-complete paths |
| Multi-line input | Shift+Enter for new line (use Ctrl+Enter in Windows Terminal) |
| Paste image | Ctrl+V (Windows uses Alt+V, WSL also uses Alt+V), or drag and drop an image into the terminal |
| Copy AI reply | Ctrl+X copies the currently selected message in /tree, and copies the last AI reply in other scenarios |
| External editor | Ctrl+G opens an external editor to edit the current content |
Other extensionsIn multi-line input, "Windows Terminal uses Ctrl+Enter" is an automatic adaptation under Windows Terminal, not the default value in keybindings.json.