# Pax reference
Pax is a separately installable terminal client for Pydantic AI. This page covers
everything it does, in detail. For an overview with screenshots, start with the
[README](../README.md). For writing plugins, see [PLUGINS.md](../PLUGINS.md).
- [Quick reference](#quick-reference): [commands](#commands), [command-line options](#command-line-options), [settings](#settings), [environment variables](#environment-variables-at-a-glance), [files](#files)
- [Getting started](#getting-started): [Start chatting](#start-chatting), [File access and safety](#file-access-and-safety), [Startup](#startup), [Updating](#updating), [Environment variables](#environment-variables), [Settings and commands](#settings-and-commands), [Project settings](#project-settings)
- [Models and accounts](#models-and-accounts): [Models and their settings](#models-and-their-settings), [Codex authentication](#codex-authentication), [GitHub Copilot subscriptions](#github-copilot-subscriptions), [vllm connection](#vllm-connection), [openrouter connection](#openrouter-connection), [Saved API keys](#saved-api-keys), [Usage and cost](#usage-and-cost)
- [The prompt](#the-prompt): [Prompt area](#prompt-area), [Pasting images](#pasting-images), [Input history](#input-history), [Word deletion](#word-deletion), [Undo and redo](#undo-and-redo), [Option keys on macOS](#option-keys-on-macos), [Interrupting a turn](#interrupting-a-turn), [Rewinding a conversation](#rewinding-a-conversation), [Shell commands with !](#shell-commands-with-)
- [Output](#output): [How tool calls look](#how-tool-calls-look), [Streaming](#streaming), [Code highlighting](#code-highlighting), [Grep previews](#grep-previews), [Shell preview limit](#shell-preview-limit), [Tool details](#tool-details), [Status line](#status-line), [Themes](#themes), [Spinners](#spinners)
- [The agent](#the-agent): [Your instructions: /system_prompt](#your-instructions-system_prompt), [Code mode and speculative execution](#code-mode-and-speculative-execution), [Questions from the model](#questions-from-the-model), [Compacting the conversation](#compacting-the-conversation), [Task delegation](#task-delegation), [Ask Pax about itself](#ask-pax-about-itself)
- [Sessions](#sessions): [Saved sessions and /resume](#saved-sessions-and-resume), [Background forks: /fork](#background-forks-fork), [Git worktrees](#git-worktrees), [Several sessions in the web UI](#several-sessions-in-the-web-ui)
- [Plugins and integrations](#plugins-and-integrations): [Plugins](#plugins), [Built-in plugins at a glance](#built-in-plugins-at-a-glance), [MCP servers: /mcp](#mcp-servers-mcp), [Desktop notifications](#desktop-notifications), [Herdr integration](#herdr-integration), [Agent of Empires integration](#agent-of-empires-integration), [Telemetry and references](#telemetry-and-references)
- [Using Pax from code](#using-pax-from-code): [Your own agent](#your-own-agent), [Headless mode](#headless-mode), [The stock agent in your own code](#the-stock-agent-in-your-own-code), [Bring an agent](#bring-an-agent)
- [Working on Pax](#working-on-pax): [Source layout](#source-layout), [Reload Pax during development](#reload-pax-during-development), [CI coverage](#ci-coverage)
## Quick reference
### Commands
| Command | What it does |
|---|---|
| `/help` | List every command, including those plugins add |
| `/model [NAME]` | Pick a saved model or fallback chain, or select `NAME`, adding it first if needed |
| `/model add [NAME]` | Browse providers and their models |
| `/model settings [NAME]` | Edit a saved model's request and thinking settings |
| `/model chains` | Open the `/model` picker on its fallback chains (alias `/chain`) |
| `/effort [VALUE\|reset]` | View or set the active model's reasoning effort |
| `/fast [on\|off\|ultrafast]` | Codex speed (ultrafast by default where offered), shown only for `openai-codex:` models |
| `/login [NAME[@PROFILE]]` | Sign in: `openai-codex`, `github-copilot`, or one a plugin adds; `@PROFILE` adds another account |
| `/accounts` | Add, rename, reorder, and sign out of accounts |
| `/keys` | Manage saved API keys |
| `/input [test\|reset]` | Keyboard setup, safe key testing, send/steer/newline bindings and question routing |
| `/permissions [full\|auto\|read-only]` | Show or set what runs without asking |
| `/project [approve NAME...\|all \| revoke NAME...\|all]` | Review what `.clai/settings.json` sets, and approve or revoke its keys for this repository |
| `/trust [yes\|no]` | Show whether you trust this session's folder, or trust it or not; see [Folder trust](#folder-trust) |
| `/set [KEY [VALUE]]` | Change a setting; no arguments opens the menu (alias `/settings`) |
| `/config show\|get\|set\|reset` | Read or write saved settings; writes apply on restart |
| `/system_prompt` | View the system prompt and edit your own instructions |
| `/theme [NAME]` | Pick a colour palette |
| `/spinner [NAME [SECONDS]]` | Pick the working animation; `/spinner init` writes a starter `spinners.json` |
| `/plugins [...]` | Manage plugins; no arguments opens the menu |
| `/mcp [...]` | Manage MCP servers (from the built-in `mcp` plugin) |
| `/compact [FOCUS]` | Summarise older messages now (from the built-in `compaction` plugin) |
| `/auto-compact [TOKENS\|PERCENT\|reset]` | Choose when compaction runs automatically in the compaction settings, or set it directly, such as `70%` or `150k` (from the built-in `compaction` plugin) |
| `/refine [FOCUS]` | Have the model review and revise its last answer (from the built-in `refinement` plugin) |
| `/usage` | Tokens and cost per turn |
| `/cost` | The retained history's total cost and tokens |
| `/resume [ID\|claude\|codex]` | Browse or restore a saved session, or import one from Claude Code or Codex |
| `/clear` | Start a new session on a clear screen (alias `/new`) |
| `/fork [@MODEL] PROMPT` | Run a copy of the conversation in the background; `/fork cancel N` stops one |
| `/forks` | Show this session's background forks |
| `/tasks` | Inspect and control delegated tasks |
| `/commit [MESSAGE]` | Commit every change in the session's directory; the model drafts the message when none is given |
| `/sandbox [local smol\|local boxlite\|e2b\|boxd\|daytona\|opensandbox\|modal\|render\|sprites\|kubernetes\|delete]` | Start a new conversation in a sandbox: `local smol` (SmolVM) and `local boxlite` (BoxLite) run a VM on this machine, the others are cloud sandboxes; `/sandbox local` asks which engine, and no argument says where this one runs. See [Sandboxes](#sandboxes-sandbox) |
| `/computer-use [on\|off]` | Let the model see and control the sandbox's desktop. See [Computer use](#computer-use-computer-use) |
| `/push [confirm]` | `git push -u origin BRANCH`; `confirm` is needed on the default branch |
| `/pr [confirm\|TITLE]` | Show a pull request the model drafts; `confirm`, or a `TITLE` of your own, pushes the branch and opens it with `gh` |
| `/update [now]` | Show whether a newer Pax is out on `updates.channel`, with **Update…** to install it; `/update now` installs at once and restarts |
| `/reload` | Reload Pax's own code without restarting |
| `/exit` | Quit |
| `/SKILL-NAME [ARGS]` | Send an Agent Skill as your next prompt |
| `!COMMAND` | Run a shell command, in the sandbox in a `/sandbox` conversation; the command and output are saved for the next prompt |
| `!!COMMAND` | Give an interactive program the whole terminal, on this machine only; only its exit status is saved |
Plugins add their own commands, such as `/notion login` or `/google_workspace`. `/help` lists them.
### Command-line options
| Option | What it does |
|---|---|
| `-m`, `--model MODEL` | Use this model for this run, without saving it |
| `pax PROMPT`, `-p`, `--prompt [TEXT]` | Run one prompt without interaction and print only the answer; see [Headless mode](#headless-mode) |
| `--output-format text\|json` | With a prompt, how the answer is printed; see [Headless mode](#headless-mode) |
| `-a`, `--agent MODULE:ATTR` | Chat with your own Pydantic AI agent; see [Your own agent](#your-own-agent) |
| `-x`, `--plugin NAME` | Load this plugin for this launch only, even if disabled, without saving it; repeatable; see [Plugins for one launch](#plugins-for-one-launch) |
| `--resume [SESSION-ID]` | Restore a saved session; no ID opens the browser |
| `-c`, `--continue` | Restore the most recent saved session in this directory; see [Saved sessions](#saved-sessions-and-resume) |
| `--resume-claude [SESSION-ID]`, `--resume-codex [SESSION-ID]` | Import and restore a Claude Code or Codex session |
| `--session-id UUID` | Save a new session under this ID |
| `--fork-session` | With `--resume` or `--continue`, continue in a copy of the session |
| `-w`, `--worktree [NAME]` | Start in a Git worktree; see [Git worktrees](#git-worktrees) |
| `--update`, `pax update` | Install the newest Pax from `updates.channel`, print how it went, and exit; see [Updating](#updating) |
| `--request-limit N` | The full prompt's model-request budget |
| `--login [NAME[@PROFILE]]` | Sign in as `/login NAME[@PROFILE]` does, or pick a sign-in, then exit; status 0 once signed in. `pax acp --login` does the same; see [Serving it over ACP](#serving-it-over-acp) |
| `--version` | Print the installed Pax version, plus the commit for a `main` install, and exit |
| `--database PATH` | Use another settings database (and session folder) |
| `pax config show\|get\|set\|reset` | Read or write saved settings from your shell. A change that could let the agent do more, such as a wider `run.permissions`, is refused: make it with `/config` in a session, since the agent can run `pax` too |
| `pax plugins list` | List saved plugin declarations from your shell; add, enable, disable, and remove them with `/plugins` in a session |
| `pax sessions` | On Unix, list live sessions by unique ID prefix, folder name, status, title, and workspace |
| `pax acp` | Serve Pax's coding agent to an editor or another Agent Client Protocol client on stdin and stdout; takes `-m`, `--request-limit`, and `--database`; see [Serving it over ACP](#serving-it-over-acp) |
### Settings
Change these with `/set KEY VALUE`, or open `/set` to browse them. See
[Settings and commands](#settings-and-commands) for how they are stored and applied.
| Setting | Default | What it does |
|---|---|---|
| `model` | `openai-codex:gpt-6-astra` | Provider-qualified model for every turn. Overrides the model baked into the agent. |
| `run.request_limit` | `10000` | Most model requests one prompt may make before the turn stops. |
| `input.bindings` | `{"send":"enter","steer":"alt-enter","newline":"shift-enter"}` | User-only decoded composer keys; `/input` edits each action. Ctrl+J inserts a newline, except on Windows, where it steers. |
| `input.keyboard_labels` | `neutral` | User-only keyboard labels: `neutral`, `mac`, or `pc`. Labels do not detect terminal transport. |
| `input.question_submit` | `ask` | User-only interaction preference: `ask`, `answer`, or `follow-up`. Never grants tool approval. |
| `input.questions` | `picker` | User-only: where questions and tool approvals wait. `picker` takes the keys as each one arrives; opt-in `composer` keeps your draft and keys, and F2 reviews them. |
| `input.busy_delivery` | `after-turn` | User-only busy composer delivery: `after-turn` or opt-in `next-checkpoint`. F4 inspects/changes it. |
| `display.thinking` | `true` | Show the model's thinking as it streams. |
| `display.task_models` | `true` | Name the model each subagent runs on in its start row, which waits for the child to report it. Off, the row prints at once without it. |
| `display.theme` | `default` | Keep Pax colours, readable on light and dark terminals, or select a bundled Termflow palette with /theme. |
| `display.spinner` | `working` | Working animation; /spinner previews the choices. An unknown name shows working. |
| `display.footer_fields` | `["model", "workspace", "permissions", "context", "output", "cost", "activity", "plugins", "updates", "live", "queued"]` | Visible main-footer fields in display order, as a JSON list. An empty list hides the footer figures. Use /set to configure the layout or reset it. assistant_age is off by default. |
| `display.splash` | `true` | Animate the startup splash. Takes effect next start. |
| `display.full_screen` | `false` | Take the whole terminal height from the start, instead of starting compact below the shell and growing as the session needs room. Takes effect next start. |
| `display.tool_calls` | `detailed` | How tool calls print: detailed gives each call its own line with arguments, and in the interactive prompt collapses consecutive file reads, searches, and listings into one Explored line Ctrl+O expands; grouped counts consecutive calls by tool on one live line. Grouped ignores display.tool_output and display.tool_arg_chars; file diffs still print. |
| `display.tool_output` | `false` | Show shell and grep output below tool summaries. File diffs are always shown. |
| `display.shell_lines` | `20` | Shell preview lines when display.tool_output is enabled. |
| `display.grep_lines` | `20` | Grep preview lines when display.tool_output is enabled. |
| `display.tool_arg_chars` | `40` | Characters shown per tool argument value; 0 hides arguments. |
| `display.smooth_seconds` | `0.5` | Catch-up window for smoothed response streaming, 0.1 to 5 seconds. |
| `run.tool_retries` | `3` | Default retries per tool call. Explicit tool retry limits take precedence. |
| `run.code_mode` | `true` | Fold tools into a sandboxed run_code that runs each statement while the model writes. Off, every tool is called natively. |
| `run.speculative_code_mode` | `false` | Also start read-only calls in run_code before the model reaches them. Turns on code mode for its runs. Ctrl+X Ctrl+S toggles it. |
| `run.permissions` | `"full"` | What runs without asking: full runs everything; auto asks before commands that delete, push, install, or reach the network; read-only asks before every file write and command. /permissions sets it. |
| `run.instructions` | `""` | Your own instructions, sent after Pax's built-in, AGENTS.md, and plugin instructions. /system_prompt edits them. |
| `accounts.pool` | `true` | A model without @PROFILE runs on every signed-in account of its provider, in /accounts order, as @* does. PROVIDER@default:MODEL runs the default account alone. |
| `sessions.naming` | `true` | Name saved sessions in the background using a model, at extra cost. By default only sessions held with the current model are named; once saved, even as true, every session from any workspace is. |
| `sessions.naming_model` | `null` | Naming model override; null uses the current model. |
| `run.decision_model` | `null` | System One decision model, such as system-one:nimble, that judges smart_search and relevance compaction and answers the system_one tool; null turns them off. Its /model settings set its base_url and api_key. Applies at next start or /reload. See [A System One decision model](#a-system-one-decision-model). |
| `updates.channel` | `stable` | Where /update looks: stable PyPI releases, or main for the newest Pax commit on main. |
| `repo_context.walk_up_roots` | `["~"]` | User-only JSON list of inclusive stops for instruction autoload when the plugin's `walk_up` is on; the nearest one containing the workspace applies, and with none the walk stops at the repository root. |
| `repo_context.autoload_symlink_roots` | `[]` | User-only JSON list of authorized external instruction-symlink target directories, for autoload only. |
| `worktrees.remove_commands` | `{}` | User-only repository-to-argv map for confirmed exit cleanup. See [Register a worktree removal command](#register-a-worktree-removal-command). |
### Environment variables at a glance
| Variable | What it does |
|---|---|
| Provider API keys, such as `OPENAI_API_KEY` or `ANTHROPIC_API_KEY` | Used by models without an account profile. Shell commands the agent runs do not see them. |
| `CLAI_MODEL` | The model for every turn, above saved and project settings, below `-m` |
| `CLAI_NO_SPLASH` | `1` skips the animated startup splash |
| `NO_COLOR` | Also skips the splash |
| `CLAI_BLEEDING_URL` | Where the `main` update channel looks for builds; see [Updating](#updating) |
| `PYTHON_DOTENV_DISABLED` | `1` turns off `.env` loading; see [Environment variables](#environment-variables) |
| `XDG_CONFIG_HOME` | Moves Pax's folder to `$XDG_CONFIG_HOME/pydantic-ai-pax/` (default `~/.config/pydantic-ai-pax/`) |
| `VISUAL`, `EDITOR` | The editor `/system_prompt` and other text fields open |
| `LOGFIRE_TOKEN` | A Logfire write token for the `observability` plugin; see [Telemetry](#telemetry-and-references) |
| `GITHUB_COPILOT_API_KEY`, `GITHUB_COPILOT_API_TOKEN`, `COPILOT_GITHUB_TOKEN` | A Copilot token when you have not run `/login github-copilot` |
| `GITHUB_COPILOT_CLIENT_ID` | Your own OAuth app for Copilot sign-in |
| `GITHUB_COPILOT_INTEGRATION_ID` | The `Copilot-Integration-Id` Copilot requests carry, `vscode-chat` by default; see [Integration id](../../../docs/models/github-copilot.md#integration-id) |
| `CLAUDE_CONFIG_DIR`, `CODEX_HOME` | Where Claude Code and Codex sessions are read from for `/resume` |
| `PYTHONWARNINGS` | `default` shows library warnings, which Pax hides |
### Files
Paths are under `$XDG_CONFIG_HOME/pydantic-ai-pax/`, or `~/.config/pydantic-ai-pax/` by default. State that is not a
preference, such as workspaces, is under `$XDG_STATE_HOME/pydantic-ai-pax/` (default `~/.local/state/pydantic-ai-pax/`).
| Path | Holds |
|---|---|
| `config.db` | Settings, saved models and their settings, plugin declarations, and which folders you trust |
| `sessions.db`, `sessions.repl/` | Saved conversations, and code mode's sandbox state per session |
| `input-history` | Prompts you typed, for Up/Down recall (plaintext) |
| `credentials-*.enc` | Encrypted sign-ins and saved keys; the key that decrypts them is in your OS keyring |
| `credentials-*.json` | The plaintext fallback when no OS keyring exists |
| `plugins/` | Drop-in plugins; `plugins/_git/` holds plugins installed from Git |
| `spinners.json` | Your own spinners and speeds |
| `logfire/`, `telemetry.log` | Logfire credentials, and export warnings kept off the screen |
| `asyncio.log` | Event loop problems kept off the screen, such as connections reset while closing |
| `.clai/settings.json` in a repository | [Project settings](#project-settings) |
| `.mcp.json` or `.clai/mcp_servers.json` in a repository | Project MCP servers, loaded after `/mcp trust accept` |
## Getting started
### Start chatting
Python 3.11+ is required.
Launch `pax`. The default model is `openai-codex:gpt-6-astra`.
Run `/login openai-codex` to connect your ChatGPT/Codex subscription.
No ChatGPT subscription? Run `/login` to see every other sign-in (such as `/login github-copilot`),
or `/model add` to pick another provider and use its API key from `/keys` or its environment variable.
Until you do, a prompt fails with an error that lists these options.
Type `/set model ` and press Tab to pick another provider-qualified model name.
The choice is saved in SQLite and used for the next prompt without restarting.
Until you choose one, the default is the agent's own model, so a plugin
capability that selects a model replaces it. A model you choose with `-m`,
`CLAI_MODEL`, the project file, `/set model`, or `/model` is passed to every
run and wins.
Without installing, run `uvx pydantic-ai-pax`; set `UV_COMPILE_BYTECODE=1` so uv compiles
the bytecode while it builds the environment, instead of Pax compiling each module the
first time it imports it. The package also installs a `pydantic-ai-pax` command that is an alias for `pax`.
From a source checkout, launch with `uv run --package pydantic-ai-pax pax`.
For API-key providers, export the provider's API key before starting, or put it in
a `.env` in the launch directory. See [Environment variables](#environment-variables)
for discovery, precedence, and trust requirements.
Codex uses subscription OAuth instead, not `OPENAI_API_KEY`. The default Coder
can read and modify files and execute commands with your user permissions. Run it
in a workspace you trust. Pax does not add a sandbox or approval layer.
The startup splash adapts Code Puppy's stdlib-only, alternate-screen Pydantic
pyramid, with Pax lettering. The persistent `Pax` banner uses `ansi_shadow`.
Below it, Pax prints its version, or the short commit for a `bleeding` build.
The splash is disabled for redirected output, CLI arguments, small terminals,
Windows, `NO_COLOR`, or `CLAI_NO_SPLASH=1`.
### File access and safety
Pax file tools can access paths outside the workspace, including `/tmp`, and do
not protect secret files or repository metadata. OS permissions still apply.
Pax attaches the launch directory as the agent's workspace, so relative paths
and commands start there. A plugin or agent capability that supplies its own
workspace, such as a sandbox, takes the launch directory's place; a capability
function that supplies none leaves the launch directory in use. Commands get
Pax's environment minus LLM provider API keys. To keep the file tools inside the
launch directory, set **Unrestricted filesystem** to `false` in
`/plugins configure coder`. Shell commands are not restricted either way.
### Folder trust
Pax treats every folder as untrusted until you say otherwise, as Claude Code does. The
first time the interactive shell starts in a folder, before any plugin loads or turn runs,
it asks **Do you trust the files in this folder?** It names what the answer covers and lists
what it found there: instruction files (`AGENTS.md`, `CLAUDE.md`), skill folders
(`.agents/skills`, `.claude/skills`), and agent folders (`.agents/agents`, `.claude/agents`,
`.codex/agents`), from the folder up to the repository root. Only names are checked, never
contents.
- **Yes, I trust this folder**: the folder's files are yours. Their text reaches the model
as your own instructions.
- **No, keep it untrusted** (the default):
the agent still reads, edits, and runs code there, as before. Pax gives the folder's files
no authority (`authority='none'` on its `LocalWorkspace`), so capabilities that check it send
their text as the repository's data, not as yours. Use it to look at a repository someone
else wrote. Dismissing the prompt with Esc or Ctrl+C keeps
the folder untrusted for this session without saving the answer, so Pax asks again next time.
Trust is not a sandbox, and it does not approve anything else in the folder. Project settings
still wait for `/project approve`, project plugins and hooks for `/plugins enable`, and project
MCP files for `/mcp trust`, whatever the answer. The question lists the ones it found. Settings a
project file may apply at once, such as `display.*` or a stricter `run.permissions`, still apply.
`/trust` shows the decision and what it covers; `/trust yes` and `/trust no` change it. A change
applies from the next prompt. What the model has already read stays in the conversation, so
`/clear` starts a new one when you want a clean break. The status row shows `trusted`, or
`untrusted` in the warning colour, beside the `workspace` directory.
Where the decision is kept:
- It is kept in `config.db`, in your settings, never in the repository, so a repository cannot
trust itself: `.clai/settings.json` has no key for it, and `pax config` cannot set it. Pax reads
nothing the folder holds to decide whether to ask.
- Inside a Git repository, it covers the whole repository: every subfolder and every linked
worktree share the main checkout's decision. A repository nested inside it, such as a
submodule or a clone, is asked about on its own. A folder whose `.git` file points at another
repository counts as that repository's worktree only if that repository's worktree metadata
points back to it.
- Outside a repository, it is kept for the folder you started in and covers its subfolders; the
nearest folder with a decision wins.
- In your home folder or the filesystem root, the answer holds for that session only, even if it
sits inside a repository or worktree, so Pax asks again next time, and a decision there never
covers the folders below.
`pax -p`, `pax --web`, and sessions the web UI opens never ask: they use the decision you made
before, and a folder you never decided about stays untrusted. `pax -p` says so on stderr and
`pax --web` in its terminal. `/trust yes` in the web UI trusts the folder of that session. A
session that moves to another folder (`/workspace`, or `/resume` of a session saved in another
folder) takes that folder's decision.
Which capabilities change their output for an untrusted folder depends on their support for
workspace authority. Today `repo_context` keeps the walk-up `AGENTS.md` files out of the
instructions: it names the folder's own file there for the model to read with its file tools,
sends the ones above it as the repository's data, and marks the ones it surfaces as the agent
works in a subfolder. Agent Skills, your own skill
folders included, stay out of the skill catalog: the model lists them with `list_skills` and
reads one with `load_skill`, as tool output. The read-only Review specialist keeps the authority
for the directory it is sent to. Agent folders do not check it yet, and load as before in both
cases. A `/sandbox` conversation works in the sandbox's own workspace, which does not take the
decision yet.
### Startup
`pax --help` parses arguments without loading the agent or plugins. Interactive
startup defers model menus and provider integrations until you open those menus,
log in, or run a prompt. Once the prompt is ready, a background thread imports
them, so the first prompt usually finds them loaded; if it arrives sooner, it waits
for the rest of those imports. Enabled plugins still load before the first prompt;
their initialization contributes to startup time.
An enabled plugin whose module is not installed, such as a built-in saved by another
Pax version, is skipped without a message; `/plugins list` shows why. Library
warnings are hidden so they do not break up the display; pass `-W default` to
Python or set `PYTHONWARNINGS=default` to see them. Log messages from Logfire and
OpenTelemetry, such as export retries and timeouts, never print to the terminal
either; logging handlers that a plugin configures still receive them.
`/login` offers both Codex and GitHub Copilot without loading their integrations for
completion. Copilot requests use your saved login through the lazy provider resolver.
### Updating
Install with `uv tool install --compile-bytecode pydantic-ai-pax` and Pax can update itself.
`updates.channel` picks where it looks:
- `stable` (default): the newest release on PyPI.
- `main`: the newest build from the `main` branch. For each `main` commit that changes
Pax, harness, or core, CI builds an sdist of each and publishes them to the
[`clai2-bleeding`](https://github.com/pydantic/pydantic-ai/releases/tag/clai2-bleeding)
prerelease, whose tag moves with them. Pax reads `clai2-bleeding.json` there
to learn the commit, then uses `--overrides` to install Pax, harness, and core
from that commit's sdists with their required extras. These are plain release
downloads, so they need no `git` and no GitHub API calls, which are rate
limited without a token. The status row names the build by its short commit.
This channel used to be called `bleeding`. That name still selects it, and
Pax saves it under that name so older versions sharing your settings can read it.
```text
/set updates.channel main
/update now
```
To use another copy of the release, start Pax with `CLAI_BLEEDING_URL` set to
the folder that holds `clai2-bleeding.json`. A fork that runs the `Pax bleeding`
workflow publishes its own:
```bash
CLAI_BLEEDING_URL=https://github.com//pydantic-ai/releases/download/clai2-bleeding pax
```
To try a local checkout, build the same files and serve them over HTTP:
```bash
src/pydantic_ai_pax/scripts/build_bleeding.sh /tmp/clai2-bleeding
python -m http.server --directory /tmp/clai2-bleeding 8000 &
CLAI_BLEEDING_URL=http://localhost:8000 pax
```
When a newer build exists, the status row shows `update : /update`.
Pax checks once at startup and again when you change the channel, and only for
`uv tool` installs. Offline, it shows nothing.
`/update` opens the **About Pax** menu: the running version, a line saying whether
it is the latest on the channel or which newer one is out, and the `updates.channel` row.
Opening it checks too, even from a source checkout, and waits up to a second for the
answer; offline, the line says why it could not tell. **Update…** asks first, then
closes the menu and installs. `/update now` installs without the menu.
Installing runs `uv tool install --force --compile-bytecode`, shows uv's output, then
restarts Pax as the new build with the same launch options, resuming the current
conversation. Bytecode compiles during installation, so the restart skips it. Switching
back to `stable` offers the latest release. Run from a source checkout, it installs
Pax as a `uv tool` the same way and restarts into that.
Installing replaces the files of the `uv tool` environment, which would break any other
`pax` process running from it. So on Linux and macOS, while another `pax` runs from that
install, `/update now` and `pax update` install nothing and name the processes' IDs: quit
them, then update again. A `pax` started while uv installs is not covered, so start none then.
`pax update` (or `pax --update`) installs the same way without starting a session: it prints uv's output
and a last line saying what it did, then exits instead of restarting, so the next `pax`
is the new build. It exits with status 1 when the check, uv, or finding uv failed, or
when other `pax` processes run from the install. On
Windows, `pax --update` exits with status 1 without installing: use `/update now` in
an interactive session, which installs after Pax exits. The flag cannot be combined with
`config`, `plugins`, `--prompt`, `--web`, `--resume`, `--continue`,
`--session-id`, `--agent`, `--worktree`, `--model`, `--request-limit`, or
`--fork-session`.
Both spellings accept `--database PATH`, including after `update`.
`/update now` works from the [web UI](../PLUGINS.md#web-this-session-in-your-browser) too,
typed in the page or in the terminal: the page shows uv's progress, over Settings too while
it is open, and the result. After an install, Pax restarts with the web UI on the same port
and token, so the page reconnects by itself and names the new version, and Settings › About
names the versions it updated from and to. `pax --web` keeps `--web`, `--port`,
and `--token-file`; a terminal session that ran `/web` comes back with the web UI running.
Like any command, `/update now` entered while a turn runs waits for the turn to end.
Windows does not let a program replace files it is running from, so there
an install exits Pax first and installs in a new PowerShell window; start `pax`
again when that window reports success.
The reinstall keeps the extras Pax was installed with, such as `pydantic-ai-pax[groq]`,
which uv records in the tool environment. It does not keep `--with` packages, so add those
again afterwards. Without uv on `PATH`, an install prints the complete command to
run yourself, in PowerShell syntax on Windows. For `main` installs, it also
writes the overrides file and includes its path in the printed command.
In the web UI, `/update` opens the same menu as the Settings window's **About** section, whose
**Update…** button asks before it runs `/update now`. Whichever session the page shows, it runs
`/update now` in the session Pax restarts from: the one the terminal shows, or under `pax --web`
the one Pax started with, so the restart resumes that one. When Pax can't restart, for
example while another live session runs a turn, **Update…** shows the reason as an error instead and
saves nothing; in the terminal, the menu shows the reason and stays open.
### Environment variables
Pax trusts the launch directory and its parents for automatic dotenv loading.
A `.env` can change provider endpoints while reusing your exported API keys, and
alter how tool subprocesses execute. Set `PYTHON_DOTENV_DISABLED=1` in your
environment before launching Pax in an untrusted directory.
Pax loads the nearest `.env` file at startup using `python-dotenv`, before reading
settings or importing agents and plugins. It searches the launch directory first,
then its parents, and loads only the first file found. The search is not limited
to Git repository boundaries. With `--worktree`, loading happens before switching
directories. Missing files and named pipes are ignored. Unreadable or non-UTF-8
files are skipped with a diagnostic on stderr.
Use `.env` for provider API keys and settings such as `CLAI_MODEL` or
`CLAI_NO_SPLASH`. Existing environment variables take precedence, including empty
values. Keep `.env` files containing credentials out of version control.
### Settings and commands
Preferences live in `$XDG_CONFIG_HOME/pydantic-ai-pax/config.db`, falling back to
`~/.config/pydantic-ai-pax/config.db`. Use `--database PATH` to select another database.
A repository can add its own layer with a `.clai/settings.json` file; see
[Project settings](#project-settings). Conversation messages and Pax's
Codex tokens are not written to the settings database. Plugin settings are arbitrary
JSON stored in plaintext in this database, including secrets if you put them there.
Pass secret references or use plugin-owned credential storage instead of embedding keys.
When you switch versions or branches, Pax ignores saved setting names it does not
recognize and leaves their stored values unchanged. Missing settings use the current
defaults. New writes still reject unknown names and invalid values. Invalid saved
values for known settings and unsupported database schema versions still cause an error.
```text
/set
/set model
/set display.thinking false
/set run.request_limit 10000
/set run.tool_retries 3
/set accounts.pool false
```
`/set` on its own opens a full-screen menu, the same kind Code Puppy uses: the
settings on the left, details for the highlighted one on the right (current
value, default, what it does). Press `/` to search. While searching, printable
characters, including Space and `R`, are query text, not actions. Enter ends the
search and keeps the matches; `/` resumes it. Esc clears the search or retained
filter first; with no filter, Esc closes.
Outside search, Space cycles the highlighted setting through its declared
choices in order, wrapping from the last to the first, and saves immediately
without moving the selection or scroll position. If the current value is unset
or not listed, Space selects the first choice. This includes booleans, model,
theme, spinner, and other settings with multiple choices; Space does nothing on
free-text or single-choice rows. Enter still opens a picker for fields with
choices (the model list is searchable, with "Type a value..." for anything not
listed), or a typed input that validates as you go for other fields.
The input opens holding the current value unless it is the default or not
set: Enter without changes saves nothing, and an empty input resets.
`R` resets the highlighted setting outside search. Every edit saves and applies
immediately, the same as `/set KEY VALUE`; **Save & close** only leaves the menu
with those edits already saved. `/settings` is
an alias of `/set` and accepts the same arguments.
While a turn is running, `/set`, `/settings`, `/system_prompt`, `/model`, `/model add`, `/model settings`,
`/model chains`, `/accounts`, `/theme`, `/spinner`, `/tasks`, `/keys`, `/login`, `/resume`, and the
`/google_workspace`, `/grain`, and `/pylon` settings menus typed without further
arguments open right away instead of queueing.
The turn keeps running: its output is held while the menu is open
and printed in order when the menu closes. A question from the agent waits for
the menu to close. Model and run settings saved in the menu apply once the
running turn ends, and so do account changes: the running turn keeps the
accounts it started with. `/model settings` edits to the running model apply to its
next model request in the same turn. `/resume` can browse, rename, and delete
sessions mid-turn, but a running conversation cannot be swapped out: picking one
tells you to enter `/resume ID`, which restores it once the turn ends. With
arguments, these commands queue like any other, except `/theme NAME`, which
repaints at once as the picker does.
`/plugins` runs right away during a turn too, with or without arguments, so
`/plugins disable NAME` does not wait behind the turn or your queued messages.
Commands, status segments, and model providers change at once. The running turn
keeps the tools and hooks it started with, because the agent binds them when a
run begins; the change reaches the agent on your next prompt, and Pax says so.
A plugin turned off mid-turn finishes its cleanup when the turn ends. While a
delegated task is running, `/plugins` still refuses changes, as between turns.
`run.tool_retries` sets the default retry budget per tool call, starting at `3`.
Use a non-negative integer; `0` disables retries. Changes apply to the next turn.
Explicit per-tool or per-toolset retry limits take precedence. This setting does
not change output-validation or HTTP transport retries.
### Project settings
A repository can pin settings for everyone who runs Pax inside it. Put a
`.clai/settings.json` next to the code; Pax looks for one in the launch
directory and each parent, stopping at the first directory that contains
`.git`, and uses the nearest file it finds. Nothing is loaded from above the
repository.
```json
{
"model": "anthropic:claude-sonnet-4-6",
"thinking": false,
"request_limit": 50,
"plugins": [
{"id": "exa", "factory": "pydantic_ai_harness.exa:ExaSearch", "settings": {"max_results": 8}},
{"id": "repo_context", "factory": "pydantic_ai_pax.builtin_plugins.repo_context", "settings": {"inventory_tool": true}}
]
}
```
The keys are the field names from `/config show` (`model`, `request_limit`,
`thinking`, `splash`, `shell_lines`, `grep_lines`, `tool_arg_chars`, `smooth_seconds`) and are
validated the same way as `/set`. A bad value stops startup with the file name
and the problem; a key Pax does not know is reported once at startup and
ignored, so a newer file still works with an older Pax. Precedence, lowest
first: defaults, your user settings, the project file, `CLAI_MODEL`, CLI flags.
Display settings (the `display.*` keys: `thinking`, `task_models`, `theme`, `spinner`,
`footer_fields`, `splash`, `full_screen`, `tool_calls`, `tool_output`, `shell_lines`, `grep_lines`, `tool_arg_chars`,
`smooth_seconds`) apply as soon as Pax finds the file. Every other key asks you
first, as project plugins do: `model`, `request_limit`, `tool_retries`, `code_mode`,
`speculative_code_mode`, `permissions`, `instructions`, `pool_accounts`,
`session_namer`, and `session_namer_model`. The exception is a `permissions` value
no wider than your own, which applies at once: the modes run from `full` through
`auto` to `read-only`, so a repository can ask for more confirmation without
your approval, but never for less. `/permissions` still changes the mode for the
current session, and the project value returns at the next start. A project file
cannot set `update_channel`: like `worktree_remove_commands`, it is user-only, and
a file that sets it stops startup. Until you approve
one, Pax uses your own setting for it and names it under the banner at startup.
`/project` lists what the file sets, with each value and whether it applies;
`/project approve NAME...` (or `all`) applies those keys now and in every later
session in that repository, and `/project revoke NAME...` (or `all`) removes saved
approvals and returns to your own settings, including an approval of a key or value
the file no longer sets, or of a file that is gone, which would otherwise apply
again if the repository brought it back. An approval is kept in your user settings, for the folder
that holds `.clai` and for the value you approved: once the file changes that
value, as after a pull, it waits for your approval again. You approve at the
prompt; `pax` has no subcommand for it. A headless `pax -p` run or `pax --web`
launch uses the approvals you saved and prints the keys it leaves out (on stderr
for `-p`).
The project's `instructions` are still sent while they wait, but as the
repository's text rather than as your own: framed on the user channel, with a
note from Pax that they come from `.clai/settings.json` and are not approved,
never in the system prompt where your own `run.instructions` go. Once approved, they take the place of
your own instructions, as before.
For instruction-loading settings, see [Repository instructions](#repository-instructions).
`plugins` takes the module declarations used by `/plugins add NAME module[:Class] [JSON]`: an `id`, a `factory`
(`module` or `module:attr`), an optional `path`, and optional `settings`. A
relative `path` is relative to the folder that holds `.clai`, whichever
subdirectory you launch from. A
repository cannot switch a plugin on for you: plugins are trusted code running
as your user, so every project-declared plugin starts off, Pax lists the ones
waiting at startup, and `/plugins enable NAME` is your approval. Approval is
remembered in your user settings together with the declaration you approved,
so a later change to the repository's declaration does not run until you
`/plugins remove NAME` (which forgets your approval and restores the project's
current declaration, off) and enable it again. The approval keeps the file's
absolute path, so another repository cannot put its own file at the same
relative path and have it run as the one you approved. It also keeps the
file's contents: once the file changes, as after a pull, the plugin does not
load until you review it and run `/plugins enable NAME` again. Modules the file
imports are not covered. An approval saved by an older Pax with a relative
path does not load; remove it and enable it again from its repository. One
saved before Pax kept the file's contents is asked for again once. Project declarations rank just
above the built-ins: a project may redeclare `coder` or `repo_context` with
other options, and that replacement is also off until you enable it.
`hooks` takes a table of commands to run before and after tool calls and as a
turn starts and ends; see
[lifecycle hooks](../PLUGINS.md#lifecycle-hooks-commands-from-settings). It is
listed as the project plugin `project_hooks` and is off until
`/plugins enable project_hooks`; unlike a plugin's declaration, any change to
the table, or to a program inside the project that a list command runs, such
as `["./scripts/check.sh"]` (a string command is approved as written),
turns it off until you enable it again (Pax checks such a program each time it
starts it), and removing the table stops
its commands (the listing keeps `project_hooks` until you remove it).
The project file is read-only from inside Pax. `/set KEY VALUE` writes your user
settings and applies for the current session; `/config set` writes your user
settings and applies on restart. Either way the project value returns at the
next start. In the `/set` menu a value the project
sets carries a muted `project` mark after it, and the details panel names the
origin. Pax prints the file it found when it starts.
The built-in `repo_context` plugin (harness `RepoContext`), which is separate
from the project file, reads instruction files automatically: one per directory,
`AGENTS.md` else `CLAUDE.md`, from the launch directory and the directories above
it. Under your home the walk-up stops at `~`;
elsewhere it stops at the repository root (see
[Repository instructions](#repository-instructions)). A subdirectory's file is added the first time
the agent reads, lists, writes or edits something in it. `/plugins disable repo_context` turns it off, for this and
every later session; `/plugins enable repo_context` brings it back. See
[PLUGINS.md](../PLUGINS.md#the-built-in-plugins) for its settings.
### Repository instructions
`repo_context` reads the workspace's instruction file and those above it. Two
user-only settings set where that walk stops, and which shared directories an
instruction symlink may point into:
```text
/set repo_context.walk_up_roots '["~", "/srv/projects"]'
/set repo_context.autoload_symlink_roots '["~/agent-context"]'
```
The walk reads ancestors up to the nearest listed root that contains the
workspace, inclusive: with the list above, a workspace under `/srv/projects`
stops there and one elsewhere under your home stops at `~`.
`repo_context.walk_up_roots` defaults to `["~"]`, your home. When no listed root
contains the workspace, as in a container's `/app`, the walk stops at the
repository root, the nearest directory with a `.git`. Avoid listing a root other
users can write to, such as `/tmp`. To scan only the workspace, turn the walk off:
```text
/plugins add repo_context pydantic_ai_pax.builtin_plugins.repo_context '{"walk_up": false}'
```
`repo_context.autoload_symlink_roots` defaults to `[]`; set
it to a JSON list of directories if your instruction files are symlinks into a
shared directory.
Both settings are user-only, not plugin JSON options; `.clai/settings.json`
rejects their fields. Use absolute paths, `~`, or `~/...`, not relative paths,
`~other-user`, or environment-variable interpolation. Single-quote each whole
JSON list as above, which also keeps paths containing spaces in one argument,
such as `/set repo_context.walk_up_roots '["~", "/srv/My Projects"]'`. Paths are
resolved, following symlinks, when used and need not exist when saved. Changes
apply on the next run, not during a running turn.
`repo_context` reads the instruction files again at each prompt. An edit to one
it sends reaches the model with your next prompt, appended after the text it already had, so the
cached part of the prompt stays the same, and the status row then shows
`AGENTS.md updated` (see [Status line](#status-line)).
Authorize a directory holding only trusted instructions, not `/` or all of home:
repository symlinks can select any readable file beneath it. See
[Repo Context](../../../docs/harness/repo-context.md#shared-instruction-symlinks)
for symlink loading, scope, and backend requirements.
Interactive commands: `/login`, `/set` (alias `/settings`), `/system_prompt`, `/theme`, `/model`, `/model add`, `/model settings`, `/model chains`, `/help`, `/clear` (alias `/new`), `/resume`, `/exit`, `/config`,
`/plugins`, `/reload`, `/update`, `/usage`, `/cost`, `/fork`, `/forks`, `/compact` and `/auto-compact` from the built-in `compaction` plugin, and `/refine` from the built-in `refinement` plugin.
Tab completion suggests commands, settings, boolean values, plugin identifiers,
and paths after `@`. Suggestions match any substring, case-sensitively. While
you type a command name, the best match comes first and is highlighted without
pressing Tab: the exact name, then names that start with what you typed. Enter
fills in the highlighted command, or runs it when it is already typed in full;
Tab and Up/down move the highlight. For paths,
matching applies to the filename within the typed directory. Path completion inserts
a path; it does not attach file contents.
Unknown command-shaped input such as `/missing` still reports an error instead
of reaching the model. Absolute paths such as `/Users/me/Desktop/Screenshot.png`
are prompts, not commands: a slash, dot, or backslash in the first token after
`/` marks path-like input. Quoted paths are also prompts. For an ambiguous
single-component path with spaces, quote it, for example `"/Screen Shot.png"`.
This routing handles path text that the editor has not converted to an attachment.
After trimming surrounding whitespace, that text, including internal spaces and
shell escapes, reaches the agent unchanged. Routing alone does not read the file;
the agent's configured tools determine how it can access it. Separately, bracketed
paste of existing image paths creates attachments as described in
[Pasting images](#pasting-images).
Up/down move through multiline drafts, then recall queued messages and saved
prompt history. Queued messages come first, newest first, because they are
your most recent input; Up then continues into history, skipping the copies of
queued messages that history already holds. A recalled queued message leaves the
queue while you edit it, so it does not run when the turn ends; the messages around
it still do. The queue preview shows `Editing - won't send while you edit it` above
the other queued messages, and the input box shows
`Enter to save · Esc to stop editing · Clear it to remove`. Enter puts the
edited message back in its place. Esc puts it back unchanged; it does not interrupt
the turn, so a second Esc does. To remove the message, clear the draft and press
Enter, Esc, or Ctrl+C. Each of these, and Alt+Enter, restores the draft you had
before pressing Up. If the turn ends and nothing else is queued, the message
stays in the input as an unsent draft. With nothing queued, Up/down only walk
history.
While you walk history, Up/down stay on history even when a recalled slash
command shows completion suggestions. Press Tab to pick a suggestion; Up/down
then move through the suggestions. Editing recalled text keeps the walk when it
protects a nonempty original draft; otherwise editing ends the walk (see
[Input history](#input-history)). Esc closes the suggestions, and Tab brings them back.
Enter submits a prompt when idle and queues a separate follow-up turn when busy.
To steer the active run instead, press Alt+Enter (Option+Enter; Ctrl+Enter on
Windows, see [Windows Terminal](#windows-terminal)). With a typed
draft, this immediately shows the message in the transcript and enqueues it for
the run's next model request. It does not interrupt the current response or
cancel in-flight tools. Messages already queued stay queued. With an empty
draft, it sends the oldest queued follow-up instead. Each press sends one
message. Slash commands, `!` shell commands, and exit signals are never steered.
A draft that cannot steer, including any draft while idle, is taken as if you
pressed Enter. A queued message that cannot steer stays queued and is not
skipped over. While running with a draft or a queued message, the input box
shows both shortcuts. If Option+Enter queues like Enter, see
[Option keys on macOS](#option-keys-on-macos).
Shift+Enter inserts a newline when the terminal reports it separately from Enter.
Ctrl+J inserts a newline in the editor (it steers on Windows, see
[Windows Terminal](#windows-terminal)); plain Enter submits. Some terminals, including
GNOME Terminal/VTE on Ubuntu, send the same input for Shift+Enter and Enter.
Use Ctrl+J there, or a terminal that supports modified-key reporting, such as
Kitty or xterm. Pax enables xterm and Kitty keyboard reporting only while the
editor is active and releases it for menus and on exit.
Ctrl+R searches history; Enter accepts a search
result without submitting it. Ctrl+D exits when the draft is empty. Ctrl+C at
input clears the line; during a run it cancels the turn and returns to input. No cancelled run is automatically retried.
## Models and accounts
### Models and their settings
`/model` selects from models you have already added, and from your
[fallback chains](#several-accounts-and-fallback-chains), listed after them.
Choose **Add a model...** to browse providers and select a new model without
leaving the command. This option is available even when no models have been
added. **New fallback chain...** creates a chain in the same picker.
`/model PROVIDER:NAME` switches directly to any model. A model not yet in your
list is added and selected; Pax does not check that it exists, so a mistyped
name fails on the next prompt with the provider's error. Tab completes the saved
list and the `add`, `settings`, and `chains` subcommands. Model names normally start with a
provider (`openai:gpt-5`), so no real model is called `add`, `settings`, or `chains`.
The currently configured model is kept in the list when upgrading.
| Command | What it does |
| --- | --- |
| `/model` | Pick a saved model or chain, add one, or edit or delete one |
| `/model NAME` | Select `NAME`, adding it first if needed |
| `/model add` | Browse providers and their models |
| `/model add NAME` | The same as `/model NAME` |
| `/model settings` | Choose a saved model to configure |
| `/model settings NAME` | Configure `NAME` |
| `/model chains` | Open the picker on its fallback chains |
`/add_model`, `/model_settings`, and `/chain` still work as deprecated spellings of
`/model add`, `/model settings`, and `/model chains`.
To remove a model you no longer use, highlight it and press **Ctrl+D** or
**Delete**, then confirm **Delete model**. This removes it from the saved list and
Tab completion and deletes its per-model settings. Provider credentials are kept.
The current model and saved default cannot be deleted. Select another model first,
or use `/set model NAME` to change the saved default. **Keep model** or Esc cancels
without changing anything.
`/model add` opens a searchable provider list, then a model picker for that provider.
Esc from the model list returns to providers. Providers are unique prefixes from
the merged catalog, including `openai-codex`. Its suggestions include
`gpt-6.2-sol`, `gpt-6.2-astra`, `gpt-6.1-sol`, `gpt-6-astra`, `gpt-6-sol`,
`gpt-6-luna`, `gpt-5.6-luna`, `gpt-5.6-terra`, and `gpt-5.6-sol`; availability
depends on your account. Unknown prices and context limits are not inferred.
The model catalog combines genai-prices' catalog
filtered to providers Pydantic AI can run, plus core's own model list, plus
whatever you have set now. The left side shows model names and marks the current
model; token counts stay in the details. The right side shows the provider, context window,
prices, and any settings you have saved for that model. Type to filter. Enter
saves it in your model list and makes it the model for the next prompt. `Ctrl+S` opens that model's settings:
the model-aware request and thinking controls described below. They are
saved per model and passed to every run with that model. Unsupported settings
may be ignored or rejected by the provider; select only settings your provider supports. `/model NAME` sets the model without the menu.
Pax installs the SDKs for OpenAI, Anthropic, and Google. Every other model provider
has a Pax extra of the same name as its `pydantic-ai-slim` extra, such as `bedrock`,
`groq`, `mistral`, or `typesafe` (TypeSafe's Jev), and `all` installs every provider
and every `/sandbox` provider but `local`. Selecting a model whose provider SDK is
missing from the Python Pax runs on fails right away, naming the extra to install
(with the extras a `uv tool` install already has, so the command keeps them),
instead of on the next prompt:
```bash
uv tool install "pydantic-ai-pax[bedrock]"
```
From a pydantic-ai checkout, run Pax with the extra instead:
```bash
uv run --package pydantic-ai-pax --extra bedrock pax
```
#### Model settings and custom parameters
`/model settings` opens a searchable list of added models. Enter configures a
model without changing the active model. Esc returns from settings to this list;
Esc again closes it. `/model settings PROVIDER:NAME` opens that model directly.
Tab completes added models.
`Ctrl+S` in `/model add` opens the same editor. Edits save immediately and apply
from the model's next request, even in a running turn. Space cycles fields with
multiple declared choices in order and wraps to the first; an unset or unlisted
value starts at the first choice. Action and submenu rows, free-text fields, and
single-choice fields do not cycle. `r` resets a field. This field list is not
searchable. Esc, Ctrl+C, or **Save & close** goes back. Enter opens a picker for
fixed choices; numeric fields accept typed values, and empty input resets.
Pax enables prompt caching by default for every model, with the unified `Prompt Caching`
setting (`cache`). It covers Claude on the Anthropic API, `claude-code:`, Amazon Bedrock and
OpenRouter, Nova on Bedrock, OpenRouter's Gemini routes, and OpenAI's GPT-5.6 and later; providers
that cache implicitly or not at all ignore it. Set it to `false` to turn caching off for a model, or
to `1h` to keep the cache longer. Saved `anthropic_cache*` settings still apply and take precedence
over it. These are CLI defaults only; plain Pydantic AI agents are unchanged.
Every model has a **Context Window** row (`context_window`): the tokens it reads per request. Unset, Pax
uses the window the model's profile or the genai-prices catalog gives, if any. Set, it replaces that window
for the status row, compaction, and the `/model add` details pane, as the model's
`profile={'context_window': N}`. It is not sent to the provider. Saved for `PROVIDER:NAME`, it also applies
to that model on other accounts, as a saved base URL does. A chain has no such row: each model in it
keeps its own. The `compaction` plugin's own `context_window` setting still overrides it for compaction.
In the web UI, `/model` typed in the composer opens the Settings window's **Models** section
instead: the model for the next prompt, each saved model's settings (this editor's rows), and
adding and removing models. `/effort` opens a dialog with the active model's settings, effort
among them. `/fast` still toggles, as in the terminal.
`/effort` shows the active model's configured reasoning effort and supported values.
`/effort high` (or another listed value) saves it for that model; `/effort reset`
removes the native effort override. Custom parameters stay unchanged: remove any
that override effort with `/model settings` first. Models without an effort
control say so. Like `/fast`, `/effort` waits for the current turn to finish.
`/commit [MESSAGE]` stages and commits every change in the session's directory;
without MESSAGE the session's model drafts one from the changes. `/push` runs
`git push -u origin BRANCH`; on the default branch it asks for `/push confirm`.
`/pr` shows a pull request title and description the model drafts from the
branch; `/pr confirm` then pushes the branch and opens exactly that with `gh`,
and `/pr TITLE` does so with your title instead. The web UI's git chip
does the same, with a file list and the drafts to edit first. A plugin's own
`/commit`, `/push`, or `/pr` replaces these; a skill of the same name is hidden
by them, and Pax says so.
First select `openai-codex:gpt-6-astra` with `/model`, then open `/model settings openai-codex:gpt-6-astra`
(or your saved Codex model), then **Speed**. GPT-6.2 Astra, GPT-6.2 Sol,
GPT-6.1 Sol, and GPT-6 Astra, the Codex models that offer
[Ultrafast](https://developers.openai.com/codex/speed), default to
**ultrafast**. Choose **fast** for priority processing, or **standard** to turn
both off. Faster speeds use more ChatGPT credits and depend on your plan. They do
not lower reasoning effort. Reset restores the model's default. Picking a tier in
the **Service Tier** row replaces the speed, and a custom `service_tier` body
parameter takes precedence over both. Older Pax builds see a speed as its nearest
service tier, `priority` for fast and ultrafast, and a different tier they save picks
the speed here.
While the active model starts with `openai-codex:`, `/fast` toggles between
standard and the model's default speed: ultrafast where it is offered, fast
elsewhere. `/fast on` selects fast, `/fast off` standard, and
`/fast ultrafast` ultrafast. It saves the active model's speed for subsequent
prompts and sessions, without changing reasoning effort or other preferences. It
is absent from help and Tab completion on other models, and typing it there
reports an unknown command. If a custom `service_tier` parameter is set, `/fast`
asks you to remove it first with `/model settings` rather than saving an
ineffective change.
Model preferences are shared across checkouts. Reading saved preferences ignores
unknown fields, so newer settings do not break an older reader with this
compatibility fix. Editing or resetting a known field preserves unknown fields
in the store. New edits still reject unknown keys and invalid values.
An invalid value in a known field stops that turn with a repair message, not the
shell; use `/model settings` to fix or reset it and try again. Pax does not silently
run with different settings or delete saved preferences.
Older branches must receive this fix too. The minimum read-side backport is
`ModelSettingsForm.model_validate(values, extra='ignore')` in
`model_settings_from_json`; keep the form itself strict. Also backport preservation
of unknown keys on save and the shell's model-settings validation error handler.
The editor offers OpenAI reasoning effort and verbosity, Responses reasoning
context, mode, and summary, and Claude classic/adaptive thinking and effort.
The editor hides generic request fields such as timeouts and penalties.
Reasoning GPT models do not show sampling controls. Previously saved overrides
remain visible so they can be reset. Choices depend on the model and API: Chat Completions does not get Responses
controls. OpenRouter and vLLM GPT routes, and Azure GPT-6 and GPT-5.6 models, expose Chat Completions reasoning effort,
verbosity, and service tier, not Responses-only controls. `all_turns` appears only on compatible models, and adaptive Claude
models do not get a token budget. Classic thinking budgets must be at least
1024 and below an explicit `max_tokens`. Without one, Pydantic AI
leaves room for the answer beyond the budget. Other unset fields
use the provider default.
Explicit native thinking settings take precedence over generic `thinking`.
GPT-6 and GPT-5.6 families, including provider-qualified and namespaced names,
default to `thinking=true`, `service_tier=default`, reasoning effort `medium`,
context `all_turns`, mode `standard`, summary `detailed`, and verbosity `low`.
Explicit per-model values win; reset restores the family default without saving
it as an override. Other models keep their existing defaults. Family defaults
follow the model each request uses and sit beneath the settings of
capabilities, a plugin's or your agent's, so a capability can change them; an
agent's own `model_settings` stay beneath the defaults. The values you saved for
the session's model (the one you chose, or Pax's default) are passed to each run
and win over everything else on requests to that model; a request on a model a
capability selected instead gets only that model's family defaults. Provider-specific
fields are consumed only by APIs that support them; this does not add Responses
controls to Chat Completions or other protocols.
Code Puppy runtime parity is not complete. In particular, its progress-aware
main/sub-agent streaming retries require core recovery support before Pax can
expose working retry controls. See [the parity audit](../MODEL_SETTINGS_AUDIT.md).
Pydantic AI owns adaptive-thinking translation and preserved-thinking replay,
including Fable 5.1's recovery when a changed conversation prefix invalidates a
thinking block. Pax does not strip thinking or implement a second recovery loop.
See [core's thinking block binding documentation](https://pydantic.dev/docs/ai/models/anthropic/#thinking-block-binding).
For native Anthropic models, **Preserved Thinking** controls
`thinking.block_binding.prefix_mismatch_behavior`: `error` rejects a mismatched
prefix; `drop_block` continues without the mismatched reasoning block. It appears
on adaptive-capable Claude models. Fable 5.1 also exposes **Thinking Display**:
`updates` or `summarized`. Opus 5.5 and Sonnet 5.5 expose it with `summarized`,
which shows the notes they write between tool calls. Setting either control
without a thinking mode selects adaptive thinking; neither can be combined with
disabled or `between_tools` thinking. **Extended Thinking** offers only the
modes the model accepts: Fable, Mythos, and Opus 5.5 always think, so they offer
`adaptive` alone, and Sonnet 5.5 offers `between_tools`, its off switch, in place
of `disabled`. Resetting the mode clears its budget, display, and binding
overrides. **Interleaved Thinking** adds the beta header on classic Claude 4
models. Pax adds the display beta when requesting updates; core adds the
block-binding beta. These native controls do not add Anthropic protocol support
to third-party Chat Completions endpoints.
GLM-4.5 and newer expose **Thinking (GLM)** and **Clear Thinking (GLM)**;
GLM-5.2 and newer also expose **Reasoning Effort (GLM)**. Clear Thinking set to
true clears earlier reasoning; false preserves it. These controls send GLM's
native `thinking.type`, `thinking.clear_thinking`, and `reasoning_effort` body
fields. Only explicit overrides are sent. Disabled thinking cannot be combined
with an effort override. A proxy that needs `chat_template_kwargs` instead of
this native shape still needs custom parameters. Custom parameters win over the
generated body on conflict.
Open `custom_params` for Code Puppy-style **Custom Params**. Enter adds or edits
`key = value`; editing the key renames it, and clearing the text removes the pair. Esc goes back.
Dotted keys nest in the request body's `extra_body`, for example:
```text
chat_template_kwargs.thinking = medium
reasoning.effort = max
```
Values accept JSON booleans, numbers, null, arrays, and objects, or unquoted
text. Quote numeric-looking strings to keep them strings. Parameters are saved
per model and applied last, overriding built-in request fields on conflict.
An extra-body object replaces the corresponding generated object, rather than
deep-merging it. For example, overriding `reasoning.effort` replaces the generated
`reasoning` object; include custom `reasoning.context` too if you need both.
They deliberately bypass the model compatibility checks: the endpoint must
support what you send. This is also the escape hatch for custom endpoints and
provider options not listed in the form. Reset `custom_params` to remove all
pairs. Do not put credentials here: values are stored as plaintext in SQLite.
Set `base_url` to send a model's requests to your own endpoint, such as a corporate
proxy, an AI gateway, or a self-hosted server. It must be an `http://` or `https://`
URL. It is saved per model, so two models of one provider can use different endpoints,
and it wins over the provider's environment variable, such as `OPENAI_BASE_URL`. It
sets the provider's own endpoint option: `azure_endpoint` for Azure, `api_base` for
LiteLLM, and `api_host` for xAI, which takes an `https://HOST[:PORT]` URL. A model on one
account, `PROVIDER@PROFILE:MODEL`, uses its own `base_url`, else the one saved for
`PROVIDER@*:MODEL`, else for `PROVIDER:MODEL`, so pooled accounts share it.
`openai-codex` sends its credentials to that origin, which must be HTTPS. A chain uses
each of its models' own `base_url`, so chains and plugin models have no Base URL row;
a provider with no endpoint, such as `sentence-transformers`, fails the turn. Pax
versions before this setting ignore it and send to the provider's default endpoint, so
if you depend on a gateway, also set the provider's environment variable or don't
downgrade.
Set `api_key` to the name of a `/keys` entry for a model to use that key instead of
the provider's environment variable. Only the name is saved; the key stays in `/keys`
and is read each time the model is built, so deleting or renaming the key in `/keys`
fails the turn until you pick another. The row
shows when the environment variable, such as `OPENAI_API_KEY`, already supplies a key.
The plain model's `api_key` also applies to its `@default` account, which uses the
environment's key; a profile such as `openai@work` keeps its own sign-in unless its
own model sets `api_key`. While `accounts.pool` runs a plain model on every signed-in
account, each keeps its own key, so its `api_key` reaches only the `@default` account,
if that is one of them. OpenRouter, vLLM, GitHub Copilot, Codex, chains, `@*` pools,
and plugin models take their keys elsewhere and have no API Key row. Pax versions
before this setting ignore it and use the environment's key, sending it to any saved
`base_url`, so don't downgrade while a model relies on both.
For `/set` and `/model add`, Tab completes setting names, boolean values, and model names from Pydantic AI's
built-in catalog without network access. Provider prefixes include `openai-codex:`,
which core supports but does not currently include in that model catalog. Complete
the provider prefix, then enter the model identifier; suggestions do not establish
subscription availability. Custom model identifiers are accepted too.
The command registry uses Termflow's `Completer`, `Document`, and `Completion`
types. Completion rows stay visible while replacement suggestions are computed;
stale suggestions cannot be selected. Provider errors appear in the footer
without ending the session. A blocked completion lookup does not hold menus or
shutdown open; its late result is discarded. Lookups use one daemon worker with
one latest queued request, so a stuck provider cannot create a thread per key. Reopening or growing the popup reuses free
space above the editor instead of adding blank transcript lines.
The interactive editor draws its own pinned prompt and completion rows,
using Termflow's layout helpers. It does not run a prompt-toolkit Application or
renderer. The keyboard decoder and history-file backend still come from
prompt-toolkit, preserving bracketed paste and modified-key handling. Redirected
input retains the simple PromptSession path.
`/set SETTING` shows its current value. `/set` changes apply to subsequent prompts
and preserve conversation history; splash changes apply at next startup.
Precedence is defaults, SQLite overrides, the project file, `CLAI_MODEL`, then
explicit CLI flags. Settings are validated before writes. `/set` updates the
active settings snapshot; legacy `/config` writes apply on restart; plugin
changes apply on the next prompt. `--request-limit` controls the full prompt's
model-request budget.
### Codex authentication
The built-in model catalog and `/set model` completions include
`openai-codex:gpt-6.2-sol`, `openai-codex:gpt-6.2-astra`, `openai-codex:gpt-6.1-sol`,
`openai-codex:gpt-6-sol`, and `openai-codex:gpt-6-luna`.
`/login openai-codex` opens the browser and uses core's `OpenAICodexOAuthFlow`:
authorization code with PKCE, state validation, and a callback at
`http://localhost:1455/auth/callback`. It times out after five minutes.
Login adds every model your account's Codex catalog lists to `/model`
(`openai-codex@PROFILE:ID` for a profile), skipping models the catalog hides. If
listing the models fails, the login stays saved, Pax reports why, and it adds the
built-in Codex models instead.
If the browser cannot reach that callback on the machine running Pax (for
example over SSH), the redirect fails in the browser. Copy the URL from the
address bar and paste it at the prompt Pax shows under the login link; the bare
`code` value works too. Pax checks the URL's `state` against the current login
before exchanging the code. Whichever arrives first, the callback or the paste,
completes the login.
Tokens are encrypted into `0600` files in `$XDG_CONFIG_HOME/pydantic-ai-pax/`
(`credentials-ACCOUNT.enc`), not stored in SQLite or `~/.codex/auth.json`. The key
that decrypts them is the only entry Pax keeps in the configured Python `keyring`
backend (service `pydantic-ai-pax`, account `encryption-key`). Pax reads that entry
at most once per session, so macOS asks for keychain access at most once, instead of
once per saved credential. Logins that older versions saved as keyring entries are
moved into encrypted files the first time they are read. Choose an OS-backed credential store: Pax
uses the configured backend and does not enforce its encryption or storage policy.
Installing or selecting a plaintext backend can store the key in plaintext. Core owns
token refresh through Pax's `OpenAICodexCredentialSource`. Tests mock keyring,
the browser, and OAuth exchange and do not access real credentials.
If Codex cannot refresh your login, Pax tells you to run `/login openai-codex`
in an interactive session, then retry your message. This replaces the generic
connection error that can hide an expired login. Headless runs show the same
advice on stderr and exit with code 1. Pax does not retry the turn automatically.
When no usable keyring backend exists (keyring raises `NoKeyringError`, `InitError`,
`RuntimeError`, or `PasswordSetError`, `kwallet.DBusKeyring` cannot open a wallet, Secret
Service's default collection stays locked (`Failed to unlock the collection!`), or the backend
does not retain the key, typical on a headless Linux box, over SSH or WSL, or on KDE / Steam Deck
with KWallet disabled or unconfigured), credentials go to a `0600` file in
`$XDG_CONFIG_HOME/pydantic-ai-pax/` (`~/.config/pydantic-ai-pax/` by default) instead, named for
the account: Codex uses `credentials-openai-codex.json`, and the GitHub Copilot, vllm and
openrouter connections use their own files. Like keyring entries, these files are per user, so
`--database PATH` does not move them; `/login` says so in its confirmation. Reading or writing
one logs a single warning per process, ending with the keyring's error when it raised one.
A locked Secret Service collection counts as missing even when you dismiss its unlock prompt,
since Pax cannot tell that from no agent to ask; any other locked keyring, such as a denied
macOS Keychain prompt, is not, so unlock it instead. Pax asks Secret Service to unlock at most
once per process. While it is locked, logins saved encrypted read as signed out, with a warning
that says so, and saving one again writes the plaintext file and deletes the encrypted one. Once
a keyring becomes available (after a locked Secret Service, in the next Pax process), the next
login or token refresh encrypts the credentials and deletes the plaintext file. To keep Pax off
Secret Service, set `PYTHON_KEYRING_BACKEND` to another backend (`keyring.backends.null.Keyring`
keeps nothing, so Pax uses the plaintext files), or provide API keys through
[environment variables](#environment-variables).
The default Coder shell runs under your OS identity, without a sandbox. Commands
can read files and access credential backends available to that identity, including
Pax's tokens. Keyring is storage, not isolation from model-controlled commands.
Use a separate OS account or isolated environment for untrusted repositories.
The requested default does not guarantee model availability for a subscription.
Custom agents supplied to `chat` retain their model unless settings explicitly
select an override. `pax --agent MODULE:ATTR` keeps the agent's model over saved
and project models; only `-m` or `CLAI_MODEL` replaces it. `/login` is async, and plugin command handlers may also return
an awaitable string.
### GitHub Copilot subscriptions
```bash
uv run pax
```
In Pax, run `/login github-copilot`. Login adds every model your account's catalog
lists to `/model` (`github-copilot@PROFILE:ID` for a profile) and, when you have not
chosen a model, selects a recent strong one, such as Claude Opus 5.5 or Gemini 4 Argon.
A model you chose stays selected. To switch, open `/model add` and choose `github-copilot`;
the provider menu also starts login when no credentials exist. If listing the models
fails, the login stays saved and Pax reports why.
You do not need to register an OAuth application or configure a client ID.
Pax supplies the same [public Copilot OAuth client ID as Pi](https://github.com/earendil-works/pi/blob/fde38ed7c2f64434beffc6c0ec3b9994cb89ae23/packages/ai/src/auth/oauth/github-copilot.ts#L10-L11)
and requests `read:user` access to your GitHub profile. This identifies the existing
Copilot OAuth application, not a separately registered Pax application.
`GITHUB_COPILOT_CLIENT_ID` remains an optional override for your own device-enabled
OAuth application; unset or blank uses the bundled default.
The workspace temporarily pins the merged Pydantic AI device-flow implementation
until it is released.
Login prints a code and `https://github.com/login/device`, then starts polling.
Open that link on this or another device and approve only the code shown by your
own Pax session. Pax does not launch a browser, so a text browser cannot block
login or take over your SSH terminal. Ctrl+C stops polling; GitHub controls the
code's expiry. No localhost callback or pasted token is needed.
GitHub authorization alone does not establish Copilot access. Login and the model
menu query your account's catalog and keep only picker-enabled models with
`/chat/completions` support. The shared model menu includes details and `Ctrl+S`
settings. Your subscription and organization policy still control inference access.
You can also select a known ID with `/model github-copilot:claude-haiku-4.5`.
Credentials use the existing keyring backend under the `github-copilot` account,
separate from Codex and API keys. Without a keyring, Pax reports the plaintext
`credentials-github-copilot.json` fallback file, created with mode `0600`.
Tokens and their issuance time stay out of settings, history, and login output.
Expiring tokens require `/login github-copilot` again; Pax does not refresh them.
A failed or cancelled authorization leaves the previous login unchanged.
Without a saved login, Pax accepts `GITHUB_COPILOT_API_KEY`,
`GITHUB_COPILOT_API_TOKEN`, or `COPILOT_GITHUB_TOKEN`, in that order.
It does not read `GH_TOKEN`, `GITHUB_TOKEN`, or another application's token files.
Core owns inference and its telemetry; Pax adds no login-specific spans.
`/login` without a name asks which sign-in to run.
#### Several accounts and fallback chains
`/accounts` lists every account you are signed in to, grouped by provider.
Logins you already had show up on their own.
- **a** adds an account: pick a provider and Pax fills in a free name, such as
`account-2`. Press Enter to keep it, then sign in as usual (browser, device code,
connection, or API key).
- **Enter** on an account signs in to it again, for example after it expired.
- **r** gives an account a name to show, such as your email.
- **d** signs out, after asking. For a plugin's account, it only leaves the list;
the plugin keeps its own sign-in.
- **[** and **]** reorder accounts. The order is the order `@*`, and a model
without an account, try them in.
Each account shows its current usage as it loads, without holding up the menu:
`5h 92% · 7d 43%` on the row, and a bar with the reset time for each limit on the
right. Pax reads it for ChatGPT/Codex (the five-hour and weekly windows) and
GitHub Copilot (premium requests); plugins can report their own, as the Claude
Code plugin does. `…` means it is still loading and `?` that the service did not
answer; the right-hand panel says why.
In the web UI, `/accounts` and `/login` open the Settings window's **Keys & accounts**
section, beside the saved `/keys`, with the same steps behind each account's button. There,
ChatGPT/Codex and GitHub Copilot sign in behind a waiting screen showing the link or code, an
API-key account saves its key in `/keys` (as `PROVIDER_PROFILE` unless you pick a saved one),
and connections and plugins' sign-ins are run as `/login NAME` in the terminal. Usage shows
only in the terminal. `/login NAME` typed in the page opens in the terminal that runs Pax;
when there is none, `/login openai-codex` waits in the page too, and a plugin's sign-in asks
in a dialog for what it would have you paste. The link a plugin prints is not shown in the
page: finish in the browser the plugin opens where Pax runs, or run `/login NAME` in a terminal.
When you pick a model in `/model add` and its provider has more than one account,
Pax asks which account runs it, or **all accounts**. All accounts saves the model
as `PROVIDER@*:MODEL`: it runs on the first signed-in account and moves to the next
when a request fails with a model API error, such as a rate or usage limit. Signing
in to another account adds it to the rotation, with nothing else to change. If
every account fails, Pax lists why each one did.
A model that names no account, such as `claude-code:claude-opus-5-5`, works the
same way: once its provider has two or more signed-in accounts, it runs on all of
them in `/accounts` order, as `@*` does. With one, it runs on that one. To run the
default account alone, write `PROVIDER@default:MODEL`; picking an account in
`/model add` saves it that way. `/set accounts.pool false` turns this off, so a
model without an account runs on the default one only, as it did before.
Under the menus, an account other than the default is a profile, written
`PROVIDER@PROFILE`. You can type it instead:
```text
/login openai-codex@work # a second ChatGPT/Codex account
/login github-copilot@work # a second GitHub login
/login openrouter@team # an OpenRouter browser sign-in or key
/login vllm@lab # another vLLM server
/login openai@work # any provider that takes an API key: a /keys entry or a typed key
/model openai-codex@work:gpt-6-astra
/model openai-codex@*:gpt-6-astra # every signed-in Codex account, in /accounts order
/model openai-codex@default:gpt-6-astra # the default account alone
```
The default account is the one without `@PROFILE`. For Codex, Copilot,
OpenRouter, and vLLM that is the existing login. Providers such as
`openai` and `anthropic` still read their usual environment variables by default;
a profile uses the key saved at `/login`. Anything else a provider needs, such as an
Azure endpoint or an Ollama URL, still comes from the environment, and `/login`
refuses to save the key until it is set. Plugins can support profiles too, such
as `/login claude@work` for a plugin's `claude-code` models. A profile name is 1
to 32 lowercase letters, digits, hyphens, or underscores; `default` names the
account without a profile, and `/login NAME@default` signs in to it. Each profile's
credentials are stored separately, the same way as the default login.
A fallback chain does the same across different models or providers, such as Codex
first and Claude after it. It tries its models in order. Chains live in the `/model`
picker, under **Fallback chains** below your models (`/model chains` opens it there):
- **New fallback chain...** asks for a name, then for its models: **a** adds a saved
model or a typed `PROVIDER[@PROFILE]:MODEL` (including `PROVIDER@*:MODEL`), **d**
removes one, **[** and **]** move one earlier or later, and Enter on **Save chain**
saves it. Enter on a model does nothing. Esc leaves without saving.
- **Enter** on `chain:NAME` selects it, like any model; `/model chain:NAME` does too.
- **Ctrl+E** changes a chain's models, **Ctrl+R** renames it, and **Ctrl+D** deletes
it, after asking. The model you are using, or your saved default, cannot be renamed
or deleted.
Outside a turn, such as when compacting a conversation or naming a session, a chain or
`@*` also moves on when a model refuses a request. A turn streams its responses, and so
does a delegated task. A refusal is only known once it has streamed, so it still ends
the turn ([#13175](https://github.com/pydantic/pydantic-ai/issues/13175) tracks
falling back from a streamed refusal). A delegated task on the session's model falls
back through its chain; a task on a delegate's own model does not. A chain shows its
first model's `/model settings` controls and saves overrides under `chain:NAME`; the
overrides apply to every model in the chain, so `/fast` works for a chain that starts
with Codex, as it does for `openai-codex@*`. Each model otherwise gets Pax's defaults
for its own family, such as the reasoning defaults for a GPT model. A chain cannot contain another chain, but it can contain `@*`. A model whose profile is not signed in fails the turn
instead of falling back, so a missing login is not hidden. Older Pax builds keep
the rest of your settings, but cannot run a profile, `@*`, `@default`, or chain
model, and run a model without an account on the default account only.
### Long subscription retry waits
With a `claude-code:` model, when Claude asks Pax to wait more than a minute before
retrying (usually because your subscription limit was reached), Pax shows the error
at once instead of waiting silently. The error says about how long Claude asked you
to wait. Try again later, or pick another model or a chain with `/model`.
For response-header details, see the [plugin contract](../PLUGINS.md#run-models-under-your-own-prefix-get_model_providers).
### vllm connection
Open `/model add`, choose `vllm`, then enter a trusted HTTP(S) server root or `/v1` URL, and optionally a token. Pax queries `/v1/models` and opens a searchable model picker. When the server lists the picked model's `max_model_len`, as vLLM does, Pax saves it as that model's **Context Window** in `/model settings`, unless one is saved already; reset the row there to clear it. HTTP sends tokens unencrypted; use HTTPS outside trusted local networks. The connection is saved like Codex's, see [Codex authentication](#codex-authentication).
A `vllm` model retries each failed request up to 5 times, with exponential backoff and jitter. Besides the usual transient errors (408, 409, 429, 5xx, and connection errors), it retries 403, which a gateway in front of the server, such as Cloudflare, can return under load even for a valid key. A 401 fails at once, and a key that keeps getting 403 fails after the last retry.
### openrouter connection
Open `/model add`, choose `openrouter`, then choose **Sign in with browser** or **Enter API key**. Browser sign-in opens OpenRouter's [PKCE authorization flow](https://openrouter.ai/docs/use-cases/oauth-pkce) and receives an authorization code on a temporary loopback listener. Pax exchanges the code for a user-controlled API key over HTTPS. If the browser cannot reach Pax (for example over SSH), paste the final callback URL or authorization code into the terminal. If no browser opens, open the printed authorization URL manually. Login times out after five minutes; Ctrl+C cancels it. You can revoke the generated key on OpenRouter.
Manual entry still accepts a key from https://openrouter.ai/keys in a masked prompt. After either method, select a model from the live catalog. Pax validates the key with `/api/v1/key` before fetching `/api/v1/models`. Cancelling before model selection leaves the saved connection unchanged.
The connection is saved in the configured Python keyring backend after selection, or in a per-user `0600` file when no keyring backend exists, as described in [Codex authentication](#codex-authentication). Backend security depends on your keyring configuration. Tokens are not stored in SQLite or command history. The selected model persists across restarts. Select the provider again to browse its live models or reconfigure the saved connection. Discovery is explicit and has a 20-second network timeout; redirects are not followed. Agent inference uses Pydantic AI core.
### Saved API keys
Open `/keys` to browse and manage saved API keys in a full-screen menu.
Use `a` to add, Enter to replace a value, `r` to rename, and `d` to delete with
confirmation. Press `/` to search key names; Enter keeps the matches, and Esc
clears the search. Values are masked and are not shown in previews. Changes save
immediately; Esc or Ctrl+C closes the menu. Errors appear inside the menu.
In the web UI, `/keys` opens the Settings window's **Keys & accounts** section,
which lists the names, says what uses each, and asks the same steps as dialogs; a
value goes from the page to Pax, never back.
The compatibility command `/set api_key` prompts for a name and masked API key. Names are trimmed
and uppercased automatically, so `my_vllm_key` becomes `MY_VLLM_KEY`. Use letters,
numbers, and underscores, starting with a letter or underscore. Saving an existing
name asks before replacing it. Ctrl+C or Ctrl+D cancels without saving. Do not put
the secret on the command line.
Consumers store a key's name, not its value, and look it up each time they
connect, so replacing a value in `/keys` updates every consumer and a deleted key
makes them fail with an error. Renaming a key that vLLM, OpenRouter, or a
plugin uses is refused until they are pointed at another key. Several
consumers can share one entry: name keys with the conventional variable name for
the service, such as `LINEAR_API_KEY` or `GITHUB_TOKEN`, and every plugin for that
service can pick the same entry. The names are labels only; Pax does not export
them as environment variables.
When saved keys exist, vLLM's token prompt and OpenRouter's **Enter API key** flow
show a searchable list of names. Choose one, enter a different key privately, or
choose **No API key** for vLLM. Esc closes the picker without connecting. Browser
login flows are unchanged. Select keys only for endpoints you trust.
Named keys use the existing credential backend, separate from provider logins and
SQLite settings. If no OS keyring exists, Pax warns that it saved them in the
per-user `0600` plaintext file `credentials-api-keys.json` in its config directory.
Key values never appear in the picker or confirmation. Names are labels, not
exported environment variables. Selecting a saved key stores a reference, not a copy. Discovery and each new
turn resolve its current value. Replacing a key updates connections that reference
it. Deleting it makes those connections fail until you restore the same name or
reconfigure them. Keys referenced by saved connections cannot be renamed. A cross-process lock
serializes key changes and connection saves so concurrent Pax sessions do not
overwrite each other's key edits. The lock file contains no credentials.
Existing connections with inline credentials, manually entered connection keys,
and browser logins remain unchanged. To switch an existing connection to a
reference, reconfigure it through `/model add` and select a saved key. Changes do not
alter an already running request or revoke credentials at the provider.
### Usage and cost
`/usage` prints a table of the current conversation: one row per turn with the
request count, input tokens, cache read and write tokens when a turn used them,
output tokens, and cost, followed by a totals row. `/cost` prints the retained
history's total on one line. Both are derived from the retained messages, so
`/new` resets them, and a cancelled turn's partial responses are counted.
Compaction drops older responses from these totals; summary requests are not
included. These are not lifetime spending totals or a billing ledger.
Prices come from core's genai-prices data for the response's model and provider.
When there is no price data (a local model, `openrouter` and `vllm` models it
does not list, or an unreleased model), the cost cell reads `unknown` rather
than zero, the line under the table names the model, and only the cost total
excludes those responses. Their requests and tokens remain in the usage totals. Cost is shown to four decimal places; a nonzero amount below that
reads `<$0.0001`. There is no spending cap here; use the agent's `UsageLimits`
for that.
When a provider response omits usage information, `/usage` and `/cost` mark the
known token and cost totals as lower bounds. The response count is still
included in the request total, and it is not listed as missing price data. The
footer prefixes a known retained-history cost with `>=` while any retained
response has omitted usage information.
## The prompt
### Keyboard setup
Run `/input` to choose Mac, PC, or neutral key labels and configure **Send**,
**Steer**, and **Newline**. The launch hints name `/input`.
The defaults stay Enter to send or queue, Alt/Option+Enter to steer, and a
distinctly reported Shift+Enter to insert a newline. Ctrl+J inserts a
newline, including in custom question answers, except on
[Windows](#windows-terminal), where Ctrl+Enter and Ctrl+J steer with whatever
key you bind to **Steer**.
Mac labels use Return, Option, and Cmd, including modified Return bindings.
PC labels name the Super key Win; neutral labels call it Super.
Keyboard labels describe your keyboard, not the remote server's OS. Choosing Mac
cannot recover a modifier lost by your terminal, SSH client, or multiplexer.
Choose **Test a key**, or run `/input test`, to see the actual decoded key and its
effective action. No prompts, steering, or interrupts execute during testing;
paste contents and your draft stay out of the report. Ctrl+G closes the test.
Text typed or pasted during testing stays in the draft; control keys are tested,
not executed. No probe runs without this explicit action.
If Shift+Enter or Option+Enter reports Enter, it is indistinguishable from Enter
on that connection. Test Ctrl+J for newline or another offered binding before
remapping. Ctrl+M, Ctrl+Enter and Ctrl+Shift+Enter act as Enter (Ctrl+Enter
steers on Windows), so they cannot be bound separately; `/set` rejects bindings that collide. In `/input`, choosing a
key another action holds swaps the two, so Enter can become the newline and Alt+Enter send; resetting one action
swaps the same way when another action holds its default. Unsupported shortcuts are refused
rather than silently taking over editing keys. The hint row below the composer follows effective
bindings. It appears once you change an `input.*` setting, and while a question waits in the composer.
`/input` and `/set` can edit or reset `input.keyboard_labels`, `input.bindings`,
`input.question_submit`, `input.questions`, and `input.busy_delivery`. `/input reset` resets all five. These are user-only
preferences, not project settings. A remap affects the composer and focused
questions, not unrelated full-screen menus or the browser's shortcuts.
### Prompt area
```text
Follow-up: Add tests for the change
Command: /usage
─ Working ⠋ 12s · Esc to interrupt ─────────────
/
/resume Browse or restore a saved session; claude or codex imports theirs
/set Change settings; no arguments opens menu
────────────────────────────────────────────────
model | context: ... | running: shell
```
The prompt sits above the footer with one editable line when empty, after a `❯ `
marker in the theme's accent colour; wrapped and multiline text is indented to match. It grows
for wrapped or pasted text, not to fill the terminal. Text pastes of five or more
lines, or at least 1,000 characters, display as `[paste N lines]`. The full text
is still submitted and saved in input history. Move the cursor inside a folded
paste to reveal it for editing; recalled history shows the full text.
While a turn or command runs, the rule above the draft shows how long it has run
and that Esc interrupts it; with a draft or a queued message it also shows the
queue and steer keys, which keep their place first on a narrow terminal. While you
edit a queued message, it shows the keys that finish the edit instead.
A turn that finishes ends with a muted `Done in 12s` row; an interrupted one with
`Interrupted. Type what to do instead.`
Each submitted prompt is echoed into the transcript after a `>` marker in the theme's
accent colour, with the prompt text in bold and every row after its first (wrapped or
its own line) indented under the text. This keeps your prompts apart from answers.
Steering messages, commands entered during a turn, and prompts restored by `/resume`
look the same. An answer you type to a question gets the same marker and bold text,
without the indent. Under a bundled palette, on a terminal that advertises 24-bit
colour, all of these also sit on a grey background; see [Themes](#themes).
Completion suggestions
appear below the draft, between the top and bottom rules. The rows carry no
side borders, so they cannot drift out of alignment.
History search stays compact too. The bordered prompt area stays visible below
streamed output while Pax works, and remains editable. A `Working` label and
animated spinner, in the same pink accent as tool names, appear in the box's top border while a turn or its lifecycle
hooks are active, without adding a row to the input area. The animation uses the editor's existing refresh
cycle and disappears when work finishes, fails, or is cancelled. It is not part
of your draft or submitted message. Pax starts compact, below what your shell already
printed, and grows with the session as output arrives. Until then the terminal keeps its
own scrolling and text selection, and Ctrl+L forgets the transcript but leaves your
shell's output above it. A slash command or `!` command run between turns prints the
conversation so far into the terminal's scrollback, where it stays even after `/clear` or
`/resume`, and the compact editor comes back below the command's output. Once the
session fills the terminal, you change the terminal's width or make it shorter, or a
command, menu, or question takes over the editor during a turn, or you press Ctrl+O while
command output is already in the terminal's scrollback, the editor sits below a Termflow live
transcript panel on the alternate screen, for the rest of the session.
`/set display.full_screen true` starts there instead, from the next start. The rest of this section describes that panel.
Both partial and completed output paint above it without repainting unchanged
input cells. PageUp/PageDown and the mouse wheel scroll the transcript without
changing the draft. While scrolled back, `↓ more below · PgDn` shows in the rule
below the draft, covering no transcript text. New output leaves a scrolled view in
place; returning to the bottom or submitting follows new output again. Ctrl+O shows or hides
the full output of commands in place (see [How tool calls look](#how-tool-calls-look)). Ctrl+L clears the screen, as in
Claude Code: the transcript is forgotten, but the conversation, your draft, and
queued messages stay. During a turn, the response still streaming keeps showing.
Use `/clear` to start a new conversation instead. Drag with the mouse to select
text, double-click to select a word, or triple-click to select a line; a line the panel
wrapped counts as one, and its copy has no line break where it wrapped. Dragging after a
double- or triple-click extends the selection by words or lines. Releasing the button
copies the selection to the clipboard and the footer says so. A click on a URL opens it,
and a double-click on one selects instead of opening it again.
Locally Pax copies with `pbcopy` on macOS, PowerShell on Windows, and `wl-copy`,
`xclip`, or `xsel` on Linux. Over SSH, or without one of those, it asks the
terminal to copy with OSC 52, which some terminals need enabling first (iTerm2:
*Applications in terminal may access clipboard*; tmux: `set-clipboard on`).
Holding Shift (Option in iTerm2) still uses the terminal's own selection in most
terminals. On exit, Pax prints the retained
transcript into native terminal scrollback, without output cleared by Ctrl+L. Typing updates the draft row; a
nonblinking highlighted cell marks the cursor. Full-screen menus temporarily hide it along
with the editor. By default, Enter submits a message to an in-memory queue.
Pending text appears above the editor as `Follow-up:` previews, with queued
slash commands labeled `Command:`; in next-checkpoint mode they read
`Follow-up (after turn):` and `Command (after turn):`. Previews are shown in
execution order and disappear as each submission starts. Long or multiline messages
have a single-line preview; large queues show a `+N more queued` summary to leave
room for the editor. The original message text is unchanged. The footer also shows
the number waiting when the `queued` footer field is visible, excluding the entry held for editing. Press F4 for visible
**Edit**, **Remove**, **Steer**, and **Delivery** controls.
Up/Down chooses an entry; `e` edits, `d` removes, `s` steers, and Esc closes without
interrupting. Any other key closes the panel and acts as it would without it, so typing keeps its letters. Edit shows **Editing - won't send while you edit it**.
The held entry cannot run and keeps its reserved ordering slot. The send key
**Save/requeue** returns it to that slot in after-turn mode. In next-checkpoint
mode, the send key opens **Choose delivery**, described below. Esc, **Stop editing**,
restores the original entry unchanged, unless you cleared it to remove it.
The steer key explicitly sends eligible text to the active run. If no run accepts
it, after-turn mode sends/queues it as usual; next-checkpoint mode asks instead.
Saving or stopping the edit restores your earlier composer, including cursor and undo history. An entry
that has already run cannot be removed or steered accidentally in its place.
Up also recalls queued messages (see Up/down above). Control bytes in completion-derived
text are escaped in previews and prompt echoes; the submitted text is unchanged.
With the default `input.busy_delivery=after-turn`, messages and slash commands
run in submission order after the current turn and cleanup finish, including
after an interrupt; queued entries do not steer the active turn.
For new busy composer prompts, press F4 then `m` to switch delivery persistently,
or use `/set input.busy_delivery next-checkpoint`. **Next checkpoint** transfers
the prompt to the active run through native steering, without cancelling current
work. It waits for current tool work, including parallel tools and explicit
approval questions, then reaches the next feasible model request. If a response
would end the run, native enqueue requests another response. It cannot change a
request already sent. Accepted prompts show a **Next checkpoint (sent to active
run)** preview and join the transcript; they are no longer editable queue entries.
This never answers a question or approves a tool.
With older queued entries or a saved edit, **next-checkpoint** mode asks before
changing delivery order. The draft stays intact and the held edit stays non-runnable:
- `s` **Steer/promote** sends only the eligible draft text at the next checkpoint.
Earlier queued entries keep their after-turn timing; this explicitly bypasses them.
- `q` **Keep queue position** chooses after-turn delivery, or a separate turn if
work has already ended. A saved edit retains its stable ID and reserved slot.
- Esc or Ctrl+C cancels the delivery choice, preserving the draft/edit. Cancelling
the edit itself is a separate Esc action after closing this choice.
If steering is unavailable, the draft and choice remain; nothing silently changes
to after-turn delivery. Pasted text and same-batch typeahead cannot select a delivery
action. Commands and shell lines retain their explicit routing and are never steered.
Delivery actions never answer questions or approve tools.
Changing delivery mode does not promote existing entries. F4 opens delivery controls
even with an empty queue, showing only the delivery mode then. `/input` and `/set` also edit/reset the preference; reset
restores `after-turn`. Bare settings menus such as
`/set` are the exception: they open during the turn (see "Settings and commands"). An unsubmitted draft stays
in the editor as turns finish. Queued messages are not saved as conversation turns
until execution starts, and are discarded on exit or `/reload`.
Full-screen question menus and slash-command menus temporarily take over input.
The editor and its draft return when the menu closes. With `input.questions=composer`,
questions do not take composer focus: see [Questions from the model](#questions-from-the-model).
Small terminals omit the border to leave room for output.
### Pasting images
Copy a screenshot or image, then press **Ctrl+V** in Pax to attach it. If your
terminal intercepts Ctrl+V, use **Alt+V** (or press Esc, then V). On macOS, Cmd+V
is the terminal's text paste, not Pax's clipboard-image shortcut.
You can also paste or drag local image file paths into the prompt. This requires
the terminal's bracketed-paste support. A paste containing only existing image
paths becomes attachments; ordinary pasted text stays text. Quoted paths and
paths containing spaces are supported. UNC and device paths are not read. PNG, JPEG, GIF, WebP, BMP, and TIFF files
are read locally and converted to PNG (the first frame of animated images).
Each image appears as `[image:...]`. Add your question and press Enter, or submit
the image alone. Delete a marker before submitting to remove that attachment.
Images in queued follow-ups belong to that follow-up, not the running turn.
Paste errors appear in the footer without submitting a message. They clear after
30 seconds, even without keyboard input, so the status row can return. Each new
paste error starts its own 30-second lifetime. Expiry preserves your draft,
attachments, and queued input; it does not clear a newer notice. Successful
attachment feedback and unrelated notices do not use this timeout.
Clipboard access uses Pillow's native Windows and macOS backends. On Linux,
Pillow uses `wl-paste` (from `wl-clipboard`) for Wayland or `xclip` for X11.
If the active desktop backend's binary is missing, Pax names the package to
install. It includes an installation command only when it recognizes your
Linux distribution and finds its package manager; otherwise, use your
distribution's package manager.
If an installed backend cannot read the clipboard, check access to the graphical
session or, over SSH, your remote clipboard bridge. Installing the package again
does not restore that access. A working remote bridge can provide clipboard
images in a headless session. Alternatively, paste a path to an image accessible
on the machine running Pax. The clipboard is read only when you invoke the
image shortcut.
Use a model that accepts images. Pax sends the image bytes to the selected model;
provider-specific size and format restrictions can still apply. Each source file
and encoded attachment is limited to 10 MiB and 25 megapixels, with 32 MiB of
pending image bytes. An image larger than 1024 pixels on its longest side is
downscaled to that before it is attached. Accepted images are saved with the conversation and restored
by `/resume`. Input recall stores markers, not image bytes: paste the image again
if you recall an expired marker. If submission is rejected because no model is
selected, the most recently rejected prompt keeps its attachments for retry. Unsubmitted images are discarded on exit or reload.
In the [web UI](../PLUGINS.md#web-this-session-in-your-browser), from `/web` or `pax --web`,
paste an image into the composer with your browser's usual paste (Cmd+V or Ctrl+V), or drop image
files on it. Each shows as a thumbnail above your text; hover one and click its **×** to remove it.
Text copied together with a picture of itself, as from a spreadsheet, pastes as text. The page
scales an image larger than 1568 pixels on its longest side down to that, about as far as models
scale it anyway, so each image fits the 10 MiB limit once converted, and turns a format Pax does
not read, such as HEIC or SVG, into PNG when the browser can draw it. The images are sent with your
prompt, or alone, and Pax checks and converts them to PNG with the same limits as above; a photo
can grow severalfold as PNG, so send fewer at a time if the 32 MiB limit refuses them. Unsent images stay with each session's draft until you reload the page.
The transcript shows each sent image as a thumbnail in your message, also after a reload or `/resume`.
The preview of a saved session that is not open, and a delegated task's transcript, show `[image]`
instead.
### Input history
Down past the newest recalled entry restores your unsent draft. If that draft
was nonempty when you started, it returns even after you edit recalled text,
including deleting all of that text. The edited text remains recoverable with
[undo](#undo-and-redo). Starting with an empty draft makes the edited text your
new draft instead. Editing the restored draft ends the walk; the next walk
returns to that edited draft.
Enter on an edited queued message still saves it in place. Returning to your
original draft first leaves that queued message unchanged; Enter then submits
your draft as a separate message.
Submitted prompts and slash commands persist across restarts for Up/Down recall,
including multiline input. They are stored as plaintext in `input-history` next
to `config.db`: `$XDG_CONFIG_HOME/pydantic-ai-pax/input-history`, or
`~/.config/pydantic-ai-pax/input-history` by default. On POSIX the file is restricted
to its owner (mode 0600). Avoid entering secrets in the prompt: input history is
not encrypted. Delete this file while Pax is closed to clear saved input.
`/clear` (alias `/new`), or bare `clear`, starts a new saved conversation, without
deleting the previous one or input recall, and clears the screen back to the startup
banner. Model responses and tool results are not saved to this file.
### Word deletion
Option+Backspace (Alt+Backspace) deletes the word before the cursor, like Ctrl+W,
including trailing whitespace. Spaces, tabs, and newlines separate words. Text
after the cursor is preserved. Your terminal must send Option as Alt/Meta for
this shortcut; legacy and modified-key encodings are supported.
### Undo and redo
Ctrl+Z undoes the last change to your draft on macOS, Linux, and Windows. It
brings back text removed with Backspace, Delete, word deletion, Ctrl+U, Ctrl+K,
or Ctrl+C, and takes back a paste or a history recall. Typing undoes a word at a
time, and a run of Backspace or Delete presses undoes in one step. Ctrl+Y or
Ctrl+Shift+Z redoes. Pax keeps the last 100 steps; submitting a message starts
the next draft with none.
If Down restores a nonempty draft after you edit recalled text, undo brings back
the edited text, and redo returns to the draft. Undo and redo end history
navigation; the next Up/down walk starts from the text then shown.
The editor reads keys in raw mode, so Ctrl+Z reaches Pax instead of suspending
it to the shell. Pax has no suspend shortcut; quit with Ctrl+D or `/exit`.
Without kitty or xterm modified-key reporting, a terminal sends Ctrl+Shift+Z
as Ctrl+Z, so use Ctrl+Y to redo there.
Cmd+Z and Cmd+Shift+Z undo and redo too, when the terminal passes them on. Pax
asks for kitty keyboard reporting, which reports Cmd as Super, but most macOS
terminals keep Cmd shortcuts for their own menus:
- kitty passes Cmd+Z on with no setup.
- Ghostty uses Cmd+Z to reopen a closed tab or split. Add
`keybind = cmd+z=text:\x1a` and `keybind = cmd+shift+z=csi:122;10u` to its config.
- WezTerm: set `config.enable_kitty_keyboard = true`, or map SUPER+z to
`wezterm.action.SendString '\x1a'`.
- iTerm2: in Settings > Profiles > Keys > Key Mappings, map Cmd+Z to
*Send Hex Codes* `0x1a`, and Cmd+Shift+Z to *Send Escape Sequence* `[122;10u`.
- Terminal.app, VS Code, and tmux: use Ctrl+Z, or map Cmd+Z to `0x1a` in the
outer terminal as above.
### Option keys on macOS
Pax asks the terminal to report modified keys, so Option+Enter (steer) works in
Herdr, and in iTerm2 even with its default Option key setting. If Option+Enter
still queues the message like Enter, the terminal is sending a plain Enter:
- Terminal.app: turn on Settings > Profiles > Keyboard > Use Option as Meta key.
- tmux: tmux forwards Alt+Enter, but does not pass Pax's request on to the
outer terminal. Set that terminal to send Option as Alt, for example iTerm2's
Settings > Profiles > Keys > Left Option key: Esc+. Herdr needs no setup.
- For Shift+Enter (newline) inside tmux, add `set -g extended-keys on` to
`~/.tmux.conf`. Without it, tmux sends Shift+Enter as Enter.
### Windows Terminal
Windows Terminal and the Windows console take Alt+Enter to toggle full screen,
so on Windows Ctrl+Enter steers instead, and the input box shows Ctrl+Enter.
Pax treats a session as Windows when it runs on Windows or when `WT_SESSION`
is set, which Windows Terminal also passes into WSL. Alt+Enter still steers
wherever it reaches Pax, and elsewhere Ctrl+Enter works like Enter.
Terminals that do not report modified keys send Ctrl+Enter as Ctrl+J, so on
Windows Ctrl+J steers too. Shift+Enter inserts a newline when the terminal
reports it separately from Enter, such as Windows Terminal 1.25 or later.
Older terminals send Shift+Enter as Enter, so there a newline needs a paste or
a terminal that reports modified keys.
SSH does not forward `WT_SESSION`, so a remote session started from Windows
Terminal has no working steer chord. Set `WT_SESSION` on the remote host, for
example with `export WT_SESSION=1` in the shell you start Pax from.
### Interrupting a turn
Press Esc or Ctrl+C to cancel the active agent turn without discarding your draft.
Queued messages, slash commands, and `!` shell commands stay queued and run next, in
the order you queued them. While you edit a queued message, the first Esc stops
editing instead of interrupting. Ctrl+C interrupts and ends the edit as Esc does:
the message goes back to its place unchanged, since only Enter saves an edit, or is
removed if you cleared it. Up finds your edit in history, and the draft you had
before pressing Up comes back.
Tool cleanup finishes before the next queued message starts. Esc does not request
exit, even when pressed repeatedly. Arrow keys and Alt+key shortcuts keep their
editing behavior. The active full-screen interface retains control of Esc rather
than passing it to the agent turn; its behavior depends on that interface.
After cancelling with Ctrl+C, press Ctrl+C again within two seconds to exit,
including across the transition back to input. Esc does not arm this exit shortcut.
At the prompt,
the first press clears input and the second exits. Ctrl+D on an empty input and
`/exit` also quit after earlier queued messages finish.
The interrupted prompt and captured partial responses and tool results stay in
conversation history, so you can follow up with a clarification. No interrupted
run is automatically retried. Unanswered tool calls in retained failed or
interrupted turns are closed out by core on the next prompt, without replaying
those tools. External application cancellation still propagates, and completed
tool side effects cannot be undone.
### Rewinding a conversation
Between turns, press Esc twice within half a second to open **Rewind conversation**.
Use Up/Down to choose an earlier prompt, then Enter to rewind. The newest prompt
is selected first. Esc or Ctrl+C closes the menu without changing your draft or
conversation. An empty conversation shows a disabled placeholder.
Rewinding removes the selected prompt and all later messages from the saved
conversation, then restores that prompt and its image attachments to the editor.
This replaces any unsent draft and its attachments; cancel the menu to keep them.
Edit the restored prompt and press Enter when ready. It does **not** undo file changes or other
tool side effects, roll back code mode's saved sandbox state (the model can pass
`restart: true` to clear it), replay tools, or erase the terminal scrollback. Only prompts
still present in the retained history are available. Prompts predating retained
rewritten context, such as a compaction summary, are disabled even if compaction
kept a copy of the prompt. That summary can contain later facts, so the original
rewind boundary no longer exists. Prompts with attachment types the editor
cannot restore are also disabled.
A press that cancels a running turn, closes completions, or leaves history search
does not count toward the shortcut. Wait for queued prompts to finish first.
Typing another key or opening another menu resets the double-Esc sequence.
In the web UI, a prompt's **Edit** and **Retry** buttons rewind to it the same way, between turns,
and send the edited or unchanged prompt with its images at once.
### Shell commands with `!`
A line that starts with `!`, after trimming surrounding whitespace, runs in the
system shell instead of starting an agent turn:
```text
> !git status
$ git status
Shell command and output saved for the next prompt
...
Done (0.1s)
```
The command runs through the system shell (`/bin/sh -c` on POSIX, `cmd.exe` on
Windows), not your login shell, so zsh or fish syntax and shell aliases are not
available. It runs in the session's directory. Stdout and stderr are captured
separately and displayed as they arrive. Pax reports `Done` or the exit code
with the elapsed time.
When Pax runs on a terminal on macOS or Linux, the command runs on a
pseudo-terminal of its own, as it would in your shell. What you type while it
runs goes to it and, as in a shell, is echoed into its output, so prompts such as
`read`, `rm -i`, or a `sudo` password work.
Programs see a terminal: Pax sets `PAGER` and `GIT_PAGER` to `cat` so `git log`
prints instead of paging, and drops colours and other terminal control sequences
from the transcript. Elsewhere, such as on Windows or with input piped into Pax,
the command's stdout and stderr are pipes and it reads the terminal's input
directly.
Ctrl+C interrupts the
command and returns to the prompt. On POSIX the command runs in its own session,
so Pax forwards the Ctrl+C to its process group, and 0.25 seconds later (as
`subprocess.run` waits) kills whatever is still running there, including
background jobs and programs that ignore Ctrl+C. Only a process that detaches
on purpose with `setsid()`, as daemons do, outlives the command. Detached jobs
should redirect stdout and stderr: Pax stops collecting their output shortly
after the shell exits. On Windows the console
delivers the Ctrl+C, and `taskkill` then ends the command's process tree. As at other times, a second Ctrl+C within two seconds exits
Pax. The command, stdout, stderr, and completion status are saved in the
conversation for the model's next turn, including partial output from interrupted
commands. Each stream retains up to 100,000 characters, with a truncation notice
when it exceeds that limit; all output continues streaming to the terminal.
Running a command does not request a model reply. This context survives
`/resume` without re-running the command; `/new` starts without it. Do not use `!`
for output you do not want saved or shared with the model.
#### Full-screen and interactive commands
A full-screen program, such as `!nano .env`, `!vim`, `!git log | less`, `!htop`,
or the editor `!git commit` opens, gets the terminal to itself:
```text
> !nano .env
$ nano .env
Shell command and output saved for the next prompt
Full-screen command: only its exit status is saved
Done (12.4s)
```
Pax needs no list of programs for this. Full-screen programs switch the
terminal to its alternate screen when they start, and on the pseudo-terminal
above Pax sees that happen. At that moment Pax takes its own display off the
screen and passes the program's output and your keys, Ctrl+C included, straight
through. Window size changes reach the program too. When it exits, Pax redraws
its screen. Output printed before the switch appears in the transcript; nothing
is saved for the next prompt but the command and its exit status.
A program that is interactive without a full screen, such as the `python` REPL
or `ssh`, runs in the transcript, where line editing shows as redrawn text. Start
it with `!!` to give it the terminal from the start: `!!python`, `!!ssh host`,
`!!./install.sh`.
```text
> !!python
$ python
Interactive command: it has the terminal, and its output is not saved
Done (42.0s)
```
Pax leaves its screen, restores the terminal's normal input mode, and runs the
command with its own input, output, and error streams, in Pax's process group.
The command gets Ctrl+C and window size changes itself; Pax ignores Ctrl+C
until it exits. When it exits, Pax restores the terminal's modes and redraws
its screen. Anything the command printed outside a full screen stays on the
terminal's main screen, which Pax covers again. Only the command and its exit
status are saved. On Windows, the command shares Pax's console in the same way.
Without `!!`, a full-screen program on Windows cannot draw, because its output
is a pipe.
#### In a sandbox
In a [`/sandbox`](#sandboxes-sandbox) conversation, a `!` line runs in the sandbox, where the
agent's commands run, not on this machine:
```text
> !git status
$ git status
Runs in the Daytona sandbox; command and output saved for the next prompt
...
Done (0.8s)
```
It runs with the sandbox's shell in the sandbox's copy of the checkout, with the keys the agent got there
with `request_env`. The output shows once the command exits, not as it arrives, and the command gets no
input from you. Ctrl+C stops it. If the sandbox fails the command, or was deleted, Pax says so; the line
never runs on this machine instead. `!!` needs this terminal, so in a sandbox Pax refuses it and saves
nothing. The command, output, and status are saved for the next prompt as on this machine.
A bare `!` or `!!` is sent to the agent as an ordinary prompt. Queued `!` lines
run in order with other queued input. `/help` lists the syntax.
## Output
### How tool calls look
Tool calls show a single-line summary by default, then any result row, then a blank line.
Tool and argument names are pink; argument values and bullet markers are muted grey.
Successful file writes and edits also show their diffs, even with `display.tool_output` off.
A finished shell command always adds one result row under its header, such as
`⎿ exit 0 · 23 lines`, or `⎿ running in background · log PATH` for a background command.
A nonzero exit is red. The row shows the path of the command's log when the command keeps
running or its output was cut. A call of any tool that fails or is refused gets a red row with
the first line of the reason; a file change you refuse says `refused` and why, and a call whose
arguments did not validate says `invalid arguments`. When calls run in parallel, a row that
does not sit under its own header ends with the command or call it belongs to. A row too wide
for the terminal is clipped at its end; a log path after it wraps instead, so it stays whole. Other shell
output and grep results stay out of the terminal; the model still receives full tool results.
Long summaries are clipped to the terminal width.
Use `/set display.tool_output true` to show shell and grep details, or
`/set display.tool_output false` to hide those details without hiding file diffs. With `display.tool_output` on,
`display.shell_lines` and `display.grep_lines` limit previews to 20 lines by
default. Plugin-provided rendering, including interactive questions, is unchanged.
In the interactive prompt, Ctrl+O shows the output of every finished command in the transcript
under its result row, and hides it again. A row whose output is hidden ends with
`ctrl+o to expand` when the row has room. The output is what the tool returned to the model,
with secrets masked: the end of a long output (about 16 KB), marked where earlier output was left
out, and the full output stays in its log. Results that arrive later, while the output is shown,
open shown too. `pax -p` and redirected output are unchanged.
In the interactive prompt, consecutive calls of the read-only file tools (`read_file`, `file_info`,
`list_directory`, `list_files`, `find_files`, `search_files`, and `grep`), direct or from inside
`run_code`, share one line that grows as they arrive, such as
`● Explored 3 files, 2 searches, 1 listing · ctrl+o to expand`. Ctrl+O lists each call under it,
with the arguments its own line would show. Any other tool call, visible text or thinking, a diff,
or a failed call's row ends the line, and the next such call starts a new one. A `grep` keeps its
own line while `display.tool_output` shows its results. `pax -p` and redirected output print one
line per call. When `run_code` calls tools while it is still being written, those calls are its
lines and no `● run_code` header is printed; a snippet that calls no tool shows `● run_code` and
its code.
To count calls instead of listing them, run `/set display.tool_calls grouped`. Consecutive calls share
one live line, such as `● shell 4, grep 2, shell 3`. A count grows in place and is final once a different
tool or other output follows. The `grouped` style shows only names and counts, so it ignores
`display.tool_output` and `display.tool_arg_chars` and prints no result rows. File edits and
writes still print their summary and diff, which ends the line.
`/set` previews the headers of both styles when you pick one, without result rows.
The default is `detailed`, one line per call, except that file reads, searches, and listings
share one.
### Streaming
Streaming uses the defaults from [Code Puppy's smoothing adapters](https://github.com/mpfaffenberger/code_puppy/blob/a862bf478b63822c9d97093f81e4f827e1c53d6e/code_puppy/agents/smooth_stream.py):
- Markdown uses Termflow `SmoothWriter`: 12 ms ticks, 0.5-second catch-up,
minimum one visible character per tick. Markdown is parsed line-by-line.
- Reasoning runs through the same Markdown pipeline with Termflow's dim
renderer, at Code Puppy's thinking pace: 20 ms ticks, 0.4-second catch-up,
minimum two characters per tick. The `Thinking` heading ends without a
newline, so the first rendered reasoning line continues on the heading's row.
- Both writers feed the live transcript panel. Output paints at up to 60 frames
per second; changed cells do not clear the input box.
- Smoothing applies only to interactive terminal output. Redirected output is
written directly. When a part ends, the text still queued is written at once,
so the next heading, tool status, or prompt does not wait for it to be typed.
`/set display.smooth_seconds 0.5` restores the Code Puppy response catch-up
window if you previously saved a slower preference. This response-only setting
accepts 0.1 to 5 seconds; thinking retains its separate 0.4-second window.
Empty thinking parts show no heading. The CLI disables core's first-run
observability banner.
Cancellation discards queued output. Incomplete Markdown lines are still buffered
until a newline or part end; smoothing does not remove that parsing delay.
Thinking signatures without text cannot be shown. A supplied agent's existing
stream handler is preserved. Custom renderer integrations must await `finish()`
and use `await abort()` on cancellation.
Response and thinking parts end with a blank separator line; responses have no
repeated Pax heading. Intermediate text is flushed when a tool-call part begins,
before the tool's arguments finish streaming. Incomplete lines within a text part
still wait for a newline or part boundary, as in Code Puppy's Markdown path.
Tool calls print once with a filled-circle marker and the tool name, followed by one blank line. Tools
without a specialized summary list their arguments after the name as `name=value` pairs, with pink names and
muted compact-JSON values. Each value shows at most 40 characters by default; `/set display.tool_arg_chars 80`
changes the next turn's limit (0 to 1000; zero hides arguments). The whole line is truncated to one terminal row. Completion activity remains in the footer
rather than adding a separate `Finished:` line to the transcript.
With `/set display.tool_calls grouped`, each call adds to a streak of the same tool on one line instead
of printing its own: `● shell 4, grep 2, shell 3`. On a terminal the line is redrawn from column zero
as each call arrives, so the last count is final only once another tool, visible text or thinking, a diff, or a widget follows.
In the interactive prompt the line keeps counting above anything printed meanwhile, such as a command typed
mid-turn. A tool that no longer fits the row starts the next line. Elsewhere the line prints once, when it ends.
The `grouped` style ignores `display.tool_output` and `display.tool_arg_chars`, and hides shell
command output and result rows.
`edit_file` and `write_file` calls are not counted: they print their summary and diff as in the `detailed` style.
The setting applies to the next turn.
Markdown tables keep their words whole where they can. A table too wide for the terminal
wraps its cells only between words, and every column is at least as wide as its longest word.
When those words cannot sit side by side, each row is shown as its own block of
`Header: value` lines, with a rule between rows; only a word wider than the terminal is
split. Resizing lays the table out again for the new width. `TERMFLOW_MAX_TABLE_WIDTH`,
if set, caps both layouts.
Markdown link labels are clickable in terminals that support OSC 8 hyperlinks.
The URL stays visible beside the label for other terminals and redirected output.
Bare `http://` and `https://` URLs, and `` autolinks, are shown in the
link colour and are clickable too; URLs inside code spans are left as code.
URLs longer than 2,048 characters are shown without clickable metadata to limit
streaming output size.
Links survive viewport resizing; following one uses your terminal's usual click
modifier (often Cmd+click or Ctrl+click).
Sign-in links are clickable too: the URL `/login openai-codex` prints, and URLs on
a sign-in waiting screen, where a URL too long for the pane is folded over several
rows that each link to all of it.
### Code highlighting
Fenced code uses the fence's language for syntax highlighting. In the interactive
prompt each code line shows as it arrives, highlighted on its own, so a line inside
a multiline string or comment can be coloured as code for a moment. When the
closing fence arrives, or the text part ends if the fence is unfinished, the whole
block is highlighted again in place, so multiline strings and comments end up
correctly coloured. Everywhere else, such as `-p`, redirected output or a resumed
session's history, the block prints once, at that point. Unlabelled and Markdown
fences stay literal, including indentation and blank lines; unknown languages use
plain text. Long code lines wrap to the terminal width. Response and reasoning code
blocks use the terminal foreground and ANSI syntax colours, rather than pale
text intended for a dark background. Bundled themes supply their own ANSI colours.
### Grep previews
Grep calls display the expression and path. Results show the first 20 logical
lines by default; `/set display.grep_lines 10` changes the next turn's preview
(0 to 1000). `Truncated N result lines` counts returned lines hidden by the UI,
including context lines. If the tool itself capped the search, a separate notice
states that the additional result count is unknown. No matches is shown explicitly.
The model still receives the original tool result.
Shell output is rendered one completed line at a time. Carriage-return progress
updates replace the buffered line rather than printing control-code text; the last
update appears at newline or tool completion. CRLF works across chunk boundaries.
Long display lines are ellipsized to terminal width. The command itself wraps
under a hanging indent, keeping its own line breaks, up to 10 terminal rows; a
count summarizes any rows beyond that. The command is highlighted as Bash, in the
colours of fenced code but dimmed and without underlines, so it reads as secondary
to the answer. Code inside it uses its own language: a heredoc body
takes the language of the command reading it (`python - <<'EOF'`, `psql < probe.py <<'EOF'`), or of a delimiter such as
`PYEOF`, and the quoted code of `python -c '...'` or `node -e '...'` is Python or
JavaScript. A heredoc in an unknown language stays grey.
Full output remains in the log; display formatting does not alter model results.
### Shell preview limit
Shell output defaults to the first 20 logical lines per command. Change it with
`/set display.shell_lines 50` (0 to 1000; zero hides output). The setting applies
to the next prompt. After the command returns, its result row counts the lines in the
log snapshot at that time and how many the preview showed, as in `exit 0 · 200 lines, 20 shown · log PATH`,
including an unterminated final line. When the preview is cut, by this limit
or by the capability's 16 KB event preview cap, the row shows the log path, where the full
output remains. Background commands can keep writing
after the snapshot; those future lines are not included in its count.
Read headers show the path and, when the model set them, the lines read, as in
`lines 20-34` or `from line 20`, numbered like `read_file`'s output (Coder
default and maximum limit: 2000). Listing headers show the directory, recursive mode,
result limit (default 200), and optional glob. Coder listings recurse using
ripgrep and honor ignore rules. These displayed defaults describe Coder tools.
Read and listing calls add no result row on success.
File-write/edit headers include the path on the same line as the tool name.
Shell headers include the command on that line. Arguments use cyan, with no
repeated completion heading before the diff or output.
### Tool details
File diffs are shown regardless of `display.tool_output`. Native capability events
drive specialized output: `FileEditedEvent` renders its bounded unified diff using
Termflow `DiffRenderer`, the same renderer Code Puppy
uses. The default appearance keeps Pax's existing addition and deletion
backgrounds; bundled palettes use Termflow's defaults. Both use brighter markers.
Code uses the terminal foreground and ANSI syntax colours on the terminal
background. Successful file writes also show the proposed diff from their matching
`FileChangeRequestedEvent`: new files show additions, overwrites show before/after
changes. Without a matching request event, only the written path is shown. Failed
or cancelled writes do not display a success diff. Large diffs retain the
filesystem's truncation notice. Coder shell events show the command, attached
combined output, exit status (or background state), and durable log paths. Output
is capped by the capability and truncation is marked. The standalone `Shell`
capability does not yet emit these Coder-specific shell events.
Terminal control characters in model text and diffs are escaped before rendering.
Shell output permits ANSI SGR color/style sequences, decoded into Rich text rather
than passed directly to the terminal. Styles persist across chunks and lines per
command; cursor movement, clipboard commands, and other controls remain escaped.
Plain shell output stays dim. ANSI generated by Termflow itself is retained.
### Status line
Open `/set`, then select `display.footer_fields` to open **Main footer layout**.
It uses the shared settings submenu in the terminal and web settings. Each field
shows whether it is shown or hidden. Enter on a field offers **Show** or **Hide**,
**Move earlier**, and **Move later**. Changes save immediately and persist across
sessions. The visible **Reset layout** row restores only the shipped footer
layout, not other display or run settings. Moving a shown field skips hidden
neighbours. Show a hidden field before moving it; moving does not change visibility.
`display.footer_fields` is an ordered JSON list of visible field names. Omitted
fields are hidden; `[]` hides the footer figures, not the prompt or task panel.
The default order is:
```json
["model", "workspace", "permissions", "context", "output", "cost", "activity", "plugins", "updates", "live", "queued"]
```
Every field is independently selectable and reorderable:
| Field | Shows |
|---|---|
| `model` | Selected model, including the focused subagent's name and short task ID when its figures are shown |
| `workspace` | Working directory, abbreviated to its tail, with its `trusted` / `untrusted` state when folder trust applies; hidden when empty |
| `permissions` | The `/permissions` mode: `full access` (in the warning colour), `auto mode`, or `read-only` |
| `context` | Used and maximum context tokens, with `?` for unknown figures |
| `output` | Streamed output estimate, then reported output tokens |
| `cost` | Retained-history cost; hidden until priced usage exists |
| `activity` | Current activity, including the tool name while one runs |
| `plugins` | All plugin status fragments as one group, in registration order; hidden when empty |
| `updates` | Available-update notice; hidden when none is available |
| `live` | Live-session indicator; hidden with only one live session |
| `queued` | Queued-input count; hidden when zero |
| `assistant_age` | Time since the main assistant last emitted nonempty text; hidden until text exists, and off by default |
Reordering preserves each field's colours and conditional visibility. Plugin
fragments move and hide together through `plugins`, not as individual fields.
After a turn that sent the model an instruction file you changed, such as an
edited `AGENTS.md`, the built-in `repo_context` plugin adds `AGENTS.md updated`
to the `plugins` group until your next prompt. `/system_prompt` shows the new
text when the file went to the model as instructions. An untrusted folder's
ancestor file goes as the repository's data instead, so the notice shows and
`/system_prompt` does not list it. To hide the notice, hide `plugins`, which
hides every plugin's fragment, or turn the plugin off with
`/plugins disable repo_context`, which also stops the instruction files from
loading.
When the row is wider than the terminal, `workspace` shortens to its last folder
(`…/jsonrc`), then fields are hidden, least important first, until it fits:
`assistant_age`, `output`, `cost`, `queued`, `updates`, `live`, `workspace`,
`plugins`, `permissions`, the `context` labels, then `model`. `activity` and the context figure
always stay. The row is cut at the edge rather than wrapped if it still does not fit.
To set the list directly, keep the JSON in one quoted argument:
```text
/set display.footer_fields '["model", "context", "assistant_age", "activity"]'
/set display.footer_fields '[]'
```
New writes reject unknown field names, duplicates, non-string entries, and values
other than a JSON list. Saved and project layouts may include names from a newer
build: this build skips unsupported names, preserving their raw values when
reading or changing unrelated settings. A future-only list shows no figures.
Explicit layout replacement or reset replaces the whole saved value. Missing
settings use the default; older builds that do not know this setting ignore it
and preserve its saved value. Other invalid saved values remain errors.
`pax config reset display.footer_fields` removes the saved override.
The optional `assistant_age` field reads `last text: 2m 3s`. Only a nonempty
main-assistant text part start or text delta resets it. Empty text, thinking,
tool calls and results, user messages, and descendant activity do not. It keeps
tracking the main assistant even when the footer shows a focused subagent.
While `assistant_age` is enabled, Pax saves the observed live text time in
response metadata and restores it on resume, rewind, or conversation switch.
Disabling the field stops those metadata writes without erasing existing history.
Histories without that metadata fall back to the last nonempty textual response's timestamp. No textual response
means no age figure. It uses the existing editor refresh cycle, not another timer.
By default, the terminal footer shows the selected model, activity, latest reported
context tokens, and streamed output estimate, including text, thinking, and
string tool-argument deltas. The estimate is characters divided by four, not a
provider tokenizer count. On completion it is replaced by reported run output
usage. Context is the most recent response's reported input plus output tokens,
not cumulative conversation billing or a context-window percentage, over the
request model's context window (`128k/1m`); `?` means unavailable, such as the
window before the first request or for a model with no known window. As each request goes out, the `compaction` plugin replaces it with
that request's estimated size and paints it yellow while the history is
[over its threshold](#compacting-the-conversation); the response's reported
usage takes over when it lands. The retained-history cost (`$0.0123`) follows the
output count in the default layout, updated after each model response and hidden
until a response has price data.
After `/compact`, the footer keeps the previous figure until the next turn;
`/cost` and `/usage` read the retained history immediately.
While the main run waits on a subagent, the footer shows that subagent's own
figures instead: its name and short task ID, the model it is using, its context
over that model's window, its streamed output estimate, and its activity, such
as `Explore [abcd1234]: claude-sonnet-4-5 | context: 8k/200k tokens | ~1,204
streamed tokens | running: grep`. The newest such subagent wins, so a nested
child takes the row from its parent. When it settles, the row returns to the
next one still running, then to the main conversation, with its figures as they
were. Background tasks, and children below one, stay in the task panel and
leave the footer to the main run. A subagent's figures show `?` until its model
reports them.
The shell owns a pinned editor below a Termflow live transcript panel. It uses
Termflow's cell buffer and changed-cell painter, not a second terminal canvas or
a prompt-toolkit renderer. The hardware cursor stays hidden during input; a
nonblinking reverse-video cell marks the editing position. Status checks run ten
times per second while working and once a second while idle. Terminals shorter
than six rows or narrower than six columns omit the border. Below three rows, the draft is retained but hidden until the
terminal grows. Resizing repaints the panel at the new size and preserves the
draft and scroll position. It never erases terminal scrollback.
Assistant text and thinking retain their Markdown source and render again when
the width or theme changes. A reply still streaming keeps its streamed rows,
wrapped to the new width, and renders again once it ends. Tool and command
output rewrap at the new width, and a `/theme` change repaints their colours
role by role: muted text, errors, diff lines, and code take the new palette's
shades. Colours no theme assigns keep their original values, and so does the
Pax logo. Full-screen menus temporarily leave the panel and detach its
keyboard reader. Output arriving during a menu stays in the transcript and
appears when the menu closes. Inline questions borrow the panel. The transcript includes
startup and plugin lifecycle notices and is carried across shell reloads.
It retains up to 10,000 items and four million characters, plus a bounded partial
line. Old output is dropped at those limits; oversized Markdown parts keep their
rendered tail instead of their source. `/clear` and `/new` forget earlier output,
so neither the panel nor the exit printout shows it again. Hyperlinks are
preserved in that printout. On the full screen, a click on a link in the status row, such as
`watch live ↗`, opens it in your browser.
Redirected output has no live editor or footer.
No model requests or telemetry are added for status reporting.
The status row follows Code Puppy's styling: muted surrounding text, an accented
output-token count, and purple tool names. Colours follow the selected `/theme`;
context warnings keep the warning colour. The same styling applies while idle
and working.
A plugin can contribute its own fragment from `get_status_segments`, such
as a branch name, or a link that ends in `↗` and opens when clicked. Fragments are muted, grouped under the configurable `plugins`
field, and dropped when the plugin unloads. See [PLUGINS.md](../PLUGINS.md) for the method and its cost
rules.
### Themes
```text
/theme
/theme tokyo_night
/set display.theme github_light
/theme default
```
Theme selection and cancellation are silent.
`/theme` opens a searchable picker. Its preview shows a sample conversation with
Markdown, thinking, a tool call, syntax highlighting, warnings, errors, and the
input/status area. Each bundled palette paints the sample's foreground and
background. Browsing does not apply a palette or save a setting. Press `/` to
search the names. Enter confirms; Esc or Ctrl+C keeps your current choice (while
searching, Esc first leaves the search). Narrow terminals show the list alone.
`default` preserves Pax's existing brand colours, including Markdown, menus,
status, and diff highlighting. Starting and exiting with this choice leaves your
terminal palette untouched. On a light terminal background, `default` uses darker
shades of its colours that reach WCAG AA contrast (4.5:1) on white, cream and light grey, and shows diffs
on pale green and red lines. Pax finds the background at startup by asking the
terminal (OSC 11), else from `COLORFGBG`; when neither says, it assumes a dark one.
It does not ask when stdin or stdout is not a terminal, with `TERM=dumb`, on Windows, or with `-p` or `--web`; keys typed
during the question still reach the first prompt. The logo keeps its brand colours. On a dark or unknown background the default preview has no forced background.
`/theme default` restores this appearance after trying another palette.
Under a bundled palette, your prompts sit on a grey background: the palette's
background moved a little towards its text colour, lighter on a dark palette and
darker on a light one. This needs a terminal that advertises 24-bit colour
(`COLORTERM=truecolor`), since the nearest of 256 colours is often not grey; without
it, prompts keep the bold text alone. Under `default` they keep the bold text alone
too, on a light terminal background as on a dark one.
All other choices come from Termflow's bundled registry, including
`catppuccin_mocha`, `catppuccin_latte`, `tokyo_night`, and `github_light`. Pax adds
no new palettes. `/theme NAME` and `/set display.theme NAME` apply the same
validated preference immediately and save it for future sessions. Tab completes
these names. The `/set` theme row also lets you reset immediately;
`/config reset display.theme` removes the saved override for the next startup.
For a bundled palette, Markdown and newly opened menus use Termflow's
`to_render_style()`, and shell roles use its colours. Where a role or code colour
would be hard to read on the palette's background, Pax darkens or lightens it to
4.5:1 contrast (WCAG AA), or to the palette's own text contrast if that is lower,
except where a 16-colour terminal paints the palette's own ANSI slots. Diff additions and deletions differ in lightness
as well as hue, so readers who cannot tell red from green can still tell them apart. Termflow changes the terminal
foreground, background, and 16 ANSI slots via OSC escape sequences. Supported
terminals may also recolour existing ANSI-styled scrollback. Pax resets terminal
colours when you return to `default` or exit a selected palette, including failure
and cancellation. Unsupported terminals may ignore these changes. Redirected
output receives no palette-changing sequences. Your terminal configuration file
is not modified.
The early splash and the `Pax` banner keep Pydantic's brand colours under
every palette, except on 16-colour terminals, where the palette owns the ANSI
slots. Code uses the terminal foreground
and ANSI syntax colours. File diffs tint added and removed lines with the palette's
green and red over its background, and light palettes keep diff code dark enough
to read. Theme selection adds no model requests or telemetry.
### Spinners
```text
/spinner
/spinner puppy
/spinner zoomies 0.1
/spinner init
/set display.spinner dots
```
The spinner is the animation in the `Working` title above the prompt while a turn
runs. `working`, the braille Pax has always shown, is the default. The catalogue
also carries every Code Puppy builtin: `puppy`, `bone`, `zoomies`, `paws`, `dots`,
`dotsWide`, `dots8Bit`, `dotsCircle`, `sand`, `growVertical`, `growHorizontal`,
`noise`, `binary`, `chevrons`, `bouncingBar`, `bouncingBall`, `pong`, `fistBump`,
and `aesthetic`.
`/spinner` opens a searchable picker with an animated preview. `-`/`+` (or
Left/Right) make the highlighted spinner slower or faster in steps of 0.02 seconds;
Enter applies it, Esc keeps your current choice. Press `/` to search the names;
while searching, `-` and `+` filter, Enter keeps the matches, and Esc clears the
search. `/spinner NAME [SECONDS]` applies by name, ignoring case, and Tab
completes the names. The choice is saved as `display.spinner` and shows on the
next frame, with no restart.
A changed speed, from the picker or `SECONDS`, is saved as that spinner's
`interval` in `spinners.json` next to Pax's settings
(`~/.config/pydantic-ai-pax/spinners.json`). The file is also where you add your
own; `/spinner init` writes a starter:
```json
{
"sniffer": {
"frames": ["( . ) ", "( . ) ", "( . ) ", "( . ) "],
"interval": 0.1,
"description": "a very minimalist puppy"
},
"zoomies": {"interval": 0.2}
}
```
An entry with `frames` defines a spinner; one without `frames` that names an
existing spinner changes only its `interval` or `description`. Entries in the file
replace builtins and plugin spinners of the same name. Intervals are clamped to
0.02-1 seconds and frames to 40 characters, padded to one width so the title does
not shift. Edits apply on the next frame. `/spinner` lists any entry it skipped
and why. A saved name that no longer exists, such as a removed plugin's, shows
`working`. Plugins add spinners from `get_spinners` (see `PLUGINS.md`).
## The agent
### Your instructions: `/system_prompt`
```text
/system_prompt
```
`/system_prompt` shows what the model is told and lets you add instructions of
your own. Pax builds the system prompt from its built-in coding instructions,
the repository's `AGENTS.md` or `CLAUDE.md`, and the instructions of the plugins
you turned on. The menu shows those parts but cannot change them; turn a plugin
off or configure it in `/plugins` instead. Your instructions are sent after them
and replace none of them.
| Row | What it does |
| --- | --- |
| Your instructions | Shows their first line and how many lines they have. Enter opens them in an editor; saving an empty text removes them. `r` removes them, so only Pax's defaults are sent. |
| Append to yours | Opens an empty editor; what you write is added as a new paragraph. |
| Full system prompt | The instructions sent with the conversation's latest request, yours included, then each change appended to them since, such as an edited `AGENTS.md` in a trusted folder, in a scrollable view. |
The web UI shows the same menu as its Settings window's **System prompt** section, with a
multi-line dialog for the editor.
Editing opens `$VISUAL`, or `$EDITOR` when `$VISUAL` is unset, on a temporary
Markdown file. Save and quit the editor to keep your changes. Unchanged text
changes nothing, and an editor that exits with an error, such as Vim's `:cq`,
cancels. A graphical editor must wait for its window to close, for example
`code --wait`. On Windows, when neither variable is set, or when the editor
cannot start, a built-in editor opens instead: Ctrl+S saves, Esc cancels.
Your instructions are the `run.instructions` setting, saved with your other
preferences, so later sessions and `/fork` use them too. They apply from your
next prompt. During a turn, `/system_prompt` opens right away, and the running
turn keeps the instructions it started with. `/set run.instructions TEXT` sets
them in one go; `/set` on its own leaves them to `/system_prompt`, which keeps
their line breaks.
### Code mode and speculative execution
Code mode is on by default: `/set run.code_mode false` turns it off, and every
tool is then called natively. Speculative execution builds on it and is off by
default. Press **Ctrl+X Ctrl+S** to switch it on or off, the same chord as Code
Puppy. It is saved as `run.speculative_code_mode`, so
`/set run.speculative_code_mode true` does the same, and it turns code mode on
for its turns even when `run.code_mode` is off. Between turns either change
applies to your next prompt. During a turn the switch and the pinned row change
at once, but the running turn keeps the tools it started with: the row says
`on from the next prompt` or `off from the next prompt` until that turn ends.
The agent's tools are bound when a run starts, so the new value cannot reach
the turn that is already running.
In code mode, every tool except `write_file` and `edit_file` becomes a
function inside one harness `CodeMode` `run_code` tool, `shell` included. Other
tools that run a program passed as a string, such as a workflow plugin, stay
native as `CodeMode` keeps them by default.
`run_code` is a persistent Python sandbox with isolated environment variables,
the host clock (through `datetime`), and no network. The model writes one snippet that calls many tools, and Pax runs it while the model
is still writing.
The sandbox keeps its variables, functions, and imports from one prompt to the
next. Pax saves them with the session when each turn ends, so `/resume` and
`--resume` bring them back with the history, and `--fork-session`, `/fork`, and
resuming a busy session give the copy its own state. When the model passes
`restart: true`, the turn saves the restarted sandbox instead. Deleting a session
in the `/resume` browser deletes its state. Sub-agents start each task with an
empty sandbox. A state Monty cannot load starts a fresh sandbox, and a state over
32 MiB is not saved, so the next prompt starts with an empty sandbox.
The sandbox's `pathlib` only reaches what the file tools may reach. `pathlib`
calls on a mount skip the `FileSystem` checks, so Pax mounts the workspace's
working directory at its real path only when a mount can enforce the same limits.
A plugin that supplies a sandbox workspace gets no mount: the host directory is
not the filesystem the file tools act on there.
- **Read-write:** `read_file` and `write_file` registered, no patterns, and not
`read_only`. This is the built-in `coder` plugin's default. `pathlib` can also
delete and rename files there, which `write_file` cannot do but could already
replace the content of.
- **Read-only:** `read_file` registered but `write_file` missing, `read_only`,
`read_only_patterns` set, or a `ToolGuardrail` or `ToolCallJudge` (a plugin's
or the agent's own) that checks or hides `write_file`, `edit_file`, `shell`,
or `run_code`. Any bound `Permissions` in `read-only` mode (the session's,
the agent's own, or a plugin's) mounts it read-only for that run.
- **Not mounted:** no `read_file`, `allowed_patterns` or `denied_patterns`, a
`ToolGuardrail` or `ToolCallJudge` that may check or hide `read_file`, no
`FileSystem`, more than one, a supplied agent that does not expose its
capabilities, or a plugin that adds a capability function or
`DynamicCapability` (which could supply one at run time). So does any
`Hooks`, such as a `before_tool` hooks table, and a `ToolCallJudge` over
every tool or chosen by metadata or a function: which tools they check can't
be read before the run. An `after_tool` table only reports, so it keeps the
mount. File access then goes through the file tools only.
While the model writes:
- **Eager execution** runs each complete statement as soon as it has streamed,
so a slow `shell` build or test starts before the snippet is finished.
- **Speculation**, only while its switch is on, starts `list_files`, `read_file`, `grep`,
`search_pax_docs`, and `read_pax_docs` calls whose arguments are all literals the
moment their line has streamed. Only these
read-only tools speculate, because an early call may belong to a branch the
snippet never takes. They must come from Pax's own file and docs tools: a
plugin or MCP tool with the same name, or one that declares itself read-only,
waits like any other call. Writes and shell commands never start speculatively.
The model gets instructions for writing snippets that benefit, with the advice
for literal read calls only while speculation is on. On Anthropic
models Pax also sets `anthropic_eager_input_streaming`, since Anthropic
otherwise sends tool arguments in one burst at the end, which leaves no time to
run anything early.
Tools called from inside `run_code` show the same headers, previews, and shell
output as direct calls, listed under their `run_code` header in the order they
ran. A speculative call is shown only once the snippet uses its result, so a
launch for a branch the snippet never took does not appear.
A pinned row above the footer shows the session's totals while speculation is on:
```text
Speculative Execution 29 hits · 0 misses · 0 wasted saved ≥ 7.0s
```
- **hits:** sandbox calls that adopted a speculative launch.
- **misses:** speculation-eligible calls that ran without a matching launch.
- **wasted:** launches discarded without being used.
- **saved ≥:** the summed durations of speculative calls that had finished
before the snippet asked for them, plus the time sandbox calls spent running
while the `run_code` arguments were still streaming. Calls still running when
claimed count as hits but add no time; restarted, rejected, or cancelled
snippets add nothing. It is a lower bound on hidden tool latency, not
wall-clock speedup, since concurrent calls can overlap.
Counts are coloured only when non-zero, using `/theme` colours. Switching off
hides the row once no running turn speculates; switching back on shows the same
session totals. Headless runs and redirected output use the same tools but show
no row. The `pydantic-monty`
sandbox behind speculative execution is a `pydantic-ai-pax` dependency; if it
cannot be imported, Pax prints a warning and runs tools natively.
### Questions from the model
When the task is ambiguous, the model can call `ask_user_question` instead of
guessing. Questions appear inline, with the conversation still visible above a
compact numbered picker. The question stays pinned above its choices, so output that
streams meanwhile, from a delegated task for instance, scrolls past above it instead
of pushing it away. A delegated task's question names the task in its title. Use Up/Down and Enter, or press an option's number to
select it. For multiple selections, Enter or a number toggles a choice; select
`Done` to submit. At least one choice is required. Esc or Ctrl+C declines the
whole request, which the model is told so it can make a stated choice and carry
on. Several questions show progress in the title. The tool's transcript line
names the questions by header, not their raw JSON. The editor's draft is
preserved, and the question and your picks are printed to the transcript afterwards.
Drag over the question, its header, or an option, or double- or triple-click one, to
select text; releasing copies it to the clipboard without choosing an answer. Transcript
text remains selectable too.
The inline `ask_user_question` picker also offers `Other (type answer)`.
Choose it to type your own answer instead of the suggested options, including for
multi-select questions. Enter submits nonblank text. Esc returns to the choices
and keeps your draft; Ctrl+C declines the whole request. Backspace and arrow keys
edit the text. Multiline paste is inserted as text and waits for Enter; it does
not submit an answer or select choices. The conversation stays visible while you type. Custom answers
appear in the transcript and reach the model as a one-item list under the question's header.
Set `input.questions` to `composer`, in `/input` or with `/set`, to keep typing instead. A pending
question then appears above the composer without taking focus, leaving your cursor, undo history,
draft, and attachments intact. Press F2 to review its numbered choices; F2 or Esc returns to the
composer, and Ctrl+C while focused declines the request. A question from a session the terminal does
not show, such as one the browser opened, waits until you show that session there with `/resume`;
the web UI can answer it meanwhile.
In the composer, sending text while a question waits offers **Answer this question** (`a`)
or **Queue follow-up** (`q`), naming the answer target. Enter does not choose for
you. `r` toggles **Remember my choice**; `/input` changes or resets the preference
later. Cancellation preserves the draft; a successful text answer clears it.
Question answers cannot carry images: queue an image-bearing draft instead.
The setting remembers interaction preference only, never answer text or approval.
Each subsequent question in a batch requires review or an explicit routing choice;
held Enter and pasted text do not answer the next question.
The menu is the built-in `ask_user` plugin around the harness's
[`AskUser`](../../../docs/harness/ask-user.md) capability. The capability only knows an
`Answerer`; the terminal menu is one, and [PLUGINS.md](../PLUGINS.md#ask_user-questions-answered-from-the-terminal)
shows how to put a different one, a web form for instance, in its place.
`/plugins disable ask_user` removes the tool.
### Permissions
`/permissions` chooses what the agent may do without asking, for this session:
| Mode | File writes | Shell commands |
|---|---|---|
| `full` (default) | run | run |
| `auto` | run | run, except commands that delete (`rm -rf`), push (`git push`), rewrite history (`git reset --hard`, `git clean`), use `sudo`, reach the network (`curl`, `ssh`, ...), or install packages |
| `read-only` | ask | ask |
A held call waits for your answer: the inline picker in the terminal, or an approval card in the web UI,
showing the command or the file change; the terminal prints the command (or a path too long for the
picker) in full above it. With `input.questions=composer`, the approval waits above the composer
instead: F2 focuses it before an option can authorize the call, and a call held in a session the terminal
does not show waits until the terminal shows it, or the web UI answers it. Generic send, steering, queued
text and the remembered question preference never approve a tool. A custom text answer always denies it. **Approve** runs it once, **Approve for this session** also runs the
same tool on the same command (or the same file) without asking for the rest of the conversation, and **Deny** tells
the model the call did not run, with the reason you type, if any. The web UI shows the mode as a chip by the
prompt box and changes it there too. A change applies from the next tool call, also during a turn, except
that code mode's sandbox keeps the folder as the turn mounted it until the next prompt.
The mode is the `run.permissions` setting: `/permissions MODE` saves it as the default for new sessions too,
and Settings, General edits it. It is harness [`Permissions`](../../../docs/harness/permissions.md), which checks
the coding tools' file writes and commands only; other tools, such as MCP servers', run as before. File tools
only reach files inside the session's folder, so `auto` lets them write. In `full` and `auto`, where code mode's
sandbox mounts the folder read-write, `pathlib` there can also delete and rename files in it without asking; in
`read-only`, the sandbox gets the folder read-only for the run. The command patterns are a convenience, not a sandbox. A session no one
can be asked in, such as `pax -p` or a web session with questions turned off, uses harness
[`DenyUnanswered`](../../../docs/harness/deny-unanswered.md): it denies the calls `Permissions` held, saying
`/permissions full` lets them run, denies any other call that needs approval (such as an MCP tool's) with the
harness default text, and answers questions from `AskUser` with "No one is available to answer in this run", so
the run finishes. A session with the terminal picker or the web UI's approval cards does not deny these. Outside `full`, a delegation whose delegate would run without these checks is refused: a named
sub-agent, or a delegation to `self` from an agent you supply (`pax --agent`), which gets `/permissions`
per run rather than bound to the agent. The model is told to do the work itself instead. Outside `full` the model also gets no
[`computer`](#computer-use-computer-use) tool.
### A System One decision model
A [decision model](https://pydantic.dev/docs/ai/models/decision/) answers typed questions about a text with
probabilities and writes no text, so it is never the model a conversation runs on. Name one served over the
[System One API](https://pydantic.dev/docs/ai/models/system-one/) with `run.decision_model`, such as Nimble from a
local Ollama:
```text
/set run.decision_model system-one:nimble
/model settings system-one:nimble
```
Its endpoint and key are its own `/model settings`: `base_url` (`http://localhost:11434` for Ollama) and
`api_key`, the name of a `/keys` entry. Left unset, `SYSTEM_ONE_BASE_URL` and `SYSTEM_ONE_API_KEY` apply; with
no endpoint at all, the `system_one` plugin fails to load and says so, and compaction says relevance
compaction is off and runs as before. From the next start or `/reload`, the model:
- judges harness `SmartSearch`, whose `smart_search` tool finds code by what it does, from the built-in
`system_one` plugin;
- answers the `system_one` tool, from the same plugin: a yes/no question about a text returns the probability
of `yes` and of `no`, and a question with `options` the probability of each option;
- judges harness `RelevanceCompaction`, which leads the `compaction` plugin's chain (the `compaction` plugin
reads `run.decision_model` itself, so this holds with `system_one` off): it keeps, reduces, or drops
each older step by what the task still needs, reducing with the summary (or, with `strategy` `truncation`,
by cutting tool results), and a failed judgment falls back to the rest of the chain. `/compact` runs the
chain without it: it keeps a history that already fits its target, which would leave `/compact` nothing to do.
The searched code, the texts the `system_one` tool is asked about, and the conversation's older steps go to that
model's server. `/set run.decision_model null` turns all three off.
### Compacting the conversation
The built-in `compaction` plugin is on by default, with or without `coder`.
It uses harness's `FallbackCompaction` with
`SummarizingCompaction` first and `SlidingWindowCompaction` as the fallback.
It protects the most recent 50,000 tokens (`protected_tokens`) from summarising and
truncation, counted as the provider reported them, thinking included. `coder`'s own tool-result clearing is separate: above 70% of the window it
still empties tool results older than its last three tool calls. `ModelAPIError`,
`FallbackExceptionGroup`, and `UsageLimitExceeded` during summarisation fall
back to truncation; other exceptions propagate. The summary request is billed
to the current model unless `summarization_model` selects another.
The chain runs automatically before requests above `threshold` (85% of the context
window by default). To change when, run `/auto-compact`, or `/plugins configure compaction`: both
open the compaction settings, with **Compact at** first.
```text
Compaction settings
> Compact at 85% - about 170k tokens
Strategy summarization
Protected tokens 50000
...
```
Space steps through 50%, 60%, 70%, 80%, 85%, and 90% of the window, each shown with what it means
in tokens on the model you are using, once its window is known. Enter lists them, with
**Type a value...** for a token count such as `150k`, whatever the window, or a share the list does
not have. R resets it to 85%. Each change is saved as you make it and applies from the next turn.
A share follows you when you switch models; a token count does not. You can also type the value and
skip the menu:
```text
/auto-compact 150k # once a request passes 150,000 tokens (also 150000, 150,000, 1.5m)
/auto-compact 70% # once a request passes 70% of the window
/auto-compact reset # back to 85% of the window
```
Where the menu cannot open, as in the web UI or with output redirected to a file, `/auto-compact`
alone says when compaction runs; the web UI's Plugins page has the same compaction settings.
A token count saves `threshold_tokens` and a share saves `threshold` and clears `threshold_tokens`.
With `threshold_tokens` set, the chain runs once a request passes that many tokens, whatever the
model's window, and `threshold` is ignored. Keep it below the model's window: above it, the provider rejects the
request before compaction runs, and saving such a count says so. `/compact` runs the same chain between turns regardless of that
threshold, but it caps the protected tokens at half the conversation, so it usually has older
messages to summarise; the protected tail can exceed that cap by the whole message that crosses it. Add free text to say what the summary must keep, for example
`/compact don't lose the "auth" decisions`. The focus is passed to the summariser
as written, including quotes, backslashes, and line breaks; no shell escaping is needed.
You get one line with the message counts before and after and the tokens saved out
of the total, which is the context size the status row shows, or the size of the messages when that is smaller, as right after an earlier `/compact`. When compacting would not make the conversation
smaller, for example because the summary is longer than what it replaces, the
conversation is left as it was and you are told so. An empty or one-message
conversation sends nothing.
The window comes from genai-prices, the same catalog the `/model add` menu shows
context sizes from. A model it does not list (`test`, a local endpoint) is
assumed to have 200,000 tokens, the harness default. `/auto-compact` moves the trigger; to change any of this,
run `/plugins configure compaction` (or press `c` on its `/plugins` row): each
edit is validated and saved as you make it, and the plugin reloads so the next
turn uses the new settings. A turn already running keeps the old ones.
You can also redeclare the plugin with your own settings;
`/plugins disable compaction` turns it off, `/compact` and `/auto-compact` included:
```text
/plugins add compaction pydantic_ai_pax.builtin_plugins.compaction '{"threshold": 0.7, "protected_tokens": 20000, "context_window": 200000}'
```
| Key | Default | Does |
|---|---|---|
| `strategy` | `"summarization"` | `"truncation"` skips the summary and only drops older messages |
| `threshold` | `0.85` | fraction of the window above which the fallback chain runs |
| `threshold_tokens` | unset | tokens above which the fallback chain runs, in place of `threshold` |
| `protected_tokens` | `50000` | tokens of the most recent messages never compacted |
| `context_window` | unset | overrides the catalog when it is wrong or silent for your model |
| `summarization_model` | unset | a cheaper model to write the summary; unset uses the one in use |
| `background_compaction` | `false` | experimental: write the summary in the background before it is due ([below](#background-compaction-experimental)) |
| `background_start` | `0.85` | experimental: with `background_compaction`, the fraction of the trigger (`threshold`, or `threshold_tokens` when set) at which the background summary starts |
The status row shows compact used/max context tokens, such as `128k/1m`.
The maximum comes from the request's model or the `context_window` override.
It stays `?` until the first request of the session or after a model change, and for
a model with no known window. With `compaction` off, the shell reads the window from the request's model itself. An unknown model's fallback
compaction budget is not shown as its maximum. Counts below 1,000 stay unscaled;
larger counts round to whole thousands (`k`) or tenths of a million (`m`).
Until a response in the conversation reports its usage, the used figure is an estimate
from the text's length that leaves out most tool definitions, shown with `~`, such as `~13k/1m`.
It usually reads low, so it can rise sharply once the first response arrives.
The context figure turns yellow when a request still exceeds `threshold` (or `threshold_tokens`) after
compaction, for example because the protected tail is too large. For windows smaller
than 50,000 tokens, redeclare the plugin with a smaller `protected_tokens` value;
`/compact` does not override that protection. Run `/compact` to retry the chain,
or `/new` to clear the history. The figure and colour
refresh with the next request; `/compact` alone does not change them.
#### Background compaction (experimental)
With `background_compaction` set to `true` (in `/plugins configure compaction`), Pax starts the
summary early instead of waiting for the trigger. Once a request, or the end of a turn, passes
`background_start` of the trigger (by default 85% of 85%, about 72% of the window; with
`threshold_tokens`, 85% of that count), the summary is
written in the background. The turn keeps running, and the summary can finish while you read. A
turn that ends already over the threshold starts none; the next request compacts as usual.
The summary is held, not applied, so nothing changes until compaction is due. Then the held summary
replaces the messages it was written from, and everything that came after it is kept word for word,
with no wait for a model call. When the summary is still being written, compaction waits for it.
`/compact` without a focus uses a held summary the same way; with a focus, it drops it and writes a
new one.
Pax drops the held summary and compacts as usual when it no longer fits: the history was changed
(`/compact`, a rewind), you switched model, the summary failed or was cancelled, or so much arrived
since it started that the result would still be over the threshold. Leaving the conversation
(`/new`, `/resume`), exiting Pax, or reloading the plugin cancels it; a delegated task's is dropped
at the end of the first turn after the task finishes. A summary that is never used still costs its tokens. Like any other summary call,
it counts toward the usage of the turn that started it, even when it finishes after that turn. It
only applies with the `summarization` strategy.
### Task delegation
The stock `coder` plugin exposes `delegate_task`, which starts a fresh conversation
with the same active plugin tools, instructions, and guardrails. Pax rebuilds its
stock agent before the next prompt when that capability snapshot changes; session
history is preserved and running tasks keep their original snapshot.
Saved Coder declarations that omit `sub_agents` still default to `false`. Enable
`sub_agents` in `/plugins configure coder` to opt in, or use `/plugins remove coder`
to restore the stock declaration. Explicit `false` remains an opt-out. Custom agents
are not rebuilt and must bind delegation and its accompanying capabilities themselves.
#### Managed tasks in the interactive stock CLI
The interactive stock agent runs `SubAgents` inside a harness `DelegationTasks`
owner. `delegate_task(agent_name, task, background=False, resume=None)` starts a
child with its own history. `general-purpose` is an alias for `self`, carrying
all agent-bound tools, instructions, and guardrails. `Explore` and `Plan` use
only filesystem readers and a `ReadOnlyWorkspace`: neither shell commands nor
`run_code` are available. They inherit the current model and are one-shot.
Custom delegates and general-purpose children can resume with the same task ID.
There are three child layers below the main agent by default.
Use foreground delegation when the answer is needed immediately, and background
delegation for independent work. Give each child a self-contained task with
paths, constraints, and expected evidence. A background acceptance receipt is
not a result. Pax delivers a settled child's report through core's native
queued-message API, as the child's output framed as `` task
data, never in system voice. Reports are not user
instructions or permission grants, and the transcript, `/rewind` and the web
history don't show them as prompts you typed. In the interactive stock CLI, a report
that arrives while idle automatically continues the parent. No extra user prompt
is needed, and your unfinished draft and queued input are preserved. Reports
arriving during a turn use that run's queue; completed reports are not replayed.
Nested children join their descendants and receive their reports before settling.
The model also manages its tasks: `list_tasks` lists them, `check_task` shows what a
running one is doing, `message_task` steers a running one or resumes a finished one, and `cancel_task` stops
one. A child that needs a decision calls `ask_parent` and waits; the question shows
as a `?` task row, and the parent answers it with `answer_task`. Like a report, a
question continues an idle parent without a user prompt, and one queued on a turn
you cancel waits for your next prompt.
- **Ctrl+B** moves foreground children of the main run to the background without
restarting them. The hint appears only while a foreground child can be
backgrounded. In tmux, send Ctrl+B through to the application or change the
tmux prefix.
Task rows use the selected `/theme`: foreground and background modes, running
activity, and failures each have their own role colour.
#### Delegate models and review directory
Enable **Sub-agents**, then configure **Delegate models** in `/plugins configure coder` to offer named model choices to
`delegate_task`. An empty mapping keeps model inheritance unchanged. Each entry names a model
(`PROVIDER[@ACCOUNT]:MODEL`) or saved chain, with an optional description and model settings:
```json
{
"custom": {
"model": "chain:my-chain"
}
}
```
Choose your own menu keys and models. Create any referenced chain in `/model chains` first.
Account selection, pooling, and fallback follow the
same rules as `/model`; saved settings for the selected model or chain apply, followed by the
entry's explicit settings. The parent's per-run model settings are not copied to a different model.
With a configured menu, the parent can pass one of its keys as `model` on each call. Omitting `model`
keeps the delegate's existing default; configuring the menu does not change the session model.
Enable **Review specialist** separately in `/plugins configure coder` to add `Review`, a fresh,
one-shot specialist with read-only file tools and
repository instructions from its own workspace. It receives no parent conversation, plugin tools,
shell, code execution, or delegation tools. Only `Review` accepts `working_directory`; `self`,
`Explore`, `Plan`, and disk agents reject it. Directory selection requires a plain local parent workspace;
the standard read-only wrapper is also accepted. Sandbox and custom policy wrappers are rejected because
rebinding the directory would discard their restrictions.
Relative paths resolve from the session directory; absolute paths and `~/` paths are accepted.
The selected directory must exist. The parent stays in its original directory.
The model chooses the directory, so a directory outside the session directory carries no
[authority](../../../docs/workspace-custom.md#workspace-authority): Review gets its `AGENTS.md` and other
repository instructions as data, not as instructions. Inside the session directory, Review gets the
session's own level.
For example, ask the parent to review a diff saved in another checkout:
```python {test="skip"}
delegate_task(
agent_name='Review',
task='Read changes.diff and review the affected code. Return findings with file paths.',
working_directory='/path/to/repository',
)
```
`/tasks` shows the selected directory. Review cannot resume or fan out. Its file tools reject writes
and paths outside their root, including symlink escapes. This is a restriction on the tools and
workspace API, not operating-system isolation. Review uses normal model inheritance unless a call
selects a configured menu option; enabling Review does not choose a model. Review requires
**Sub-agents** and is off by default (`review_agent=false`). Its setting is tagged
`coder-review-agent`, independently of the menu's `coder-delegate-models` tag. Older builds ignore
settings they cannot read while preserving them for the next compatible build.
#### Agent folders
Pax loads custom agents from disk, in Claude Markdown (`*.md`) or Codex TOML
(`*.toml`) format. Choose folders in `/plugins configure coder` under
**Agent folders**. The list saves each change immediately; no JSON editing is
needed. These folders contain sub-agent definitions, not files for code search.
- **Add directory path** (`a`) accepts one local directory. An unprefixed
directory name is saved as a path, so entering `agents` here means
`./agents`, not the folder-name shortcut below.
- The list is saved once for all projects. A relative path such as
`./team-agents` resolves against whichever project Pax runs in, so every
repository can keep its own copy; it is saved even if the current project
lacks it, and projects without it skip it. Absolute and `~/...` paths name
one fixed directory for every project, so they must exist when you add them.
- **Browse local directories** (`b`) includes hidden folders. Type to filter,
Enter to open a folder, Left to go to its parent, and **Use this directory**
to select it. The choice is saved as an absolute path, used in every project;
type a relative path with **Add directory path** to follow each project
instead. Ctrl+L opens the full current path for viewing or navigation.
- Enter on an entry opens its actions. `e` edits its current value; `d` removes
it from the search without deleting files. Esc cancels an edit or returns to
the previous menu; **Save & close** returns with changes already saved.
- Duplicate entries are rejected, as are absolute and `~/...` paths that are
missing, files, or unreadable. Existing saved entries stay editable and
removable even if their directory no longer exists.
**Add folder name** keeps the existing shortcut behavior:
- A name such as `agents` searches `.agents/agents`, `.claude/agents`, and
`.codex/agents`, first in the project, then in your home directory. Project
definitions win over personal ones with the same name.
- Add another name, for example `global`, to also load
`.claude/global` and its siblings.
- Named locations do not have to exist yet. Missing ones are skipped.
- Remove every entry to turn disk-defined agents off.
The stock CLI starts with `["agents"]`, so existing `.claude/agents` and
`.codex/agents` definitions work without setup. If you saved Coder settings
before this existed, disk agents stay off until you set **Agent folders**.
Definition files are read as data and never executed.
- **`/tasks`** opens the live view during a turn or between turns. A sidebar lists the
conversation's tasks as a tree, and Up and Down select one; the view opens on the newest
running task. Its transcript streams beside the sidebar, in-flight text included; PgUp
and PgDn scroll it. Esc clears the typed message, then closes the view.
- **Typing a message and pressing Enter** steers the selected running child: it reads the
message as user input at its next model request. On a finished child that can resume,
Enter prompts it again from its saved history, apart from the conversation. Explore, Plan
and Review take no messages once they finish. A pasted block's line breaks become spaces,
so a paste is never sent until you press Enter.
- **Ctrl+B / `/tasks background ID`** backgrounds the selected child.
- **Ctrl+X / `/tasks stop ID`** stops that child and its descendants, leaving siblings
running. Stopping a child prevents automatic model resume.
- **Ctrl+R** on a finished child does what `/tasks resume ID` does, and closes the view.
- **`/tasks resume ID`** explicitly authorizes resume and queues a request to the
parent to continue the saved child. Explore and Plan cannot resume. The parent
uses `delegate_task` with the same ID and agent name; it remains responsible
for reviewing the child's result.
The transcript shows a task's start row once the child first streams an event with its model name,
for example `● Explore [ab12cd34] · claude-sonnet-4-5 inspect files`. The name is the model
actually used by the child, not a delegation menu key. A child that ends or asks a question before
reporting a model gets its start row without one, just before that row. Set `/set display.task_models false` to show
start rows immediately without the model name instead.
The editor panel shows the task tree, activity, elapsed time, and descendant
counts. Task durations in the panel, completion rows, and `/tasks` use at most
three nonzero units, such as `1h 2m 3s` or `2d 4h 5m`. Zero and negative durations
show `0s`; seconds are omitted when days are shown. From 30 days, a known start
time displays its local date as `%b %d`, such as `Jan 02`, instead of elapsed
units. A completed task's duration stops at its finish time. This changes only
the labels, not task expiry or lifecycle clocks. The footer shows the context of the newest foreground child; see
[Status line](#status-line). Successful rows disappear on completion; failed
and stopped rows remain for 30 seconds. The `/tasks` hint also remains for 30 seconds. The view retains
completed tasks for inspection. Live previews retain the latest 65,536 characters
of an unfinished text part; settled responses retain their full history.
Questions asked by children use the main
terminal and identify the requesting child.
Task metadata and independent histories are stored beside the session database
in `.tasks/`. Each database has its own task directory; in-memory
stores do not write task files. Child runs also use the session's `StepPersistence` store.
After restarting, resume the parent session to inspect or continue its children.
Restoring an interrupted child does not execute it. Inspect partial effects
before requesting resume. Delivery acknowledgements are saved to prevent replay
of reports already consumed by a parent.
Background execution is supported for local workspaces. A run-owned remote or
sandbox workspace can still run foreground children, but background requests and
promotion are refused because that workspace can close when its parent exits.
Plugin changes are held while managed children run so their transports and hooks
remain alive. Exit and reload cancel and drain managed children before plugin
shutdown. Cancelling the main turn stops its foreground delegates; children
already in the background remain owned by the session.
Supplied agents keep their existing delegation behavior. The managed task UI is
not installed on them or on headless invocations; a headless stock run still has
the task tools, and waits for its background children's reports before it ends.
Turn off `task_control` in `/plugins configure coder` to keep `delegate_task`
without the task tools or background delegation. The setting is tagged
`coder-task-control`, so a Pax build without it ignores a saved value instead
of failing to load `coder`. Saved Coder `sub_agents: false`
and declarations omitting that setting remain opt-outs. Pax adds no tools when
delegation is disabled.
#### Agent Skills
The `coder` plugin loads [Agent Skills](https://agentskills.io/specification)
(`//SKILL.md`) from these folders, in this order:
1. `.agents/skills` and `.claude/skills` in the project
2. `~/.agents/skills` and `~/.claude/skills` in your home directory
Project folders are looked for in the directory you launch Pax in, then in
each directory above it up to the root of its git repository, nearest directory
first, the way nearer instruction files take precedence. Launched in `repo/src`,
Pax reads `repo/src/.agents/skills` and `repo/src/.claude/skills`, then
`repo/.agents/skills` and `repo/.claude/skills`, so a skill in
`repo/src/.claude/skills` wins over one with the same name in
`repo/.agents/skills`. Outside a git repository, only the launch directory is
searched.
Folders that do not exist are skipped. Skills need a local workspace, so they
are off on Windows. The model sees each skill's name and
description and loads the instructions it needs, which tell it the skill's
directory so it can follow references to `scripts/` or `references/`. Without
any skills, nothing is added to the prompt and the model gets no extra tool.
Each skill is also a command: `/code-review src/app.py` sends the
`code-review` skill as your next prompt, with `src/app.py` in place of
`$ARGUMENTS`, or appended as `ARGUMENTS: src/app.py` when the skill has no
`$ARGUMENTS`. The command reads the skill's `SKILL.md` again each time, so it
sends your latest edits, and says so if the skill is gone. A skill named like a
Pax or plugin command, such as `model`, leaves that command alone and stays
available to the model.
Two frontmatter fields decide who can use a skill:
- `disable-model-invocation: true` makes it a command only: the model doesn't
see it and can't load it. Use it for skills with side effects, such as a
deploy.
- `user-invocable: false` makes it model-only: there is no `/command`.
Pax quietly ignores the other behavioral fields some clients support, such as
`allowed-tools` or `model`, so skills shared with those clients load as they are.
When two folders have a skill with the same name, the earlier folder wins:
project skills over personal ones, nearer directories over further ones, and
`.agents` over `.claude` in the same directory. A skill reached
twice, such as through a symlinked `.agents/skills`, or a byte-identical copy,
counts once. Pax prints one line for each skipped skill when it starts: a
malformed `SKILL.md`, or a name another skill already has. It also prints a line
for a skill folder it skips because it is a file, holds a `SKILL.md` itself
(one skill rather than a folder of them), or can't be read, such as one without
read permission; your other folders still load.
The model's catalog is read at the start of every turn, so it lists a skill you
add mid-session. Its `/command` arrives after `/reload` or
`/plugins reload coder`. Choose different folders in `/plugins configure coder`
under **Skill folders**, as a JSON list of paths; `~/` means your home directory
and `[]` turns skills off. To turn off single skills, choose **Skills** there:
each pick turns a skill on or off. A skill that is off is hidden from the model
and has no `/command`, in every project; skills you add later start on. A
skill folder that becomes a file, a single skill, or unreadable mid-session is
left out of the next turn's catalog. A single skill's directory or `SKILL.md`
that Pax cannot read is skipped with a notice, and the other skills still load.
Any other error reading the folders when Pax starts turns skills off, with a
notice, until the next `/reload`; the coding tools still load.
Skill commands are read on this machine. With a plugin that runs the agent in a
sandbox, the model's catalog is read from the sandbox's workspace instead, so the
two can differ.
### Ask Pax about itself
Ask, for example, "How do saved API keys work?", "Create a plugin with a custom
menu", or "Use my model provider". The default agent lists `pax_customization`
as a deferred capability in its catalog, one line until the model calls
`load_capability` to reveal two docs tools. The loaded capability gives the model
a short instruction to use these docs for questions about Pax, and to read the
customization guide before advising on customizing Pax.
- `search_pax_docs(query)` returns the best matching sections, each with its path
and a short snippet.
- `read_pax_docs(path)` lists the docs when `path` is empty, returns a doc such as
`reference` or `harness/coder`, or one section such as
`reference#saved-api-keys`, with its subsections. A doc over 50,000 characters
comes back as an outline of section paths instead, so a long doc like this
reference is read a section at a time. A section over the limit returns its own
text (truncated if needed) and an outline of any subsections. Section paths are
the docs' own heading anchors.
The docs are this reference, the [README](../README.md), the
[plugin contract](../PLUGINS.md), the customization guide, the
[declarative plugins](declarative-plugins.md) design note, and the README of each
Pydantic AI Harness capability Pax uses, such as `harness/shell` and
`harness/subagents`. They ship with the installed packages and are read only when a
tool is called, never included in every prompt or loaded capability. No network
access or source checkout is needed.
The customization guide covers plugin installation and reload, hooks, tools,
settings, commands, rendering, custom TUI menus, and model/provider launchers. It
distinguishes plugin APIs from UI changes that currently need a Pax source change.
This is guidance, not an automatic installer or a permission boundary: plugins
execute trusted Python as your user. Review generated plugins before enabling them.
A custom agent can opt in by adding `PaxDocs()` from `pydantic_ai_pax.pax_docs`
to its capabilities. Existing agents using `ClaiDocs` or `customization_guide()`
keep the `clai_customization` capability and its `read_clai_docs` and
`search_clai_docs` tools. New sessions advertise only Pax docs tools. Resuming a session that loaded the old capability restores its tools.
See [PLUGINS.md](../PLUGINS.md) for the plugin contract.
## Sessions
On Unix, run `pax sessions` to see your live Pax sessions across processes,
including idle sessions and those waiting for an answer.
| Column | Meaning |
|---|---|
| `ID` | A live-session ID prefix, extended until unique across the sessions listed |
| `Name` | The workspace folder's name, for display only |
| `Status` | `idle`, `running`, or `waiting` for user input |
| `Title` | The saved conversation's title |
| `Workspace` | The folder the session works in |
The command never opens, resumes, messages, or controls a session, and never starts a turn.
It prints `No live sessions.` when none are reachable. If a process has too much session
data to list, it reports an error instead of omitting that process silently; close some idle
sessions and try again. On Windows, it reports that Unix sockets are required and exits
unsuccessfully.
Saved conversations that are not open remain available through `/resume`.
### Saved sessions and `/resume`
The project pane groups existing Git worktrees and their subdirectories under
one repository name. Session cards show each checkout's current branch, or its
worktree directory name for detached HEAD. These labels are read when the browser
opens, not historical branch names. Missing directories, non-Git workspaces, and
unavailable Git fall back to directory labels. Separate repositories with the
same name remain separate and use paths to distinguish them. Transcript previews
keep the original saved path; resuming does not change directories or migrate
saved data.
In the browser, a archives the selected session: it leaves the list and
the web UI's sidebar, except its **Archived** view, and nothing is deleted.
h lists archived sessions too, marked `(archived)`, and searches them;
a on one unarchives it. The current session and one running in another
Pax cannot be archived. Resuming an archived session, or a new turn in it,
unarchives it; `--fork-session` leaves it archived and continues in the copy.
Pax saves accepted prompts before the first model request and saves the retained
history after successful, failed, and cancelled turns. `/compact` commits its
replacement immediately, even if you exit before another prompt. `/new` switches
to a fresh session ID; it does not delete the previous session.
```bash
pax --resume # browse saved sessions
pax --resume SESSION-ID # restore one session
pax --continue # restore the most recent session in this directory (-c)
pax --session-id UUID # start a new session saved under this ID
pax --resume SESSION-ID --fork-session [--session-id UUID] # continue in a copy
```
These flags take the same shapes as Claude Code's, so tools that drive several
coding agents can manage Pax sessions the same way. `--session-id` must be a UUID
that no saved session uses yet; the session is saved under it with its first
prompt. `--fork-session` copies the restored session to a new ID, the given
`--session-id` or a random one, and continues there; the original stays as it was.
With the browser (`--resume` without an ID), the selected session is copied.
`--session-id` combines with `--resume` only together with `--fork-session`.
`--continue` (`-c`) restores the session saved most recently in the directory
Pax starts in, as `claude --continue` does. Sessions from other directories and
archived ones are skipped. When this directory has none, Pax says so and starts
a new session; `--session-id` then names it. `--continue` works with `-p` and
`--web`, and takes `--fork-session` like `--resume SESSION-ID`. Only one of
`--continue` and the `--resume` flags can be given.
Inside Pax, `/resume` opens the same browser and `/resume SESSION-ID` restores a
session directly. Opening or restoring a session does not call the coding model
or execute pending tools. Background naming, unless turned off, may make a separate,
tool-free model request. Your current model, working directory, credentials, and
approved plugins remain in effect, except that a Claude Code or Codex session
moves Pax into its own directory (see below). The saved model name is shown for reference.
Resuming shows the restored conversation in the terminal: the last 10 prompts
with their answers, reasoning, and tool calls, drawn the way they streamed.
Older turns are summarized in one line; the model still receives the whole
history. Inside Pax, `/resume` replaces the visible conversation, as `/clear`
does: the previous one stays saved but is not shown again. Output that
only streamed, such as shell previews and diffs, is not saved, so those tools
show their call line.
The browser follows Code Puppy's project/session design:
- Projects on the left, with session counts. The current directory is preselected.
The selected project stays highlighted while browsing its sessions. **SELECT
PROJECT** or **SELECT SESSION** labels the focused pane, with matching key hints.
- A repository with sessions in more than one checkout (branch or worktree) lists
them beneath it, indented and dimmed. Select one to see only its sessions.
When a repository has active checkouts, its removed worktrees and those with no
session in the last 14 days gather in one **older worktrees** row beneath them,
whose sessions still say where they ran. The repository's own checkout always
keeps its row. Sessions from deleted folders that no repository claims gather under
**missing folders** at the bottom.
- Two-line session cards on the right: time, title, subtitle, tags, message and
token counts. Recent sorting groups cards under headings that widen with age:
**TODAY**, **YESTERDAY**, **LAST 7 DAYS**, **LAST 30 DAYS**, then one per month,
each older card showing its date.
- `f` cycles which sessions are listed: all of them, Pax's own, or those from
Claude Code or Codex. The header names the source while one is chosen.
- Enter opens a project or resumes a session. Right opens a scrollable transcript,
with newer messages first. Left returns to projects.
- `/` searches across projects, including saved user/assistant text. `s` cycles
recent, message-count, and token-count sorting. `m` loads another 200 summaries.
- `r` sets a manual title, which the namer will not overwrite. `d` asks for
confirmation before deletion. The active session cannot be deleted.
- Esc goes back; Ctrl+C closes. Narrow screens show one focused pane at a time.
- Selecting a session from another directory resumes immediately, without
confirmation. It does not change directories or move the saved conversation out
of its original project group. A Claude Code or Codex session is the exception: it
moves Pax into the folder it ran in, or continues here when that folder no longer
exists or Pax cannot move now. Direct cross-directory resume asks you to use the browser.
The browser counts loaded summaries, not a separate unbounded catalog. Search
runs against the full catalog before pagination. It does not index tool output,
reasoning, or content removed by compaction.
The resume transcript preview displays at most 24,000 characters of the newest-first
text, with a truncation notice for longer histories. Search is Unicode
case-insensitive and includes text instructions in multimodal prompts.
#### Claude Code and Codex sessions
Pax can continue a session you started in Claude Code or Codex. It reads their
saved transcripts: Claude Code's under `~/.claude/projects` (or
`$CLAUDE_CONFIG_DIR/projects`), and Codex's under `~/.codex/sessions` (or
`$CODEX_HOME/sessions`).
```bash
pax --resume-claude # browse Claude Code sessions
pax --resume-claude SESSION-ID # import and restore one
pax --resume-codex # browse Codex sessions
pax --resume-codex SESSION-ID # import and restore one
```
The session ID is the one Claude Code or Codex shows, such as the ID in
`claude --resume ID` or `codex resume ID`. Inside Pax, `/resume claude` and
`/resume codex` work the same way, with or without an ID. `-p` accepts both flags
with an ID. Only one of `--resume`, `--resume-claude`, and `--resume-codex` can be
given.
Pax continues such a session in the directory it was started in, wherever you
launched Pax: `--resume-claude SESSION-ID`, `--resume-codex SESSION-ID`, and
`--resume` of Pax's copy start there, and resuming one inside Pax moves the
session there between turns. The
session stays there, also after `/new`, and `/update` restarts Pax there. That
directory's project file, instruction files, skills, plugins, and project MCP
servers then apply, as if Pax had started there: read afresh from the directory,
not from the imported transcript, and each waiting for the same approval as on
any launch there. The folder keeps its own trust decision: one you never decided
about stays untrusted, and `/trust` decides it. Claude Code's and Codex's own
user-level MCP settings are not read.
Plain `/resume` lists them too, beside Pax's own sessions, in the project they
were started in, each card saying which agent it comes from, such as **Claude
Code · to import** for one not imported yet: Enter imports and resumes it, and
Right previews it. Rename or delete it after importing it. The imported copy
keeps saying where it came from, also once Pax renames it, and the web UI's
sidebar shows the same label beside its title. Codex sessions a
script ran with `codex exec` are not listed, but `--resume-codex SESSION-ID`
imports one.
Importing copies the conversation into Pax's saved sessions. The originals are
only read, never changed. Pax keeps what the model saw: prompts, answers,
reasoning summaries, tool calls, and their results, failed ones and images
included. After a Claude Code compaction, it keeps the compacted history, and
after a Claude Code rewind or Codex rollback, it keeps where you ended up. A
tool call with no recorded result gets one saying it was interrupted. The tools
in the old calls belong to the other agent; the model sees them as history, and
Pax's own tools handle what comes next.
Pax also keeps what the other agent's harness added to the conversation. From
Claude Code: messages you typed while the model worked, attached files,
reminders, skill bodies, and task notifications. From Codex: its developer
instructions, environment, `AGENTS.md` and other context, and messages between
its agents. They are marked as the harness's, so the transcript doesn't show
them as your prompts and compaction doesn't treat them as your requests. A note
opens the history saying it ran in the other agent, and another closes it saying
it continues in Pax, whose tools and instructions now apply. A Claude Code
session keeps the name you or Claude Code gave it, and a Codex session the name
in Codex's index.
A compaction summary Claude Code or Codex wrote is imported as a summary like
the ones Pax's own compaction writes, so Pax's compaction later builds on it
rather than summarizing it again. A Claude Code session starts at its latest
compaction: the summary, then the messages Claude Code kept from before it, as
Claude Code sent them. A Codex session keeps the history the summary replaced
ahead of it.
Codex encrypts some of what its models see so that only OpenAI's models can
read it: reasoning, its compaction summaries, and messages between its agents.
Pax keeps the reasoning and summaries for `openai-codex:` models, which continue
from them as Codex's model did. Other models see the readable reasoning summaries
instead, and the whole history from before each Codex compaction, as they cannot
read the summary that replaced it. Messages between Codex's agents can't be sent
again, and are marked where they were left out.
Sub-agents become the imported session's tasks, with their own histories, so
`/tasks` shows them, and a Codex sub-agent's session is not listed on its own. A
sub-agent's report or final answer appears in the history as a task report. The
closing note gives each sub-agent's task ID, so the model can resume a Claude
Code `general-purpose` or Codex default one with its saved history. One that
stopped before it reported is imported as cancelled.
Resuming the same session again opens the same copy. Until you continue it in
Pax, each resume reads the original again, so later turns in Claude Code or
Codex come along. Once you send a prompt in Pax, the copy is Pax's own and
later turns in Claude Code or Codex are not merged into it.
#### Background names
A saved session immediately gets a fallback title from its first prompt. A
single background worker can replace it with a short title, subtitle, and up to
four topic tags. The browser refreshes names while
idle without moving selection.
The worker uses up to 2,400 characters of recent user/assistant text, plus the
previous summary once a model has generated one. Until then, the fallback title
is not offered as a name to keep. When the conversation is longer than that
text, its first 400 characters are sent as well, so sessions begun from one
template are told apart. The worker is also given the titles of the other
sessions in the same workspace, and asked for a sentence-case title that differs
from them; a title one of them already has, in any letter case, is numbered, as
in `Fix renderer (2)`. It refreshes generated names after 16 content
revisions; revisions, unlike message offsets, survive compaction. This is a
bounded current summary, not a lossless incremental transcript archive. Opening
the browser backfills up to ten eligible sessions. Queue length, request count,
output size, and a 60-second deadline bound the work. Each naming request asks
for no reasoning, or the least the model accepts, and at most 4,096 output
tokens, so a reasoning model has room to answer. Exiting cancels and joins the
worker.
```text
/set sessions.naming false
/set sessions.naming_model openai:gpt-5-mini
/set sessions.naming_model null
```
Naming is on by default. Turn it off to make no naming requests, and sessions
keep their fallback titles. It uses the current model unless
`sessions.naming_model` names a smaller one. It sends conversation excerpts to
that model's provider and incurs additional usage. While naming is on only by
default, it names only sessions held with the current model, and lists only
their titles: a session held with another model, such as a local one or another
model of the same provider, or imported from another agent, keeps its fallback
title, and neither its text nor its title is sent. Switching models therefore leaves older sessions unnamed.
Saving `sessions.naming true`, or choosing `sessions.naming_model`, names every
untitled or stale session, from any workspace, sending it and its siblings'
titles to the naming model. It has no tools and does not
inherit coding plugins. Missing credentials, timeouts, invalid output, or stale
results leave the existing name usable and do not interrupt foreground work.
`/usage` and the browser preview show persisted naming token counts separately;
`/cost` remains retained foreground-history cost.
#### Storage and recovery limits
Conversations, metadata, and step records live in `sessions.db` beside the settings
database. `--database` therefore also selects the directory for saved sessions.
Code mode's saved sandbox state lives in `sessions.repl/`, one owner-only file
per session, next to it.
New conversation databases use owner-only file permissions where supported. The
contents are **not encrypted**: prompts, replies, tool results, and media may
contain secrets. Do not share the database between machines. An unfinished run
whose recorded process is still alive is treated as busy; revision checks reject
stale writers instead of overwriting another process's work.
Resuming a busy session does not wait for it or take it over. Pax copies its
newest saved state, including the latest step checkpoint, into a new saved
session titled with `(fork)`, and continues that copy. The original keeps
running in its own process and may still change files; no tools are replayed.
Resuming it again, from any Pax, continues the newest unarchived copy made this
way that no other Pax runs, rather than copying it again. A fork you made yourself,
with **Fork** or `/fork`, is never continued in its place.
The built-in `persistence` plugin records additional Harness checkpoints before
model requests, after model responses, and at settled tool-cycle boundaries.
`/plugins disable persistence` disables that extra step capture, not conversation
saving. Without it, a hard kill recovers the accepted prompt and preceding saved
history, not the in-flight turn's progress. Every Pax on the machine shares
`sessions.db`, and SQLite lets one of them write at a time. A step record waits
for the lock, so it can delay a tool result or a cancel by up to 30 seconds; one
still locked out then is skipped instead of failing the turn. Resume then uses an
earlier checkpoint, and a tool whose completion was skipped is listed under
unknown effects.
An interrupted session is marked `!`. If a process died mid-run, resume loads its
newest available step checkpoint and warns you to inspect external effects. A
completed tool in a partially completed parallel batch may still have no saved
result. An older settled checkpoint does not undo later file writes or commands.
There is no automatic tool replay, side-effect deduplication, workspace rollback,
or restoration of arbitrary plugin state.
Deletion removes the conversation and associated run records in the same SQLite
transaction. Shared content-addressed media is retained; deletion is not secure
erasure. Snapshot retention keeps eight recent checkpoints per run, plus the
latest settled recovery point when needed. There is no whole-session TTL or media
garbage collection.
### Background forks: `/fork`
`/fork` runs a copy of the current conversation in the background, so you can
keep working while it answers. It follows Code Puppy's `/fork`.
```text
/fork write tests for the parser fork with the current model
/fork @openai:gpt-5 review this fork with another model
/fork cancel 2 stop fork #2
/forks list this session's forks
```
The fork copies the retained history at the moment `/fork` runs and continues
from that copy as its own saved session. Later turns in the foreground do not
reach it, and it does not change the foreground history. With no history yet, or
if the copy fails, the fork starts with a fresh context and says so. It uses the
current model, plugins, and model settings unless `@model` names another model.
Pax has one agent, so unlike Code Puppy there is no `@agent` argument.
While forks run, the editor shows one row per fork above the prompt, like Code
Puppy's sub-agent panel: the fork number, its model, your `/spinner`, the elapsed
time, and what it is doing (`thinking`, `tool: NAME`, `responding`). A fork that
finished while a turn or command was running shows as done until its output prints.
When a fork finishes, Pax prints a `FORK #N RESPONSE` banner with the model, the response as
Markdown, the elapsed time, and the saved session id. `/resume SESSION-ID`
switches the foreground to that fork's conversation. Output waits while a turn or
command is running, then prints before the next prompt. Commands run between
turns, so a `/fork` typed during a turn is queued like any other command.
Cancelling a turn with Esc or Ctrl+C also cancels running forks. `/exit` and
`/reload` cancel them too.
A fork is a turn for plugins: `turn_start` runs before it starts and can rewrite
or cancel its prompt, which refuses the fork, and `turn_end` reports its outcome
when it finishes. `fork_end` follows with the fork's answer, or why it failed, so
the web UI shows it, and `/forks` there shows its table, as cards. Forks share the foreground's plugin instances, so a tool that
asks you a question can open its picker from a fork.
### Git worktrees
```bash
pax --worktree my-task
pax -w
```
A Git worktree is another checkout of the same repository with its own branch
and working files. Run these commands inside a repository with at least one
commit. `--worktree NAME` creates a `clai-NAME` branch from the current `HEAD`
and starts Pax at `/.worktrees/NAME`. If that worktree already
exists, Pax reopens it; if only the `clai-NAME` branch exists, Pax checks it out.
`-w` is the short form; omit the name to generate one. Names start with a letter
or digit and contain only ASCII letters, digits, hyphens, and underscores.
After checkout succeeds, Pax adds `/.worktrees/` to Git's local `info/exclude`
file to keep generated checkouts out of `git status`, without changing your
tracked `.gitignore`.
Uncommitted changes, ignored files, and untracked files are not copied. Project settings, repository instructions, and coding
tools use the new worktree root. Your user settings and plugins stay available;
a relative `--database` path still refers to the directory you launched from.
Pax prints the path and branch below its logo; a headless `--prompt` run prints
them on stderr instead. A startup error names the kept checkout. A directory at
that path that is not a Git worktree is rejected. If checkout fails, Pax tries to remove only the branch it just
created, without forcing deletion. If cleanup or the ignore edit fails, the error
names the retained branch or checkout for recovery.
On normal interactive exit, Pax checks the linked worktree for changes:
uncommitted or untracked files, or a different commit checked out than at launch.
Ignored files do not count. If nothing changed in a worktree this launch created,
Pax removes it without asking, and deletes its `clai-NAME` branch too when this
launch created that branch and Git agrees it is merged (`git branch -d`).
Pax also removes, without asking, a worktree opened with `--worktree`, created or
reopened, that has no uncommitted or untracked files and whose commits are all on
a remote-tracking branch, even if a different commit is checked out than at launch.
It keeps the branch and prints the
removed path. Pushed commits are judged from the local remote-tracking branches;
Pax does not fetch. Ignored files are deleted with the worktree. To keep a
worktree anyway, lock it with `git worktree lock PATH`, which makes Git refuse the
removal. Both rules still apply after `/update now` restarts Pax in the worktree.
A linked worktree you launched Pax inside without `--worktree` is never removed
without asking. If it is unchanged, Pax keeps it without asking, as it does a
reopened worktree that is unchanged and has unpushed commits.
Otherwise, if the worktree changed, Pax asks **Remove this worktree?** with an inline picker:
**Yes**, **No** (selected by default), or **No, don't ask again for this worktree**.
The path and removal details appear dimmed below the question. The complete
details are also available in the transcript before you choose; use PageUp and
PageDown to inspect long commands. Enter on **No**,
Esc, Ctrl+C, or EOF keeps it; select **Yes** to confirm removal. The third choice
keeps it and saves the preference in your settings database for this checkout,
which also keeps it once its commits are pushed.
There is no command to undo this choice for the same checkout.
A new checkout at the same path is asked again. By default, removal keeps
the branch and uses Git without `--force`, so dirty or locked worktrees are kept
with an explanation. You can register a user-only removal command for an exact
repository in `config.db` with the `worktrees.remove_commands` user setting; when
unset or empty (`{}`), removal uses Git. See
[Register a removal command](#register-a-worktree-removal-command). The command runs
only after this explicit confirmation, from outside the target checkout, and Pax
considers it successful only if the checkout is actually gone. The main checkout is never
removed. Headless runs, piped input, and startup errors keep the worktree without
prompting. `/new`, `/resume`, and `/reload` do not remove the checkout:
they leave the shell using the same working directory.
Enter a retained directory and run `pax --continue` or `pax --resume` to continue a saved session.
`--worktree` cannot be combined with `--resume`, `--continue`, `config`, or `plugins`.
#### Register a worktree removal command
For a repository where Git cannot perform the cleanup you want, set
`worktrees.remove_commands` in your user settings. It maps the repository's
canonical absolute Git common directory to a nonempty argv list. Find the key
with `git rev-parse --path-format=absolute --git-common-dir` inside that repository.
The match is exact, with no wildcards. Keys resolving to the same directory are
rejected rather than silently choosing one command. For example, in a Pax session:
```text
/set worktrees.remove_commands '{"/absolute/path/to/repo/.git": ["/absolute/path/to/cleanup-worktree", "{path}", "{branch}"]}'
```
The executable is your own cleanup program. Only whole argv tokens are
substituted: `{path}` is the absolute target checkout, `{branch}` is its current
branch (empty when detached), and `{repo}` is Git's main-worktree location: the
parent of a non-bare `.git` directory, or the common directory for other layouts.
Embedded placeholders such as
`--worktree={path}` are rejected; pass `"--worktree", "{path}"` instead. Pax does
not invoke a shell or expand variables.
To call a user-defined shell function, explicitly invoke its shell. For example,
a zsh function named `cleanup_worktree` could use this argv:
```json
["zsh", "-ic", "cleanup_worktree \"$1\"", "pax-remove", "{branch}"]
```
Interactive zsh loads your rc files, adding startup overhead and possibly output.
The branch reaches the function as `$1`; Pax never inserts it into shell text.
Neither the function nor the cleanup program above ships with Pax.
Pax warns that the command may delete the branch and uncommitted files before
asking for confirmation. The command inherits stdin, stdout, stderr, and the
terminal, has no timeout, and can be interrupted with Ctrl+C. A command failure
does not fall back to Git. If the saved configuration cannot be read or validated
on exit, Pax warns and offers the existing Git cleanup prompt instead. If Git
metadata cannot be read to prepare a registered command, Pax keeps the checkout
and reports the error. `.clai/settings.json` cannot set `worktree_remove_commands`;
Pax refuses to start if it does. Automatic removal and
`/workspaces destroy` continue to use Git.
When you no longer need the checkout, use Git's own cleanup commands from your
original repository root. Without `--force`, Git refuses to remove a dirty worktree:
```bash
git worktree remove .worktrees/my-task
git branch -d clai-my-task
```
A worktree separates working files, not permissions. Pax's default tools can
still access files outside it. Creation runs before the agent starts and emits
no agent telemetry spans.
### Sandboxes: `/sandbox`
Run `/sandbox PROVIDER` (`local smol`, `local boxlite`, `e2b`, `boxd`, `daytona`, `opensandbox`, `modal`, `render`,
`sprites`, or `kubernetes`) in a new conversation, before its first prompt. `local smol` and `local boxlite` run a
microVM on this machine, with SmolVM or BoxLite; `/sandbox local` alone asks which, and says what each still needs.
The others are cloud sandboxes. Pax copies this checkout (the branch, its unpushed commits, and
uncommitted files) into a new sandbox, saying which step it is on, and every command and file edit of the
conversation runs there, `!` lines included. `/resume` and `/fork` reopen it, and `/sandbox delete` deletes it. `/sandbox` alone says where
the conversation runs. To work on this machine again, run `/new`.
A sandbox stays until you run `/sandbox delete`, even when you leave its conversation. If Pax stops
while copying the checkout in, the conversation keeps its half-copied sandbox; `/sandbox delete` deletes
it. A fork or copy of the conversation uses the same sandbox, and stops working once it is deleted.
`git` and `gh` in the sandbox act as your `gh` login, so the agent can push and open pull requests.
Each sandbox gets the token `gh` has when you run `/sandbox`, and loses it when the sandbox is deleted.
The copy downloads older versions of files from GitHub when a command first reads them, so `git log -p`,
`git blame`, `git diff` against an older commit, or checking out another branch also need that token, and
fail once it stops working. Without a `gh` login, the sandbox has no GitHub access, and its copy has no
`origin` remote; it gets the whole history from this machine instead, and needs nothing from GitHub.
| Provider | Install extra | Keys | Where your GitHub token is | Who can read it |
|---|---|---|---|---|
| `local smol` | `pydantic-ai-pax[local]` on macOS (Apple silicon) and Linux; on Windows, `smolvm` on `PATH` | none | in the VM | anything run in the VM |
| `local boxlite` | `pydantic-ai-pax[local]` on macOS (Apple silicon) and Linux, with Python 3.14 or older; not on Windows | none | in the VM | anything run in the VM |
| `e2b` | `pydantic-ai-pax[e2b]` | `E2B_API_KEY` | E2B's proxy, in the sandbox's network rules | anyone with an API key for your E2B team; use a team of your own |
| `boxd` | `pydantic-ai-pax[boxd]` | `BOXD_API_KEY` | boxd's proxy, in a private secret made for the machine | a command in the sandbox, as below |
| `daytona` | `pydantic-ai-pax[daytona]` | `DAYTONA_API_KEY` | Daytona's proxy, in a secret of your Daytona organization made for the sandbox | anyone in your Daytona organization who can create sandboxes can name the secret and have the proxy send the token |
| `opensandbox` | `pydantic-ai-pax[opensandbox]` | `OPEN_SANDBOX_DOMAIN`, and `OPEN_SANDBOX_API_KEY` if your server needs one | your OpenSandbox server's credential proxy, in the memory of the sandbox's egress sidecar | anyone with your server's API key can use it; anyone who can read the sidecar's memory on the server's machine |
| `modal` | `pydantic-ai-pax[modal]` | Modal's own login: `modal token new` | in the sandbox | anything run in the sandbox |
| `render` | `pydantic-ai-pax[render]` | `RENDER_API_KEY` and `RENDER_WORKSPACE_ID` | in the sandbox | anything run in the sandbox |
| `sprites` | `pydantic-ai-pax[sprites]` | `SPRITE_TOKEN` | in the Sprite | anything run in the Sprite |
| `kubernetes` | `pydantic-ai-pax[kubernetes]` | `CLAI_KUBERNETES_WARM_POOL`, and `CLAI_KUBERNETES_NAMESPACE` if it is not `default`; `kubectl`'s current context | in the sandbox pod | anything run in the pod, and anyone who can exec into it |
A key the agent asks for with `request_env` reaches every command it starts in the sandbox afterwards,
on every provider, for as long as this conversation stays open in Pax. After a restart, a `/reload`, or a
conversation reopened in another session, it asks again and you pick the same saved `/keys` entry.
It goes to the provider with each command: inside the command for `boxd`, `daytona` and `render`, in its URL for `sprites`.
Install a provider with `uv tool install 'pydantic-ai-pax[PROVIDER]'`, and add its keys in `/keys`.
`/sandbox PROVIDER` says what is missing.
**Through the provider's proxy** (`e2b`, `boxd`, `daytona`, `opensandbox`): the token never enters the
sandbox. The provider's network proxy, outside it, adds the token to requests for `github.com`,
`api.github.com`, and `uploads.github.com`, and the sandbox holds only a stand-in. Use one of these if the
agent must not have your token.
`opensandbox` runs on your own [OpenSandbox](https://open-sandbox.ai) server, whose egress must be in
`dns+nft` mode. A server address without a scheme uses HTTPS unless it is this machine (`localhost`,
`127.0.0.1`, or `[::1]`). Its credential proxy keeps the token in the memory of the sandbox's egress
sidecar until the sandbox is deleted; if the sidecar restarts, the token is gone and `git` and `gh` there are signed
out. OpenSandbox's proxy is meant for sandboxes that reach only the hosts it allows, so a sandbox made with
a `gh` login reaches only `github.com`, `api.github.com`, and `uploads.github.com`: it can't install
packages or download release assets, archives, or Git LFS files. One made without a `gh` login keeps
your server's network policy.
Whether a server started in the sandbox can be reached from outside is also up to your server:
`/sandbox` does not turn on OpenSandbox's Secure Access, which needs a Kubernetes ingress gateway and
which Docker deployments reject, so on a server whose ingress is reachable, anything listening in the
sandbox answers without a token.
`daytona` keeps the token in a `CLAI_GITHUB_...` secret of your Daytona organization, which
`/sandbox delete` deletes with the sandbox. A sandbox deleted outside Pax, in Daytona's dashboard or CLI
or by Daytona's auto-delete, leaves its secret behind: delete it on Daytona's Secrets page.
**In the sandbox** (`local smol`, `local boxlite`, `modal`, `render`, `sprites`, `kubernetes`): these have no proxy that can add it, so
Pax saves the token in the sandbox's home folder for `git` and `gh`. Anything run there, the agent
included, can read it, and it goes when the sandbox does. A `kubernetes` sandbox is a pod Pax claims from
your [agent-sandbox](https://agent-sandbox.sigs.k8s.io) warm pool, on the cluster `kubectl`'s current
context names, and reaches through `kubectl port-forward`. Its pod runs commands but takes no file
uploads, so the token travels base64-encoded inside a command to the pod.
`local smol` and `local boxlite` run a microVM on this machine, with its own kernel and filesystem; neither needs an
account or key. Nothing of this machine is mounted into it, but it has network access, from this machine's network,
so it can reach your local network too. Both run the `python:3.13` image, which the engine downloads the first time.
`local boxlite` runs a [BoxLite](https://github.com/boxlite-ai/boxlite) micro-VM in Pax's process, on macOS
(Apple silicon) and Linux, where it needs read and write access to `/dev/kvm`; BoxLite has no Windows build. One
process at a time can use BoxLite's home directory (`~/.boxlite`), so a second Pax session opening a `local boxlite`
sandbox fails until the first exits.
`local smol` runs a [SmolVM](https://github.com/smol-machines/smolvm) microVM, on macOS (Apple silicon), Linux, and
Windows. On macOS and Linux the `local` extra installs smolmachines, which runs the VM in
Pax's process; Linux needs read and write access to `/dev/kvm`. On Windows, which smolmachines has no
build for, unzip the `windows-x86_64` [smolvm release](https://github.com/smol-machines/smolvm/releases)
into a folder on `PATH`, with the Windows Hypervisor Platform turned on; Pax then drives `smolvm` itself,
which macOS and Linux do too when the extra is not installed. That way of running it has not been tested on a
Windows host yet.
How long a sandbox lasts differs. A `local smol` or `local boxlite` VM keeps its files until `/sandbox delete`; it stops when Pax
does, and starts again when the conversation is reopened. Where Pax drives the `smolvm` CLI, closing a session
stops its VM, so a command another Pax session is running there fails; run it again. An `e2b` sandbox that times out is paused, and Daytona stops an idle
one; both keep their files, so delete them when you are done. A `modal` or `render` sandbox ends after
24 hours, with its files and any unpushed work, and a Modal sandbox cannot be paused. A Sprite has no
time limit and sleeps while idle. An `opensandbox` sandbox or a `kubernetes` claim has no time limit.
With `boxd`, the real token goes only into request headers to GitHub, which `gh` and `git`
use, not into a URL or body, so a command can't save it in a GitHub file or issue and read it back
([boxd's docs](https://docs.boxd.sh/guides/env-secrets#host-bound-secrets)).
A server started in a `boxd` machine is also public: boxd gives every machine an HTTPS address
that forwards to ports such as 8000 and 3000, and has no setting to turn it off or require a
login ([boxd's docs](https://docs.boxd.sh/guides/https)). The address holds the machine's random
name, so it can't be guessed, but anyone who learns it can reach the server. `e2b` sandboxes
answer only requests that carry the sandbox's access token.
When a command needs another key, such as `ANTHROPIC_API_KEY` for a script, the agent asks
for it by name, and Pax shows the `/keys` picker: pick a saved key or type a new one, which
is saved in `/keys`. Pax sets it as an environment variable in the sandbox, so the agent
carries on in the same turn without seeing the value. This key is in the sandbox, and anything
run there can read it. It reaches every command started afterwards; a server started before it
needs a restart. The table says how long it lasts: one kept for this Pax session is gone once the session
closes the sandbox, as an idle session does, or in a `/fork`, so the agent asks again. The agent asks only in the terminal,
not in the web UI.
### Computer use: `/computer-use`
`/computer-use` gives the model a `computer` tool that sees and controls the sandbox's desktop.
- **Before `/sandbox`**: run `/computer-use`, then `/sandbox PROVIDER`. The sandbox starts with a
desktop.
- **In a running sandbox**: `boxd`, `daytona`, `local smol`, `render`, `sprites` and `kubernetes`
add a desktop to the sandbox you have. `e2b`, `modal` and `local boxlite` can only
give a desktop to a new sandbox, so Pax asks you to run `/sandbox delete`, `/new`, `/computer-use`,
then `/sandbox PROVIDER`. It never deletes the sandbox itself, since a fork or copy of the conversation
may use it.
- **Turning it off**: `/computer-use off` removes the `computer` tool from the next turn. The sandbox
keeps running until `/sandbox delete`.
- **Permissions**: the model gets the `computer` tool only under `/permissions full`, since the screen can
change anything. Under another mode it is told the desktop needs `/permissions full`, and `/computer-use` says so too.
- `local smol` needs `smolmachines` for a desktop (`pydantic-ai-pax[local]`, on macOS Apple silicon
or Linux), so not on Windows. `opensandbox` has no desktop.
The setting is saved in the conversation, so `/resume`, `/fork` and compaction keep it.
#### Watching the desktop
While computer use is on, the status row shows `watch live ↗` next to the sandbox. Click it to open the
desktop on the provider's own website. Pax runs no viewer of its own. In a resumed conversation the link
appears once a turn reaches the sandbox, since getting it would start a stopped one.
- **`boxd`**: the machine's Desktop view in boxd's console. It opens in a browser signed in to your
boxd account.
- **`daytona`**: the desktop's noVNC page, on a signed link that works for 1 hour. Anyone holding the link
can see the screen and use the mouse and keyboard until it expires. Pax gets a new link for the status
row when a turn starts, once the old one is over 50 minutes old, so in a turn longer than an hour the link
disappears until the next turn. A page opened earlier stays connected.
- **Other providers** have no such link, so the status row shows no `watch live ↗`.
Everything on the sandbox's screen, secrets included, goes to the model's provider in screenshots,
and text on the screen can steer the model like any tool output.
### Several sessions in the web UI
```bash
pax --web
```
The [web UI](../PLUGINS.md#web-this-session-in-your-browser), from `pax --web` or
`/web` in a terminal, keeps several sessions live in one Pax. Click any session in the sidebar and it opens live, even while
others run turns. Each live session has its own conversation, folder, plugins,
queued prompts, and running turn, and keeps working while you look at another.
It works in the folder it was saved in, with that folder's `AGENTS.md`, skills,
`.clai/settings.json`, and MCP project files. Under `pax --web`, **New session**
asks which folder. It lists one row per project it has sessions in, which starts
in the checkout you are in, else the main one; the row's chevron, or → and ←, shows
and hides every worktree of its repository, to start in one of those instead. It also
completes a typed path to any directory, listing each repository it finds with its
worktrees shown. **New worktree…**, on a row or below the list for the row the arrow keys
select, checks out a new branch of that folder's repository
first, from the base you name (by default its `HEAD`), in `.worktrees/` as
[`--worktree`](#git-worktrees) does, and starts the session there; without a branch
name, it makes `clai-NAME` with a generated NAME. The worktree stays when the
session closes. With `/web`, New session starts in the folder of the session you are
looking at.
Pax never changes its own working directory to do this. There is no limit on how
many sessions run at once.
- **A stable sidebar.** Sessions are listed by project, or all together under
**Recent**, newest created first. Selecting, renaming, or a turn ending never
moves a row. Sessions whose folder is gone fold into **Removed worktrees**.
- **Status marks.** Each row has one: a spinner and elapsed time while it runs a
turn here, a hollow ring while another Pax runs it, **Needs input** while it asks
you a question, and a bold title while it has changes you have not seen.
**Attention** (Cmd/Ctrl+Alt+U) lists only those sessions.
- **Archiving.** A session's menu archives it, or every session of its branch, and a
project's menu archives all its chats. The sidebar's **Archived** view lists them
with **Unarchive**.
- **Esc** and the stop button interrupt the session you are looking at, and only it.
- **Steering and the queue.** As at the terminal's prompt, Enter queues a message
while a turn runs and Alt+Enter (Option+Enter), or the bolt button, steers the turn
with it; Alt+Enter with nothing typed steers the oldest queued message. The page
lists what waits above the composer, whether it was queued there or in the
terminal, and you can edit, steer, or remove each message before it runs. The
terminal's queue rows follow those changes.
- **Prompt recall.** Up on the composer's first line recalls the session's sent
prompts, newest first, and Down on its last line steps back toward the unsent
draft, which returns past the newest. Elsewhere in a multiline draft, Up/down
move the caret, and with command suggestions open they pick one. Queued
messages are edited in the list above the composer instead.
- **`@` files.** Typing `@` at the start of the composer or after a space lists the
session folder's files and folders that best match what follows, such as
`README.md` for `@READ`. In a Git repository these are the files Git tracks or
would add, so `.gitignore` applies; elsewhere, all but those in hidden folders,
`node_modules`, and `__pycache__`. Up/down pick one, and Tab or Enter puts its
path in the prompt; a folder stays open to list what it holds. Enter on a file
already typed in full sends the prompt as it is; Tab still takes the highlighted
one. The path is sent as you see it, and the agent reads the file with its tools.
- **Idle closing.** A session closes after an hour with no turn, no queued input,
no background fork or delegated task, and no browser or terminal showing it; a
page counts as showing the last five sessions it showed. Its conversation stays saved: click it to resume it. The session `pax --web`
started with never closes this way.
- **Settings.** `/set` in one session applies to every live session, except `model`
and the `run.*` settings, which stay with the session that set them, and settings
a session's `.clai/settings.json` fixes.
- **Read-only.** A session whose folder is gone, such as a removed worktree,
opens read-only. With `/web` from a terminal, so does a session saved in another
folder than the one Pax started in.
- **Running in another Pax.** A session another Pax is running opens read-only,
saving nothing. **Fork to continue here** continues it in a fork, as resuming a
busy session does, so it reuses a fork made before.
- **The terminal.** With `/web` from a terminal, the terminal shows one live session
at a time, and its toolbar shows `N live` while more than one is. `/resume ID` of a
session live in the browser shows that session in the terminal, even mid-turn,
instead of copying it; the session shown before keeps running.
- **`/update now` and `/reload`** restart Pax, so `/update now` runs only in the session
the terminal shows, or under `pax --web` in the session it started with, and
`/reload` only in the terminal. Elsewhere they refuse and say where to enter them;
**Update…** in the web UI's About runs `/update now` in that session from any page.
They also refuse while another session runs a turn, saying how many run, so try
again when they finish; bare `/update` can still show the menu in the session
shown in the terminal. With `/web` from a terminal, Pax restarts in the folder
it started in, so they refuse in a shown session that works in another folder.
`/reload` keeps the terminal's conversation but closes the other live sessions and
stops the web UI; run `/web` again to reopen it. `/update now` brings the web UI back.
- **Terminal menus and prompts.** A command that opens one, such as `/model add`,
`/resume claude`, or `/set api_key`, opens it in the terminal that runs Pax. When
there is none, as for `pax --web` started from a script or service, the command
fails with an error saying to enter it in a terminal, and names the page's
equivalent when there is one, such as `/model` or `/keys`. `/login openai-codex`
and a plugin's `read_line` prompt (see `PLUGINS.md`) ask in the page instead.
- **Quitting.** Ctrl+C in the terminal that runs `pax --web` quits Pax and ends
every session.
## Plugins and integrations
### Plugins
Plugins import from `pydantic_ai_pax`.
Everything beyond the prompt loop is a plugin, including the default coding
tools. Any Pydantic AI capability is a plugin as it is; give the agent web
search from Pydantic AI Harness without writing code. Install the `exa` extra
and set `EXA_API_KEY` first:
```sh
pip install 'pydantic-ai-harness[exa]'
export EXA_API_KEY=...
```
```text
/plugins add exa pydantic_ai_harness.exa:ExaSearch '{"max_results": 8}'
```
For anything beyond one capability, a plugin is a `Plugin` subclass. Like a
Pydantic AI capability, it declares what it contributes by overriding methods,
each defaulting to nothing. A single plugin can do as much as it likes; this one
both adds a capability and reacts to a lifecycle moment, to show two shapes at
once:
```python
from collections.abc import Sequence
from pydantic_ai.capabilities import AgentCapability
from pydantic_ai_harness.exa import ExaSearch
from pydantic_ai_pax.plugins import Plugin, TurnEnd
class Search(Plugin):
def get_capabilities(self) -> Sequence[AgentCapability[None]]:
return (ExaSearch(max_results=8),)
async def on_turn_end(self, event: TurnEnd) -> None:
self.host.console.bell()
```
Drop the file in `~/.config/pydantic-ai-pax/plugins/`, register anything
importable with `/plugins add NAME module[:Class] [JSON]`, or clone a trusted
repository with `/plugins add https://github.com/your-org/my-plugin.git`.
Git repositories need an `__init__.py` or `plugin.py` at their root; install
any dependencies in Pax's Python environment first. See
[where plugins live](../PLUGINS.md#where-plugins-live) for supported URLs and checkout management.
The plugin is live for the next prompt; no restart. `/plugins` alone opens a full-screen menu to enable, disable,
reload, and remove: Enter or Space toggles the highlighted plugin, and `c`, `r`,
and `d` configure, reload, and remove it. Press `/` to search plugin names; while you
search, every key you type filters, Enter keeps the matches so the keys act on
them, and Esc clears the search. Esc or `q` closes the menu without printing the
plugin list. Use `/plugins list` to print it. Plugins are trusted code running as you.
[PLUGINS.md](../PLUGINS.md) has every method, event, and rule.
Every Pax on your machine shares one settings database, so another worktree or
branch may have saved a plugin setting this one cannot run. When a saved setting
names a feature this build lacks, Pax skips just that setting and uses the default.
Startup stays quiet about it; the plugin's row in `/plugins`, and `/plugins enable`
or `reload` for that plugin, show what was skipped:
```text
coder: ignored saved sub_agents (needs stock-bound-delegation); using defaults.
```
Nothing is rewritten; the other build still sees your setting. If a plugin still
rejects its settings when a turn starts, that turn fails with the plugin named, and
Pax leaves that plugin's capability out of later turns; `/plugins reload NAME` tries
it again. Pax builds from before this
check apply every saved setting as they always did.
`/plugins enable notion` gives the agent Notion's hosted MCP tools and opens its
settings menu (`/plugins configure notion` reopens it). It uses a browser sign-in
by default, made with `/notion login`, or a token picked from `/keys` by name (a new
one is saved there as `NOTION_API_KEY`). Plugin settings never hold the token.
No built-in plugin opens a browser while loading or during a prompt: each signs in
only from its settings menu or its `login` command, and Esc cancels the wait. See
[PLUGINS.md](../PLUGINS.md#notion-workspace-tools).
`/plugins enable linear` gives the agent Linear's hosted MCP tools, read-only by
default, and opens its settings menu (`/plugins configure linear` reopens it). The
key is picked from `/keys` by name (a new one is saved there as `LINEAR_API_KEY`),
or choose browser sign-in. See [PLUGINS.md](../PLUGINS.md#linear-issues-and-projects).
### Plugins for one launch
```sh
pax -x web -x workspaces
pax -x github -p "Summarize my open pull requests"
```
`-x NAME` (long form `--plugin NAME`, repeatable) loads a plugin for this launch
only, even when it is disabled. It works in the terminal, with `-p`, and with
`--web`, where every session the browser opens loads it too. `NAME` is a plugin
`/plugins` lists as built in, added, or a drop-in file; an unknown one fails
before the first prompt, listing the ones there are. A plugin the project's
`.clai/settings.json` declares isn't loaded this way: approve it with
`/plugins enable NAME`, as usual.
Nothing saved changes: `/plugins list` shows a disabled plugin as `disabled,
loaded for this launch`, and the next `pax` without `-x` leaves it off, even if
the plugin saved its settings meanwhile. `/plugins disable NAME` or
`/plugins remove NAME` turns it off for the rest of the launch, also through
`/reload` and `/update`, and is saved as usual. `-x` can't be combined with
`--agent`, which loads no plugins.
### Built-in plugins at a glance
The coding tools,
`Coder(unrestricted_filesystem=True)`, are the built-in `coder` plugin: on by
default, `/plugins disable coder` for a chat-only shell. The model can also ask
you multiple-choice questions mid-run through the built-in `ask_user` plugin;
see [Questions from the model](#questions-from-the-model). The built-in
`repo_context` plugin reads the instruction files (`AGENTS.md`, else `CLAUDE.md`)
of the launch directory and its ancestors into the agent's
instructions, and a subdirectory's as the agent works there; `/plugins disable
repo_context` turns that off.
On Windows, the agent's workspace is a `WindowsWorkspace` on the launch directory, so commands run
in PowerShell; Pax does not provide repository context or skills there yet.
`coder` clears old tool results as the context fills.
Pax sends every tool, MCP tool, and output tool with strict mode off, whatever the
provider, and relies on argument repair and retries instead. A `NativeOutput` schema keeps
the provider's mode, as Anthropic and Bedrock only offer native output in strict mode. The built-in `compaction`
plugin, [described in Compacting the conversation](#compacting-the-conversation), is on by default beside it:
it summarises older messages before the context runs out and adds `/compact` and `/auto-compact`.
The built-in `refinement` plugin adds `/refine`: the model reviews its last answer and gives it
again, revised, as a turn of its own. Add words to say what to look at, such as
`/refine check the error handling`. To have every answer reviewed without asking, add harness
[Refine Output](../../../docs/harness/refine-output.md):
`/plugins add refine_output pydantic_ai_harness.refine_output:RefineOutput`. Each turn then shows
the first answer followed by the revised one.
Other harness capabilities are not listed in `/plugins`; add one on purpose with
`/plugins add`, see [other harness capabilities](../PLUGINS.md#other-harness-capabilities).
The disabled built-in `google_workspace` connects Gmail, Calendar, and Drive with a
token kept in `/keys`. `/google_workspace` opens its settings menu: the `/keys`
entry to use (`GOOGLE_ACCESS_TOKEN` by default), products, and read-only tools; see
[its settings](../PLUGINS.md#google_workspace-gmail-calendar-and-drive-tools).
`/plugins enable logfire_mcp` turns on the Logfire plugin, which lets the agent query
your Logfire telemetry through Logfire's MCP server, and opens a settings menu (which
Logfire, tools, and a key picked from `/keys`, never stored in plugin settings;
otherwise browser sign-in, which also signs new users up and works over SSH:
`/logfire login`). Reopen it with `/plugins configure logfire_mcp`; see
[Logfire](../PLUGINS.md#logfire-query-your-telemetry).
Hosted integrations such as `github`, `slack`, `linear`, and `logfire_mcp` load on
demand: the model sees one catalog line for each enabled one and loads its tools
with `load_capability` when a task needs them; see
[the built-in plugins](../PLUGINS.md#the-built-in-plugins).
### MCP servers: `/mcp`
`/mcp` manages MCP servers the way Code Puppy's `/mcp` does. Bare `/mcp` shows a
status dashboard. `/mcp install` opens a form where you name the server, pick
`stdio`, `http`, or `sse`, type its URL or command, edit the rest of its JSON
configuration in your editor, and switch on OAuth sign-in for remote servers.
`/mcp edit NAME` reopens the same form. `/mcp start NAME`, `stop NAME`,
`restart NAME`, `status NAME`, `logs NAME [LINES]`, `auth NAME [logout]`,
`remove NAME`, and `trust [status|accept|revoke]` manage servers, and `/mcp help`
lists them all. Saved servers are available to the agent from the next prompt,
with tool names prefixed by the server name. A server connects on the first
prompt that needs it (or `/mcp start`) and stays connected; one that cannot
connect is marked `error` and left out rather than failing the prompt. An OAuth
server signs in only with `/mcp auth NAME`, never in the middle of a prompt.
Servers are on demand by default: their tools stay out of prompts until the agent
loads them by the server's description. Switch off **On demand**
(`"defer_loading": false`) to put a server's tools in every prompt; see
[Load a server's tools on demand](../PLUGINS.md#load-a-servers-tools-on-demand). A
repository's Claude Code-style `.mcp.json` (or `.clai/mcp_servers.json`) loads
once you review it and run `/mcp trust accept`. See
[Connect MCP servers](../PLUGINS.md#connect-mcp-servers) for storage, secrets, OAuth,
and project trust. `/plugins disable mcp` removes the command and tools. In the
web UI, bare `/mcp` opens the Settings window's MCP servers section, which lists
the servers and runs the same form and subcommands in the page.
### Desktop notifications
The built-in `notifications` plugin is enabled by default. Interactive sessions
send a desktop notification when a turn finishes or fails, and when the model
asks a question through `ask_user`. Cancelled turns do not notify. Messages use
the title `Pax` and generic status text, not prompts, answers, paths, or errors.
macOS uses the system `osascript` notification service. Allow notifications for
Script Editor in System Settings > Notifications; Focus modes can suppress them.
Linux uses `/usr/bin/notify-send` when installed and a desktop notification service is
available. Windows, redirected output, headless mode, and SSH sessions do not
send notifications. These are local OS notifications, not terminal escape
sequences, so local tmux sessions need no passthrough configuration. Pax does
not detect terminal focus; notifications are submitted even while you are
looking at the terminal. Delivery and presentation depend on OS settings.
Use `/plugins disable notifications` to persistently turn them off and
`/plugins enable notifications` to restore them. `/plugins remove notifications`
resets the built-in default. Missing services, nonzero exits, and a two-second
submission timeout do not fail the turn. No notification-specific telemetry is
emitted.
### Herdr integration
The built-in `herdr` plugin is enabled by default inside a [herdr](https://herdr.dev)
pane. It reports Pax's state, session reference, model/token metadata, and
conversation title under the agent name `pax` (`clai2` before this release),
and lets herdr reopen the conversation after a herdr restart. Show the
`$model`, `$tokens`, and `$context` metadata through your herdr sidebar's
`[ui.sidebar.agents] rows`, not `rows_by_agent`, which herdr rejects for agents
it does not detect itself.
It does nothing outside herdr, on Windows, or without a terminal. Use
`/plugins disable herdr` to opt out. The new default also applies on upgrade;
an existing saved opt-out is preserved.
Pax's separate `notifications` plugin is unchanged; use
`/plugins disable notifications` if you prefer only herdr's alerts. See
[the plugin guide](../PLUGINS.md#herdr-integration) for details and limitations.
### Agent of Empires integration
Run `/plugins enable aoe` once to let [Agent of Empires](https://github.com/agent-of-empires/agent-of-empires)
(AoE) show Pax sessions as `running`, `waiting`, `idle`, or `error` and reopen a
restarted session's conversation. Titling the AoE session after the conversation is
opt-in: turn off AoE's `session.tie_workdir_to_name` first, so a rename does not move the
worktree Pax is working in, then run
`/plugins add aoe pydantic_ai_pax.builtin_plugins.aoe '{"titles": true}'`.
Register Pax with AoE as a custom agent:
```toml
# ~/.config/agent-of-empires/config.toml
[session.custom_agents]
pax = "pax"
```
Then `aoe add --tool pax -l`. The plugin does nothing outside an AoE session.
See [the plugin guide](../PLUGINS.md#agent-of-empires-integration) for details and limitations.
### Telemetry and references
The stock CLI enables the built-in `observability` plugin by default. It adds Pydantic
AI's [`Instrumentation`](https://pydantic.dev/docs/ai/capabilities/overview/)
capability to Pax turns for agent, model-request, and tool
spans, including timing, token usage, and failures. While it is loaded it also
turns on Pydantic AI instrumentation for every agent (`Agent.instrument_all`), so
agents Pax does not run itself, such as the compaction summariser,
sub-agents, and session naming, are traced to the same place, and `/compact` records a
`compact_messages` span. Unloading restores the previous setting. It adds Pax's
own UI spans only when `ui_events` is on (see below). HTTP client instrumentation
is off by default.
Startup plugin load failures reported in the terminal are also sent through the configured
Logfire instance, including their exception and traceback, even when `ui_events` is off. Failures are
reported after loading finishes, including those that happened before observability
loaded. Disabling the plugin leaves these failures as terminal messages only.
Other errors Pax shows you and recovers from are sent the same way: a failed turn
(for example, a model provider you have not logged in to), a slash command that
fails unexpectedly (for example, `/update` hitting a GitHub rate limit), and a plugin
handler that fails. Usage errors, such as a mistyped command, are not sent. An error
inside the agent run is already on the run's span, so it is not sent twice. With
`include_content` off, the default, these records and load failures keep only the exception's type.
This plugin was previously named `logfire`. Existing enabled/disabled choices,
settings, and saved token references carry over without reconfiguration. Existing
commands and project or drop-in declarations using `logfire` still target this
same plugin; it appears as `observability` in `/plugins`.
Set `LOGFIRE_TOKEN` to a write token for your Logfire project. Alternatively,
place the SDK's `logfire_credentials.json` in your user config directory at
`$XDG_CONFIG_HOME/pydantic-ai-pax/logfire/` (default
`~/.config/pydantic-ai-pax/logfire/`). SDK configuration is also read only from
that directory. The plugin ignores repository-local Logfire configuration and
credentials, plus `LOGFIRE_CONFIG_DIR` and `LOGFIRE_CREDENTIALS_DIR`, so a checkout
cannot choose the telemetry destination. Relative `XDG_CONFIG_HOME` values fall
back to `~/.config`. Export uses `send_to_logfire='if-token-present'`: no credentials
means no Logfire export and no interactive project setup. Logfire's
terminal console output is disabled so it does not interfere with the editor.
Warnings and errors Logfire and OpenTelemetry log about failed exports go to
`telemetry.log` next to `config.db` instead of over the editor; Pax names the
file on exit when a session wrote to it. Headless `pax -p` keeps them on stderr.
Standard SDK configuration, including explicitly configured OTLP exporters, still
applies; disable the plugin to stop its instrumentation altogether.
Agent runs and recorded UI interactions nest under a `Pax session` root span.
Its `agent_session_id` attribute is the saved conversation ID.
`/clear` selects a new root; `/resume` returns to that conversation's root if it
was already opened by this plugin instance. Unloading the plugin ends its roots;
reloading starts new traces with the same saved conversation IDs. A span is only
exported when it ends, which a root does at exit, so each root also gets a
`Pax session opened` log right away, carrying the same `agent_session_id` and
email: query that to find a session that is still running. With `--resume`, the
log is repeated with the saved ID as soon as startup picks the conversation.
Logfire rejects a span that started more than a day before it arrives, so a
root still open after 12 hours is ended then, and the next record opens a new
root, and trace, with the same `agent_session_id`. A run under way keeps its
place in the ended root's trace.
Each session root is tagged with your email, as a Logfire tag and the
`user.email` attribute; of its children, only the `Pax session opened` log
carries it. `user_tag` picks where it comes from. The default,
`logfire-account`, uses the account you signed in with when you set up the
**Logfire project** (below); that account already has access to the project, so
the tag reveals nothing new to it. With a token from `LOGFIRE_TOKEN`, the
credentials file, a token changed since setup, a setup made before this setting
existed, or a server that does not report your email, roots are not tagged until
you run the setup again. `git-email` uses `git config user.email` instead (Git
is only queried with this choice; a missing email leaves the tag out), and
`false` turns the tag off. Choose **User tag** in
`/plugins configure observability`, or set `user_tag` in the plugin settings.
Everything Pax records itself (session roots, UI records, and plugin load
failures) uses the `pax` instrumentation scope.
Prompts, responses, tool arguments/results, and binary content such as image
attachments are left out by default, so a Logfire token, even one set up for
another project, only receives timing, token usage, model and tool names, and the
type of each error. To record them, set **Message content** (`include_content`)
and **Binary content** (`include_binary_content`) to included in
`/plugins configure observability`. They then cover retained history used by later
turns too, which can send source code, file contents, and screenshots to the
configured telemetry destination, so review that destination first. Settings saved
before these options defaulted to off, and that never set them, now leave content
out as well; turn them on again to keep it. Keep tokens out of plugin settings,
which are saved as plaintext.
```text
/plugins configure observability
/plugins disable observability
/plugins enable observability
/plugins reload observability
/plugins add observability pydantic_ai_pax.builtin_plugins.logfire '{"include_content": true, "include_binary_content": true}'
```
`/plugins configure observability`, or `c` on `observability` in `/plugins`, opens
its settings menu. Each option below is a row there; each edit saves at once and
applies from the next run. The last command replaces the built-in configuration
instead. Its options are
`service_name` (default `pydantic-ai-pax`), `include_content` (default `false`),
`include_binary_content` (default `false`), `httpx` (default `false`), and `send_to_logfire` (either
`"if-token-present"` or `false`). The plugin explicitly sets the latter, rather
than taking `LOGFIRE_SEND_TO_LOGFIRE` from the environment. Traces carry Pax's
own version as `service.version`; `LOGFIRE_SERVICE_VERSION` and
`OTEL_SERVICE_VERSION` do not change it. Content flags control
Pydantic AI's prompt/result and standard binary-content capture, not all metadata;
model/tool names and tool definitions may still be recorded. Logfire's normal
scrubbing remains enabled. Set `httpx` to `true` to trace HTTP requests made with
`httpx` and `httpx2` while the plugin is active. With `include_content=true`,
Logfire also captures HTTP headers and request and response bodies; with it off,
those are not captured. HTTP instrumentation is process-wide, unlike agent tracing.
More options choose where telemetry goes, what it covers, and what it reads. `token` names a
`/keys` entry holding a Logfire write token, which then takes the place of
`LOGFIRE_TOKEN` and the credential file; a missing key stops export with a warning
rather than falling back. `variables_key` names a `/keys` entry holding a Logfire
API key with the `project:read_variables` scope (write tokens cannot read
variables), which the plugin's Logfire instance then reads
[managed variables](https://logfire.pydantic.dev/docs/reference/advanced/managed-variables/)
with instead of `LOGFIRE_API_KEY`. Nothing reads them unless a capability asks the
instance for one, so the key is only used then. A missing key is reported, and
the SDK falls back to `LOGFIRE_API_KEY` as if none were chosen. Pax's own agent
is named `pax`, so its runs are `invoke_agent clai2` spans and Logfire Agent
Control can address it by that name. `ui_events` (default `true`; set `false` to opt out) adds spans and logs in the
`pax` scope for UI interactions: menus, slash commands, `/set`, plugin actions,
`/keys`, prompt submissions, steering, interrupts, completions, and session start,
clear, and resume. They record names and listed choices, never typed values or
secrets. The one exception: while `include_content` is on, a submitted prompt also
carries its text as `prompt`, cut to 64,000 characters. `!` lines record only
that they were shell commands and their length, and slash-command arguments are
never recorded, since both can hold secrets such as `/plugins add` settings.
#### Setting up where traces go
Choose **Logfire project** in the settings menu (`/plugins configure observability`, or
`c` on `observability` in `/plugins`):
1. Pick which Logfire: Logfire US, Logfire EU, or **Another Logfire...** to type a
self-hosted or staging one as a host (`logfire.example.com`), the URL you open it
at, or its MCP URL (`https://logfire.example.com/mcp`); see
[Which Logfire](../PLUGINS.md#which-logfire). Enter chooses; Esc cancels and changes
nothing.
2. Sign in, or sign up, in the browser. Pax prints the link too, so it works over SSH.
3. Pick one of the projects you can write to (`/` to search, Enter to use it).
Pax then creates a write token for that project, saves it in `/keys` as
`LOGFIRE_TOKEN__`, and points the plugin's `token` at it; the plugin
reloads and the next turn is traced there. The sign-in itself is not kept, only
your account's email, saved with the key name as `account` to tag session roots. The
Logfire you picked is saved as the plugin's `base_url`, so `LOGFIRE_BASE_URL` cannot
send the token elsewhere, and sending is turned on if it was off. The Logfire
plugin's settings start from the same Logfire, so you pick the region once. Choose the row
again to switch projects, or press `R` on it to go back to `LOGFIRE_TOKEN` or the
credentials file.
#### Sending UX telemetry to the Pydantic shared project
`@pydantic.dev` staff can send Pax UX telemetry to the team's shared Logfire
project: run `/plugins configure observability`, choose **Logfire project**, pick
Logfire US, sign in with your Pydantic account, and pick the shared Pax project.
UI events are recorded by default. If you previously turned them off, set
**UI events** to recorded in the same menu, or:
```text
/plugins add observability pydantic_ai_pax.builtin_plugins.logfire '{"token": {"name": "LOGFIRE_TOKEN__"}, "ui_events": true}'
```
using the key name the setup menu printed (Esc closes the menu that `/plugins add`
opens). Run the setup menu again to go back to your personal project. Agent spans
leave content out by default, so the team gets UX telemetry and timing; turn on
**Message content** only if you mean to share your prompts and results with it.
The plugin owns an isolated Logfire instance. Disable, reload, or exit flushes
and shuts down that instance without shutting down application-global providers.
Pax waits at most three seconds for this, then warns that some telemetry may
not have been sent and lets cleanup finish in the background. If an export is
stuck, OpenTelemetry can still delay Pax's exit.
The existing global propagator is preserved. Logfire's SDK may install shared
executor context-propagation helpers; those SDK hooks are not removed on unload.
The plugin does not mutate a supplied agent. While enabled, its explicit per-run
`Instrumentation` takes precedence over that agent's instrumentation settings, and
`Agent.instrument_all` points agents without their own settings at the plugin's
instance; disabling it leaves the agent's original configuration and the previous
`Agent.instrument_all` setting in effect. Custom
`chat()` launchers only get built-ins when passed `builtin_plugins=DEFAULT_PLUGINS`.
- [Pydantic AI agent execution and events](https://pydantic.dev/docs/ai/core-concepts/agent/)
- [Capability events](https://pydantic.dev/docs/ai/capabilities/overview/)
- [Code Puppy splash](https://github.com/mpfaffenberger/code_puppy/blob/main/code_puppy/splash.py)
- [Code Puppy streaming](https://github.com/mpfaffenberger/code_puppy/blob/main/code_puppy/agents/event_stream_handler.py)
- [Code Puppy command registry](https://github.com/mpfaffenberger/code_puppy/blob/main/code_puppy/command_line/command_registry.py)
See [`THIRD_PARTY_NOTICES.md`](../THIRD_PARTY_NOTICES.md) for attribution.
## Using Pax from code
### Your own agent
```bash
pax --agent pydantic_ai.main:my_cool_agent
pax -a my_agents:reviewer -p "Review the staged diff"
```
`--agent MODULE:ATTR` (short form `-a`) chats with an existing Pydantic AI `Agent`
instance instead of Pax's default agent. Pax appends the launch directory to
`sys.path`, after installed packages, so a module next to where you start Pax
resolves without installing it. It does so only when nothing installed has the
module's top-level name. A module there whose top-level name is also installed
resolves against the installed package instead, so it usually fails with "module
not found". `ATTR` must
name an instance, not a class; the agent runs with `deps=None`. For that session
only, no plugins load: no built-ins (including the stock coder tools), no saved or
drop-in user plugins, and no project plugins, and `/plugins` reports that they are
off. Nothing saved changes, so plain `pax` loads plugins as before. The agent
keeps its own model unless `-m` or `CLAI_MODEL` selects another, and code mode
starts off, whatever is saved; `/set run.code_mode true` turns it on. `-p`, `--resume`,
and `--worktree` still apply; `config` and `plugins` subcommands reject `--agent`.
To pass deps or plugins, write a launcher that calls `chat` (see
`customization.md`).
### Headless mode
```bash
pax "Explain this repository" -m anthropic:claude-sonnet-4-6
pax -p "Continue the task" --resume SESSION-ID
pax -w -- "-v flags in the test runner: what do they do?"
git diff | pax -p -a my_agents:reviewer
pax -a my_agents:extractor --output-format json "List the cities in README.md"
```
`pax PROMPT` and `-p TEXT` / `--prompt TEXT` run one turn through tools to completion.
A first word that is not `acp`, `config`, `plugins`, `sessions`, or `update` starts the prompt,
and the words after it are joined with spaces; options may come before or between them.
A lowercase near-miss of a subcommand, such as `pax plugin list`, fails with a suggestion
instead; send it with `-p` or after `--` to run it as a prompt.
A word that starts with `-` may be read as an option even when quoted, so `pax "-m means model"`
does not run that prompt: put the prompt after `--`, as in `pax [OPTIONS] -- PROMPT...`,
and every word after `--` is prompt text, with or without `-p` before it. `-w`, `--resume`, `--resume-claude`, and
`--resume-codex` take the next word as their value when one follows, so a prompt directly
after one of them needs `--` or `-p`: `pax -w "fix the bug"` takes `fix the bug` as the
worktree name and opens the interactive shell. `-p` with no text, or the prompt `-`
before any `--`, reads the prompt from stdin instead, and fails if stdin is a terminal. Only the final answer is printed
to stdout, without Markdown rendering, wrapping, banners, thinking, or tool output.
A string output prints as it is; any other output, such as an agent's
`output_type=City` model, prints as JSON. `--output-format json` prints a JSON object
with an `output` key for any output, string or not.
Errors go to stderr with a nonzero exit status; Ctrl+C exits with status 130.
The turn is saved and can be resumed. With a prompt, `--resume` requires an explicit
session ID; the browser cannot open. `--continue`, `--session-id`, and `--fork-session` work as
interactively. Prompt text is literal, not a slash command.
`-m` is the short form of `--model`. It overrides the saved, project, and
`CLAI_MODEL` model for this invocation without changing your saved preference.
It also works in interactive mode.
Headless mode skips the `ask_user` plugin, including saved replacements, without
changing your preferences. Full-screen plugin requests fail rather than waiting
for input. Other enabled plugins and coding tools still run with your permissions.
Trusted third-party plugins must not read input or print directly to stdout;
Pax cannot enforce that contract on arbitrary Python code. Plugin load failures
abort headless runs. Background session naming is not started.
### The stock agent in your own code
`open_stock_agent` opens Pax's stock coding agent without the terminal. Use it with
`agent.run`, `run_stream_events`, `iter`, or anything else that takes an agent:
```python
import asyncio
from pathlib import Path
from pydantic_ai_pax import open_stock_agent
async def main() -> None:
async with open_stock_agent(workspace=Path.cwd(), model='anthropic:claude-opus-5-5') as agent:
result = await agent.run('Summarize this repository in one paragraph.')
print(result.output)
asyncio.run(main())
```
The agent has the `coder`, `repo_context`, and `compaction` built-ins,
configured as in `pax`, except that `coder`'s `task_control` is off: pass
`plugin_settings={'coder': {'task_control': True}}` to give the model the task
tools and background delegation. The file and shell tools work in `workspace`,
and the instruction files (`AGENTS.md`, else `CLAUDE.md`) of `workspace` and its
ancestors are read, plus a subdirectory's as the agent works there. A capability you pass that
supplies a workspace, such as a sandbox, takes its place, and a run's own
`workspace=` replaces it for that run. Commands get this process's environment
minus LLM provider API keys. Model names resolve as in `pax`, the agent's own
and any a run passes, so `openai-codex:` and `github-copilot:` use the sign-ins
saved with `/login`. Pax's per-model defaults apply too, such as prompt
caching. Without `model`, every run must pass one.
Nothing else you saved for `pax` applies: no saved, drop-in, or project plugins, no
`.clai/settings.json`, no `/model settings`, and no `chain:` fallback chains. `ask_user`
and the other terminal plugins stay out, as do `observability` and `mcp`, which read
your Pax configuration, and the Pax customization guide. Plugins close when the
`async with` block exits.
`plugin_settings` changes a built-in's settings, merged over the stock ones. This
keeps the file tools inside the workspace and loads no agents from disk:
```python
plugin_settings = {'coder': {'unrestricted_filesystem': False, 'agent_folders': []}}
```
`capabilities` adds your own capabilities. They are bound beside the built-ins, so
delegated tasks carry them too.
#### Serving it over ACP
`pax acp` serves this stock agent to an [Agent Client Protocol](https://agentclientprotocol.com)
(ACP) client, such as [Zed](https://zed.dev/docs/ai/external-agents), which starts it and talks to it
over stdin and stdout. Nothing but the protocol goes to stdout; notices go to stderr. It needs no
install: `uvx pydantic-ai-pax acp` runs the latest release. In Zed's `settings.json`:
```json
{
"agent_servers": {
"Pax": {
"type": "custom",
"command": "uvx",
"args": ["pydantic-ai-pax", "acp"]
}
}
}
```
What it serves:
- **The model** is `-m`, else `CLAI_MODEL`, else your saved `model`, as in `pax`. `--request-limit`
and `--database` work as in `pax` too. Model names resolve as in `pax`, so `openai-codex:` and
`github-copilot:` use the sign-ins saved with `/login`; `/model settings` does not apply. A
`chain:` fallback chain cannot run here, so `pax acp` stops at launch when the model is one.
- **Each session works in the folder the client opens**: its file and shell tools, and the
instruction files `repo_context` reads, are that folder's, not the one `pax acp` started in. Agent
Skills in that folder are too, but those in the folders above it, up to the repository root, still
come from the folder `pax acp` started in
([#15146](https://github.com/pydantic/pydantic-ai/issues/15146)).
- **Every file write and shell command asks the client first**, as under `/permissions read-only`, and
the client shows each one as a permission request. An "always allow" answer covers the same call for
the rest of that session. Your saved `run.permissions` does not apply.
- **Folder trust is never asked**, as with `pax -p`: a session takes the decision you made for its
folder in `pax`, and a folder you never decided about stays untrusted, which stderr says. See
[Folder trust](#folder-trust).
- **The plugins are this agent's**: `coder`, `repo_context`, and `compaction`, with `coder`'s
`sub_agents` off, since a delegated task cannot yet pass an approval up to the client
([#4302](https://github.com/pydantic/pydantic-ai/issues/4302)). No saved, drop-in, or project
plugins load, and `.clai/settings.json` is not read. MCP servers the client offers are not
connected yet; stderr names them.
- **Signing in**: what works is what `pax acp` reads without your settings database. That is
`/login openai-codex` and `/login github-copilot`, a key saved with `/login PROVIDER@PROFILE`
for `-m PROVIDER@PROFILE:MODEL`, and provider keys in the environment, such as
`ANTHROPIC_API_KEY`, when the client passes them on. A `/keys` entry reaches a model only through
`/model settings`, so it does not apply. To a client that can run ACP Terminal Auth, `pax acp`
offers `--login`, which the client adds to the command it runs `pax acp` with: `pax acp --login`
(or `pax --login`, for a client that replaces the arguments) opens the `openai-codex` and
`github-copilot` sign-in picker and exits when it is done, with status 0 once signed in. For a
key, run `pax --login PROVIDER@PROFILE` in a terminal yourself. A client says it can run Terminal
Auth with `auth.terminal`, or with `_meta["terminal-auth"]`, as older clients and the ACP
Registry's check do.
- **Sessions are not saved**: they end with the connection, and `/resume` does not list them.
`pax acp` cannot be combined with `-p`, `--web`, `--update`, `--resume`, `--continue`,
`--session-id`, `--fork-session`, `--worktree`, `--agent`, or `--plugin`.
To serve the agent with settings of your own, open it yourself and hand it to harness
[`run_acp_stdio`](../../../docs/harness/acp.md). This script asks the client before every shell
command and file change:
```python
import asyncio
from pathlib import Path
from pydantic_ai_harness.experimental.acp import run_acp_stdio
from pydantic_ai_harness.guardrails import GuardrailResult, ToolCallInfo, ToolGuardrail
from pydantic_ai_pax import open_stock_agent
def ask_first(call: ToolCallInfo) -> GuardrailResult:
if call.name in ('shell', 'write_file', 'edit_file'):
return GuardrailResult.approve()
return GuardrailResult.allow()
async def main() -> None:
async with open_stock_agent(
workspace=Path.cwd(),
model='anthropic:claude-opus-5-5',
capabilities=[ToolGuardrail(guard=ask_first)],
plugin_settings={'coder': {'sub_agents': False}},
) as agent:
await run_acp_stdio(agent)
asyncio.run(main())
```
Pax installs the ACP SDK that `run_acp_stdio` needs, as `pydantic-ai-harness[acp]` does. Each approval becomes an ACP
permission request. Every session works in `workspace`. To follow the folder each
client session opens instead, return a `workspace` from a `session_config`, as
[Rooting tools at the workspace](../../../docs/harness/acp.md#rooting-tools-at-the-workspace)
shows. `sub_agents` is off because a delegated task cannot yet pass an
approval up to the client, so its run would fail
([#4302](https://github.com/pydantic/pydantic-ai/issues/4302)). Where approvals are
answered in your own process, a
[`HandleDeferredToolCalls`](../../../docs/deferred-tools.md#resolving-deferred-calls-with-a-handler)
capability in `capabilities` answers them for delegated tasks too.
### Bring an agent
```python
import asyncio
from pydantic_ai import Agent
from pydantic_ai_pax import chat
agent = Agent('test') # No capabilities required.
asyncio.run(chat(agent, deps=None))
```
`Session(agent, deps=..., plugins=..., on_stream_event=...)` is the noninteractive
API. Call `await session.prompt(text)` for each turn, or
`await session.prompt(text, images=[BinaryContent(data=png_bytes, media_type="image/png")])`
for image input (`BinaryContent` comes from `pydantic_ai.messages`). Native `agent.run` drives the
loop through tools to completion. Successful turns retain `result.all_messages()`;
cancelled turns retain the prompt and messages captured by Pydantic AI, including
interrupted responses and tool results. Failed turns leave the previous history
intact. External tool side effects may already have occurred. History is in memory
only. Structured outputs are supported and displayed after completion.
## Working on Pax
### Source layout
The shell entry point lives in `app.py`. Related implementations live in
`cli/`, `config/`, `runtime/`, `models/`, `plugins/`, and `ui/` (`prompt/`,
`menus/`, and `rendering/`). Built-in plugins live in `builtin_plugins/`; MCP has its own
`mcp/` package. Plugin authors can still import `pydantic_ai_pax.plugins` and
`pydantic_ai_pax.commands` directly. See [the plugin guide](../PLUGINS.md) for
examples.
### Reload Pax during development
```text
/reload
```
After editing `pydantic_ai_pax` source, run `/reload` without arguments. It uses
`importlib.reload` on loaded Pax modules and rebuilds the prompt loop, commands,
and session with the updated code. The Python process, agent, dependencies passed
to `chat`, conversation messages, selected model, and active settings are kept.
The retained transcript is kept too, including when upgrading a running session
from the older scrollback implementation to the live panel.
Enabled plugins unload and load again so their handlers use the refreshed
shell types. Disabled and unapproved project plugins stay off.
If an import or shell rebuild fails, Pax reports the error and restores the
previous module bindings. Correct the source and retry `/reload`. Plugin
instances and their contributions are recreated. Installed module globals not
overwritten by the new source can survive; initialize mutable state in `__init__`.
Import-time side effects cannot be undone.
Reload ordering follows module-scope imports in the current Python source, so
adding or changing imports between Pax modules does not require a restart.
Newly referenced local modules and package initializers are included when planning
the dependency order, but Python imports them only if the updated code uses them.
Function-local imports and `TYPE_CHECKING` guards do not create eager dependencies.
Literal guards and direct comparisons of `sys.platform`, `os.name`, and
`sys.version_info` select only the active branch, including imported aliases.
Other conditions are analyzed conservatively and may require a restart if their
alternative imports form a cycle. No guard expression is executed during planning.
A detected import cycle or invalid source reports an error before reloading modules.
Restart for changes to startup code, the custom agent's construction, or dependencies,
including `pydantic_ai_harness`. `/reload` refreshes Pax only, not Harness or core,
even when their source has changed in the same checkout. If new Pax code imports
a symbol the running dependency does not have, restart with the same launch options
and `--resume` to continue the saved session. Keep the worktree if asked to remove it.
Exit removes a clean `--worktree` checkout with no unpushed commits without asking;
run `git worktree lock .` in it first to keep it.
`/reload` does not rerun the CLI or recursively reload third-party packages. Import-time side effects
still cannot be undone. Use `/plugins reload NAME` when you only want to reload one
plugin.
### CI coverage
The `Pax coverage` check requires 100% branch coverage for `src/pydantic_ai_pax`.
It is separate from Harness coverage;
passing Pax test jobs alone does not mean either coverage gate has passed.
Tracked under [#875](https://github.com/pydantic/pydantic-ai-harness/issues/875).