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 PathScopeDescription
~/.pi/agent/settings.jsonGlobal (all projects)General configuration applicable to all projects
.pi/settings.jsonProject-levelOnly 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 ItemTypeDefault ValueDescription
defaultProviderstring-Default provider, e.g., "anthropic", "openai"
defaultModelstring-Default model ID
defaultThinkingLevelstring-Default reasoning level, options: off / minimal / low / medium / high / xhigh / max
hideThinkingBlockbooleanfalseHide AI reasoning process by default
showCacheMissNoticesbooleanfalseShow cache miss notifications
thinkingBudgetsobject-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:

LevelApplicable ScenarioExample Budget
minimalAlmost no reasoning, pursuing the fastest response1024
lowSimple Q&A and small changes4096
mediumDefault choice for daily coding tasks10240
highComplex refactoring and troubleshooting difficult issues32768

UI and Display Configuration

The following configuration items control theme appearance, editor layout, and startup behavior.

Configuration ItemTypeDefault ValueDescription
themestring"dark"Theme name
externalEditorstringAutomatically selected based on the systemExternal editor command opened with Ctrl+G
quietStartupbooleanfalseHide startup header information
collapseChangelogbooleanfalseWhether to show a collapsed changelog after updates
editorPaddingXnumber0Editor horizontal padding (0-3)
outputPadnumber1Message area horizontal padding (0 or 1)
autocompleteMaxVisiblenumber5Maximum 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 ItemTypeDefault ValueDescription
httpProxystring-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 ItemTypeDefault ValueDescription
compaction.enabledbooleantrueEnable automatic compression
compaction.reserveTokensnumber16384Tokens reserved for the LLM response
compaction.keepRecentTokensnumber20000Number 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 ItemTypeDefault ValueDescription
retry.enabledbooleantrueEnable automatic retry
retry.maxRetriesnumber3Maximum retry count
retry.baseDelayMsnumber2000Base retry delay (milliseconds), exponential backoff: 2s, 4s, 8s
retry.provider.timeoutMsnumberSDK defaultRequest timeout (milliseconds)
retry.provider.maxRetriesnumber0Provider-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 ItemTypeDefault ValueDescription
steeringModestring"one-at-a-time"Steering message sending strategy: "all" or "one-at-a-time"
followUpModestring"one-at-a-time"Follow-up message sending strategy
transportstring"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 ItemTypeDefault ValueDescription
terminal.showImagesbooleantrueDisplay images in the terminal
terminal.imageWidthCellsnumber60Inline image width (terminal cells)
images.autoResizebooleantrueScale images down to within 2000x2000
images.blockImagesbooleanfalseBlock 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 ItemTypeDefault ValueDescription
shellPathstring-Custom shell path
shellCommandPrefixstring-Prefix for each bash command
npmCommandstring[]-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 ItemTypeDefault ValueDescription
enabledModelsstring[]-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