@earendil-works/pi-coding-agent 0.86.1 → 0.87.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/README.md +25 -675
  3. package/dist/bundle/chunks/{anthropic-messages-MYU5ZMRF.js → anthropic-messages-J5WXPPPC.js} +1 -1
  4. package/dist/bundle/chunks/chunk-65HAU2C5.js +2 -0
  5. package/dist/bundle/chunks/{chunk-CMRUVXTE.js → chunk-OJP47DM6.js} +48 -42
  6. package/dist/bundle/chunks/github-copilot.js +1 -1
  7. package/dist/bundle/chunks/{openai-completions-CYGM3XXP.js → openai-completions-OBX42CLD.js} +2 -2
  8. package/dist/bundle/chunks/{virtual-modules-MGTKWDID.js → virtual-modules-VHMJYYWQ.js} +1 -1
  9. package/dist/bundle/cli-runtime.js +1 -1
  10. package/dist/bundle/index.js +1 -1
  11. package/dist/bundle/rpc-entry.js +1 -1
  12. package/dist/cli/args.d.ts.map +1 -1
  13. package/dist/cli/args.js +14 -4
  14. package/dist/cli/args.js.map +1 -1
  15. package/dist/cli/file-processor.d.ts +1 -1
  16. package/dist/cli/file-processor.d.ts.map +1 -1
  17. package/dist/cli/file-processor.js.map +1 -1
  18. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  19. package/dist/core/agent-session-runtime.js +1 -1
  20. package/dist/core/agent-session-runtime.js.map +1 -1
  21. package/dist/core/agent-session.d.ts +27 -3
  22. package/dist/core/agent-session.d.ts.map +1 -1
  23. package/dist/core/agent-session.js +389 -119
  24. package/dist/core/agent-session.js.map +1 -1
  25. package/dist/core/cache-warmer.d.ts +1 -0
  26. package/dist/core/cache-warmer.d.ts.map +1 -1
  27. package/dist/core/cache-warmer.js +15 -1
  28. package/dist/core/cache-warmer.js.map +1 -1
  29. package/dist/core/compaction/compaction.d.ts +3 -1
  30. package/dist/core/compaction/compaction.d.ts.map +1 -1
  31. package/dist/core/compaction/compaction.js +155 -57
  32. package/dist/core/compaction/compaction.js.map +1 -1
  33. package/dist/core/crash-log.d.ts +5 -0
  34. package/dist/core/crash-log.d.ts.map +1 -1
  35. package/dist/core/crash-log.js +68 -0
  36. package/dist/core/crash-log.js.map +1 -1
  37. package/dist/core/export-html/template.js +6 -1
  38. package/dist/core/extensions/index.d.ts +1 -1
  39. package/dist/core/extensions/index.d.ts.map +1 -1
  40. package/dist/core/extensions/index.js.map +1 -1
  41. package/dist/core/extensions/runner.d.ts +16 -3
  42. package/dist/core/extensions/runner.d.ts.map +1 -1
  43. package/dist/core/extensions/runner.js +110 -5
  44. package/dist/core/extensions/runner.js.map +1 -1
  45. package/dist/core/extensions/types.d.ts +77 -6
  46. package/dist/core/extensions/types.d.ts.map +1 -1
  47. package/dist/core/extensions/types.js.map +1 -1
  48. package/dist/core/index.d.ts +1 -1
  49. package/dist/core/index.d.ts.map +1 -1
  50. package/dist/core/index.js.map +1 -1
  51. package/dist/core/model-config.d.ts +52 -0
  52. package/dist/core/model-config.d.ts.map +1 -1
  53. package/dist/core/model-config.js +16 -0
  54. package/dist/core/model-config.js.map +1 -1
  55. package/dist/core/model-resolver.d.ts.map +1 -1
  56. package/dist/core/model-resolver.js +1 -1
  57. package/dist/core/model-resolver.js.map +1 -1
  58. package/dist/core/prompt-templates.d.ts +6 -1
  59. package/dist/core/prompt-templates.d.ts.map +1 -1
  60. package/dist/core/prompt-templates.js +61 -35
  61. package/dist/core/prompt-templates.js.map +1 -1
  62. package/dist/core/provider-composer.d.ts +1 -0
  63. package/dist/core/provider-composer.d.ts.map +1 -1
  64. package/dist/core/provider-composer.js +19 -0
  65. package/dist/core/provider-composer.js.map +1 -1
  66. package/dist/core/resource-loader.d.ts.map +1 -1
  67. package/dist/core/resource-loader.js +6 -2
  68. package/dist/core/resource-loader.js.map +1 -1
  69. package/dist/core/sdk.d.ts.map +1 -1
  70. package/dist/core/sdk.js +3 -4
  71. package/dist/core/sdk.js.map +1 -1
  72. package/dist/core/session-manager.d.ts +36 -9
  73. package/dist/core/session-manager.d.ts.map +1 -1
  74. package/dist/core/session-manager.js +97 -7
  75. package/dist/core/session-manager.js.map +1 -1
  76. package/dist/core/tools/read.d.ts +4 -1
  77. package/dist/core/tools/read.d.ts.map +1 -1
  78. package/dist/core/tools/read.js +5 -1
  79. package/dist/core/tools/read.js.map +1 -1
  80. package/dist/index.d.ts +2 -2
  81. package/dist/index.d.ts.map +1 -1
  82. package/dist/index.js +1 -1
  83. package/dist/index.js.map +1 -1
  84. package/dist/main.d.ts.map +1 -1
  85. package/dist/main.js +4 -3
  86. package/dist/main.js.map +1 -1
  87. package/dist/modes/interactive/bug-report.d.ts.map +1 -1
  88. package/dist/modes/interactive/bug-report.js +4 -0
  89. package/dist/modes/interactive/bug-report.js.map +1 -1
  90. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  91. package/dist/modes/interactive/components/tree-selector.js +7 -0
  92. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  93. package/dist/modes/interactive/interactive-mode.d.ts +3 -0
  94. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  95. package/dist/modes/interactive/interactive-mode.js +64 -2
  96. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  97. package/dist/utils/mime.d.ts.map +1 -1
  98. package/dist/utils/mime.js +1 -1
  99. package/dist/utils/mime.js.map +1 -1
  100. package/dist/utils/tool-result-images.d.ts +3 -1
  101. package/dist/utils/tool-result-images.d.ts.map +1 -1
  102. package/dist/utils/tool-result-images.js +4 -1
  103. package/dist/utils/tool-result-images.js.map +1 -1
  104. package/docs/cli-integration.md +106 -0
  105. package/docs/cli.md +268 -0
  106. package/docs/compaction.md +45 -26
  107. package/docs/configuration.md +45 -0
  108. package/docs/containerization.md +109 -82
  109. package/docs/custom-provider.md +132 -784
  110. package/docs/docs.json +139 -99
  111. package/docs/environment-variables.md +3 -5
  112. package/docs/extensions.md +134 -2956
  113. package/docs/how-pi-works.md +49 -0
  114. package/docs/images/interactive-mode.png +0 -0
  115. package/docs/index.md +24 -69
  116. package/docs/json.md +193 -65
  117. package/docs/keybindings.md +57 -102
  118. package/docs/llama-cpp.md +3 -3
  119. package/docs/message-types.md +261 -0
  120. package/docs/models.md +64 -546
  121. package/docs/packages.md +66 -167
  122. package/docs/prompt-templates.md +31 -68
  123. package/docs/providers.md +102 -240
  124. package/docs/quickstart.md +61 -106
  125. package/docs/rpc-commands.md +854 -0
  126. package/docs/rpc-extension-ui.md +200 -0
  127. package/docs/rpc.md +129 -1556
  128. package/docs/sdk.md +76 -1160
  129. package/docs/security.md +70 -32
  130. package/docs/session-format.md +25 -216
  131. package/docs/sessions.md +35 -141
  132. package/docs/settings.md +109 -387
  133. package/docs/shell-aliases.md +85 -5
  134. package/docs/skills.md +51 -190
  135. package/docs/slash-commands.md +60 -0
  136. package/docs/terminal-setup.md +105 -78
  137. package/docs/termux.md +74 -83
  138. package/docs/themes.md +68 -280
  139. package/docs/tmux.md +31 -39
  140. package/docs/tui.md +69 -923
  141. package/docs/usage.md +54 -272
  142. package/docs/windows.md +43 -17
  143. package/examples/README.md +13 -2
  144. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  145. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  146. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  147. package/examples/extensions/gondolin/package-lock.json +2 -2
  148. package/examples/extensions/gondolin/package.json +1 -1
  149. package/examples/extensions/sandbox/package-lock.json +2 -2
  150. package/examples/extensions/sandbox/package.json +1 -1
  151. package/examples/extensions/with-deps/package-lock.json +2 -2
  152. package/examples/extensions/with-deps/package.json +1 -1
  153. package/examples/plugins/pi-example-plugin/src/session.ts +3 -2
  154. package/examples/rpc-client.ts +35 -0
  155. package/examples/rpc-extension-ui.ts +25 -5
  156. package/examples/sdk/README.md +1 -1
  157. package/npm-shrinkwrap.json +20 -20
  158. package/package.json +8 -8
  159. package/dist/bundle/chunks/chunk-HTEQD2HM.js +0 -2
  160. package/docs/development.md +0 -90
package/docs/settings.md CHANGED
@@ -1,428 +1,150 @@
1
- # Settings
1
+ # Settings Reference
2
2
 
3
- Pi uses JSON settings files with project settings overriding global settings.
3
+ This reference lists user-configurable settings, their types, defaults, and purposes. Project settings override agent-directory settings. Resource lists are combined. See [Configuration](configuration.md) for file locations and trust behavior.
4
4
 
5
- | Location | Scope |
6
- |----------|-------|
7
- | `~/.pi/agent/settings.json` | Global (all projects) |
8
- | `.pi/settings.json` | Project (current directory) |
5
+ ## Model and thinking
9
6
 
10
- Edit directly or use `/settings` for common options. To save startup model defaults interactively, use `/model` and press Ctrl+S on the desired model. To save the startup thinking level, use `/thinking` and press Ctrl+S.
11
-
12
- ## Project Trust
13
-
14
- On interactive startup, pi asks before trusting a project folder that contains project-local settings, resources, or project `.agents/skills` and has no saved decision for the folder or a parent folder in `~/.pi/agent/trust.json`. Trusting a project allows pi to load `.pi/settings.json` and `.pi` resources, install missing project packages, and execute project extensions.
15
-
16
- Non-interactive modes (`-p`, `--mode json`, and `--mode rpc`) do not show a trust prompt. Without an applicable saved trust decision, they use `defaultProjectTrust` from global settings: `ask` (default) and `never` ignore those project resources, while `always` trusts them. Pass `--approve`/`-a` or `--no-approve`/`-na` to override project trust for one run.
17
-
18
- If no extension or saved decision applies, `defaultProjectTrust` controls the fallback behavior. Set it to `"ask"`, `"always"`, or `"never"` in `~/.pi/agent/settings.json`, or change it with `/settings`.
19
-
20
- `pi config` and package commands use the same project trust flow, except `pi update` never prompts. Pass `--approve` to trust project-local settings for one command or `--no-approve` to ignore them.
21
-
22
- Use `/trust` in interactive mode to save a project trust decision for future sessions, including trust for the immediate parent folder. It writes `~/.pi/agent/trust.json` only; the current session is not reloaded, so restart pi for changes to take effect.
23
-
24
- ## All Settings
25
-
26
- ### Model & Thinking
7
+ <a id="model-cycling"></a>
27
8
 
28
9
  | Setting | Type | Default | Description |
29
- |---------|------|---------|-------------|
30
- | `defaultProvider` | string | - | Startup provider (e.g., `"anthropic"`, `"openai"`; saved with Ctrl+S in `/model`, or edited manually) |
31
- | `defaultModel` | string | - | Startup model ID (saved with Ctrl+S in `/model`, or edited manually) |
32
- | `defaultThinkingLevel` | string | - | Startup thinking level (saved with Ctrl+S in `/thinking`, or edited manually): `"off"`, `"minimal"`, `"low"`, `"medium"`, `"high"`, `"xhigh"`, `"max"` |
33
- | `modelThinkingLevels` | object | - | Per-model startup thinking levels keyed by `"provider/modelId"`; configure from `/settings` → Default thinking level per model or edit manually |
34
- | `hideThinkingBlock` | boolean | `false` | Hide thinking blocks in output |
35
- | `showCacheMissNotices` | boolean | `false` | Show transcript notices for significant prompt-cache misses, successful cache-warming usage, compaction or branch-summary usage, and provider recovery diagnostics such as dropped Anthropic thinking blocks |
36
- | `thinkingBudgets` | object | - | Custom token budgets per thinking level. Anthropic, Google, and Bedrock use these natively. OpenAI-compatible models use them when `compat.thinkingTokenBudgetField` (or `supportsThinkingTokenBudget`) is set. |
37
- | `cacheWarming` | string | `"streaming"` | Prompt cache-warming mode: `"off"`, `"streaming"`, or `"idle"`. Global setting only. |
38
-
39
- #### Cache Warming
40
-
41
- Providers drop a prompt cache entry after a period of inactivity, so the first request after a pause pays full input price again. Cache warming re-sends the last request with a one-token output budget shortly before expiry:
10
+ |---|---|---|---|
11
+ | `defaultProvider` | string | Automatic | Startup AI provider. |
12
+ | `defaultModel` | string | Automatic | Startup model ID. |
13
+ | `defaultThinkingLevel` | `"off" \| "minimal" \| "low" \| "medium" \| "high" \| "xhigh" \| "max"` | `"medium"` | Startup thinking level. |
14
+ | `modelThinkingLevels` | object | None | Per-model startup thinking levels keyed by exact `provider/modelId`. |
15
+ | `thinkingBudgets` | object | Built-in budgets | Token budgets for `minimal`, `low`, `medium`, and `high` thinking levels. |
16
+ | `enabledModels` | `string[]` | All available models | Model patterns used for startup selection and model cycling. Uses the same format as `--models`. |
17
+ | `hideThinkingBlock` | boolean | `false` | Hide thinking blocks in the transcript. |
18
+ | `showCacheMissNotices` | boolean | `false` | Show notices for significant cache misses, successful cache warming, compaction usage, and provider recovery. |
19
+ | `cacheWarming` | `"off" \| "streaming" \| "idle"` | `"streaming"` | Keep eligible provider prompt caches warm during active runs or, with `"idle"`, between runs. Global setting only. |
42
20
 
43
- - `"off"` disables warming.
44
- - `"streaming"` protects expensive prefixes during long tool executions and stops as soon as the agent settles.
45
- - `"idle"` also considers refreshes while waiting for your next prompt, using a fixed 15% continuation probability measured from real usage.
21
+ Cache warming runs only when the model declares a cache lifetime and Pi estimates at least $0.05 in avoided cache-miss cost. Refresh usage counts toward session totals but does not enter model context. `/session` shows the next decision; extensions can override it with `cache_warming_decision`. See [Prompt Cache Lifetimes](models.md#prompt-cache-lifetimes).
46
22
 
47
- ```json
48
- {
49
- "cacheWarming": "idle"
50
- }
51
- ```
23
+ See [Choose a Model](models.md) for model selection and thinking controls.
52
24
 
53
- A refresh is sent only when the expected avoided cache-miss cost, minus the cost of the refresh, leaves at least $0.05 of expected savings. Active agent runs use 100% continuation probability. `/session` shows the next decision, continuation probability, expected savings, threshold, and estimated costs. When cache miss notices are enabled, each successful refresh appears in the transcript with its cost; notices identify extension overrides.
54
-
55
- Warming stops when the context changes (model switch, compaction, branch navigation). Idle warming stops no later than 30 minutes after the last real provider request; warming during an active agent run stops after 60 minutes. Extensions can override each decision through the [`cache_warming_decision`](extensions.md#cache_warming_decision) event.
56
-
57
- Each refresh is billed as a cache read of the full context plus one output token. Usage and cost show up in session totals but never enter model context. Pi schedules candidates at 90% of the cache lifetime while leaving at least ten seconds before expiry.
58
-
59
- Warming needs a known cache lifetime for the model and the retention tier the request used (`short`, or `long` with `PI_CACHE_RETENTION=long`). The built-in catalog carries lifetimes for direct Anthropic; custom models and other providers can declare theirs with `promptCache` in `models.json` (see [Prompt Cache Lifetimes](models.md#prompt-cache-lifetimes)). Claude models that use budget-based rather than adaptive thinking are skipped while thinking is on, because Anthropic derives the thinking budget from `max_tokens` and keys the message cache on it, so a one-token request cannot reproduce the entry.
60
-
61
- #### thinkingBudgets
62
-
63
- ```json
64
- {
65
- "thinkingBudgets": {
66
- "minimal": 1024,
67
- "low": 4096,
68
- "medium": 10240,
69
- "high": 32768
70
- }
71
- }
72
- ```
73
-
74
- ### UI & Display
25
+ ## Interaction
75
26
 
76
27
  | Setting | Type | Default | Description |
77
- |---------|------|---------|-------------|
78
- | `theme` | string | `"dark"` | Theme name (`"dark"`, `"light"`, or custom) |
79
- | `externalEditor` | string | `$VISUAL`, then `$EDITOR`, then Notepad on Windows or `nano` elsewhere | Command for Ctrl+G external editor; takes precedence over environment variables |
80
- | `quietStartup` | boolean | `false` | Hide startup header |
81
- | `defaultProjectTrust` | string | `"ask"` | Fallback project trust behavior: `"ask"`, `"always"`, or `"never"`. Global setting only |
82
- | `collapseChangelog` | boolean | `false` | Show condensed changelog after updates |
83
- | `enableInstallTelemetry` | boolean | `true` | Send the anonymous install/update ping and selected provider attribution headers. This does not control update checks |
84
- | `enableAnalytics` | boolean | `false` | Opt-in analytics data sharing. Currently only asked for during the experimental first-time setup (`PI_EXPERIMENTAL=1`) |
85
- | `trackingId` | string | - | Analytics tracking identifier, generated when `enableAnalytics` is turned on |
86
- | `doubleEscapeAction` | string | `"tree"` | Action for double-escape: `"tree"`, `"fork"`, or `"none"` |
87
- | `treeFilterMode` | string | `"default"` | Default filter for `/tree`: `"default"`, `"no-tools"`, `"user-only"`, `"labeled-only"`, `"all"` |
88
- | `editorPaddingX` | number | `0` | Horizontal padding for input editor (0-3) |
89
- | `outputPad` | number | `1` | Horizontal padding for user messages, assistant messages, and thinking (0 or 1) |
90
- | `autocompleteMaxVisible` | number | `5` | Max visible items in autocomplete dropdown (3-20) |
91
- | `showHardwareCursor` | boolean | `false` | Show the terminal cursor while TUI positions it for IME support |
92
- | `tuiMode` | string | `"regular"` | Interactive TUI mode: `"regular"` or experimental `"fullscreen"`. Changes from `/settings` apply immediately; `--tui-mode` overrides this setting at startup |
93
- | `fullscreenExitOutput` | string | `"transcript"` | Fullscreen exit output: `"transcript"` prints the final transcript and resume hint, while `"resume-hint"` restores the previous screen and prints only the resume hint. Has no effect in regular TUI mode |
94
- | `fullscreenScrollbar` | string | `"auto"` | Fullscreen transcript scrollbar: `"auto"` shows it temporarily while scrolling or while the pointer is over its rightmost-column track, `"always"` reserves that column and keeps it visible, and `"hidden"` hides it. Has no effect in regular TUI mode |
95
- | `fullscreenCopyOnSelect` | boolean | `true` | Automatically copy selected text in fullscreen mode. When disabled, selections stay highlighted and `Ctrl+X` copies the active selection |
96
-
97
- For VS Code, include `--wait` so pi resumes after the editor exits:
98
-
99
- ```json
100
- {
101
- "externalEditor": "code --wait"
102
- }
103
- ```
104
-
105
- ### Telemetry and update checks
106
-
107
- `enableInstallTelemetry` controls the anonymous install/update ping to `https://pi.dev/api/report-install` and Pi attribution headers for OpenRouter, NVIDIA NIM, and Cloudflare provider requests. Opting out disables both. It does not disable update checks; Pi can still fetch `https://pi.dev/api/latest-version` to look for the latest version.
108
-
109
- Set `PI_SKIP_VERSION_CHECK=1` to disable the Pi version update check. Use `--offline` or `PI_OFFLINE=1` to disable all startup network operations described here, including update checks, package update checks, and install/update telemetry.
110
-
111
- ### Network
28
+ |---|---|---|---|
29
+ | `steeringMode` | `"all" \| "one-at-a-time"` | `"one-at-a-time"` | How queued steering messages are delivered. |
30
+ | `followUpMode` | `"all" \| "one-at-a-time"` | `"one-at-a-time"` | How queued follow-up messages are delivered. |
31
+ | `externalEditor` | string | `$VISUAL`, `$EDITOR`, then platform default | Command opened by the external-editor keybinding. |
32
+ | `doubleEscapeAction` | `"tree" \| "fork" \| "none"` | `"tree"` | Action for double Escape with an empty editor. |
33
+ | `treeFilterMode` | `"default" \| "no-tools" \| "user-only" \| "labeled-only" \| "all"` | `"default"` | Initial filter used by `/tree`. |
34
+ | `defaultProjectTrust` | `"ask" \| "always" \| "never"` | `"ask"` | Fallback project-trust behavior. **Can only be set in agent-directory settings.** |
35
+
36
+ ## Tools
112
37
 
113
38
  | Setting | Type | Default | Description |
114
- |---------|------|---------|-------------|
115
- | `httpProxy` | string | - | HTTP proxy URL applied as `HTTP_PROXY` and `HTTPS_PROXY`. Global setting only. |
39
+ |---|---|---|---|
40
+ | `defaultTools` | `string[]` | `read`, `bash`, `edit`, `write` | Built-in tools enabled at startup. An empty array disables all built-in tools but not extension or SDK tools. |
116
41
 
117
- ```json
118
- {
119
- "httpProxy": "http://127.0.0.1:7890"
120
- }
121
- ```
42
+ Available built-in tools are `read`, `bash`, `powershell`, `edit`, `write`, `grep`, `find`, and `ls`. CLI tool options override this setting for one invocation. See [Command Line](cli.md#tools).
122
43
 
123
- ### Warnings
44
+ ## Sessions and context
124
45
 
125
46
  | Setting | Type | Default | Description |
126
- |---------|------|---------|-------------|
127
- | `warnings.anthropicExtraUsage` | boolean | `true` | Show a warning when Anthropic subscription auth may use paid extra usage |
128
-
129
- ```json
130
- {
131
- "warnings": {
132
- "anthropicExtraUsage": false
133
- }
134
- }
135
- ```
47
+ |---|---|---|---|
48
+ | `sessionDir` | string | Agent session directory | Session storage directory. Relative paths resolve from the working directory. `PI_CODING_AGENT_SESSION_DIR` and `--session-dir` override this setting. |
136
49
 
137
50
  ### Compaction
138
51
 
139
52
  | Setting | Type | Default | Description |
140
- |---------|------|---------|-------------|
141
- | `compaction.enabled` | boolean | `true` | Enable auto-compaction |
142
- | `compaction.reserveTokens` | number | `16384` | Tokens reserved for LLM response |
143
- | `compaction.keepRecentTokens` | number | `20000` | Recent tokens to keep (not summarized) |
144
- | `compaction.modelOverrides` | object | - | Per-model `reserveTokens` and `keepRecentTokens` overrides keyed by exact `"provider/modelId"` |
145
-
146
- ```json
147
- {
148
- "compaction": {
149
- "enabled": true,
150
- "reserveTokens": 16384,
151
- "keepRecentTokens": 20000
152
- }
153
- }
154
- ```
155
-
156
- #### Per-model compaction overrides
157
-
158
- ```json
159
- {
160
- "compaction": {
161
- "enabled": true,
162
- "reserveTokens": 16384,
163
- "keepRecentTokens": 20000,
164
- "modelOverrides": {
165
- "some-provider/big-model": {
166
- "reserveTokens": 400000
167
- },
168
- "local/small-model": {
169
- "reserveTokens": 2048,
170
- "keepRecentTokens": 4096
171
- }
172
- }
173
- }
174
- }
175
- ```
176
-
177
- Keys match exact, case-sensitive `provider/modelId` values, not names or glob patterns. Model IDs may contain slashes (for example, `openrouter/anthropic/claude-sonnet-4`).
178
-
179
- Each token setting resolves independently: matching model override → ordinary `compaction` setting → built-in default. In the example, `some-provider/big-model` keeps the ordinary 20000 recent tokens. Token values must be non-negative safe integers. Invalid values in the matching model override produce an error when read; only omitted fields fall back to the ordinary setting. Model override entries must be objects. Invalid ordinary token settings produce an error when read, even if the active model has a valid override. Only omitted ordinary values use built-in defaults. Zero is accepted, but `reserveTokens: 0` leaves no response margin and also sets the summarization output budget to zero.
180
-
181
- Global and project settings merge recursively **before** model lookup. A project can override one field for a model without replacing its other fields or other models. A global model-specific value takes precedence over a project-wide fallback; override the same model entry in the project to change it.
182
-
183
- `enabled` is not model-specific. The active model's token settings apply to manual compaction, automatic threshold checks (including between assistant turns), and overflow recovery. Switching models takes effect on the next check or compaction. Configure overrides in JSON; `/settings` retains the ordinary auto-compaction toggle.
184
-
185
- See [compaction.md](compaction.md) for trigger and summarization behavior.
186
-
187
- ### Branch Summary
188
-
189
- | Setting | Type | Default | Description |
190
- |---------|------|---------|-------------|
191
- | `branchSummary.reserveTokens` | number | `16384` | Tokens reserved when selecting branch history; output is capped at 4096 tokens |
192
- | `branchSummary.skipPrompt` | boolean | `false` | Skip "Summarize branch?" prompt on `/tree` navigation (defaults to no summary) |
53
+ |---|---|---|---|
54
+ | `compaction.enabled` | boolean | `true` | Enable automatic compaction. |
55
+ | `compaction.reserveTokens` | number | `16384` | Tokens reserved for the model response. |
56
+ | `compaction.keepRecentTokens` | number | `20000` | Recent tokens retained without summarization. |
57
+ | `compaction.modelOverrides` | object | None | Per-model token settings keyed by exact `provider/modelId`. |
193
58
 
194
- ### Retry
59
+ <a id="per-model-compaction-overrides"></a>
195
60
 
196
- | Setting | Type | Default | Description |
197
- |---------|------|---------|-------------|
198
- | `retry.enabled` | boolean | `true` | Enable automatic agent-level retry on transient errors |
199
- | `retry.maxRetries` | number | `3` | Maximum agent-level retry attempts |
200
- | `retry.baseDelayMs` | number | `2000` | Base delay for agent-level exponential backoff (2s, 4s, 8s) |
201
- | `retry.maxAgentDelayMs` | number | `60000` | Max agent-level retry delay (60s) |
202
- | `retry.provider.timeoutMs` | number | SDK default | Provider/SDK request timeout in milliseconds |
203
- | `retry.provider.maxRetries` | number | `0` | Provider/SDK retry attempts |
204
- | `retry.provider.maxRetryDelayMs` | number | `60000` | Max server-requested delay before failing (60s) |
205
-
206
- Agent-level retries use exponential backoff capped by `retry.maxAgentDelayMs`, so long retry runs stay responsive after prolonged outages.
207
-
208
- When a provider requests a retry delay longer than `retry.provider.maxRetryDelayMs`, the request fails immediately with an informative error instead of waiting silently. Set it to `0` to disable the limit.
209
-
210
- Keep `retry.provider.maxRetries` at `0` unless provider-level retries are explicitly needed. Setting it above `0` can make SDK/provider retries handle out-of-usage-limit errors before Pi sees them, which may block the agent until the provider quota resets in some circumstances.
211
-
212
- ```json
213
- {
214
- "retry": {
215
- "enabled": true,
216
- "maxRetries": 3,
217
- "baseDelayMs": 2000,
218
- "maxAgentDelayMs": 60000,
219
- "provider": {
220
- "timeoutMs": 3600000,
221
- "maxRetries": 0,
222
- "maxRetryDelayMs": 60000
223
- }
224
- }
225
- }
226
- ```
227
-
228
- ### Message Delivery
61
+ Compaction token values must be non-negative safe integers. Each value resolves independently from the matching model override, then the ordinary compaction setting, then the built-in default. Project and user objects merge before model lookup.
229
62
 
230
- | Setting | Type | Default | Description |
231
- |---------|------|---------|-------------|
232
- | `steeringMode` | string | `"one-at-a-time"` | How steering messages are sent: `"all"` or `"one-at-a-time"` |
233
- | `followUpMode` | string | `"one-at-a-time"` | How follow-up messages are sent: `"all"` or `"one-at-a-time"` |
234
- | `transport` | string | `"auto"` | Preferred transport for providers that support multiple transports: `"sse"`, `"websocket"`, `"websocket-cached"`, or `"auto"` |
235
- | `httpIdleTimeoutMs` | number | `300000` | HTTP header/body idle timeout in milliseconds, also used by providers with explicit stream idle timeouts. Set to `0` to disable. |
236
- | `websocketConnectTimeoutMs` | number | `15000` | WebSocket connect/open handshake timeout in milliseconds for providers that support WebSocket transports. Set to `0` to disable. |
63
+ See [Compaction Reference](compaction.md) for trigger, summarization, and validation behavior.
237
64
 
238
- ### Terminal & Images
65
+ ### Branch summaries
239
66
 
240
67
  | Setting | Type | Default | Description |
241
- |---------|------|---------|-------------|
242
- | `terminal.showImages` | boolean | `true` | Show images in terminal (if supported) |
243
- | `terminal.imageWidthCells` | number | `60` | Preferred inline image width in terminal cells |
244
- | `terminal.clearOnShrink` | boolean | `false` | Clear empty rows when content shrinks (can cause flicker) |
245
- | `terminal.hyperlinks` | boolean or `"auto"` | `"auto"` | Override OSC 8 hyperlink support (advanced, JSON-only) |
246
- | `terminal.images` | string or boolean | `"auto"` | Override image protocol support with `"kitty"`, `"iterm2"`, `false`, or `"auto"` (advanced, JSON-only) |
247
- | `terminal.trueColor` | boolean or `"auto"` | `"auto"` | Override truecolor support (advanced, JSON-only) |
248
- | `images.autoResize` | boolean | `true` | Resize images to 2000x2000 max. Applies to `@file` attachments, `read`, and images returned by tools |
249
- | `images.blockImages` | boolean | `false` | Block all images from being sent to LLM |
250
-
251
- ### Shell
252
-
253
- | Setting | Type | Default | Description |
254
- |---------|------|---------|-------------|
255
- | `shellPath` | string | - | Custom shell path (e.g., for Cygwin on Windows); supports a leading `~` for the home directory |
256
- | `shellCommandPrefix` | string | - | Prefix for every bash command (e.g., `"shopt -s expand_aliases"`) |
257
- | `npmCommand` | string[] | - | Command argv used for npm package lookup/install operations (e.g., `["mise", "exec", "node@20", "--", "npm"]`) |
258
-
259
- Windows paths in JSON must use forward slashes or escaped backslashes:
68
+ |---|---|---|---|
69
+ | `branchSummary.reserveTokens` | number | `16384` | Tokens reserved when summarizing branch history. |
70
+ | `branchSummary.skipPrompt` | boolean | `false` | Skip the branch-summary prompt and default to no summary. |
260
71
 
261
- ```json
262
- {
263
- "shellPath": "C:/Program Files/Git/bin/bash.exe"
264
- }
265
- ```
266
-
267
- ```json
268
- {
269
- "shellPath": "C:\\Program Files\\Git\\bin\\bash.exe"
270
- }
271
- ```
272
-
273
- ```json
274
- {
275
- "npmCommand": ["mise", "exec", "node@20", "--", "npm"]
276
- }
277
- ```
278
-
279
- `npmCommand` is used for all npm package-manager operations, including installs, uninstalls, and dependency installs inside git packages. User-scoped npm packages install under `~/.pi/agent/npm/`; project-scoped npm packages install under `.pi/npm/`. Use argv-style entries exactly as the process should be launched. When `npmCommand` is configured, git package dependency installs use plain `install` to avoid npm-specific flags in wrappers or alternate package managers.
280
-
281
- ### Tools
72
+ ## Terminal and display
282
73
 
283
74
  | Setting | Type | Default | Description |
284
- |---------|------|---------|-------------|
285
- | `defaultTools` | string[] | - | Built-in tools enabled initially. When omitted, Pi uses its standard defaults |
286
-
287
- `defaultTools` selects the built-in tools enabled at startup. Extension and SDK custom tools remain enabled. Available built-ins are `read`, `bash`, `powershell`, `edit`, `write`, `grep`, `find`, and `ls`:
288
-
289
- ```json
290
- {
291
- "defaultTools": ["bash", "edit", "write"]
292
- }
293
- ```
294
-
295
- On Windows, select `powershell` instead of `bash`, or include both:
296
-
297
- ```json
298
- {
299
- "defaultTools": ["read", "powershell", "edit", "write"]
300
- }
301
- ```
302
-
303
- An empty array starts with no built-in tools while preserving extension and SDK custom tools. `--tools` replaces this behavior with a strict allowlist for all tools, `--no-tools` disables all tools, and `--no-builtin-tools` disables the built-in defaults. `--exclude-tools` filters the resulting list. A project `defaultTools` array replaces the global array.
304
-
305
- ### Sessions
75
+ |---|---|---|---|
76
+ | `theme` | string | Detected | Built-in or custom theme name. |
77
+ | `quietStartup` | boolean | `false` | Hide the startup header. |
78
+ | `tuiMode` | `"regular" \| "fullscreen"` | `"regular"` | Interactive terminal UI mode. |
79
+ | `fullscreenExitOutput` | `"transcript" \| "resume-hint"` | `"transcript"` | Output printed when fullscreen mode exits. |
80
+ | `fullscreenScrollbar` | `"auto" \| "always" \| "hidden"` | `"auto"` | Fullscreen transcript scrollbar behavior. |
81
+ | `fullscreenCopyOnSelect` | boolean | `true` | Copy selected text automatically in fullscreen mode. |
82
+ | `editorPaddingX` | number | `0` | Horizontal editor padding from 0 to 3 cells. |
83
+ | `outputPad` | `0 \| 1` | `1` | Horizontal transcript padding. |
84
+ | `autocompleteMaxVisible` | number | `5` | Visible autocomplete entries, from 3 to 20. |
85
+ | `showHardwareCursor` | boolean | `false` | Show the terminal cursor while Pi positions it for input methods. |
86
+ | `terminal.showImages` | boolean | `true` | Display inline images when supported. |
87
+ | `terminal.imageWidthCells` | number | `60` | Preferred inline image width in terminal cells. |
88
+ | `terminal.clearOnShrink` | boolean | `false` | Clear empty rows when rendered content shrinks. |
89
+ | `terminal.showTerminalProgress` | boolean | `false` | Show OSC 9;4 progress in the terminal tab. |
90
+ | `terminal.hyperlinks` | `boolean \| "auto"` | `"auto"` | Override OSC 8 hyperlink detection. |
91
+ | `terminal.images` | `"kitty" \| "iterm2" \| "auto" \| false` | `"auto"` | Override inline-image protocol detection. |
92
+ | `terminal.trueColor` | `boolean \| "auto"` | `"auto"` | Override true-color detection. |
93
+ | `images.autoResize` | boolean | `true` | Resize images to at most 2000 by 2000 pixels before sending them to a model. |
94
+ | `images.blockImages` | boolean | `false` | Prevent images from being sent to models. |
95
+ | `markdown.codeBlockIndent` | string | `" "` | Prefix used to indent rendered code blocks. |
96
+ | `markdown.mermaid` | `"off" \| "final" \| "streaming"` | `"streaming"` | Mermaid rendering mode. |
97
+
98
+ See [Themes](themes.md) and [Terminal Setup](terminal-setup.md) for format and platform details.
99
+
100
+ ## Network and retries
306
101
 
307
102
  | Setting | Type | Default | Description |
308
- |---------|------|---------|-------------|
309
- | `sessionDir` | string | - | Directory where session files are stored. Accepts absolute or relative paths, plus `~`. |
310
-
311
- ```json
312
- { "sessionDir": ".pi/sessions" }
313
- ```
314
-
315
- When multiple sources specify a session directory, precedence is `--session-dir`, `PI_CODING_AGENT_SESSION_DIR`, then `sessionDir` in settings.json.
316
-
317
- ### Model Cycling
103
+ |---|---|---|---|
104
+ | `transport` | `"auto" \| "sse" \| "websocket" \| "websocket-cached"` | `"auto"` | Preferred transport for AI providers that support multiple transports. |
105
+ | `httpProxy` | string | None | Proxy URL applied as `HTTP_PROXY` and `HTTPS_PROXY` for Pi-managed HTTP clients. **Can only be set in agent-directory settings.** |
106
+ | `httpIdleTimeoutMs` | number | `300000` | HTTP header and body idle timeout in milliseconds. Set to `0` to disable. |
107
+ | `websocketConnectTimeoutMs` | number | `15000` | WebSocket connection timeout in milliseconds. Set to `0` to disable. |
108
+ | `retry.enabled` | boolean | `true` | Enable automatic agent-level retry for transient failures. |
109
+ | `retry.maxRetries` | number | `3` | Maximum agent-level retry attempts. |
110
+ | `retry.baseDelayMs` | number | `2000` | Initial exponential-backoff delay in milliseconds. |
111
+ | `retry.maxAgentDelayMs` | number | `60000` | Maximum agent-level retry delay in milliseconds. |
112
+ | `retry.provider.timeoutMs` | number | `httpIdleTimeoutMs` | Provider request timeout in milliseconds. |
113
+ | `retry.provider.maxRetries` | number | `0` | Provider-level retry attempts. |
114
+ | `retry.provider.maxRetryDelayMs` | number | `60000` | Maximum server-requested delay in milliseconds. Set to `0` to disable the limit. |
115
+
116
+ Keep `retry.provider.maxRetries` at `0` unless provider-level retries are required. Provider retries can delay Pi from handling quota and usage-limit errors itself.
117
+
118
+ ## Shell
318
119
 
319
120
  | Setting | Type | Default | Description |
320
- |---------|------|---------|-------------|
321
- | `enabledModels` | string[] | - | Model patterns for Ctrl+P cycling (same format as `--models` CLI flag) |
121
+ |---|---|---|---|
122
+ | `shellPath` | string | Platform default | Custom shell executable path. Supports a leading `~`. |
123
+ | `shellCommandPrefix` | string | None | Prefix prepended to every shell command. |
124
+ | `npmCommand` | `string[]` | `npm` | Command and arguments used for npm package lookup and installation. |
322
125
 
323
- ```json
324
- {
325
- "enabledModels": ["claude-*", "gpt-4o", "gemini-2*"]
326
- }
327
- ```
126
+ See [Shell aliases](shell-aliases.md) for shell setup and [Pi Packages](packages.md) for package-manager behavior.
328
127
 
329
- ### Markdown
128
+ ## Resources
330
129
 
331
- | Setting | Type | Default | Description |
332
- |---------|------|---------|-------------|
333
- | `markdown.codeBlockIndent` | string | `" "` | Indentation for code blocks |
334
- | `markdown.mermaid` | string | `"streaming"` | Mermaid rendering mode: `"off"`, `"final"`, or `"streaming"` |
130
+ Resource paths in user settings resolve from the agent directory. Paths in project settings resolve from the project `.pi` directory. Absolute paths and `~` are supported.
335
131
 
336
- ### Resources
132
+ | Setting | Type | Default | Description |
133
+ |---|---|---|---|
134
+ | `packages` | array | `[]` | npm, git, or local Pi package sources. See [Pi Packages](packages.md). |
135
+ | `extensions` | `string[]` | `[]` | Extension files or directories. |
136
+ | `skills` | `string[]` | `[]` | Skill files or directories. |
137
+ | `prompts` | `string[]` | `[]` | Prompt-template files or directories. |
138
+ | `themes` | `string[]` | `[]` | Theme files or directories. |
139
+ | `enableSkillCommands` | boolean | `true` | Register skills as `/skill:name` commands. |
337
140
 
338
- These settings define where to load extensions, skills, prompts, and themes from.
141
+ Resource arrays support glob exclusions with `!pattern`, exact inclusion with `+path`, and exact exclusion with `-path`. Pi loads resources listed in both user-level and project settings.
339
142
 
340
- Paths in `~/.pi/agent/settings.json` resolve relative to `~/.pi/agent`. Paths in `.pi/settings.json` resolve relative to `.pi`. Absolute paths and `~` are supported.
143
+ ## Updates, telemetry, and warnings
341
144
 
342
145
  | Setting | Type | Default | Description |
343
- |---------|------|---------|-------------|
344
- | `packages` | array | `[]` | npm/git packages to load resources from |
345
- | `extensions` | string[] | `[]` | Local extension file paths or directories |
346
- | `skills` | string[] | `[]` | Local skill file paths or directories |
347
- | `prompts` | string[] | `[]` | Local prompt template paths or directories |
348
- | `themes` | string[] | `[]` | Local theme file paths or directories |
349
- | `enableSkillCommands` | boolean | `true` | Register skills as `/skill:name` commands |
350
-
351
- Arrays support glob patterns and exclusions. Use `!pattern` to exclude. Use `+path` to force-include an exact path and `-path` to force-exclude an exact path.
352
-
353
- #### packages
354
-
355
- String form loads all resources from a package:
356
-
357
- ```json
358
- {
359
- "packages": ["pi-skills", "@org/my-extension"]
360
- }
361
- ```
362
-
363
- Object form filters which resources to load:
364
-
365
- ```json
366
- {
367
- "packages": [
368
- {
369
- "source": "pi-skills",
370
- "skills": ["brave-search", "transcribe"],
371
- "extensions": []
372
- }
373
- ]
374
- }
375
- ```
376
-
377
- See [packages.md](packages.md) for package management details.
378
-
379
- ## Example
380
-
381
- ```json
382
- {
383
- "defaultProvider": "anthropic",
384
- "defaultModel": "claude-sonnet-4-20250514",
385
- "defaultThinkingLevel": "medium",
386
- "modelThinkingLevels": {
387
- "anthropic/claude-sonnet-4-20250514": "high"
388
- },
389
- "theme": "dark",
390
- "compaction": {
391
- "enabled": true,
392
- "reserveTokens": 16384,
393
- "keepRecentTokens": 20000
394
- },
395
- "retry": {
396
- "enabled": true,
397
- "maxRetries": 3
398
- },
399
- "enabledModels": ["claude-*", "gpt-4o"],
400
- "warnings": {
401
- "anthropicExtraUsage": true
402
- },
403
- "packages": ["pi-skills"]
404
- }
405
- ```
406
-
407
- ## Project Overrides
408
-
409
- Project settings (`.pi/settings.json`) override global settings. Nested objects are merged:
410
-
411
- ```json
412
- // ~/.pi/agent/settings.json (global)
413
- {
414
- "theme": "dark",
415
- "compaction": { "enabled": true, "reserveTokens": 16384 }
416
- }
417
-
418
- // .pi/settings.json (project)
419
- {
420
- "compaction": { "reserveTokens": 8192 }
421
- }
422
-
423
- // Result
424
- {
425
- "theme": "dark",
426
- "compaction": { "enabled": true, "reserveTokens": 8192 }
427
- }
428
- ```
146
+ |---|---|---|---|
147
+ | `collapseChangelog` | boolean | `false` | Show a condensed changelog after an update. |
148
+ | `enableInstallTelemetry` | boolean | `true` | Enable anonymous install/update reporting and selected provider attribution headers. Does not control update checks. |
149
+ | `enableAnalytics` | boolean | `false` | Opt in to analytics data sharing. Currently used only by the experimental first-run setup. |
150
+ | `warnings.anthropicExtraUsage` | boolean | `true` | Warn when Anthropic subscription authentication may use paid extra usage. |