@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/usage.md CHANGED
@@ -1,312 +1,94 @@
1
- # Using Pi
2
-
3
- This page collects day-to-day usage details that do not fit on the quickstart page.
4
-
5
- ## Interactive Mode
6
-
7
- <p align="center"><img src="images/interactive-mode.png" alt="Interactive Mode" width="600"></p>
8
-
9
- The interface has four main areas:
10
-
11
- - **Startup header** - shortcuts, loaded context files, prompt templates, skills, and extensions
12
- - **Messages** - user messages, assistant responses, tool calls, tool results, notifications, errors, and extension UI
13
- - **Editor** - where you type; border color indicates the current thinking level
14
- - **Footer** - working directory, session name, token/cache usage, cost, context usage, and current model. Totals include assistant responses, usage reported by tools, and summary generation.
15
-
16
- The editor can be replaced temporarily by built-in UI such as `/settings` or by custom extension UI.
17
-
18
- ### Editor Features
19
-
20
- | Feature | How |
21
- |---------|-----|
22
- | File reference | Type `@` to fuzzy-search project files |
23
- | Path completion | Press Tab to complete paths |
24
- | Multi-line input | Shift+Enter, or Ctrl+Enter on Windows Terminal |
25
- | Copy response | Ctrl+X copies the selected message in `/tree`; otherwise it copies the last assistant message, or the active fullscreen text selection when `fullscreenCopyOnSelect` is disabled |
26
- | Images | Paste with Ctrl+V, Alt+V on Windows, or drag into the terminal |
27
- | Shell command | `!command` runs and sends output to the model |
28
- | Hidden shell command | `!!command` runs without sending output to the model |
29
- | External editor | Ctrl+G opens `externalEditor`, `$VISUAL`, `$EDITOR`, Notepad on Windows, or `nano` elsewhere |
30
-
31
- See [Keybindings](keybindings.md) for all shortcuts and customization.
32
-
33
- ## Slash Commands
34
-
35
- Type `/` in the editor to open command completion. Extensions can register custom commands, skills are available as `/skill:name`, and prompt templates expand via `/templatename`.
36
-
37
- | Command | Description |
38
- |---------|-------------|
39
- | `/login`, `/logout` | Manage OAuth or API-key credentials |
40
- | [`/llama`](llama-cpp.md) | Download, load, and unload llama.cpp router models |
41
- | `/model` | Switch models; Ctrl+S in the picker saves the startup default |
42
- | `/thinking` | Switch thinking level; Ctrl+S in the picker saves the startup default |
43
- | `/scoped-models` | Enable/disable models for Ctrl+P cycling |
44
- | `/settings` | Theme, message delivery, transport, and other preferences |
45
- | `/resume` | Pick from previous sessions |
46
- | `/new` | Start a new session |
47
- | `/name <name>` | Set session display name |
48
- | `/session` | Show session file, ID, messages, tokens, and cost |
49
- | `/tree` | Jump to any point in the session and continue from there |
50
- | `/trust` | Save project trust decision for future sessions |
51
- | `/fork` | Create a new session from a previous user message |
52
- | `/clone` | Duplicate the current active branch into a new session |
53
- | `/compact [prompt]` | Manually compact context, optionally with custom instructions |
54
- | `/copy` | Copy last assistant message to clipboard |
55
- | `/export [file]` | Export session to HTML or JSONL |
56
- | `/import <file>` | Import and resume a session from a JSONL file |
57
- | `/share` | Upload as private GitHub gist with shareable HTML link |
58
- | `/bug [description]` | Report a bug to the Pi developers; see [Sessions](sessions.md#reporting-bugs) |
59
- | `/reload` | Reload keybindings, extensions, skills, prompts, themes, and context files |
60
- | `/hotkeys` | Show all keyboard shortcuts |
61
- | `/changelog` | Display version history |
62
- | `/quit` | Quit pi |
63
-
64
- ## Message Queue
65
-
66
- You can submit messages while the agent is still working:
67
-
68
- - **Enter** queues a steering message, delivered after the current assistant turn finishes executing its tool calls.
69
- - **Alt+Enter** queues a follow-up message, delivered after the agent finishes all work.
70
- - **Escape** aborts and restores queued messages to the editor.
71
- - **Alt+Up** retrieves queued messages back to the editor.
72
-
73
- On Windows Terminal, Alt+Enter is fullscreen by default. Remap it as described in [Terminal setup](terminal-setup.md) if you want pi to receive the shortcut.
74
-
75
- Configure delivery in [Settings](settings.md) with `steeringMode` and `followUpMode`.
76
-
77
- ## Sessions
78
-
79
- Sessions are saved automatically to `~/.pi/agent/sessions/`, organized by working directory.
80
-
81
- ```bash
82
- pi -c # Continue most recent session
83
- pi -r # Browse and select a session
84
- pi --no-session # Ephemeral mode; do not save
85
- pi --name "my task" # Set session display name at startup
86
- pi --session <path|id> # Use a specific session file or session ID
87
- pi --fork <path|id> # Fork a session into a new session file
88
- ```
89
-
90
- Useful session commands:
91
-
92
- - `/session` shows the current session file and ID.
93
- - `/tree` navigates the in-file session tree and can summarize abandoned branches.
94
- - `/fork` creates a new session from an earlier user message.
95
- - `/clone` duplicates the current active branch into a new session file.
96
- - `/compact` summarizes older messages to free context.
97
-
98
- See [Sessions](sessions.md) and [Compaction](compaction.md) for details.
99
-
100
- ## Context Files
101
-
102
- Pi loads `AGENTS.md` or `CLAUDE.md` at startup from:
103
-
104
- - `~/.pi/agent/AGENTS.md` for global instructions
105
- - parent directories, walking up from the current working directory
106
- - the current directory
107
-
108
- If a directory contains `AGENTS.override.md`, Pi loads it instead of `AGENTS.md` or `CLAUDE.md` from that directory. Context files from other directories still layer normally.
109
-
110
- Use context files for project conventions, commands, safety rules, and preferences. Disable loading with `--no-context-files` or `-nc`.
111
-
112
- ### System Prompt Files
113
-
114
- Replace the default system prompt with:
115
-
116
- - `.pi/SYSTEM.md` for a project
117
- - `~/.pi/agent/SYSTEM.md` globally
1
+ # Use Pi in the terminal
118
2
 
119
- Append to the default prompt without replacing it with `APPEND_SYSTEM.md` in either location.
3
+ Run `pi` from the folder you want to work in. Pi uses that folder to discover files, instructions, and configuration, and to group saved sessions. If you have not installed Pi or chosen a model yet, follow the [Quickstart](quickstart.md).
120
4
 
121
- ### Project Trust
5
+ Pi may ask whether you trust the working folder before loading its project resources. See [Project trust](security.md#understand-project-trust).
122
6
 
123
- 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.
7
+ <p align="center"><img src="images/interactive-mode.png" alt="Pi interactive mode showing a conversation, editor, and status information" width="750"></p>
124
8
 
125
- Before the trust decision, pi loads only context files, user/global extensions, and CLI `-e` extensions so they can handle the `project_trust` event. Project-local extensions, project package-managed extensions, and project settings are loaded only after the project is trusted. This split also applies when switching to a session from a different cwd whose trust has not been resolved in the current process.
9
+ The transcript shows your prompts, Pi's responses, tool calls, results, and errors. You write prompts and commands in the editor. The footer shows the current folder, session, model, context usage, and accumulated usage and cost.
126
10
 
127
- 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.
11
+ ## Enter a prompt
128
12
 
129
- 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`.
13
+ Type a request and press `Enter` to send it. Use `Shift+Enter` to add a line, or press `Ctrl+G` to work on a longer prompt in your configured external editor.
130
14
 
131
- `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.
15
+ To include files or images:
132
16
 
133
- 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.
17
+ - Type `@` to search for a file and add it to your prompt.
18
+ - Press `Tab` to complete a path.
19
+ - Paste an image or drag it into a compatible terminal.
134
20
 
21
+ ## Follow Pi's work
135
22
 
136
- ## Exporting and Sharing Sessions
23
+ Pi shows each tool call and result while it works. Press `Ctrl+O` to expand or collapse tool output. Press `Ctrl+T` to show or hide thinking blocks.
137
24
 
138
- Use `/export [file]` to write a session to HTML.
25
+ The startup header lists the instructions and resources Pi loaded. The editor border indicates the current thinking level. The footer updates as the model uses context and reports usage.
139
26
 
140
- Use `/share` to upload a private GitHub gist with a shareable HTML link.
27
+ Pi does not ask before every tool call. Review commands and changed files, and use a sandbox for untrusted or unattended work. See [Security](security.md).
141
28
 
142
- If you use pi for open source work and want to publish sessions for model, prompt, tool, and evaluation research, see [`badlogic/pi-share-hf`](https://github.com/badlogic/pi-share-hf). It publishes sessions to Hugging Face datasets.
29
+ ## Change direction
143
30
 
144
- ## CLI Reference
31
+ You can send more input while Pi is working:
145
32
 
146
- ```bash
147
- pi [options] [--] [@files...] [messages...]
148
- ```
149
-
150
- ### Package Commands
151
-
152
- ```bash
153
- pi install <source> [-l] # Install package, -l for project-local
154
- pi remove <source> [-l] # Remove package
155
- pi uninstall <source> [-l] # Alias for remove
156
- pi update [source|self|pi] # Update pi only, or one package source
157
- pi update --all # Update pi and packages; reconcile pinned git refs
158
- pi update --extensions # Update packages only; reconcile pinned git refs
159
- pi update --models # Refresh model catalogs only
160
- pi update --self # Update pi only
161
- pi update --extension <src> # Update one package
162
- pi list # List installed packages
163
- pi config # Enable/disable package resources
164
- ```
33
+ | What you want | Action |
34
+ |---|---|
35
+ | Adjust the current task | Type a message and press `Enter` |
36
+ | Add work after the current task | Type a message and press `Alt+Enter` |
37
+ | Return queued messages to the editor | Press `Alt+Up` |
38
+ | Stop the current task | Press `Escape` |
165
39
 
166
- These commands manage pi packages and `pi update` can update the pi CLI installation. To uninstall pi itself, see [Quickstart](quickstart.md#uninstall). `pi config` and project package commands accept `--approve`/`--no-approve` to trust or ignore project-local settings for one command. `pi update` never prompts for project trust.
40
+ A message sent with `Enter` waits until the current response and its tool calls finish, then guides the next response. A follow-up sent with `Alt+Enter` waits until Pi finishes the current task. Aborting returns queued messages to the editor.
167
41
 
168
- See [Pi Packages](packages.md) for package sources and security notes.
42
+ Windows Terminal reserves some Alt shortcuts. See [Terminal Setup](terminal-setup.md) for the Windows alternatives.
169
43
 
170
- ### Modes
44
+ ## Change the model or settings
171
45
 
172
- | Flag | Description |
173
- |------|-------------|
174
- | default | Interactive mode |
175
- | `-p`, `--print` | Print response and exit |
176
- | `--mode json` | Output all events as JSON lines; see [JSON mode](json.md) |
177
- | `--mode rpc` | RPC mode over stdin/stdout; see [RPC mode](rpc.md) |
178
- | `--export <in> [out]` | Export a session to HTML |
46
+ Type `/` to search the available commands. The commands you will use most often are:
179
47
 
180
- In print mode, pi also reads piped stdin and merges it into the initial prompt:
48
+ - `/model` selects a model. Press `Ctrl+L` to open the same selector.
49
+ - `/thinking` selects how much reasoning the current model uses. Press `Shift+Tab` to cycle through supported levels.
50
+ - `/login` and `/logout` manage provider access.
51
+ - `/settings` changes common preferences.
181
52
 
182
- ```bash
183
- cat README.md | pi -p "Summarize this text"
184
- ```
53
+ Prompt templates, skills, and extensions can add more commands to the same menu. See [Choose a Model](models.md), [Configuration](configuration.md), or the complete [Slash Commands reference](slash-commands.md).
185
54
 
186
- ### Model Options
187
-
188
- | Option | Description |
189
- |--------|-------------|
190
- | `--provider <name>` | Provider, such as `anthropic`, `openai`, or `google` |
191
- | `--model <pattern>` | Model pattern or ID; supports `provider/id` and optional `:<thinking>` |
192
- | `--api-key <key>` | API key, overriding environment variables |
193
- | `--thinking <level>` | `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max` |
194
- | `--models <patterns>` | Comma-separated patterns for Ctrl+P cycling |
195
- | `--list-models [search]` | List available models |
196
-
197
- ### Session Options
198
-
199
- | Option | Description |
200
- |--------|-------------|
201
- | `-c`, `--continue` | Continue the most recent session |
202
- | `-r`, `--resume` | Browse and select a session |
203
- | `--session <path\|id>` | Use a specific session file or partial UUID |
204
- | `--fork <path\|id>` | Fork a session file or partial UUID into a new session |
205
- | `--session-dir <dir>` | Custom session storage directory |
206
- | `--no-session` | Ephemeral mode; do not save |
207
- | `--name <name>`, `-n <name>` | Set session display name at startup |
208
-
209
- ### Tool Options
210
-
211
- | Option | Description |
212
- |--------|-------------|
213
- | `--tools <list>`, `-t <list>` | Allowlist specific built-in, extension, and custom tools |
214
- | `--exclude-tools <list>`, `-xt <list>` | Disable specific built-in, extension, and custom tools |
215
- | `--no-builtin-tools`, `-nbt` | Disable built-in tools but keep extension/custom tools enabled |
216
- | `--no-tools`, `-nt` | Disable all tools |
217
-
218
- Built-in tools: `read`, `bash`, `powershell` (Windows), `edit`, `write`, `grep`, `find`, `ls`.
219
-
220
- ### Resource Options
221
-
222
- | Option | Description |
223
- |--------|-------------|
224
- | `-e`, `--extension <source>` | Load an extension from path, npm, or git; repeatable |
225
- | `--no-extensions` | Disable extension discovery |
226
- | `--skill <path>` | Load a skill; repeatable |
227
- | `--no-skills` | Disable skill discovery |
228
- | `--prompt-template <path>` | Load a prompt template; repeatable |
229
- | `--no-prompt-templates` | Disable prompt template discovery |
230
- | `--theme <path>` | Load a theme; repeatable |
231
- | `--no-themes` | Disable theme discovery |
232
- | `--no-context-files`, `-nc` | Disable `AGENTS.md` and `CLAUDE.md` discovery |
233
-
234
- Combine `--no-*` with explicit flags to load exactly what you need, ignoring settings. Example:
235
-
236
- ```bash
237
- pi --no-extensions -e ./my-extension.ts
238
- ```
55
+ ## Continue or start over
239
56
 
240
- ### Other Options
57
+ Pi saves sessions automatically unless session persistence is disabled.
241
58
 
242
- | Option | Description |
243
- |--------|-------------|
244
- | `--system-prompt <text>` | Replace default prompt; context files and skills are still appended |
245
- | `--append-system-prompt <text>` | Append to system prompt |
246
- | `--tui-mode <mode>` | TUI mode: `regular` (default) or experimental `fullscreen` |
247
- | `--use-theme <name[/name]>` | Set the initial interactive theme for this run without changing settings |
248
- | `--verbose` | Force verbose startup |
249
- | `-a`, `--approve` | Trust project-local files for this run |
250
- | `-na`, `--no-approve` | Ignore project-local files for this run |
251
- | `--` | Stop option parsing; remaining arguments are prompts or `@file` inputs |
252
- | `-h`, `--help` | Show help |
253
- | `-v`, `--version` | Show version |
59
+ - `/new` starts a new session.
60
+ - `/resume` opens another saved session.
61
+ - `/name` gives the current session a recognizable name.
62
+ - `/session` shows its file, ID, message count, token usage, and cost.
254
63
 
255
- In `fullscreen` mode, the transcript scrolls inside the terminal viewport while queued messages, working status, extension widgets, editor, and footer remain fixed at the bottom. Mouse/trackpad input scrolls the region under the pointer; keyboard viewport actions always remain available. Inline images work in terminals that support the Kitty graphics protocol, including Kitty and Ghostty. In iTerm2 they render as text placeholders because its inline-image protocol cannot delete or crop placements during application-owned scrolling. In `regular` mode, pi uses the main screen and terminal-owned scrollback, and iTerm2 inline images continue to render normally. See [Terminal setup](terminal-setup.md) for terminal-specific settings and workarounds.
64
+ Use `/tree`, `/fork`, or `/clone` when you want to explore another approach without losing existing work. Use `/compact` to reduce the conversation history sent to the model. See [Sessions and Context](sessions.md) for these workflows.
256
65
 
257
- Set **TUI mode** in `/settings` to switch between `regular` and `fullscreen` immediately and choose the default for future sessions. **Fullscreen exit output** controls whether exiting fullscreen prints the final transcript or restores the previous screen and prints only the session resume hint.
66
+ After leaving Pi, run `pi --continue` from the same folder to resume its most recent session.
258
67
 
259
- ### File Arguments
68
+ ## Run a terminal command
260
69
 
261
- Prefix files with `@` to include them in the message:
70
+ Prefix a command with `!` to run it and include its output in the conversation:
262
71
 
263
- ```bash
264
- pi @prompt.md "Answer this"
265
- pi -p @screenshot.png "What's in this image?"
266
- pi @code.ts @test.ts "Review these files"
72
+ ```text
73
+ !git status
267
74
  ```
268
75
 
269
- ### Examples
270
-
271
- ```bash
272
- # Interactive with initial prompt
273
- pi "List all .ts files in src/"
76
+ Use `!!` when you want to run a command without sending its output to the model.
274
77
 
275
- # Non-interactive
276
- pi -p "Summarize this codebase"
78
+ ## Copy, export, or share results
277
79
 
278
- # Prompt beginning with a dash
279
- pi -p -- "- Summarize these points"
80
+ Press `Ctrl+X` or run `/copy` to copy the last assistant response. Use `/export` to save the session as HTML or JSONL.
280
81
 
281
- # Non-interactive with piped stdin
282
- cat README.md | pi -p "Summarize this text"
82
+ Use `/share` to upload the session and get a viewer link. With Radius authentication, the artifact is visible to your Radius organization. Otherwise, Pi creates a private GitHub gist through the GitHub CLI. Review the session first because it can contain prompts, tool output, file contents, and credentials exposed during the conversation.
283
83
 
284
- # Named one-shot session
285
- pi --name "release audit" -p "Audit this repository"
84
+ ## Adjust the terminal
286
85
 
287
- # Different model
288
- pi --provider openai --model gpt-4o "Help me refactor"
289
-
290
- # Model with provider prefix
291
- pi --model openai/gpt-4o "Help me refactor"
292
-
293
- # Model with thinking level shorthand
294
- pi --model sonnet:high "Solve this complex problem"
295
-
296
- # Limit model cycling
297
- pi --models "claude-*,gpt-4o"
298
-
299
- # Read-only mode
300
- pi --tools read,grep,find,ls -p "Review the code"
301
-
302
- # Disable one extension or built-in tool while keeping the rest available
303
- pi --exclude-tools ask_question
304
- ```
86
+ Regular mode uses the terminal's normal scrollback. Fullscreen mode keeps the editor and status area fixed while the transcript scrolls within the terminal window. Choose a mode through `/settings` or `--tui-mode`.
305
87
 
306
- ## Design Principles
88
+ Terminal support for mouse input, keyboard shortcuts, and inline images varies. See [Terminal Setup](terminal-setup.md) for platform-specific configuration and [Keybindings](keybindings.md) for every configurable shortcut. Run `/hotkeys` to inspect the shortcuts active in your current session.
307
89
 
308
- Pi keeps the core small and pushes workflow-specific behavior into extensions, skills, prompt templates, and packages.
90
+ ## Collect diagnostic information
309
91
 
310
- It intentionally does not include built-in MCP, sub-agents, permission popups, plan mode, to-dos, or background bash. You can build or install those workflows as extensions or packages, or use external tools such as containers and tmux.
92
+ When troubleshooting terminal rendering or conversation state, run `/debug`. Pi writes the rendered terminal lines and current session messages to `pi-debug.log` in your [agent directory](configuration.md#agent-directory).
311
93
 
312
- For the full rationale, read the [blog post](https://mariozechner.at/posts/2025-11-30-pi-coding-agent/).
94
+ Review this file before sharing it. It can contain prompts, model responses, tool output, file contents, and terminal data.
package/docs/windows.md CHANGED
@@ -1,39 +1,65 @@
1
- # Windows Setup
1
+ # Run Pi on Windows
2
2
 
3
- Pi uses Git Bash by default on Windows. Checked locations (in order):
3
+ Run Pi either as a native Windows process or inside Windows Subsystem for Linux (WSL). Native Windows uses Git Bash by default for Bash commands and can optionally expose PowerShell to the model. Pi inside WSL uses the Linux environment and its Bash installation.
4
4
 
5
- 1. Custom path from `~/.pi/agent/settings.json`
6
- 2. Git Bash (`C:\Program Files\Git\bin\bash.exe`)
7
- 3. `bash.exe` on PATH (Cygwin, MSYS2, WSL)
5
+ Follow the main [Quickstart](quickstart.md) to install and authenticate Pi. Use this page to choose and configure its command environment.
8
6
 
9
- For most users, [Git for Windows](https://git-scm.com/download/win) is sufficient.
7
+ ## Choose native Windows or WSL
10
8
 
11
- ## PowerShell Tool
9
+ | Environment | Command environment | Use it when |
10
+ |---|---|---|
11
+ | Native Windows with Git Bash | Git Bash for the built-in `bash` tool and `!` commands | Your files and development tools primarily live on Windows |
12
+ | Native Windows with the `powershell` tool | PowerShell for model tool calls; Bash remains available for `!` commands | The task depends on PowerShell modules or Windows-native commands |
13
+ | WSL | Linux Bash and tools inside the selected WSL distribution | Your files and toolchain already live in Linux or WSL |
12
14
 
13
- The optional `powershell` tool runs commands through `pwsh.exe` when available, otherwise Windows PowerShell. It starts PowerShell with `-NoProfile -NonInteractive -ExecutionPolicy Bypass`. Administrator-enforced execution policies can still take precedence.
15
+ ## Use Git Bash on native Windows
14
16
 
15
- Use `defaultTools` to replace the model-facing `bash` tool:
17
+ For most native Windows users, installing [Git for Windows](https://git-scm.com/download/win) is sufficient.
16
18
 
17
- ```json
18
- {
19
- "defaultTools": ["read", "powershell", "edit", "write"]
20
- }
19
+ Pi resolves Bash in this order:
20
+
21
+ 1. `shellPath` from `~/.pi/agent/settings.json`
22
+ 2. Git Bash under `Program Files` or `Program Files (x86)`
23
+ 3. `bash.exe` on `PATH`, including Cygwin, MSYS2, or legacy WSL Bash
24
+
25
+ Start Pi and enter this command to verify the shell:
26
+
27
+ ```text
28
+ !printf 'Bash is working\n'
21
29
  ```
22
30
 
23
- Or enable both while comparing behavior:
31
+ If Pi cannot find Bash, it reports the locations it checked. Install Git for Windows, put another Bash executable on `PATH`, or configure `shellPath`.
32
+
33
+ ## Let the model use PowerShell
34
+
35
+ The optional `powershell` tool runs commands through `pwsh.exe` when available, then falls back to Windows PowerShell. It starts PowerShell with `-NoProfile -NonInteractive -ExecutionPolicy Bypass`. Administrator-enforced execution policies can still take precedence.
36
+
37
+ To replace the model-facing `bash` tool with `powershell`, add this to `~/.pi/agent/settings.json`:
24
38
 
25
39
  ```json
26
40
  {
27
- "defaultTools": ["read", "bash", "powershell", "edit", "write"]
41
+ "defaultTools": ["read", "powershell", "edit", "write"]
28
42
  }
29
43
  ```
30
44
 
31
- The `!` and `!!` editor commands still use Bash.
45
+ Restart Pi, then ask it to run a harmless PowerShell command. The `!` and `!!` editor commands continue to use Bash. The `powershell` tool is available only when Pi runs as a native Windows process.
46
+
47
+ See [Settings](settings.md#tools) for other tool combinations.
48
+
49
+ ## Use a custom Bash executable
32
50
 
33
- ## Custom Bash Path
51
+ Set `shellPath` when Bash is installed somewhere Pi does not discover automatically:
34
52
 
35
53
  ```json
36
54
  {
37
55
  "shellPath": "C:\\cygwin64\\bin\\bash.exe"
38
56
  }
39
57
  ```
58
+
59
+ JSON uses backslashes for escape sequences. When you write a Windows path with backslashes, write each backslash twice, as shown above.
60
+
61
+ See [Configure shell commands](shell-aliases.md) for command prefixes, aliases, and the complete shell-resolution behavior.
62
+
63
+ ## Configure Windows Terminal
64
+
65
+ Windows Terminal reserves or rewrites some modified keys. See [Windows Terminal](terminal-setup.md#windows-terminal) to configure `Shift+Enter` and `Alt+Enter`, and [Keybindings](keybindings.md) for Pi's Windows and WSL shortcut defaults.
@@ -1,6 +1,16 @@
1
1
  # Examples
2
2
 
3
- Example code for pi-coding-agent SDK and extensions.
3
+ Example code for the pi-coding-agent SDK, process integration, and extensions.
4
+
5
+ ## CLI integration
6
+
7
+ [`rpc-client.ts`](rpc-client.ts) uses the typed `RpcClient` to run Pi in a child process, stream events, and wait for the run to settle.
8
+
9
+ Build the coding-agent package before running it from a repository checkout:
10
+
11
+ ```bash
12
+ npx tsx examples/rpc-client.ts "Explain this repository"
13
+ ```
4
14
 
5
15
  ## Directories
6
16
 
@@ -23,6 +33,7 @@ An experimental plugin package that Pi automatically builds into separate Sessio
23
33
 
24
34
  ## Documentation
25
35
 
26
- - [SDK Reference](sdk/README.md)
36
+ - [SDK Examples](sdk/README.md)
37
+ - [CLI Integration](../docs/cli-integration.md)
27
38
  - [Extensions Documentation](../docs/extensions.md)
28
39
  - [Skills Documentation](../docs/skills.md)
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider",
3
- "version": "0.86.1",
3
+ "version": "0.87.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-custom-provider",
9
- "version": "0.86.1",
9
+ "version": "0.87.1",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sdk": "^0.52.0"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-anthropic",
3
3
  "private": true,
4
- "version": "0.86.1",
4
+ "version": "0.87.1",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-gitlab-duo",
3
3
  "private": true,
4
- "version": "0.86.1",
4
+ "version": "0.87.1",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-gondolin",
3
- "version": "0.86.1",
3
+ "version": "0.87.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-gondolin",
9
- "version": "0.86.1",
9
+ "version": "0.87.1",
10
10
  "dependencies": {
11
11
  "@earendil-works/gondolin": "0.12.0"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-gondolin",
3
3
  "private": true,
4
- "version": "0.86.1",
4
+ "version": "0.87.1",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-sandbox",
3
- "version": "1.16.1",
3
+ "version": "1.17.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-sandbox",
9
- "version": "1.16.1",
9
+ "version": "1.17.1",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sandbox-runtime": "^0.0.26"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-sandbox",
3
3
  "private": true,
4
- "version": "1.16.1",
4
+ "version": "1.17.1",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-with-deps",
3
- "version": "0.86.1",
3
+ "version": "0.87.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-with-deps",
9
- "version": "0.86.1",
9
+ "version": "0.87.1",
10
10
  "dependencies": {
11
11
  "ms": "^2.1.3"
12
12
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-with-deps",
3
3
  "private": true,
4
- "version": "0.86.1",
4
+ "version": "0.87.1",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -16,8 +16,9 @@ export default defineFacet({
16
16
  },
17
17
  });
18
18
  env.onActivate(() => {
19
- workerActivations.state.count += 1;
20
- workerActivations.publish(BACKGROUND_CONTEXT);
19
+ workerActivations.change(BACKGROUND_CONTEXT, (draft) => {
20
+ draft.count += 1;
21
+ });
21
22
  });
22
23
  },
23
24
  });