@astralyn/pi 0.82.2 → 0.82.4

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 (172) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +70 -634
  3. package/dist/cli/config-selector.d.ts.map +1 -1
  4. package/dist/cli/config-selector.js +3 -2
  5. package/dist/cli/config-selector.js.map +1 -1
  6. package/dist/cli/startup-ui.d.ts.map +1 -1
  7. package/dist/cli/startup-ui.js +3 -2
  8. package/dist/cli/startup-ui.js.map +1 -1
  9. package/dist/core/agent-session.d.ts +2 -0
  10. package/dist/core/agent-session.d.ts.map +1 -1
  11. package/dist/core/agent-session.js +31 -12
  12. package/dist/core/agent-session.js.map +1 -1
  13. package/dist/core/extensions/index.d.ts +1 -1
  14. package/dist/core/extensions/index.d.ts.map +1 -1
  15. package/dist/core/extensions/index.js.map +1 -1
  16. package/dist/core/extensions/types.d.ts +11 -0
  17. package/dist/core/extensions/types.d.ts.map +1 -1
  18. package/dist/core/extensions/types.js.map +1 -1
  19. package/dist/core/model-resolver.d.ts +1 -0
  20. package/dist/core/model-resolver.d.ts.map +1 -1
  21. package/dist/core/model-resolver.js +13 -3
  22. package/dist/core/model-resolver.js.map +1 -1
  23. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  24. package/dist/core/remote-catalog-provider.js +19 -1
  25. package/dist/core/remote-catalog-provider.js.map +1 -1
  26. package/dist/core/resource-loader.d.ts.map +1 -1
  27. package/dist/core/resource-loader.js +3 -0
  28. package/dist/core/resource-loader.js.map +1 -1
  29. package/dist/extensions/index.d.ts.map +1 -1
  30. package/dist/extensions/index.js +2 -0
  31. package/dist/extensions/index.js.map +1 -1
  32. package/dist/extensions/llama/provider.d.ts.map +1 -1
  33. package/dist/extensions/llama/provider.js +6 -0
  34. package/dist/extensions/llama/provider.js.map +1 -1
  35. package/dist/extensions/plan/constants.d.ts +31 -0
  36. package/dist/extensions/plan/constants.d.ts.map +1 -0
  37. package/dist/extensions/plan/constants.js +57 -0
  38. package/dist/extensions/plan/constants.js.map +1 -0
  39. package/dist/extensions/plan/index.d.ts +21 -0
  40. package/dist/extensions/plan/index.d.ts.map +1 -0
  41. package/dist/extensions/plan/index.js +291 -0
  42. package/dist/extensions/plan/index.js.map +1 -0
  43. package/dist/extensions/plan/schema.d.ts +15 -0
  44. package/dist/extensions/plan/schema.d.ts.map +1 -0
  45. package/dist/extensions/plan/schema.js +13 -0
  46. package/dist/extensions/plan/schema.js.map +1 -0
  47. package/dist/extensions/plan/state.d.ts +29 -0
  48. package/dist/extensions/plan/state.d.ts.map +1 -0
  49. package/dist/extensions/plan/state.js +74 -0
  50. package/dist/extensions/plan/state.js.map +1 -0
  51. package/dist/extensions/plan/storage.d.ts +18 -0
  52. package/dist/extensions/plan/storage.d.ts.map +1 -0
  53. package/dist/extensions/plan/storage.js +58 -0
  54. package/dist/extensions/plan/storage.js.map +1 -0
  55. package/dist/extensions/rewind/anchor.d.ts +29 -0
  56. package/dist/extensions/rewind/anchor.d.ts.map +1 -0
  57. package/dist/extensions/rewind/anchor.js +35 -0
  58. package/dist/extensions/rewind/anchor.js.map +1 -0
  59. package/dist/extensions/rewind/engine.d.ts +2 -6
  60. package/dist/extensions/rewind/engine.d.ts.map +1 -1
  61. package/dist/extensions/rewind/engine.js +41 -10
  62. package/dist/extensions/rewind/engine.js.map +1 -1
  63. package/dist/extensions/rewind/index.d.ts.map +1 -1
  64. package/dist/extensions/rewind/index.js +55 -21
  65. package/dist/extensions/rewind/index.js.map +1 -1
  66. package/dist/extensions/rewind/menu.d.ts.map +1 -1
  67. package/dist/extensions/rewind/menu.js +7 -2
  68. package/dist/extensions/rewind/menu.js.map +1 -1
  69. package/dist/extensions/rewind/restore.d.ts +26 -9
  70. package/dist/extensions/rewind/restore.d.ts.map +1 -1
  71. package/dist/extensions/rewind/restore.js +58 -16
  72. package/dist/extensions/rewind/restore.js.map +1 -1
  73. package/dist/extensions/subagent/activity.d.ts +1 -0
  74. package/dist/extensions/subagent/activity.d.ts.map +1 -1
  75. package/dist/extensions/subagent/activity.js +20 -4
  76. package/dist/extensions/subagent/activity.js.map +1 -1
  77. package/dist/extensions/subagent/agents.d.ts.map +1 -1
  78. package/dist/extensions/subagent/agents.js +2 -13
  79. package/dist/extensions/subagent/agents.js.map +1 -1
  80. package/dist/extensions/subagent/constants.d.ts +4 -3
  81. package/dist/extensions/subagent/constants.d.ts.map +1 -1
  82. package/dist/extensions/subagent/constants.js +9 -3
  83. package/dist/extensions/subagent/constants.js.map +1 -1
  84. package/dist/extensions/subagent/index.d.ts.map +1 -1
  85. package/dist/extensions/subagent/index.js +12 -5
  86. package/dist/extensions/subagent/index.js.map +1 -1
  87. package/dist/extensions/subagent/render.d.ts.map +1 -1
  88. package/dist/extensions/subagent/render.js +166 -41
  89. package/dist/extensions/subagent/render.js.map +1 -1
  90. package/dist/extensions/subagent/resolve.d.ts +2 -5
  91. package/dist/extensions/subagent/resolve.d.ts.map +1 -1
  92. package/dist/extensions/subagent/resolve.js +8 -13
  93. package/dist/extensions/subagent/resolve.js.map +1 -1
  94. package/dist/extensions/subagent/runner.d.ts +3 -1
  95. package/dist/extensions/subagent/runner.d.ts.map +1 -1
  96. package/dist/extensions/subagent/runner.js +111 -66
  97. package/dist/extensions/subagent/runner.js.map +1 -1
  98. package/dist/extensions/subagent/schema.d.ts +0 -6
  99. package/dist/extensions/subagent/schema.d.ts.map +1 -1
  100. package/dist/extensions/subagent/schema.js +2 -3
  101. package/dist/extensions/subagent/schema.js.map +1 -1
  102. package/dist/extensions/subagent/sdk-runner.d.ts.map +1 -1
  103. package/dist/extensions/subagent/sdk-runner.js +32 -16
  104. package/dist/extensions/subagent/sdk-runner.js.map +1 -1
  105. package/dist/extensions/subagent/types.d.ts +3 -2
  106. package/dist/extensions/subagent/types.d.ts.map +1 -1
  107. package/dist/extensions/subagent/types.js.map +1 -1
  108. package/dist/modes/interactive/components/custom-message.d.ts +3 -1
  109. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  110. package/dist/modes/interactive/components/custom-message.js +10 -2
  111. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  112. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  113. package/dist/modes/interactive/components/scoped-models-selector.js +22 -13
  114. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  115. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  116. package/dist/modes/interactive/interactive-mode.js +31 -18
  117. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  118. package/dist/utils/coalescing-terminal.d.ts +62 -0
  119. package/dist/utils/coalescing-terminal.d.ts.map +1 -0
  120. package/dist/utils/coalescing-terminal.js +151 -0
  121. package/dist/utils/coalescing-terminal.js.map +1 -0
  122. package/docs/bundled/README.md +38 -0
  123. package/docs/bundled/extensions/README.md +19 -0
  124. package/docs/bundled/extensions/plan.md +31 -0
  125. package/docs/{distribution → bundled}/extensions/question.md +0 -11
  126. package/docs/{distribution → bundled}/extensions/rewind.md +19 -18
  127. package/docs/{distribution → bundled}/extensions/router.md +1 -14
  128. package/docs/{distribution → bundled}/extensions/statusline.md +1 -2
  129. package/docs/{distribution → bundled}/extensions/subagent.md +15 -22
  130. package/docs/bundled/extensions/todo.md +28 -0
  131. package/docs/{distribution → bundled}/themes.md +4 -11
  132. package/docs/{distribution → bundled}/tool-presentation.md +4 -10
  133. package/docs/compaction.md +18 -14
  134. package/docs/custom-provider.md +8 -8
  135. package/docs/docs.json +61 -9
  136. package/docs/extensions.md +14 -13
  137. package/docs/index.md +12 -7
  138. package/docs/json.md +4 -4
  139. package/docs/providers.md +1 -1
  140. package/docs/rpc.md +3 -9
  141. package/docs/session-format.md +5 -5
  142. package/docs/skills.md +1 -1
  143. package/docs/themes.md +4 -8
  144. package/docs/tui.md +1 -1
  145. package/examples/extensions/README.md +0 -1
  146. package/examples/extensions/custom-provider-anthropic/index.ts +4 -4
  147. package/examples/extensions/custom-provider-gitlab-duo/index.ts +2 -2
  148. package/examples/extensions/dynamic-resources/dynamic.json +1 -1
  149. package/examples/extensions/gondolin/index.ts +4 -6
  150. package/examples/extensions/message-renderer.ts +2 -2
  151. package/examples/extensions/overlay-qa-tests.ts +2 -2
  152. package/examples/extensions/project-trust.ts +2 -2
  153. package/examples/sdk/README.md +38 -44
  154. package/npm-shrinkwrap.json +2 -2
  155. package/package.json +6 -2
  156. package/docs/development.md +0 -68
  157. package/docs/distribution/README.md +0 -34
  158. package/docs/distribution/architecture.md +0 -102
  159. package/docs/distribution/extensions/README.md +0 -17
  160. package/docs/distribution/maintenance.md +0 -121
  161. package/docs/distribution/release.md +0 -85
  162. package/examples/extensions/subagent/README.md +0 -175
  163. package/examples/extensions/subagent/agents/planner.md +0 -37
  164. package/examples/extensions/subagent/agents/reviewer.md +0 -35
  165. package/examples/extensions/subagent/agents/scout.md +0 -50
  166. package/examples/extensions/subagent/agents/worker.md +0 -24
  167. package/examples/extensions/subagent/agents.ts +0 -126
  168. package/examples/extensions/subagent/index.ts +0 -1009
  169. package/examples/extensions/subagent/prompts/implement-and-review.md +0 -10
  170. package/examples/extensions/subagent/prompts/implement.md +0 -10
  171. package/examples/extensions/subagent/prompts/scout-and-plan.md +0 -9
  172. /package/docs/{distribution → bundled}/extensions/deepwiki.md +0 -0
package/README.md CHANGED
@@ -1,701 +1,137 @@
1
1
  # Pi
2
2
 
3
- > A personal `@astralyn/pi` distribution based on [earendil-works/pi](https://github.com/earendil-works/pi). It is not an upstream release.
3
+ `@astralyn/pi` is a standalone distribution of the Pi terminal coding agent. It follows the coding-agent package from [earendil-works/pi](https://github.com/earendil-works/pi) release tags while shipping its own documentation, bundled workflows, context-safety behavior, and npm release process.
4
4
 
5
- This closed repository contains only the standalone coding-agent package maintained by its owner and invited Contributors. It does not accept external issues or pull requests. Product usage and public APIs are indexed in [`docs/index.md`](docs/index.md); distribution architecture, bundled behavior, maintenance, and publishing are under [`docs/distribution/`](docs/distribution/README.md).
5
+ This is not an upstream release. The repository is maintained privately and does not accept external issues or pull requests.
6
6
 
7
- ## What this distribution changes
7
+ ## Install
8
8
 
9
- - Native tool calls use a consistent `●` call / `│` result presentation with bounded collapsed output.
10
- - Long tool loops auto-compact after a complete tool batch and before the next provider request, continuing the same run when the rebuilt context is safe and failing closed otherwise.
11
- - Personal workflow extensions are bundled: `deepwiki`, `question`, `todo`, `rewind`, `router`, and `statusline`.
12
- - `ice-cream-dark` and `ice-cream-light` are bundled themes.
13
-
14
- The AI, Agent core, and TUI runtimes are exact upstream npm dependencies rather than locally forked workspaces. See the [architecture](docs/distribution/architecture.md) and [maintenance guide](docs/distribution/maintenance.md) for that boundary.
15
-
16
- Pi is a minimal terminal coding harness. Adapt pi to your workflows, not the other way around, without having to fork and modify pi internals. Extend it with TypeScript [Extensions](#extensions), [Skills](#skills), [Prompt Templates](#prompt-templates), and [Themes](#themes). Put your extensions, skills, prompt templates, and themes in [Pi Packages](#pi-packages) and share them with others via npm or git.
17
-
18
- Pi ships with powerful defaults but skips features like sub agents and plan mode. Instead, you can ask pi to build what you want or install a third party pi package that matches your workflow.
19
-
20
- Pi runs in four modes: interactive, print or JSON, RPC for process integration, and an SDK for embedding in your own apps. See [openclaw/openclaw](https://github.com/openclaw/openclaw) for a real-world SDK integration.
21
-
22
- ## Share your OSS coding agent sessions
23
-
24
- If you use pi for open source work, please share your coding agent sessions.
25
-
26
- Public OSS session data helps improve models, prompts, tools, and evaluations using real development workflows.
27
-
28
- For the full explanation, see [this post on X](https://x.com/badlogicgames/status/2037811643774652911).
29
-
30
- To publish sessions, use [`badlogic/pi-share-hf`](https://github.com/badlogic/pi-share-hf). Read its README.md for setup instructions. All you need is a Hugging Face account, the Hugging Face CLI, and `pi-share-hf`.
31
-
32
- You can also watch [this video](https://x.com/badlogicgames/status/2041151967695634619), where I show how I publish my `pi-mono` sessions.
33
-
34
- I regularly publish my own `pi-mono` work sessions here:
35
-
36
- - [badlogicgames/pi-mono on Hugging Face](https://huggingface.co/datasets/badlogicgames/pi-mono)
37
-
38
- ## Table of Contents
39
-
40
- - [Quick Start](#quick-start)
41
- - [Providers & Models](#providers--models)
42
- - [Interactive Mode](#interactive-mode)
43
- - [Editor](#editor)
44
- - [Commands](#commands)
45
- - [Keyboard Shortcuts](#keyboard-shortcuts)
46
- - [Message Queue](#message-queue)
47
- - [Sessions](#sessions)
48
- - [Branching](#branching)
49
- - [Compaction](#compaction)
50
- - [Settings](#settings)
51
- - [Context Files](#context-files)
52
- - [Customization](#customization)
53
- - [Prompt Templates](#prompt-templates)
54
- - [Skills](#skills)
55
- - [Extensions](#extensions)
56
- - [Themes](#themes)
57
- - [Pi Packages](#pi-packages)
58
- - [Programmatic Usage](#programmatic-usage)
59
- - [Philosophy](#philosophy)
60
- - [CLI Reference](#cli-reference)
61
-
62
- ---
63
-
64
- ## Quick Start
9
+ Pi requires Node.js 22.19 or later.
65
10
 
66
11
  ```bash
67
12
  npm install -g --ignore-scripts @astralyn/pi
68
- ```
69
-
70
- `--ignore-scripts` disables dependency lifecycle scripts during install. Pi does not require install scripts for normal npm installs.
71
-
72
- Authenticate with an API key:
73
-
74
- ```bash
75
- export ANTHROPIC_API_KEY=sk-ant-...
76
13
  pi
77
14
  ```
78
15
 
79
- Or use your existing subscription:
80
-
81
- ```bash
82
- pi
83
- /login # Then select provider
84
- ```
85
-
86
- Then just talk to pi. By default, pi gives the model four tools: `read`, `write`, `edit`, and `bash`. The model uses these to fulfill your requests. Add capabilities via [skills](#skills), [prompt templates](#prompt-templates), [extensions](#extensions), or [pi packages](#pi-packages).
87
-
88
- **Platform notes:** [Windows](docs/windows.md) | [Termux (Android)](docs/termux.md) | [tmux](docs/tmux.md) | [Terminal setup](docs/terminal-setup.md) | [Shell aliases](docs/shell-aliases.md)
89
-
90
- ---
91
-
92
- ## Providers & Models
93
-
94
- For each built-in provider, pi maintains a list of tool-capable models. Configured provider catalogs refresh automatically; run `pi update --models` to force an immediate refresh. Authenticate via subscription (`/login`) or API key, then select any model from that provider via `/model` (or Ctrl+L).
95
-
96
- **Subscriptions:**
97
- - Anthropic Claude Pro/Max
98
- - OpenAI ChatGPT Plus/Pro (Codex)
99
- - GitHub Copilot
100
-
101
- **API keys:**
102
- - Anthropic
103
- - Ant Ling
104
- - OpenAI
105
- - Azure OpenAI
106
- - DeepSeek
107
- - NVIDIA NIM
108
- - Google Gemini
109
- - Google Vertex
110
- - Amazon Bedrock
111
- - Mistral
112
- - Groq
113
- - Cerebras
114
- - Cloudflare AI Gateway
115
- - Cloudflare Workers AI
116
- - xAI
117
- - OpenRouter
118
- - Vercel AI Gateway
119
- - ZAI Coding Plan (Global)
120
- - ZAI Coding Plan (China)
121
- - OpenCode Zen
122
- - OpenCode Go
123
- - Hugging Face
124
- - Fireworks
125
- - Together AI
126
- - Kimi For Coding
127
- - MiniMax
128
- - Xiaomi MiMo
129
- - Xiaomi MiMo Token Plan (China)
130
- - Xiaomi MiMo Token Plan (Amsterdam)
131
- - Xiaomi MiMo Token Plan (Singapore)
132
-
133
- Pi also supports the llama.cpp router server. Configure it with `/login llama.cpp`, manage downloads and loaded models with `/llama`, then select a loaded model with `/model`. See [docs/llama-cpp.md](docs/llama-cpp.md) for setup and usage.
134
-
135
- See [docs/providers.md](docs/providers.md) for other provider setup instructions.
136
-
137
- **Custom providers & models:** Add providers via `~/.pi/agent/models.json` if they speak a supported API (OpenAI, Anthropic, Google). For custom APIs or OAuth, use extensions. See [docs/models.md](docs/models.md) and [docs/custom-provider.md](docs/custom-provider.md).
138
-
139
- ---
140
-
141
- ## Interactive Mode
142
-
143
- <p align="center"><img src="docs/images/interactive-mode.png" alt="Interactive Mode" width="600"></p>
144
-
145
- The interface from top to bottom:
146
-
147
- - **Startup header** - Shows shortcuts (`/hotkeys` for all), loaded AGENTS.md files, prompt templates, skills, and extensions
148
- - **Messages** - Your messages, assistant responses, tool calls and results, notifications, errors, and extension UI
149
- - **Editor** - Where you type; border color indicates thinking level
150
- - **Footer** - Working directory, session name, total token/cache usage (`↑` input, `↓` output, `R` cache read, `W` cache write, `CH` latest cache hit rate), cost, context usage, current model. Totals include assistant responses, usage reported by tools, and summary generation.
151
-
152
- The editor can be temporarily replaced by other UI, like built-in `/settings` or custom UI from extensions (e.g., a Q&A tool that lets the user answer model questions in a structured format). [Extensions](#extensions) can also replace the editor, add widgets above/below it, a status line, custom footer, or overlays.
153
-
154
- ### Editor
155
-
156
- | Feature | How |
157
- |---------|-----|
158
- | File reference | Type `@` to fuzzy-search project files |
159
- | Path completion | Tab to complete paths |
160
- | Multi-line | Shift+Enter (or Ctrl+Enter on Windows Terminal) |
161
- | External editor | Ctrl+G opens `externalEditor`, `$VISUAL`, `$EDITOR`, Notepad on Windows, or `nano` elsewhere |
162
- | Clipboard | Ctrl+V to paste an image or text (Alt+V on Windows), or drag images onto terminal |
163
- | Bash commands | `!command` runs and sends output to LLM, `!!command` runs without sending |
164
-
165
- Standard editing keybindings for delete word, undo, etc. See [docs/keybindings.md](docs/keybindings.md).
166
-
167
- ### Commands
168
-
169
- Type `/` in the editor to trigger commands. [Extensions](#extensions) can register custom commands, [skills](#skills) are available as `/skill:name`, and [prompt templates](#prompt-templates) expand via `/templatename`.
170
-
171
- | Command | Description |
172
- |---------|-------------|
173
- | `/login`, `/logout` | Manage provider credentials |
174
- | [`/llama`](docs/llama-cpp.md) | Download, load, and unload llama.cpp router models |
175
- | `/model` | Switch models |
176
- | `/scoped-models` | Enable/disable models for Ctrl+P cycling |
177
- | `/settings` | Thinking level, theme, message delivery, transport |
178
- | `/resume` | Pick from previous sessions |
179
- | `/new` | Start a new session |
180
- | `/name <name>` | Set session display name |
181
- | `/session` | Show session info (file, ID, messages, tokens, cost) |
182
- | `/tree` | Jump to any point in the session and continue from there |
183
- | `/trust` | Save project trust decision for future sessions (restart required) |
184
- | `/fork` | Create a new session from a previous user message |
185
- | `/clone` | Duplicate the current active branch into a new session |
186
- | `/compact [prompt]` | Manually compact context, optional custom instructions |
187
- | `/copy` | Copy last assistant message to clipboard |
188
- | `/export [file]` | Export session to HTML or JSONL file |
189
- | `/import <file>` | Import and resume a session from a JSONL file |
190
- | `/share` | Upload as private GitHub gist with shareable HTML link |
191
- | `/reload` | Reload keybindings, extensions, skills, prompts, themes, and context files |
192
- | `/hotkeys` | Show all keyboard shortcuts |
193
- | `/changelog` | Display version history |
194
- | `/quit` | Quit pi |
195
-
196
- ### Keyboard Shortcuts
197
-
198
- See `/hotkeys` for the full list. Customize via `~/.pi/agent/keybindings.json`. See [docs/keybindings.md](docs/keybindings.md).
199
-
200
- **Commonly used:**
201
-
202
- | Key | Action |
203
- |-----|--------|
204
- | Ctrl+C | Clear editor |
205
- | Ctrl+C twice | Quit |
206
- | Escape | Cancel/abort |
207
- | Escape twice | Open `/tree` |
208
- | Ctrl+L | Open model selector |
209
- | Ctrl+P / Shift+Ctrl+P | Cycle scoped models forward/backward |
210
- | Shift+Tab | Cycle thinking level |
211
- | Ctrl+O | Collapse/expand tool output |
212
- | Ctrl+T | Collapse/expand thinking blocks |
213
- | Ctrl+X | Copy the last assistant message |
214
-
215
- ### Message Queue
216
-
217
- Submit messages while the agent is working:
218
-
219
- - **Enter** queues a *steering* message, delivered after the current assistant turn finishes executing its tool calls
220
- - **Alt+Enter** queues a *follow-up* message, delivered only after the agent finishes all work
221
- - **Escape** aborts and restores queued messages to editor
222
- - **Alt+Up** retrieves queued messages back to editor
16
+ Use `/login` for a supported subscription provider, or configure an API key before starting Pi. See the [quickstart](docs/quickstart.md) and [provider guide](docs/providers.md).
223
17
 
224
- On Windows Terminal, `Alt+Enter` is fullscreen by default. Remap it in [docs/terminal-setup.md](docs/terminal-setup.md) so pi can receive the follow-up shortcut.
18
+ `--ignore-scripts` disables dependency lifecycle scripts during installation. Pi does not require install scripts for normal npm installs.
225
19
 
226
- Configure delivery in [settings](docs/settings.md): `steeringMode` and `followUpMode` can be `"one-at-a-time"` (default, waits for response) or `"all"` (delivers all queued at once). `transport` selects provider transport preference (`"sse"`, `"websocket"`, or `"auto"`) for providers that support multiple transports.
20
+ ## What This Distribution Ships
227
21
 
228
- ---
22
+ The package keeps Pi's extensible terminal coding-agent architecture and adds a small set of built-in behaviors:
229
23
 
230
- ## Sessions
24
+ - native `●` call and `│` result presentation with bounded collapsed tool output;
25
+ - automatic compaction between completed tool batches and the next provider request;
26
+ - bundled `deepwiki`, `question`, `rewind`, `router`, `statusline`, `subagent`, and `todo` extensions;
27
+ - bundled `ice-cream-dark` and `ice-cream-light` themes;
28
+ - exact registry dependencies on the upstream AI, Agent core, and TUI packages.
231
29
 
232
- Sessions are stored as JSONL files with a tree structure. Each entry has an `id` and `parentId`, enabling in-place branching without creating new files. See [docs/session-format.md](docs/session-format.md) for file format.
30
+ See [bundled features](docs/bundled/README.md) for the complete catalog.
233
31
 
234
- ### Management
32
+ ## Usage
235
33
 
236
- Sessions auto-save to `~/.pi/agent/sessions/` organized by working directory.
34
+ Start an interactive session in a project directory:
237
35
 
238
36
  ```bash
239
- pi -c # Continue most recent session
240
- pi -r # Browse and select from past sessions
241
- pi --no-session # Ephemeral mode (don't save)
242
- pi --name "my task" # Set session display name at startup
243
- pi --session <path|id> # Use specific session file or ID
244
- pi --fork <path|id> # Fork specific session file or ID into a new session
37
+ pi
245
38
  ```
246
39
 
247
- Use `/session` in interactive mode to see the current session ID before reusing it with `--session <id>` or `--fork <id>`.
248
-
249
- ### Branching
250
-
251
- **`/tree`** - Navigate the session tree in-place. Select any previous point, continue from there, and switch between branches. All history preserved in a single file.
252
-
253
- <p align="center"><img src="docs/images/tree-view.png" alt="Tree View" width="600"></p>
254
-
255
- - Search by typing, fold/unfold and jump between branches with Ctrl+←/Ctrl+→ or Alt+←/Alt+→, page with ←/→
256
- - Filter modes (Ctrl+O): default → no-tools → user-only → labeled-only → all
257
- - Press Ctrl+X to copy the selected message
258
- - Press Shift+L to label entries as bookmarks and Shift+T to toggle label timestamps
259
-
260
- **`/fork`** - Create a new session file from a previous user message on the active branch. Opens a selector, copies the active path up to that point, and places the selected prompt in the editor for modification.
261
-
262
- **`/clone`** - Duplicate the current active branch into a new session file at the current position. The new session keeps the full active-path history and opens with an empty editor.
263
-
264
- **`--fork <path|id>`** - Fork an existing session file or partial session UUID directly from the CLI. This copies the full source session into a new session file in the current project.
265
-
266
- ### Compaction
40
+ Useful commands:
267
41
 
268
- Long sessions can exhaust context windows. Compaction summarizes older messages while keeping recent ones.
42
+ | Command | Purpose |
43
+ |---|---|
44
+ | `/login` | Authenticate a provider |
45
+ | `/model` | Select a configured model |
46
+ | `/settings` | Change thinking, theme, queue, and transport settings |
47
+ | `/compact` | Manually compact the active context |
48
+ | `/tree` | Navigate and branch session history |
49
+ | `/resume` | Resume a previous session |
50
+ | `/reload` | Reload extensions, skills, prompts, themes, and context files |
51
+ | `/hotkeys` | Show configured keyboard shortcuts |
269
52
 
270
- **Manual:** `/compact` or `/compact <custom instructions>`
53
+ Run a one-shot prompt:
271
54
 
272
- **Automatic:** Enabled by default. Triggers on context overflow (recovers and retries) or when approaching the limit (proactive). Configure via `/settings` or `settings.json`.
273
-
274
- Compaction is lossy. The full history remains in the JSONL file; use `/tree` to revisit. Customize compaction behavior via [extensions](#extensions). See [docs/compaction.md](docs/compaction.md) for internals.
275
-
276
- ---
277
-
278
- ## Settings
279
-
280
- Use `/settings` to modify common options, or edit JSON files directly:
281
-
282
- | Location | Scope |
283
- |----------|-------|
284
- | `~/.pi/agent/settings.json` | Global (all projects) |
285
- | `.pi/settings.json` | Project (overrides global) |
286
-
287
- See [docs/settings.md](docs/settings.md) for all options.
288
-
289
- ### Project Trust
290
-
291
- 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.
292
-
293
- 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.
294
-
295
- 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.
296
-
297
- 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`.
298
-
299
- `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.
300
-
301
- 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.
302
-
303
- ### Provider attribution and update checks
304
-
305
- This distribution checks the npm registry for the latest `@astralyn/pi` version. Disable the startup check with `PI_SKIP_VERSION_CHECK=1`.
306
-
307
- The `enableInstallTelemetry` setting name is retained for configuration compatibility, but it now controls only optional provider attribution headers for supported OpenRouter, Cloudflare, and NVIDIA NIM requests. The Fork does not send install or update pings to `pi.dev`. Set it to `false` in `settings.json`, or set `PI_TELEMETRY=0`, to disable those headers.
308
-
309
- Use `--offline` or `PI_OFFLINE=1` to disable startup network operations, including the npm version check, model refresh, and package update checks.
310
-
311
- ---
312
-
313
- ## Context Files
314
-
315
- Pi loads `AGENTS.md` (or `CLAUDE.md`) at startup from:
316
- - `~/.pi/agent/AGENTS.md` (global)
317
- - Parent directories (walking up from cwd)
318
- - Current directory
319
-
320
- Use for project instructions (`AGENTS.md`/`CLAUDE.md`), conventions, common commands. All matching files are concatenated.
321
-
322
- Disable context file loading with `--no-context-files` (or `-nc`).
323
-
324
- ### System Prompt
325
-
326
- Replace the default system prompt with `.pi/SYSTEM.md` (project) or `~/.pi/agent/SYSTEM.md` (global). Append without replacing via `APPEND_SYSTEM.md`.
327
-
328
- ---
329
-
330
- ## Customization
331
-
332
- ### Prompt Templates
333
-
334
- Reusable prompts as Markdown files. Type `/name` to expand.
335
-
336
- ```markdown
337
- <!-- ~/.pi/agent/prompts/review.md -->
338
- Review this code for bugs, security issues, and performance problems.
339
- Focus on: {{focus}}
55
+ ```bash
56
+ pi -p "Summarize this repository"
340
57
  ```
341
58
 
342
- Place in `~/.pi/agent/prompts/`, `.pi/prompts/`, or a [pi package](#pi-packages) to share with others. See [docs/prompt-templates.md](docs/prompt-templates.md).
343
-
344
- ### Skills
59
+ Include files with `@` arguments:
345
60
 
346
- On-demand capability packages following the [Agent Skills standard](https://agentskills.io). Invoke via `/skill:name` or let the agent load them automatically.
347
-
348
- ```markdown
349
- <!-- ~/.pi/agent/skills/my-skill/SKILL.md -->
350
- # My Skill
351
- Use this skill when the user asks about X.
352
-
353
- ## Steps
354
- 1. Do this
355
- 2. Then that
61
+ ```bash
62
+ pi @README.md "Review this documentation"
356
63
  ```
357
64
 
358
- Place in `~/.pi/agent/skills/`, `~/.agents/skills/`, `.pi/skills/`, or `.agents/skills/` (from `cwd` up through parent directories) or a [pi package](#pi-packages) to share with others. See [docs/skills.md](docs/skills.md).
359
-
360
- ### Extensions
65
+ Run structured modes:
361
66
 
362
- <p align="center"><img src="docs/images/doom-extension.png" alt="Doom Extension" width="600"></p>
363
-
364
- TypeScript modules that extend pi with custom tools, commands, keyboard shortcuts, event handlers, and UI components.
365
-
366
- ```typescript
367
- export default function (pi: ExtensionAPI) {
368
- pi.registerTool({ name: "deploy", ... });
369
- pi.registerCommand("stats", { ... });
370
- pi.on("tool_call", async (event, ctx) => { ... });
371
- }
67
+ ```bash
68
+ pi --mode json
69
+ pi --mode rpc
372
70
  ```
373
71
 
374
- The default export can also be `async`. pi waits for async extension factories before startup continues, which is useful for one-time initialization such as fetching remote model lists before calling `pi.registerProvider()`.
375
-
376
- **What's possible:**
377
- - Custom tools (or replace built-in tools entirely)
378
- - Sub-agents and plan mode
379
- - Custom compaction and summarization
380
- - Permission gates and path protection
381
- - Custom editors and UI components
382
- - Status lines, headers, footers
383
- - Git checkpointing and auto-commit
384
- - SSH and sandbox execution
385
- - MCP server integration
386
- - Make pi look like Claude Code
387
- - Games while waiting (yes, Doom runs)
388
- - ...anything you can dream up
389
-
390
- Place in `~/.pi/agent/extensions/`, `.pi/extensions/`, or a [pi package](#pi-packages) to share with others. See [docs/extensions.md](docs/extensions.md) and [examples/extensions/](examples/extensions/).
391
-
392
- ### Themes
393
-
394
- Built-in: `dark`, `light`. Themes hot-reload: modify the active theme file and pi immediately applies changes.
72
+ See [Using Pi](docs/usage.md), [JSON mode](docs/json.md), and [RPC mode](docs/rpc.md).
395
73
 
396
- Place in `~/.pi/agent/themes/`, `.pi/themes/`, or a [pi package](#pi-packages) to share with others. See [docs/themes.md](docs/themes.md).
74
+ ## Sessions and Context
397
75
 
398
- ### Pi Packages
76
+ Sessions are stored as JSONL under `~/.pi/agent/sessions/`. Pi supports persistent branching, labels, forks, cloning, import/export, and context compaction. The full session history remains on disk after compaction.
399
77
 
400
- Bundle and share extensions, skills, prompts, and themes via npm or git. Find packages on [npmjs.com](https://www.npmjs.com/search?q=keywords%3Api-package) or [Discord](https://discord.com/channels/1456806362351669492/1457744485428629628).
78
+ Pi discovers `AGENTS.md` and `CLAUDE.md` context files from the project and its parent directories. Global instructions can be stored at `~/.pi/agent/AGENTS.md`.
401
79
 
402
- > **Security:** Pi packages run with full system access. Extensions execute arbitrary code, and skills can instruct the model to perform any action including running executables. Review source code before installing third-party packages.
80
+ See [Sessions](docs/sessions.md), [Session format](docs/session-format.md), and [Compaction](docs/compaction.md).
403
81
 
404
- ```bash
405
- pi install npm:@foo/pi-tools
406
- pi install npm:@foo/pi-tools@1.2.3 # pinned version
407
- pi install git:github.com/user/repo
408
- pi install git:github.com/user/repo@v1 # tag or commit
409
- pi install git:git@github.com:user/repo
410
- pi install git:git@github.com:user/repo@v1 # tag or commit
411
- pi install https://github.com/user/repo
412
- pi install https://github.com/user/repo@v1 # tag or commit
413
- pi install ssh://git@github.com/user/repo
414
- pi install ssh://git@github.com/user/repo@v1 # tag or commit
415
- pi remove npm:@foo/pi-tools
416
- pi uninstall npm:@foo/pi-tools # alias for remove
417
- pi list
418
- pi update # update pi only
419
- pi update --all # update pi and packages
420
- pi update --extensions # update packages only
421
- pi update --models # refresh model catalogs only
422
- pi update --self # update pi only
423
- pi update --self --force # reinstall pi even if current
424
- pi update npm:@foo/pi-tools # update one package
425
- pi config # enable/disable extensions, skills, prompts, themes
426
- ```
427
-
428
- Packages install to `~/.pi/agent/git/` (git) or `~/.pi/agent/npm/` (npm). Use `-l` for project-local installs (`.pi/git/`, `.pi/npm/`). Git `@ref` values are pinned tags or commits; pinned packages are skipped by `pi update --extensions` and `pi update --all`, so use `pi install git:host/user/repo@new-ref` to move an existing package to a new ref. Git packages install dependencies with `npm install --omit=dev` by default, so runtime deps must be listed under `dependencies`; when `npmCommand` is configured, git packages use plain `install` for compatibility with wrappers. If you use a Node version manager and want package installs to reuse a stable npm context, set `npmCommand` in `settings.json`, for example `["mise", "exec", "node@20", "--", "npm"]`.
429
-
430
- Create a package by adding a `pi` key to `package.json`:
431
-
432
- ```json
433
- {
434
- "name": "my-pi-package",
435
- "keywords": ["pi-package"],
436
- "pi": {
437
- "extensions": ["./extensions"],
438
- "skills": ["./skills"],
439
- "prompts": ["./prompts"],
440
- "themes": ["./themes"]
441
- }
442
- }
443
- ```
82
+ ## Customization
444
83
 
445
- Without a `pi` manifest, pi auto-discovers from conventional directories (`extensions/`, `skills/`, `prompts/`, `themes/`).
84
+ Pi can be extended without modifying its core:
446
85
 
447
- See [docs/packages.md](docs/packages.md).
86
+ - [Extensions](docs/extensions.md) add tools, commands, lifecycle handlers, provider integrations, and TUI components.
87
+ - [Skills](docs/skills.md) provide on-demand workflows and reference material.
88
+ - [Prompt templates](docs/prompt-templates.md) add reusable slash-command prompts.
89
+ - [Themes](docs/themes.md) customize terminal presentation.
90
+ - [Pi packages](docs/packages.md) distribute those resources through npm or git.
448
91
 
449
- ---
92
+ Project-local code and package resources execute with the user's permissions. Review third-party packages and trust a project only when its local configuration and extensions are acceptable.
450
93
 
451
- ## Programmatic Usage
94
+ ## Programmatic API
452
95
 
453
- ### SDK
96
+ Use the SDK from Node.js:
454
97
 
455
98
  ```typescript
456
99
  import { createAgentSession, ModelRuntime, SessionManager } from "@astralyn/pi";
457
100
 
458
101
  const modelRuntime = await ModelRuntime.create();
459
102
  const { session } = await createAgentSession({
460
- sessionManager: SessionManager.inMemory(),
461
103
  modelRuntime,
104
+ sessionManager: SessionManager.inMemory(),
462
105
  });
463
106
 
464
107
  await session.prompt("What files are in the current directory?");
465
108
  ```
466
109
 
467
- For advanced multi-session runtime replacement, use `createAgentSessionRuntime()` and `AgentSessionRuntime`.
468
-
469
- See [docs/sdk.md](docs/sdk.md) and [examples/sdk/](examples/sdk/).
470
-
471
- ### RPC Mode
472
-
473
- For non-Node.js integrations, use RPC mode over stdin/stdout:
474
-
475
- ```bash
476
- pi --mode rpc
477
- ```
478
-
479
- RPC mode uses strict LF-delimited JSONL framing. Clients must split records on `\n` only. Do not use generic line readers like Node `readline`, which also split on Unicode separators inside JSON payloads.
480
-
481
- See [docs/rpc.md](docs/rpc.md) for the protocol.
482
-
483
- ---
484
-
485
- ## Philosophy
486
-
487
- Pi is aggressively extensible so it doesn't have to dictate your workflow. Features that other tools bake in can be built with [extensions](#extensions), [skills](#skills), or installed from third-party [pi packages](#pi-packages). This keeps the core minimal while letting you shape pi to fit how you work.
488
-
489
- **No MCP.** Build CLI tools with READMEs (see [Skills](#skills)), or build an extension that adds MCP support. [Why?](https://mariozechner.at/posts/2025-11-02-what-if-you-dont-need-mcp/)
490
-
491
- **No sub-agents.** There's many ways to do this. Spawn pi instances via tmux, or build your own with [extensions](#extensions), or install a package that does it your way.
492
-
493
- **No permission popups.** Run in a container, or build your own confirmation flow with [extensions](#extensions) inline with your environment and security requirements.
494
-
495
- **No plan mode.** Write plans to files, or build it with [extensions](#extensions), or install a package.
496
-
497
- **No built-in to-dos.** They confuse models. Use a TODO.md file, or build your own with [extensions](#extensions).
498
-
499
- **No background bash.** Use tmux. Full observability, direct interaction.
500
-
501
- Read the [blog post](https://mariozechner.at/posts/2025-11-30-pi-coding-agent/) for the full rationale.
502
-
503
- ---
504
-
505
- ## CLI Reference
506
-
507
- ```bash
508
- pi [options] [@files...] [messages...]
509
- ```
510
-
511
- ### Package Commands
512
-
513
- ```bash
514
- pi install <source> [-l] # Install package, -l for project-local
515
- pi remove <source> [-l] # Remove package
516
- pi uninstall <source> [-l] # Alias for remove
517
- pi update [source|self|pi] # Update pi only, or one package source
518
- pi update --all # Update pi and packages
519
- pi update --extensions # Update packages only
520
- pi update --models # Refresh model catalogs only
521
- pi update --self # Update pi only
522
- pi update --self --force # Reinstall pi even if current
523
- pi update --extension <src> # Update one package
524
- pi list # List installed packages
525
- pi config # Enable/disable package resources
526
- ```
527
-
528
- `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.
529
-
530
- ### Modes
531
-
532
- | Flag | Description |
533
- |------|-------------|
534
- | (default) | Interactive mode |
535
- | `-p`, `--print` | Print response and exit |
536
- | `--mode json` | Output all events as JSON lines (see [docs/json.md](docs/json.md)) |
537
- | `--mode rpc` | RPC mode for process integration (see [docs/rpc.md](docs/rpc.md)) |
538
- | `--export <in> [out]` | Export session to HTML |
539
-
540
- In print mode, pi also reads piped stdin and merges it into the initial prompt:
541
-
542
- ```bash
543
- cat README.md | pi -p "Summarize this text"
544
- ```
545
-
546
- ### Model Options
547
-
548
- | Option | Description |
549
- |--------|-------------|
550
- | `--provider <name>` | Provider (anthropic, openai, google, etc.) |
551
- | `--model <pattern>` | Model pattern or ID (supports `provider/id` and optional `:<thinking>`) |
552
- | `--api-key <key>` | API key (overrides env vars) |
553
- | `--thinking <level>` | `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max` |
554
- | `--models <patterns>` | Comma-separated patterns for Ctrl+P cycling |
555
- | `--list-models [search]` | List available models |
556
-
557
- ### Session Options
558
-
559
- | Option | Description |
560
- |--------|-------------|
561
- | `-c`, `--continue` | Continue most recent session |
562
- | `-r`, `--resume` | Browse and select session |
563
- | `--session <path\|id>` | Use specific session file or partial UUID |
564
- | `--fork <path\|id>` | Fork specific session file or partial UUID into a new session |
565
- | `--session-dir <dir>` | Custom session storage directory |
566
- | `--no-session` | Ephemeral mode (don't save) |
567
- | `--name <name>`, `-n <name>` | Set session display name at startup |
568
-
569
- ### Tool Options
570
-
571
- | Option | Description |
572
- |--------|-------------|
573
- | `--tools <list>`, `-t <list>` | Allowlist specific tool names across built-in, extension, and custom tools |
574
- | `--exclude-tools <list>`, `-xt <list>` | Disable specific tool names across built-in, extension, and custom tools |
575
- | `--no-builtin-tools`, `-nbt` | Disable built-in tools by default but keep extension/custom tools enabled |
576
- | `--no-tools`, `-nt` | Disable all tools by default |
577
-
578
- Available built-in tools: `read`, `bash`, `edit`, `write`, `grep`, `find`, `ls`
579
-
580
- ### Resource Options
581
-
582
- | Option | Description |
583
- |--------|-------------|
584
- | `-e`, `--extension <source>` | Load extension from path, npm, or git (repeatable) |
585
- | `--no-extensions` | Disable extension discovery |
586
- | `--skill <path>` | Load skill (repeatable) |
587
- | `--no-skills` | Disable skill discovery |
588
- | `--prompt-template <path>` | Load prompt template (repeatable) |
589
- | `--no-prompt-templates` | Disable prompt template discovery |
590
- | `--theme <path>` | Load theme (repeatable) |
591
- | `--no-themes` | Disable theme discovery |
592
- | `--no-context-files`, `-nc` | Disable AGENTS.md and CLAUDE.md context file discovery |
593
-
594
- Combine `--no-*` with explicit flags to load exactly what you need, ignoring settings.json (e.g., `--no-extensions -e ./my-ext.ts`).
595
-
596
- ### Other Options
597
-
598
- | Option | Description |
599
- |--------|-------------|
600
- | `--system-prompt <text>` | Replace default prompt (context files and skills still appended) |
601
- | `--append-system-prompt <text>` | Append to system prompt |
602
- | `--verbose` | Force verbose startup |
603
- | `-a`, `--approve` | Trust project-local files for this run |
604
- | `-na`, `--no-approve` | Ignore project-local files for this run |
605
- | `-h`, `--help` | Show help |
606
- | `-v`, `--version` | Show version |
607
-
608
- ### File Arguments
609
-
610
- Prefix files with `@` to include in the message:
611
-
612
- ```bash
613
- pi @prompt.md "Answer this"
614
- pi -p @screenshot.png "What's in this image?"
615
- pi @code.ts @test.ts "Review these files"
616
- ```
617
-
618
- ### Examples
619
-
620
- ```bash
621
- # Interactive with initial prompt
622
- pi "List all .ts files in src/"
623
-
624
- # Non-interactive
625
- pi -p "Summarize this codebase"
626
-
627
- # Non-interactive with piped stdin
628
- cat README.md | pi -p "Summarize this text"
629
-
630
- # Named one-shot session
631
- pi --name "release audit" -p "Audit this repository"
632
-
633
- # Different model
634
- pi --provider openai --model gpt-4o "Help me refactor"
635
-
636
- # Model with provider prefix (no --provider needed)
637
- pi --model openai/gpt-4o "Help me refactor"
110
+ The package exports its SDK from `@astralyn/pi` and its executable RPC entry point from `@astralyn/pi/rpc-entry`.
638
111
 
639
- # Model with thinking level shorthand
640
- pi --model sonnet:high "Solve this complex problem"
112
+ See the [SDK guide](docs/sdk.md) and [SDK examples](examples/sdk/README.md).
641
113
 
642
- # Limit model cycling
643
- pi --models "claude-*,gpt-4o"
114
+ ## Documentation
644
115
 
645
- # Read-only mode
646
- pi --tools read,grep,find,ls -p "Review the code"
116
+ - [Documentation index](docs/index.md)
117
+ - [Quickstart](docs/quickstart.md)
118
+ - [Settings](docs/settings.md)
119
+ - [Environment variables](docs/environment-variables.md)
120
+ - [Bundled features](docs/bundled/README.md)
121
+ - [Security](docs/security.md)
647
122
 
648
- # Disable one extension or built-in tool while keeping the rest available
649
- pi --exclude-tools ask_question
123
+ Repository architecture, upstream synchronization, development, and publishing are documented in the source repository's [maintainer guide](https://github.com/ming-kang/pi/tree/main/maintainers). Those files are intentionally excluded from the npm package.
650
124
 
651
- # High thinking level
652
- pi --thinking high "Solve this complex problem"
653
- ```
654
-
655
- ### Environment Variables
656
-
657
- | Variable | Description |
658
- |----------|-------------|
659
- | `PI_CODING_AGENT` | Set to `true` by the CLI and RPC entry points so child processes can detect that they run inside Pi |
660
- | `PI_CODING_AGENT_DIR` | Override config directory (default: `~/.pi/agent`) |
661
- | `PI_CODING_AGENT_SESSION_DIR` | Override session storage directory (overridden by `--session-dir`) |
662
- | `PI_PACKAGE_DIR` | Override package directory (useful for Nix/Guix where store paths tokenize poorly) |
663
- | `PI_OFFLINE` | Disable startup network operations, including npm version checks, package update checks, and model refresh |
664
- | `PI_SKIP_VERSION_CHECK` | Skip the Pi version update check at startup. This prevents the npm registry latest-version request |
665
- | `PI_TELEMETRY` | Override optional provider attribution headers. Use `1`/`true`/`yes` to enable or `0`/`false`/`no` to disable. This does not disable version checks |
666
- | `PI_CACHE_RETENTION` | Set to `long` for extended prompt cache (Anthropic: 1h, OpenAI: 24h) |
667
- | `VISUAL`, `EDITOR` | Fallback external editor for Ctrl+G when `externalEditor` is unset; defaults to Notepad on Windows and `nano` elsewhere |
668
-
669
- Commands run by the LLM-callable bash tool also receive current session metadata:
670
-
671
- | Variable | Description |
672
- |----------|-------------|
673
- | `PI_SESSION_ID` | Current session ID |
674
- | `PI_SESSION_FILE` | Absolute session JSONL path; unset for ephemeral sessions |
675
- | `PI_PROVIDER` | Currently selected model provider |
676
- | `PI_MODEL` | Currently selected model ID |
677
- | `PI_REASONING_LEVEL` | Current effective reasoning level |
125
+ ## Upstream Boundary
678
126
 
679
- These values are resolved when each command starts. See [Environment Variables](docs/environment-variables.md#bash-tool-session-environment) for semantics, examples, and custom-tool opt-out.
127
+ The repository contains only the coding-agent package. AI, Agent core, and TUI are consumed as exact npm dependencies:
680
128
 
681
- ---
129
+ - [`@earendil-works/pi-ai`](https://www.npmjs.com/package/@earendil-works/pi-ai)
130
+ - [`@earendil-works/pi-agent-core`](https://www.npmjs.com/package/@earendil-works/pi-agent-core)
131
+ - [`@earendil-works/pi-tui`](https://www.npmjs.com/package/@earendil-works/pi-tui)
682
132
 
683
- ## Development
684
-
685
- This repository is developed privately by its owner and invited Contributors. See [docs/development.md](docs/development.md) for setup and debugging notes. Distribution-specific development rules are in [AGENTS.md](AGENTS.md).
133
+ Upstream release tags are reviewed selectively. Their documentation and examples are inputs to synchronization, not files that overwrite this distribution's documentation.
686
134
 
687
135
  ## License
688
136
 
689
137
  MIT
690
-
691
- ## See Also
692
-
693
- - [@earendil-works/pi-ai](https://www.npmjs.com/package/@earendil-works/pi-ai): Core LLM toolkit
694
- - [@earendil-works/pi-agent-core](https://www.npmjs.com/package/@earendil-works/pi-agent-core): Agent framework
695
- - [@earendil-works/pi-tui](https://www.npmjs.com/package/@earendil-works/pi-tui): Terminal UI components
696
-
697
- <p align="center">
698
- <a href="https://pi.dev">pi.dev</a> domain graciously donated by
699
- <br /><br />
700
- <a href="https://exe.dev"><img src="docs/images/exy.png" alt="Exy mascot" width="48" /><br />exe.dev</a>
701
- </p>