Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Pi Agent Configuration in Detail

Pi Agent Configuration in Detail

Pi Agent uses JSON configuration files and supports both global and project-level configuration.


Config file locations

Pi Agent reads configuration from two fixed paths, with different priorities.

File path Scope Description
~/.pi/agent/settings.json Global (all projects) General configuration that applies to all projects
.pi/settings.json Project-level Applies only to the current project and overrides the global configuration

You can edit the JSON file directly or use the /settings command in interactive mode to modify common options.


Model and reasoning configuration

The following settings 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, such as "anthropic" or "openai"
defaultModel string - Default model ID
defaultThinkingLevel string - Default reasoning level; valid values are off / minimal / low / medium / high / xhigh / max
hideThinkingBlock boolean false Hide AI reasoning by default
showCacheMissNotices boolean false Show cache miss notifications
thinkingBudgets object - Customize the token budget for each level

Example custom reasoning budget:

Example

{

  "thinkingBudgets": {

    "minimal": 1024,

    "low": 4096,

    "medium": 10240,

    "high": 32768

  }

}

Note that the following values are only illustrative and are not official defaults.

The meaning of each level and its corresponding example budget are as follows:

Rating Applicable scenarios Example budget
minimal Almost no reasoning, for the fastest response 1024
low Simple Q&A and small changes 4096
medium The default choice for everyday coding tasks 10240
high Complex refactoring and difficult troubleshooting 32768

UI and display configuration

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

Configuration Item Type Default value Description
theme string "dark" Theme name
externalEditor string Automatically select based on the system External editor command opened by Ctrl+G
quietStartup boolean false Hide the startup header
collapseChangelog boolean false Whether to show a collapsed changelog after an update
editorPaddingX number 0 Editor horizontal padding (0-3)
outputPad number 1 Horizontal padding of the message area (0 or 1)
autocompleteMaxVisible number 5 Maximum visible autocomplete entries (3-20)

External editor configuration recommended for VS Code users:

Example

{

  "externalEditor": "code --wait"

}

--wait The parameter ensures Pi Agent resumes only after VS Code closes the file; otherwise Pi Agent continues running immediately after the editor opens.


Network configuration

The following settings control the proxy used when Pi Agent accesses model APIs.

Configuration Item Type Default value Description
httpProxy string - HTTP proxy URL (global config only)

Setting a proxy (for environments such as mainland China that require a proxy to access APIs):

Example

{

  "httpProxy": "http://127.0.0.1:7890"

}


Context compaction configuration

Pi Agent automatically compacts history when the context nears its limit; these settings control when compaction triggers and what is retained.

Configuration Item Type Default value Description
compaction.enabled boolean true Enable automatic compaction
compaction.reserveTokens number 16384 Tokens reserved for the LLM response
compaction.keepRecentTokens number 20000 Number of recent tokens kept uncompressed

Retry configuration

The following settings determine automatic retry behavior after a failed request, including retry count and backoff interval.

Configuration Item Type Default value Description
retry.enabled boolean true Enable automatic retry
retry.maxRetries number 3 Maximum number of retries
retry.baseDelayMs number 2000 Retry base delay (ms), exponential backoff: 2s, 4s, 8s
retry.provider.timeoutMs number SDK default Request timeout (ms)
retry.provider.maxRetries number 0 Provider-level retry count

It is recommended to include retry.provider.maxRetries Keep this at 0 unless you really need provider-level retries.

Setting it above 0 may cause SDK-level retries to block Pi Agent when rate limits are hit, instead of letting Pi Agent's own retry mechanism handle it.


Message passing configuration

The following settings control when and how messages you insert into the conversation are sent to the model.

Configuration Item Type Default value Description
steeringMode string "one-at-a-time" steering message send strategy: "all" or "one-at-a-time"
followUpMode string "one-at-a-time" follow-up message send strategy
transport string "auto" Transport protocol: "sse", "websocket", "websocket-cached", "auto"

Terminal and image configuration

The following settings 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 settings control the shell and command prefix used when Pi Agent runs bash commands.

Configuration Item Type Default value Description
shellPath string - Custom shell path
shellCommandPrefix string - Prefix for every bash command
npmCommand string[] - Custom command for npm package operations

Example of managing Node.js versions with tools such as mise or asdf:

Example

{

  "npmCommand": ["mise", "exec", "node@20", "--", "npm"]

}


Model loop configuration

The following settings control which models are visible when you cycle models with Ctrl+P.

Configuration Item Type Default value Description
enabledModels string[] - List of models available in the Ctrl+P cycle, 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 are merged rather than replaced; the following example illustrates this.

Global config file ~/.pi/agent/settings.json:

Example

{

  "theme": "dark",

  "compaction": { "enabled": true, "reserveTokens": 16384 }

}

Project config file .pi/settings.json:

Example

{

  "compaction": { "reserveTokens": 8192 }

}

In the merged effective configuration, theme takes the global dark, compaction.enabled takes the global true, and compaction.reserveTokens is overridden by the project config to 8192.

In other words, the project config only overrides fields it explicitly declares; all other fields continue to use the global configuration.


Complete configuration example

Here 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, default true.

It warns when Anthropic subscription authentication may incur paid extra usage.

packages is the installed-package filtering configuration, used to declare which packages to load.