Install Pi, connect your model, complete your first mission, and master common slash commands and directional controls.

Difficulty: ★ | Estimated time: 30–60 minutes | Prerequisite: Ability to use a terminal

1. What is Pi

Official definition: Pi is a Scalable AI agent that works from the terminal. You give it a target and a working directory, and it can inspect files, run commands, edit content, and complete multi-step tasks.

Its design philosophy (from README):

  • Minimalist kernel + strong extension:"Adapt Pi to your workflows, not the other way around."(Make Pi fit into your workflow, not the other way around.)
  • Features intentionally not built-in: Pi comes with powerful default capabilities, but No built-in sub-agents and plan mode. If necessary, you can ask Pi to write it for you, or install packages made by others. (warehouse examples/extensions/subagent/、plan-mode/ This is an example of using extensions. )
  • Multiple ways to use: Interactive terminal, print/JSON automation, RPC process control, TypeScript SDK embedding. The official example of a real integration project is OpenClaw.
  • Not just for programming: Officially also recommended for research notes, writing, data files, side projects, etc.

1.1 Default built-in tools

  • read

    function
    Read text files and supported images
    Enabled by default
    ✅
  • bash

    function
    Execute shell command
    Enabled by default
    ✅
  • edit

    function
    Exact text replacement for existing files
    Enabled by default
    ✅
  • write

    function
    Create or overwrite files
    Enabled by default
    ✅
  • grep / find / ls

    function
    Search content / find path by glob / list directory
    Enabled by default
    No
  • powershell

    function
    Executing PowerShell on Windows
    Enabled by default
    No
  • codemode / tool_search

    function
    Built-in extensions are provided (see 07 Advanced: MCP, Codemode and package distribution)
    Enabled by default
    No (MCP automatically turns on when needed)
ToolsfunctionEnabled by default
readRead text files and supported images✅
bashExecute shell command✅
editExact text replacement for existing files✅
writeCreate or overwrite files✅
grep / find / lsSearch content / find path by glob / list directoryNo
powershellExecuting PowerShell on WindowsNo
codemode / tool_searchBuilt-in extensions are provided (see 07 Advanced: MCP, Codemode and package distribution)No (MCP automatically turns on when needed)

2. Installation

2.1 Recommendation: Official installation script

macOS / Linux:

curl -fsSL https://pi.dev/install.sh | sh

Windows:

powershell -c "irm https://pi.dev/install.ps1 | iex"

The installation script will Lock all dependencies, then use pi update Upgrade.

2.2 Install with npm

npm install -g --ignore-scripts @earendil-works/pi-coding-agent

Key points:

  • need Node.js 22.19 or newer version。
  • npm way No locking of transitive dependencies; Pi does not require dependent life cycle scripts for normal installation, so it is officially recommended to add --ignore-scripts。

2.3 Installation with Nix

nix profile add github:earendil-works/pi/stable

# For older versions of Nix use nix profile install

# Upgrade: nix profile upgrade pi (pi update cannot upgrade Nix installation)

# Locked version: github:earendil-works/pi/v1.0.0

2.4 Verification

pi --version

2.5 Uninstall

npm uninstall -g @earendil-works/pi-coding-agent   # npm Installation
curl -fsSL https://pi.dev/install.sh | sh            # Installation script: rerun and select Uninstall Pi
nix profile remove pi                                # Nix

Note: the above method will not be deleted ~/.pi/agent/ configuration, credentials, sessions, and installed Pi packages.

3. First startup

cd /path/to/folder
pi

The working directory is important: Pi use it to Discover related files, directives and configurations, also use it to Group saved conversations。

The interface consists of three parts:

  • Conversation area (transcript): Shows your prompts, Pi's replies, tool calls, results and errors;
  • editor: Enter prompts and commands;
  • footer: Current directory, session, model, context usage, cumulative token usage and cost.

The default since 1.0 is full screen mode(Editor and status area are fixed, dialog scrolls within the window). If you want to use terminal native scrolling, use /settings Change it, or add it at startup --tui-mode regular。

Entering a certain area for the first time .pi/ When configuring the directory, Pi may ask Do you trust this project?(Project trust, see 03 Usage tips)。

4. Connection model

  • model: Something that generates a Pi reply.
  • Provider: Pi The service or account used to access the model.

Enter in Pi:

/login

Select a Provider and follow the prompts to log in with your subscription (OAuth) or save your API Key. Available later /model Switch models.

You can also provide the API Key using environment variables (suitable for CI):

export ANTHROPIC_API_KEY=sk-ant-...
pi

Common environment variables (from Providers documentation):ANTHROPIC_API_KEY、OPENAI_API_KEY、GEMINI_API_KEY、DEEPSEEK_API_KEY、OPENROUTER_API_KEY、XAI_API_KEY、MISTRAL_API_KEY、GROQ_API_KEY、MOONSHOT_API_KEY、ZAI_CODING_CN_API_KEY(Zhipu Coding Plan China),MINIMAX_CN_API_KEY Wait. For a complete list see https://pi.dev/docs/latest/providers 。

5. Give Pi a task

Pi will display every file read, search, command and edit it makes, but Your consent will not be asked before each tool call。

Official sample task:

Summarize @meeting-notes.md and save the action items to action-items.md.

Explain how this repository is structured and how to run its checks.

Compare @previous.csv with @current.csv and summarize the important changes.

Tip: Type in the editor @ OK Search files And insert the path without having to type the full path by hand.

Security reminder: Please use version control or backup for important work; for untrusted or unattended tasks, please use containers or other sandboxes.

6. Quick check of common operations

6.1 Input

  • send

    Button
    Enter
  • newline

    Button
    Shift+Enter
  • Writing long prompts with an external editor

    Button
    Ctrl+G
  • Insert file

    Button
    input @ Search;Tab Complete path
  • Insert picture

    Button
    Paste or drag into a compatible terminal
OperationButton
sendEnter
newlineShift+Enter
Writing long prompts with an external editorCtrl+G
Insert fileinput @ Search;Tab Complete path
Insert picturePaste or drag into a compatible terminal

6.2 Observe Pi working

  • Expand/collapse tool output

    Button
    Ctrl+O
  • Show/hide think blocks

    Button
    Ctrl+T
OperationButton
Expand/collapse tool outputCtrl+O
Show/hide think blocksCtrl+T

6.3 Changing direction while working on Pi

  • Adjust current tasks (steering)

    Operation
    After entering the message, press Enter
  • Append work after the current task (follow-up)

    Operation
    After entering the message, press Alt+Enter
  • Get queued messages back to the editor

    Operation
    Alt+Up
  • Stop current task

    Operation
    Escape
you wantOperation
Adjust current tasks (steering)After entering the message, press Enter
Append work after the current task (follow-up)After entering the message, press Alt+Enter
Get queued messages back to the editorAlt+Up
Stop current taskEscape

6.4 Common slash commands

  • /model(or Ctrl+L)

    function
    Select model
  • /thinking(or Shift+Tab loop)

    function
    Set thinking level
  • /login / /logout

    function
    Manage Provider Credentials
  • /settings

    function
    Common preferences
  • /new /resume /name /session

    function
    New/Restore/Name/View Session
  • /tree /fork /clone /compact

    function
    Session trees and context management (see 02 Core concepts)
  • /copy(or Ctrl+X) /export /share

    function
    Copy last reply / Export HTML or JSONL / Upload to share
  • /reload

    function
    Reload keys, extensions, skills, templates, themes, context files
  • /hotkeys

    function
    View current shortcut keys
  • /trust

    function
    Save project trust decision
  • /debug

    function
    Write render lines and session messages pi-debug.log Easy to troubleshoot
commandfunction
/model(or Ctrl+L)Select model
/thinking(or Shift+Tab loop)Set thinking level
/login / /logoutManage Provider Credentials
/settingsCommon preferences
/new /resume /name /sessionNew/Restore/Name/View Session
/tree /fork /clone /compactSession trees and context management (see 02 Core concepts)
/copy(or Ctrl+X) /export /shareCopy last reply / Export HTML or JSONL / Upload to share
/reloadReload keys, extensions, skills, templates, themes, context files
/hotkeysView current shortcut keys
/trustSave project trust decision
/debugWrite render lines and session messages pi-debug.log Easy to troubleshoot

6.5 Running terminal commands in a conversation

!git status
  • !命令: Run and add the output to the dialog (the model can see it);
  • !!命令: run but No Send the output to the model.

7. Continue the previous work

Pi automatically saves the session. In the same directory after exiting:

pi --continue   # or pi -c:Restore the most recent sessions for this directory
pi --resume     # or pi -r:Open session selector

8. Small exercises

  1. Installation and verification: Install Pi and run pi --version, record the version number.
  2. Connection model:Run /login Connect to any Provider and use /model To switch models once, press Ctrl+S Save it as the default model.
  3. first task: Start Pi in a small project directory, enter:Explain how this repository is structured and how to run its checks. Observe what tools it calls.
  4. Directional control: For a longer task, use it during execution Enter Send a steering message (such as "only look at the src directory"), and then use Alt+Enter Add a follow-up to understand the difference between the two.
  5. command prefix:Try separately !ls and !!ls, and then ask Pi "What was the result of ls just now" to verify which output entered the context.
  6. resume session:Use after exiting pi -c To return to the previous conversation, use /session View the session file path, token, and fee.

9. Official sources