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:

CommandFunctionDescription
/loginLogin providerSelect OAuth subscription or API Key provider for authentication
/logoutLogoutClear stored authentication credentials
/modelSwitch modelOpen the model selector and search by name; press Ctrl+S inside the selector to save as startup default
/thinkingSwitch reasoning levelOpen the reasoning level selector; press Ctrl+S inside the selector to save as startup default
/scoped-modelsModel scope managementSet the list of models available for Ctrl+P cycle switching
/settingsSettings panelOpen the built-in settings interface: reasoning level, theme, message delivery, transport protocol, etc.
/resumeResume sessionSelect and restore from a historical session
/newNew sessionStart a brand new conversation
/nameName sessionSet a readable name for the current session
/sessionSession infoShow session file path, ID, message count, token usage, and cost
/treeSession tree navigationJump to any node in the conversation tree to continue the conversation
/trustTrust projectSave project trust decisions to avoid being asked every startup
/forkFork sessionFork a new session file from a previous user message
/cloneClone sessionCopy the current active branch to a new session file
/compactCompact contextManually compact conversation history to free up context window space
/copyCopy replyCopy the AI's last reply to the clipboard
/exportExport sessionExport as HTML or JSONL file
/importImport sessionImport and restore session from a JSONL file
/shareShare sessionUpload as a private GitHub Gist, generate a shareable HTML link
/reloadHot reloadReload extensions, Skills, prompt templates, themes, context files, and keyboard shortcut configurations
/hotkeysKeyboard shortcut helpShow a list of all keyboard shortcuts
/changelogChangelogShow version update history
/quitExitExit 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:

LevelApplicable scenario
offNo reasoning (general tasks)
minimal / lowLight reasoning (routine coding)
mediumModerate reasoning
high / xhighDeep reasoning (complex problems)
maxMaximum 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:

PrefixBehaviorOutput handlingUse case
!Execute the command and send the output to the AIVisible to AILet AI view test results, lint output, git status
!!Execute the command, do not send output to AILocal display onlyOpen 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 typeShortcutTrigger timingTypical scenario
SteeringEnterInserted after all tool calls in the current round have finished executing, before the next LLM callWhen the AI is executing a sequence of read → edit → bash calls and you want to correct its direction midway
Follow-upAlt+EnterInserted 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 retrieveEscapeAbort the current operation and retrieve the queued messages back to the editor areaImmediately stop when the AI goes off track, and take back the queued instructions
Only retrieve queued messagesAlt+UpDo not abort the current operation, only return queued messages to the editor areaWhen 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.

FeatureOperation method
File reference searchType @ to trigger fuzzy search of project files
Path auto-completionPress Tab to auto-complete paths
Multi-line inputShift+Enter for new line (use Ctrl+Enter in Windows Terminal)
Paste imageCtrl+V (Windows uses Alt+V, WSL also uses Alt+V), or drag and drop an image into the terminal
Copy AI replyCtrl+X copies the currently selected message in /tree, and copies the last AI reply in other scenarios
External editorCtrl+G opens an external editor to edit the current content

In multi-line input, "Windows Terminal uses Ctrl+Enter" is an automatic adaptation under Windows Terminal, not the default value in keybindings.json.

Other extensions