Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Pi Agent Interactive Mode

Pi Agent Interactive Mode

This chapter comprehensively covers core operations in Pi Agent interactive mode, including Slash commands, model management, and keyboard operations.


Complete Slash commands

Typing / in the edit area triggers command auto-completion.

The following are commonly used built-in commands in Pi Agent interactive mode:

Command Function Description
/login Log in to a provider Choose an OAuth subscription or API Key provider for authentication
/logout Log out Clear stored authentication credentials
/model Switching models Open the model selector, search by name; press Ctrl+S in the selector to save as startup default
/thinking Switch reasoning level Open the reasoning level selector; press Ctrl+S in the selector to save as startup default
/scoped-models Model scope management Set the list of models available for Ctrl+P cycling
/settings Settings panel Open the built-in settings interface: reasoning level, theme, messaging, transport protocol, etc.
/resume Resume the session Select and restore from a historical session
/new New session Start a brand-new conversation
/name Name the 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
/trust Trust project Save the project trust decision to avoid asking at 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 Compress the 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 an HTML or JSONL file
/import Import session Import and restore a session from a JSONL file
/share Share session Upload as a private GitHub Gist, generating a shareable HTML link
/reload Hot reload Reload extensions, Skills, prompt templates, themes, context files, and keyboard shortcut configuration
/hotkeys Shortcut help Show the 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:name commands, while prompt templates are via /template-name to call it.


Model management

Model management covers three aspects: switching models, setting the cycling scope, and adjusting reasoning levels.

The corresponding commands and shortcuts are introduced below.

Switching models (/model and Ctrl+L)

Use the /model command or Ctrl+L to open the model selector and browse all available AI models.

In the model selector, you can search by name; after selecting, press Ctrl+S to save as startup default.

The following 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; actual display will differ from the example.

Quick cycling (Ctrl+P)

Ctrl+P cycles models forward, Shift+Ctrl+P cycles backward.

The cycling scope is controlled by the /scoped-models command or the enabledModels setting.

Reasoning levels (Shift+Tab)

Shift+Tab cycles reasoning levels.

The editor border color changes with the level, letting you intuitively sense the current reasoning depth:

Rating Applicable scenarios
off No reasoning (general tasks)
minimal / low Light reasoning (routine coding)
medium Medium 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 startup default.

Reasoning levels unsupported by the model have no effect and will not appear in the cycling list.

The model's capabilities determine the upper limit of reasoning levels.


Shell command integration

You can execute shell commands directly in the edit area without leaving Pi Agent:

Prefix Behavior Output handling Use Cases
! Execute a command, output sent to the AI Visible to the AI Let the AI view test results, lint output, git status
!! Execute a command, output not sent to the 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

The following is the actual effect of executing !npm test; the output is shown locally and given to the AI:



!npm test

> pi-demo@1.0.0 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)

! Command output occupies the AI's context window.

If the output is large (such as a full log), consider using !! or redirect the output to a file and then have the AI read it.


Message queue in depth

The message queue lets you send instructions while the AI is working, greatly improving interaction efficiency:

Message types Keyboard shortcut Trigger Timing Typical scenario
Steering Enter Inserted after all tool calls in the current turn finish and before the next LLM call When the AI is executing a series of read → edit → bash calls and you want to correct direction midway
Follow-up Alt+Enter Inserted only after the AI finishes all work (no more tool calls to execute) Append new requirements after the AI completes the current task
Abort and retrieve Escape Abort the current operation and retrieve queued messages to the edit area Stop immediately when the AI goes off track, and take back queued instructions
Retrieve queued messages only Alt+Up Without aborting the current operation, only retrieve queued messages to the edit area When you want to rewrite queued content but don't need to interrupt the AI

You can control message sending strategy via steeringMode and followUpMode in settings.

Under Windows and WSL, Alt+Enter is often occupied by the terminal (e.g., Windows Terminal binds fullscreen toggle by default); in this case, the actual default for sending follow-up messages is Ctrl+Q.


Editor features

The edit area provides enhanced capabilities such as file references, path completion, and multi-line input, reducing back-and-forth tool switching.

Function Operation
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 newline (Ctrl+Enter in Windows Terminal)
Paste images Ctrl+V (Alt+V on Windows, also Alt+V on WSL), or drag an image into the terminal
Copy AI reply Ctrl+X copies the currently selected message in /tree; otherwise copies the last AI reply
External editor Ctrl+G opens the external editor to edit the current content

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