CLI and options
Launch Pi interactively, print one response, stream JSON events, or run the JSONL RPC protocol.
A practical map of Pi's deliberately small core and programmable command surface: CLI modes and flags, 23 built-in slash commands, Session Tree branching, Pi Packages, Extensions, Skills, prompt templates, special shell input, and JSONL RPC.
$ pi --model sonnet:high
session: tree-native JSONL
tools: read bash edit write
extensions: programmable
/tree
├─ approach A
│ └─ active branch
└─ approach B
▌
Core, bundled, and dynamic capabilities are labeled separately.
The essential mental model
The built-in CLI and slash registry are intentionally small. The installed surface grows through Extensions, Skills, prompt templates, Packages, and programmatic clients.
Launch Pi interactively, print one response, stream JSON events, or run the JSONL RPC protocol.
Twenty-three built-in commands cover models, sessions, sharing, trust, reloads, and configuration.
Use @ for files, ! for shell output the model can see, and !! for local-only shell output.
Prompt templates, Skills, and Extensions expand the command surface at runtime.
Install bundles of Extensions, Skills, prompts, and themes from npm, git, or a local path.
Control prompts, queues, models, thinking, bash, compaction, and session trees over stdin/stdout.
The current package is @earendil-works/pi-coding-agent. The former @mariozechner/pi-coding-agent package is deprecated at 0.73.1 and points users to Earendil Works.
Complete overview
The tree separates fixed CLI commands, runtime modes, core slash commands, bundled llama.cpp support, dynamic resources, and special input.
pi [options] [--] [@files...] [messages...]
CLI commands
├── install <source>
├── remove <source>
├── uninstall <source> # alias: remove
├── update [source|self|pi]
├── list
├── config
└── auth
├── check
├── print-api-key
└── print-bearer-token
Runtime modes
├── interactive # default TUI
├── text # pi -p / --mode text
├── json # event stream
└── rpc # stdin/stdout JSONL
Core slash commands
├── /settings /model /thinking
├── /scoped-models /login /logout
├── /new /resume /name
├── /session /tree /fork
├── /clone /compact /copy
├── /export /import /share
├── /trust /reload /hotkeys
├── /changelog /quit
└── /llama # bundled extension
Dynamic command surface
├── /<prompt-template>
├── /skill:<skill-name>
├── /<extension-command>
└── --<extension-flag>
Special input
├── @file # attach file or image
├── !command # execute + add output to context
└── !!command # execute without LLM contextQuick start
These cover interactive work, one-shot automation, continuation, read-only review, tree navigation, and process integration.
Open the TUI
piStart an interactive Pi session in the current project.
One-shot task
pi -p "Fix the TypeScript errors"Process a prompt non-interactively, print the result, and exit.
Continue recent work
pi -c "Continue the implementation"Resume the most recent project session with a new message.
Read-only review
pi --tools read,grep,find,ls -p "Review this repository"Limit Pi to the built-in read-only tools for a safer review pass.
Explore a branch
/treeJump to an earlier session node and continue on a new branch.
Embed as a process
pi --mode rpcControl Pi over line-delimited JSON through stdin and stdout.
piFull terminal UI with slash commands, selectors, and session navigation.
pi -p "..."Run one task, print the assistant response, and exit for shell automation.
pi --mode json "..."Emit the agent event stream as JSON lines for pipelines and log processors.
pi --mode rpcKeep Pi alive as a controlled subprocess using stdin/stdout JSONL commands.
CLI options
All rows here are registered by the core parser. Extensions may append additional long flags to the local help output.
Select a provider and model, tune reasoning, or restrict Ctrl+P model cycling.
--provider <name>Select an LLM provider.
--model <pattern>Values: provider/model · fuzzy pattern · optional :thinking suffix
Select a model by ID or fuzzy pattern. A value such as sonnet:high also sets thinking.
--api-key <key>Provide a credential for this run instead of saved auth or environment variables.
--thinking <level>Values: off · minimal · low · medium · high · xhigh · max
Set the requested reasoning level when the selected model supports it.
--models <patterns>Set a comma-separated, glob-aware model list for Ctrl+P cycling.
--list-models [search]List available models, optionally using a fuzzy search term.
Replace or extend the system prompt and control project instruction discovery.
--system-prompt <text>Replace Pi's default coding-assistant prompt.
--append-system-prompt <text>Append text or file contents to the system prompt; repeat as needed.
--no-context-filesAliases: -nc
Disable discovery of AGENTS.md and CLAUDE.md context files.
Continue, select, fork, name, relocate, or avoid persisting a session.
--continueAliases: -c
Continue the most recent project session.
--resumeAliases: -r
Open the session picker at startup.
--session <path|id>Use a session file path or partial session UUID.
--session-id <id>Use an exact current-project session ID, creating it when missing.
--fork <path|id>Fork the selected session into a new session file before starting.
--session-dir <dir>Override the directory used for session storage and lookup.
--no-sessionUse an ephemeral session that is not saved to disk.
--name <name>Aliases: -n
Set a human-readable session name at startup.
Apply allowlists and denylists across built-in, custom, and Extension tools.
--tools <list>Aliases: -t
Enable only the comma-separated tool names.
--exclude-tools <list>Aliases: -xt
Disable the comma-separated tool names.
--no-toolsAliases: -nt
Disable all built-in, custom, and Extension tools.
--no-builtin-toolsAliases: -nbt
Disable built-ins while leaving Extension and custom tools available.
Load individual resources or disable automatic discovery for a controlled run.
--extension <path>Aliases: -e
Load an Extension file explicitly; repeat for multiple files.
--no-extensionsAliases: -ne
Disable discovery while still allowing explicit -e paths.
--skill <path>Load a Skill file or directory explicitly; repeat as needed.
--no-skillsAliases: -ns
Disable Skill discovery and loading.
--prompt-template <path>Load a prompt-template file or directory.
--no-prompt-templatesAliases: -np
Disable prompt-template discovery.
--theme <path>Load an additional theme file or directory.
--use-theme <name[/name]>Set the initial theme for this run without changing settings.
--no-themesDisable theme discovery and loading.
Choose output, TUI layout, trust, startup networking, and parsing behavior.
--printAliases: -p
Run non-interactively, print the response, and exit.
--mode <mode>Values: text · json · rpc
Select text, JSON event, or RPC output.
--tui-mode <mode>Values: regular · fullscreen
Use the regular or fullscreen TUI.
--export <file>Export a session file to HTML and exit.
--approveAliases: -a
Trust project-local resources for this run.
--no-approveAliases: -na
Ignore project-local resources for this run.
--offlineDisable startup network operations; equivalent to PI_OFFLINE=1.
--verboseForce verbose startup output.
--Stop option parsing; treat later values as messages or @file inputs.
--help / --versionAliases: -h / -v
Show local help or the installed version.
read, bash, edit, and write are the primary tools. grep, find, and ls are optional read-only built-ins. PowerShell is available on Windows.
readbashpowershelleditwritegrepfindlsPackages, updates, and credentials
Pi install manages Pi Packages, not the binary. Likewise, pi uninstall is only an alias for removing a Package.
Manage bundles from npm, git, HTTPS, SSH, or a local directory.
pi install <source>Values: npm: · git: · https:// · ssh:// · local path
Install a Pi Package and add it to user settings.
pi install -l <source>Install for the current project and update .pi/settings.json.
pi remove <source>Remove a configured Pi Package.
pi uninstall <source>Alias for pi remove; it does not uninstall the Pi CLI.
pi listList Packages in user and trusted project settings.
pi config [-l]Open the TUI for enabling or disabling package resources.
Update the CLI, installed Packages, or model catalogs independently.
pi updateAliases: pi update --self · pi update pi · pi update self
Update Pi itself; self-update is the default target.
pi update --extensionsUpdate installed Pi Packages without updating Pi.
pi update --modelsRefresh model catalogs only.
pi update --allUpdate both Pi and installed Packages.
pi update <source>Aliases: pi update --extension <source>
Update one Package source.
pi update --self --forceReinstall Pi even when the installed version is current.
Check provider readiness or expose a credential to another local tool.
pi auth checkValues: --provider · --model · --json · --credentials · --no-refresh
Check credentials and refresh expired OAuth credentials unless disabled.
pi auth print-api-keyValues: --provider · --model
Print a configured API key for another local client.
pi auth print-bearer-tokenValues: --provider · --model · --min-expiry 30m|1h
Print a valid OAuth token, refreshing it when needed.
Pi Packages can run Extensions with full system access, and Skills can instruct the model to use tools. Review third-party source before installation and only trust project-local resources intentionally.
Interactive TUI
The core registry contains exactly 23 commands. /llama comes from Pi's official bundled llama.cpp Extension; installed resources can add more.
Choose models, thinking, credentials, and the model-cycle scope.
/settingsOpen the interactive settings menu.
/model [provider/model]Open the selector or switch directly to a model.
/thinking [level]Open the selector or set a supported thinking level.
/scoped-modelsConfigure models included in Ctrl+P cycling and their order.
/login [provider]Configure provider-specific authentication.
/logoutRemove saved provider authentication.
Create, resume, identify, branch, duplicate, and compact JSONL trees.
/newStart a fresh session.
/resumeBrowse and resume a previous project session.
/name <name>Set a human-readable session name.
/sessionShow the file, ID, message count, tokens, and cost.
/treeNavigate the current session and continue on an in-file branch.
/forkCreate a new session file from an earlier user message.
/cloneCopy the active branch into a new session file.
/compact [instructions]Summarize older context, optionally with custom focus.
Move session data, copy the latest response, or share a transcript.
/copyCopy the last agent message.
/export [file]Values: .html · .jsonl
Export HTML by default or specify .jsonl.
/import <file>Import and resume a JSONL session.
/shareShare the session as a secret GitHub gist with a viewer link.
Trust, reload, inspect changes and keybindings, or exit.
/trustSave trust for future sessions; restart to load newly trusted resources.
/reloadReload keybindings, Extensions, Skills, prompts, themes, and context.
/hotkeysShow active keyboard shortcuts.
/changelogDisplay Pi's changelog.
/quitExit Pi.
/llamaManage llama.cpp router model discovery, downloads, loading, and unloading.
@src/auth.tsType @ to fuzzy-search files, or pass @file and @image arguments on the CLI.
!git diffExecute the command and include its output in the current LLM context.
!!git statusExecute the command without adding its output to the LLM context.
Pi's signature workflow
Every JSONL entry has an ID and parent. Revisit an earlier node without deleting the original path, keep alternatives together, or split a path into a new session.
root user prompt
└── assistant response
├── user: approach A
│ └── assistant
│ └── user: continue A ← active
└── user: approach B
└── assistant/treeMove within the same file and create an in-file branch.
/forkPick an earlier user prompt and create a new session file.
/cloneCopy the active branch into a new session file.
While Pi is running, submit with Enter to steer after current tool calls. Use Alt+Enter to queue a follow-up until the active work finishes.
No fixed command count
Markdown prompts, Agent Skills, TypeScript Extensions, and shareable Packages make two Pi installations expose different slash commands and CLI flags.
A Markdown file in a prompts directory becomes a slash command named after the file.
~/.pi/agent/prompts/review.md
→ /review securityAgent Skills can load automatically or be invoked through the skill namespace.
.pi/skills/web-search/SKILL.md
→ /skill:web-searchTypeScript Extensions register slash commands, tools, UI, events, providers, and long CLI flags.
pi.registerCommand("deploy", ...)
→ /deployPackages distribute Extensions, Skills, prompts, and themes through npm, git, or local paths.
pi install npm:@scope/pi-tools/plan, /todos, /tools, /preset, /ask, /steer, and /followup appear in examples or third-party Extensions. They are valid when installed, but not part of the fixed 23-command registry.
Process integration
Send one JSON object per LF-delimited line on stdin. Pi replies and streams events on stdout for IDEs, custom UIs, and orchestrators.
promptsteerfollow_upabortclear_queuenew_sessionget_stateget_messagesset_modelcycle_modelget_available_modelsset_thinking_levelcycle_thinking_levelget_available_thinking_levelsset_steering_modeset_follow_up_modecompactset_auto_compactionset_auto_retryabort_retrybashabort_bashget_session_statsexport_htmlswitch_sessionforkcloneget_fork_messagesget_entriesget_treeget_last_assistant_textset_session_nameget_commands# Start Pi as a JSONL RPC subprocess
pi --mode rpc
# Write one JSON object per line to stdin
{"id":"state-1","type":"get_state"}
{"type":"set_model","provider":"openai","modelId":"gpt-5.5"}
{"type":"set_thinking_level","level":"high"}
{"type":"prompt","message":"Review this repository"}
{"type":"bash","command":"git status"}
{"type":"get_tree"}get_commands returns Extension commands, prompt templates, and Skills. It intentionally omits TUI-only built-ins such as /settings and /hotkeys.
Keyboard reference
Bindings are customizable in ~/.pi/agent/keybindings.json. /hotkeys is the best source of truth after local changes.
Ctrl+CClear the editor; press again to exit
Ctrl+DExit when the editor is empty
EscCancel or abort the current operation
Ctrl+GOpen the prompt in an external editor
Ctrl+LOpen the model selector
Ctrl+PCycle to the next scoped model
Shift+Ctrl+PCycle to the previous scoped model
Shift+TabCycle the thinking level
Ctrl+OCollapse or expand tool output
Ctrl+TCollapse or expand thinking blocks
Ctrl+XCopy the last assistant message
Alt+EnterQueue a follow-up message
Alt+UpRestore queued messages to the editor
Shift+EnterInsert a new line
Windows and WSL use alternatives for some model, queue, image-paste, and fullscreen-search shortcuts. Check /hotkeys on the target machine.
Choosing the mental model
Pi keeps workflow choices programmable. OpenCode ships more platform capabilities directly in its CLI and TUI.
Allow only Pi's optional read-only built-ins and print one result.
pi --tools read,grep,find,ls \
-p "Review this repository for security and correctness issues"Stream structured events for a pipeline or log consumer.
pi --mode json \
--model openai/gpt-5.5 \
--thinking high \
"Fix the failing tests"Resume the latest session and add a constraint without opening a picker.
pi -c "Continue, but do not change the database schema"Disable discovery and load exactly one audited Extension and Skill.
pi --no-extensions -e ./review.ts \
--no-skills --skill ./skills/security \
"Review this project"Sources and version notes
This reference was checked against v0.84.3 and the Earendil Works main branch on August 26, 2026.
Versions move quickly and project resources vary. Use local help and autocomplete as the final authority for a specific machine.
pi --helppi --versionpi listpi auth --help//hotkeys/changelog