Pi Agent Configuration Explained
Pi Agent uses JSON-format configuration files, supporting both global configuration and project-level configuration.
Configuration File Location
Pi Agent reads configuration from two fixed paths, and the two have different priorities.
| File Path | Scope | Description |
|---|---|---|
| ~/.pi/agent/settings.json | Global (all projects) | General configuration applicable to all projects |
| .pi/settings.json | Project-level | Only takes effect for the current project and overrides the global configuration |
You can directly edit the JSON file, or use the interactive mode's/settingscommand to modify common options.
Model and Reasoning Configuration
The following configuration items control which provider and model are used by default, and how the reasoning budget is allocated.
| Configuration Item | Type | Default Value | Description |
|---|---|---|---|
| defaultProvider | string | - | Default provider, e.g., "anthropic", "openai" |
| defaultModel | string | - | Default model ID |
| defaultThinkingLevel | string | - | Default reasoning level, options: off / minimal / low / medium / high / xhigh / max |
| hideThinkingBlock | boolean | false | Hide AI reasoning process by default |
| showCacheMissNotices | boolean | false | Show cache miss notifications |
| thinkingBudgets | object | - | Customize token budget for each level |
Custom reasoning budget example:
Example
"thinkingBudgets": {
"minimal": 1024,
"low": 4096,
"medium": 10240,
"high": 32768
}
}
It should be noted that the values below are for demonstration purposes only, not official defaults.
The meaning of each level and its corresponding example budget is as follows:
| Level | Applicable Scenario | Example Budget |
|---|---|---|
| minimal | Almost no reasoning, pursuing the fastest response | 1024 |
| low | Simple Q&A and small changes | 4096 |
| medium | Default choice for daily coding tasks | 10240 |
| high | Complex refactoring and troubleshooting difficult issues | 32768 |
UI and Display Configuration
The following configuration items control theme appearance, editor layout, and startup behavior.
| Configuration Item | Type | Default Value | Description |
|---|---|---|---|
| theme | string | "dark" | Theme name |
| externalEditor | string | Automatically selected based on the system | External editor command opened with Ctrl+G |
| quietStartup | boolean | false | Hide startup header information |
| collapseChangelog | boolean | false | Whether to show a collapsed changelog after updates |
| editorPaddingX | number | 0 | Editor horizontal padding (0-3) |
| outputPad | number | 1 | Message area horizontal padding (0 or 1) |
| autocompleteMaxVisible | number | 5 | Maximum visible autocomplete entries (3-20) |
Recommended external editor configuration for VS Code users:
Example
"externalEditor": "code --wait"
}
--waitThe parameter ensures that Pi Agent resumes only after VS Code closes the file; otherwise Pi Agent continues executing immediately after the editor opens.
Network Configuration
The following configuration items control the proxy Pi Agent uses when accessing model APIs.
| Configuration Item | Type | Default Value | Description |
|---|---|---|---|
| httpProxy | string | - | HTTP proxy URL (global configuration only) |
Setting up a proxy (for environments such as mainland China where a proxy is needed to access APIs):
Example
"httpProxy": "http://127.0.0.1:7890"
}
Context Compression Configuration
When the context approaches its limit, Pi Agent automatically compresses historical messages. These settings control when compression is triggered and what is retained.
| Configuration Item | Type | Default Value | Description |
|---|---|---|---|
| compaction.enabled | boolean | true | Enable automatic compression |
| compaction.reserveTokens | number | 16384 | Tokens reserved for the LLM response |
| compaction.keepRecentTokens | number | 20000 | Number of recent tokens kept uncompressed |
Retry Configuration
The following configuration items determine automatic retry behavior after request failures, including the number of retries and the backoff interval.
| Configuration Item | Type | Default Value | Description |
|---|---|---|---|
| retry.enabled | boolean | true | Enable automatic retry |
| retry.maxRetries | number | 3 | Maximum retry count |
| retry.baseDelayMs | number | 2000 | Base retry delay (milliseconds), exponential backoff: 2s, 4s, 8s |
| retry.provider.timeoutMs | number | SDK default | Request timeout (milliseconds) |
| retry.provider.maxRetries | number | 0 | Provider-level retry count |
It is recommended to keepretry.provider.maxRetriesit at 0, unless you truly need provider-level retries.
Setting it to greater than 0 may cause SDK-level retries to block Pi Agent when usage limits are exceeded, rather than letting Pi Agent's retry mechanism handle it.
Message Delivery Configuration
The following configuration items control when and how messages you insert in the conversation are sent to the model.
| Configuration Item | Type | Default Value | Description |
|---|---|---|---|
| steeringMode | string | "one-at-a-time" | Steering message sending strategy: "all" or "one-at-a-time" |
| followUpMode | string | "one-at-a-time" | Follow-up message sending strategy |
| transport | string | "auto" | Transport protocol: "sse", "websocket", "websocket-cached", "auto" |
Terminal and Image Configuration
The following configuration items control how images are displayed in the terminal and how they are processed before being sent to the model.
| Configuration Item | Type | Default Value | Description |
|---|---|---|---|
| terminal.showImages | boolean | true | Display images in the terminal |
| terminal.imageWidthCells | number | 60 | Inline image width (terminal cells) |
| images.autoResize | boolean | true | Scale images down to within 2000x2000 |
| images.blockImages | boolean | false | Block all images from being sent to the LLM |
Shell Configuration
The following configuration items control the shell and command prefix used when Pi Agent executes bash commands.
| Configuration Item | Type | Default Value | Description |
|---|---|---|---|
| shellPath | string | - | Custom shell path |
| shellCommandPrefix | string | - | Prefix for each bash command |
| npmCommand | string[] | - | Custom command for npm package operations |
Example of using tools such as mise or asdf to manage the Node.js version:
Example
"npmCommand": ["mise", "exec", "node@20", "--", "npm"]
}
Model Cycling Configuration
The following configuration items control which models can be seen when cycling through models with Ctrl+P.
| Configuration Item | Type | Default Value | Description |
|---|---|---|---|
| enabledModels | string[] | - | List of models available when cycling with Ctrl+P, supports wildcards |
Example
"enabledModels": ["claude-*", "gpt-4o", "gemini-2*"]
}
Configuration Merge Rules
Project configuration (.pi/settings.json) overrides global configuration (~/.pi/agent/settings.json).
Nested objects usemergerather than replacement. The following example illustrates this.
Global configuration file ~/.pi/agent/settings.json:
Example
"theme": "dark",
"compaction": { "enabled": true, "reserveTokens": 16384 }
}
Project configuration file .pi/settings.json:
Example
"compaction": { "reserveTokens": 8192 }
}
In the effective configuration after merging, theme takes the global dark, compaction.enabled takes the global true, and compaction.reserveTokens is overridden to 8192 by the project configuration.
In other words, the project configuration only overrides the fields it explicitly declares, and all other fields continue to use the global configuration.
Complete Configuration Example
The following is a typical global configuration file:
Example
"defaultProvider": "anthropic",
"defaultModel": "claude-sonnet-4-20250514",
"defaultThinkingLevel": "medium",
"theme": "dark",
"compaction": {
"enabled": true,
"reserveTokens": 16384,
"keepRecentTokens": 20000
},
"retry": {
"enabled": true,
"maxRetries": 3
},
"enabledModels": ["claude-*", "gpt-4o"],
"warnings": {
"anthropicExtraUsage": true
},
"packages": ["pi-skills"]
}
warnings.anthropicExtraUsage is a boolean, defaulting to true.
It provides a reminder when Anthropic subscription authentication may incur additional paid usage.
packages is an installed package filter configuration, used to declare which packages to load.
Other Extensions