@eminent337/aery 0.67.68

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 (148) hide show
  1. package/CHANGELOG.md +3768 -0
  2. package/README.md +623 -0
  3. package/docs/compaction.md +394 -0
  4. package/docs/custom-provider.md +637 -0
  5. package/docs/development.md +71 -0
  6. package/docs/extensions.md +2368 -0
  7. package/docs/images/doom-extension.png +0 -0
  8. package/docs/images/exy.png +0 -0
  9. package/docs/images/interactive-mode.png +0 -0
  10. package/docs/images/tree-view.png +0 -0
  11. package/docs/json.md +82 -0
  12. package/docs/keybindings.md +197 -0
  13. package/docs/models.md +395 -0
  14. package/docs/packages.md +218 -0
  15. package/docs/prompt-templates.md +88 -0
  16. package/docs/providers.md +195 -0
  17. package/docs/rpc.md +1407 -0
  18. package/docs/sdk.md +1149 -0
  19. package/docs/session.md +412 -0
  20. package/docs/settings.md +247 -0
  21. package/docs/shell-aliases.md +13 -0
  22. package/docs/skills.md +232 -0
  23. package/docs/terminal-setup.md +106 -0
  24. package/docs/termux.md +127 -0
  25. package/docs/themes.md +295 -0
  26. package/docs/tmux.md +61 -0
  27. package/docs/tree.md +233 -0
  28. package/docs/tui.md +918 -0
  29. package/docs/windows.md +17 -0
  30. package/examples/README.md +25 -0
  31. package/examples/extensions/README.md +208 -0
  32. package/examples/extensions/antigravity-image-gen.ts +418 -0
  33. package/examples/extensions/auto-commit-on-exit.ts +49 -0
  34. package/examples/extensions/bash-spawn-hook.ts +30 -0
  35. package/examples/extensions/bookmark.ts +50 -0
  36. package/examples/extensions/built-in-tool-renderer.ts +249 -0
  37. package/examples/extensions/claude-rules.ts +86 -0
  38. package/examples/extensions/commands.ts +72 -0
  39. package/examples/extensions/confirm-destructive.ts +59 -0
  40. package/examples/extensions/custom-compaction.ts +127 -0
  41. package/examples/extensions/custom-footer.ts +64 -0
  42. package/examples/extensions/custom-header.ts +73 -0
  43. package/examples/extensions/custom-provider-anthropic/index.ts +604 -0
  44. package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
  45. package/examples/extensions/custom-provider-anthropic/package.json +19 -0
  46. package/examples/extensions/custom-provider-gitlab-duo/index.ts +349 -0
  47. package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
  48. package/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
  49. package/examples/extensions/custom-provider-qwen-cli/index.ts +345 -0
  50. package/examples/extensions/custom-provider-qwen-cli/package.json +16 -0
  51. package/examples/extensions/dirty-repo-guard.ts +56 -0
  52. package/examples/extensions/doom-overlay/README.md +46 -0
  53. package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
  54. package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
  55. package/examples/extensions/doom-overlay/doom/build.sh +152 -0
  56. package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
  57. package/examples/extensions/doom-overlay/doom-component.ts +132 -0
  58. package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
  59. package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
  60. package/examples/extensions/doom-overlay/index.ts +74 -0
  61. package/examples/extensions/doom-overlay/wad-finder.ts +51 -0
  62. package/examples/extensions/dynamic-resources/SKILL.md +8 -0
  63. package/examples/extensions/dynamic-resources/dynamic.json +79 -0
  64. package/examples/extensions/dynamic-resources/dynamic.md +5 -0
  65. package/examples/extensions/dynamic-resources/index.ts +15 -0
  66. package/examples/extensions/dynamic-tools.ts +74 -0
  67. package/examples/extensions/event-bus.ts +43 -0
  68. package/examples/extensions/file-trigger.ts +41 -0
  69. package/examples/extensions/git-checkpoint.ts +53 -0
  70. package/examples/extensions/handoff.ts +153 -0
  71. package/examples/extensions/hello.ts +26 -0
  72. package/examples/extensions/hidden-thinking-label.ts +53 -0
  73. package/examples/extensions/inline-bash.ts +94 -0
  74. package/examples/extensions/input-transform.ts +43 -0
  75. package/examples/extensions/interactive-shell.ts +196 -0
  76. package/examples/extensions/mac-system-theme.ts +47 -0
  77. package/examples/extensions/message-renderer.ts +59 -0
  78. package/examples/extensions/minimal-mode.ts +426 -0
  79. package/examples/extensions/modal-editor.ts +85 -0
  80. package/examples/extensions/model-status.ts +31 -0
  81. package/examples/extensions/notify.ts +55 -0
  82. package/examples/extensions/overlay-qa-tests.ts +1348 -0
  83. package/examples/extensions/overlay-test.ts +150 -0
  84. package/examples/extensions/permission-gate.ts +34 -0
  85. package/examples/extensions/pirate.ts +47 -0
  86. package/examples/extensions/plan-mode/README.md +65 -0
  87. package/examples/extensions/plan-mode/index.ts +340 -0
  88. package/examples/extensions/plan-mode/utils.ts +168 -0
  89. package/examples/extensions/preset.ts +430 -0
  90. package/examples/extensions/protected-paths.ts +30 -0
  91. package/examples/extensions/provider-payload.ts +18 -0
  92. package/examples/extensions/qna.ts +122 -0
  93. package/examples/extensions/question.ts +264 -0
  94. package/examples/extensions/questionnaire.ts +427 -0
  95. package/examples/extensions/rainbow-editor.ts +88 -0
  96. package/examples/extensions/reload-runtime.ts +37 -0
  97. package/examples/extensions/rpc-demo.ts +118 -0
  98. package/examples/extensions/sandbox/index.ts +321 -0
  99. package/examples/extensions/sandbox/package-lock.json +92 -0
  100. package/examples/extensions/sandbox/package.json +19 -0
  101. package/examples/extensions/send-user-message.ts +97 -0
  102. package/examples/extensions/session-name.ts +27 -0
  103. package/examples/extensions/shutdown-command.ts +63 -0
  104. package/examples/extensions/snake.ts +343 -0
  105. package/examples/extensions/space-invaders.ts +560 -0
  106. package/examples/extensions/ssh.ts +220 -0
  107. package/examples/extensions/status-line.ts +32 -0
  108. package/examples/extensions/subagent/README.md +172 -0
  109. package/examples/extensions/subagent/agents/planner.md +37 -0
  110. package/examples/extensions/subagent/agents/reviewer.md +35 -0
  111. package/examples/extensions/subagent/agents/scout.md +50 -0
  112. package/examples/extensions/subagent/agents/worker.md +24 -0
  113. package/examples/extensions/subagent/agents.ts +126 -0
  114. package/examples/extensions/subagent/index.ts +987 -0
  115. package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
  116. package/examples/extensions/subagent/prompts/implement.md +10 -0
  117. package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
  118. package/examples/extensions/summarize.ts +206 -0
  119. package/examples/extensions/system-prompt-header.ts +17 -0
  120. package/examples/extensions/tic-tac-toe.ts +1008 -0
  121. package/examples/extensions/timed-confirm.ts +70 -0
  122. package/examples/extensions/titlebar-spinner.ts +58 -0
  123. package/examples/extensions/todo.ts +297 -0
  124. package/examples/extensions/tool-override.ts +144 -0
  125. package/examples/extensions/tools.ts +141 -0
  126. package/examples/extensions/trigger-compact.ts +50 -0
  127. package/examples/extensions/truncated-tool.ts +195 -0
  128. package/examples/extensions/widget-placement.ts +9 -0
  129. package/examples/extensions/with-deps/index.ts +32 -0
  130. package/examples/extensions/with-deps/package-lock.json +31 -0
  131. package/examples/extensions/with-deps/package.json +22 -0
  132. package/examples/extensions/working-indicator.ts +123 -0
  133. package/examples/rpc-extension-ui.ts +632 -0
  134. package/examples/sdk/01-minimal.ts +22 -0
  135. package/examples/sdk/02-custom-model.ts +49 -0
  136. package/examples/sdk/03-custom-prompt.ts +62 -0
  137. package/examples/sdk/04-skills.ts +55 -0
  138. package/examples/sdk/05-tools.ts +44 -0
  139. package/examples/sdk/06-extensions.ts +90 -0
  140. package/examples/sdk/07-context-files.ts +42 -0
  141. package/examples/sdk/08-prompt-templates.ts +51 -0
  142. package/examples/sdk/09-api-keys-and-oauth.ts +48 -0
  143. package/examples/sdk/10-settings.ts +53 -0
  144. package/examples/sdk/11-sessions.ts +48 -0
  145. package/examples/sdk/12-full-control.ts +73 -0
  146. package/examples/sdk/13-session-runtime.ts +67 -0
  147. package/examples/sdk/README.md +147 -0
  148. package/package.json +102 -0
package/README.md ADDED
@@ -0,0 +1,623 @@
1
+ <p align="center">
2
+ <a href="https://shittycodingagent.ai">
3
+ <img src="https://shittycodingagent.ai/logo.svg" alt="pi logo" width="128">
4
+ </a>
5
+ </p>
6
+ <p align="center">
7
+ <a href="https://discord.com/invite/3cU7Bz4UPx"><img alt="Discord" src="https://img.shields.io/badge/discord-community-5865F2?style=flat-square&logo=discord&logoColor=white" /></a>
8
+ <a href="https://www.npmjs.com/package/@mariozechner/pi-coding-agent"><img alt="npm" src="https://img.shields.io/npm/v/@mariozechner/pi-coding-agent?style=flat-square" /></a>
9
+ <a href="https://github.com/badlogic/pi-mono/actions/workflows/ci.yml"><img alt="Build status" src="https://img.shields.io/github/actions/workflow/status/badlogic/pi-mono/ci.yml?style=flat-square&branch=main" /></a>
10
+ </p>
11
+ <p align="center">
12
+ <a href="https://pi.dev">pi.dev</a> domain graciously donated by
13
+ <br /><br />
14
+ <a href="https://exe.dev"><img src="docs/images/exy.png" alt="Exy mascot" width="48" /><br />exe.dev</a>
15
+ </p>
16
+
17
+ > New issues and PRs from new contributors are auto-closed by default. Maintainers review auto-closed issues daily. See [CONTRIBUTING.md](../../CONTRIBUTING.md).
18
+
19
+ ---
20
+
21
+ 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.
22
+
23
+ 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.
24
+
25
+ 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.
26
+
27
+ ## Share your OSS coding agent sessions
28
+
29
+ If you use pi for open source work, please share your coding agent sessions.
30
+
31
+ Public OSS session data helps improve models, prompts, tools, and evaluations using real development workflows.
32
+
33
+ For the full explanation, see [this post on X](https://x.com/badlogicgames/status/2037811643774652911).
34
+
35
+ 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`.
36
+
37
+ You can also watch [this video](https://x.com/badlogicgames/status/2041151967695634619), where I show how I publish my `pi-mono` sessions.
38
+
39
+ I regularly publish my own `pi-mono` work sessions here:
40
+
41
+ - [badlogicgames/pi-mono on Hugging Face](https://huggingface.co/datasets/badlogicgames/pi-mono)
42
+
43
+ ## Table of Contents
44
+
45
+ - [Quick Start](#quick-start)
46
+ - [Providers & Models](#providers--models)
47
+ - [Interactive Mode](#interactive-mode)
48
+ - [Editor](#editor)
49
+ - [Commands](#commands)
50
+ - [Keyboard Shortcuts](#keyboard-shortcuts)
51
+ - [Message Queue](#message-queue)
52
+ - [Sessions](#sessions)
53
+ - [Branching](#branching)
54
+ - [Compaction](#compaction)
55
+ - [Settings](#settings)
56
+ - [Context Files](#context-files)
57
+ - [Customization](#customization)
58
+ - [Prompt Templates](#prompt-templates)
59
+ - [Skills](#skills)
60
+ - [Extensions](#extensions)
61
+ - [Themes](#themes)
62
+ - [Pi Packages](#pi-packages)
63
+ - [Programmatic Usage](#programmatic-usage)
64
+ - [Philosophy](#philosophy)
65
+ - [CLI Reference](#cli-reference)
66
+
67
+ ---
68
+
69
+ ## Quick Start
70
+
71
+ ```bash
72
+ npm install -g @mariozechner/pi-coding-agent
73
+ ```
74
+
75
+ Authenticate with an API key:
76
+
77
+ ```bash
78
+ export ANTHROPIC_API_KEY=sk-ant-...
79
+ pi
80
+ ```
81
+
82
+ Or use your existing subscription:
83
+
84
+ ```bash
85
+ pi
86
+ /login # Then select provider
87
+ ```
88
+
89
+ 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).
90
+
91
+ **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)
92
+
93
+ ---
94
+
95
+ ## Providers & Models
96
+
97
+ For each built-in provider, pi maintains a list of tool-capable models, updated with every release. Authenticate via subscription (`/login`) or API key, then select any model from that provider via `/model` (or Ctrl+L).
98
+
99
+ **Subscriptions:**
100
+ - Anthropic Claude Pro/Max
101
+ - OpenAI ChatGPT Plus/Pro (Codex)
102
+ - GitHub Copilot
103
+ - Google Gemini CLI
104
+ - Google Antigravity
105
+
106
+ **API keys:**
107
+ - Anthropic
108
+ - OpenAI
109
+ - Azure OpenAI
110
+ - Google Gemini
111
+ - Google Vertex
112
+ - Amazon Bedrock
113
+ - Mistral
114
+ - Groq
115
+ - Cerebras
116
+ - xAI
117
+ - OpenRouter
118
+ - Vercel AI Gateway
119
+ - ZAI
120
+ - OpenCode Zen
121
+ - OpenCode Go
122
+ - Hugging Face
123
+ - Kimi For Coding
124
+ - MiniMax
125
+
126
+ See [docs/providers.md](docs/providers.md) for detailed setup instructions.
127
+
128
+ **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).
129
+
130
+ ---
131
+
132
+ ## Interactive Mode
133
+
134
+ <p align="center"><img src="docs/images/interactive-mode.png" alt="Interactive Mode" width="600"></p>
135
+
136
+ The interface from top to bottom:
137
+
138
+ - **Startup header** - Shows shortcuts (`/hotkeys` for all), loaded AGENTS.md files, prompt templates, skills, and extensions
139
+ - **Messages** - Your messages, assistant responses, tool calls and results, notifications, errors, and extension UI
140
+ - **Editor** - Where you type; border color indicates thinking level
141
+ - **Footer** - Working directory, session name, total token/cache usage, cost, context usage, current model
142
+
143
+ 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.
144
+
145
+ ### Editor
146
+
147
+ | Feature | How |
148
+ |---------|-----|
149
+ | File reference | Type `@` to fuzzy-search project files |
150
+ | Path completion | Tab to complete paths |
151
+ | Multi-line | Shift+Enter (or Ctrl+Enter on Windows Terminal) |
152
+ | Images | Ctrl+V to paste (Alt+V on Windows), or drag onto terminal |
153
+ | Bash commands | `!command` runs and sends output to LLM, `!!command` runs without sending |
154
+
155
+ Standard editing keybindings for delete word, undo, etc. See [docs/keybindings.md](docs/keybindings.md).
156
+
157
+ ### Commands
158
+
159
+ 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`.
160
+
161
+ | Command | Description |
162
+ |---------|-------------|
163
+ | `/login`, `/logout` | OAuth authentication |
164
+ | `/model` | Switch models |
165
+ | `/scoped-models` | Enable/disable models for Ctrl+P cycling |
166
+ | `/settings` | Thinking level, theme, message delivery, transport |
167
+ | `/resume` | Pick from previous sessions |
168
+ | `/new` | Start a new session |
169
+ | `/name <name>` | Set session display name |
170
+ | `/session` | Show session info (file, ID, messages, tokens, cost) |
171
+ | `/tree` | Jump to any point in the session and continue from there |
172
+ | `/fork` | Create a new session from a previous user message |
173
+ | `/clone` | Duplicate the current active branch into a new session |
174
+ | `/compact [prompt]` | Manually compact context, optional custom instructions |
175
+ | `/copy` | Copy last assistant message to clipboard |
176
+ | `/export [file]` | Export session to HTML file |
177
+ | `/share` | Upload as private GitHub gist with shareable HTML link |
178
+ | `/reload` | Reload keybindings, extensions, skills, prompts, and context files (themes hot-reload automatically) |
179
+ | `/hotkeys` | Show all keyboard shortcuts |
180
+ | `/changelog` | Display version history |
181
+ | `/quit` | Quit pi |
182
+
183
+ ### Keyboard Shortcuts
184
+
185
+ See `/hotkeys` for the full list. Customize via `~/.pi/agent/keybindings.json`. See [docs/keybindings.md](docs/keybindings.md).
186
+
187
+ **Commonly used:**
188
+
189
+ | Key | Action |
190
+ |-----|--------|
191
+ | Ctrl+C | Clear editor |
192
+ | Ctrl+C twice | Quit |
193
+ | Escape | Cancel/abort |
194
+ | Escape twice | Open `/tree` |
195
+ | Ctrl+L | Open model selector |
196
+ | Ctrl+P / Shift+Ctrl+P | Cycle scoped models forward/backward |
197
+ | Shift+Tab | Cycle thinking level |
198
+ | Ctrl+O | Collapse/expand tool output |
199
+ | Ctrl+T | Collapse/expand thinking blocks |
200
+
201
+ ### Message Queue
202
+
203
+ Submit messages while the agent is working:
204
+
205
+ - **Enter** queues a *steering* message, delivered after the current assistant turn finishes executing its tool calls
206
+ - **Alt+Enter** queues a *follow-up* message, delivered only after the agent finishes all work
207
+ - **Escape** aborts and restores queued messages to editor
208
+ - **Alt+Up** retrieves queued messages back to editor
209
+
210
+ 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.
211
+
212
+ 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.
213
+
214
+ ---
215
+
216
+ ## Sessions
217
+
218
+ 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.md](docs/session.md) for file format.
219
+
220
+ ### Management
221
+
222
+ Sessions auto-save to `~/.pi/agent/sessions/` organized by working directory.
223
+
224
+ ```bash
225
+ pi -c # Continue most recent session
226
+ pi -r # Browse and select from past sessions
227
+ pi --no-session # Ephemeral mode (don't save)
228
+ pi --session <path|id> # Use specific session file or ID
229
+ pi --fork <path|id> # Fork specific session file or ID into a new session
230
+ ```
231
+
232
+ Use `/session` in interactive mode to see the current session ID before reusing it with `--session <id>` or `--fork <id>`.
233
+
234
+ ### Branching
235
+
236
+ **`/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.
237
+
238
+ <p align="center"><img src="docs/images/tree-view.png" alt="Tree View" width="600"></p>
239
+
240
+ - Search by typing, fold/unfold and jump between branches with Ctrl+←/Ctrl+→ or Alt+←/Alt+→, page with ←/→
241
+ - Filter modes (Ctrl+O): default → no-tools → user-only → labeled-only → all
242
+ - Press Shift+L to label entries as bookmarks and Shift+T to toggle label timestamps
243
+
244
+ **`/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.
245
+
246
+ **`/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.
247
+
248
+ **`--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.
249
+
250
+ ### Compaction
251
+
252
+ Long sessions can exhaust context windows. Compaction summarizes older messages while keeping recent ones.
253
+
254
+ **Manual:** `/compact` or `/compact <custom instructions>`
255
+
256
+ **Automatic:** Enabled by default. Triggers on context overflow (recovers and retries) or when approaching the limit (proactive). Configure via `/settings` or `settings.json`.
257
+
258
+ 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.
259
+
260
+ ---
261
+
262
+ ## Settings
263
+
264
+ Use `/settings` to modify common options, or edit JSON files directly:
265
+
266
+ | Location | Scope |
267
+ |----------|-------|
268
+ | `~/.pi/agent/settings.json` | Global (all projects) |
269
+ | `.pi/settings.json` | Project (overrides global) |
270
+
271
+ See [docs/settings.md](docs/settings.md) for all options.
272
+
273
+ To opt out of anonymous install/update telemetry tied to changelog detection, set `enableInstallTelemetry` to `false` in `settings.json`, or set `PI_TELEMETRY=0`.
274
+
275
+ ---
276
+
277
+ ## Context Files
278
+
279
+ Pi loads `AGENTS.md` (or `CLAUDE.md`) at startup from:
280
+ - `~/.pi/agent/AGENTS.md` (global)
281
+ - Parent directories (walking up from cwd)
282
+ - Current directory
283
+
284
+ Use for project instructions, conventions, common commands. All matching files are concatenated.
285
+
286
+ Disable context file loading with `--no-context-files` (or `-nc`).
287
+
288
+ ### System Prompt
289
+
290
+ Replace the default system prompt with `.pi/SYSTEM.md` (project) or `~/.pi/agent/SYSTEM.md` (global). Append without replacing via `APPEND_SYSTEM.md`.
291
+
292
+ ---
293
+
294
+ ## Customization
295
+
296
+ ### Prompt Templates
297
+
298
+ Reusable prompts as Markdown files. Type `/name` to expand.
299
+
300
+ ```markdown
301
+ <!-- ~/.pi/agent/prompts/review.md -->
302
+ Review this code for bugs, security issues, and performance problems.
303
+ Focus on: {{focus}}
304
+ ```
305
+
306
+ 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).
307
+
308
+ ### Skills
309
+
310
+ On-demand capability packages following the [Agent Skills standard](https://agentskills.io). Invoke via `/skill:name` or let the agent load them automatically.
311
+
312
+ ```markdown
313
+ <!-- ~/.pi/agent/skills/my-skill/SKILL.md -->
314
+ # My Skill
315
+ Use this skill when the user asks about X.
316
+
317
+ ## Steps
318
+ 1. Do this
319
+ 2. Then that
320
+ ```
321
+
322
+ 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).
323
+
324
+ ### Extensions
325
+
326
+ <p align="center"><img src="docs/images/doom-extension.png" alt="Doom Extension" width="600"></p>
327
+
328
+ TypeScript modules that extend pi with custom tools, commands, keyboard shortcuts, event handlers, and UI components.
329
+
330
+ ```typescript
331
+ export default function (pi: ExtensionAPI) {
332
+ pi.registerTool({ name: "deploy", ... });
333
+ pi.registerCommand("stats", { ... });
334
+ pi.on("tool_call", async (event, ctx) => { ... });
335
+ }
336
+ ```
337
+
338
+ 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()`.
339
+
340
+ **What's possible:**
341
+ - Custom tools (or replace built-in tools entirely)
342
+ - Sub-agents and plan mode
343
+ - Custom compaction and summarization
344
+ - Permission gates and path protection
345
+ - Custom editors and UI components
346
+ - Status lines, headers, footers
347
+ - Git checkpointing and auto-commit
348
+ - SSH and sandbox execution
349
+ - MCP server integration
350
+ - Make pi look like Claude Code
351
+ - Games while waiting (yes, Doom runs)
352
+ - ...anything you can dream up
353
+
354
+ 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/).
355
+
356
+ ### Themes
357
+
358
+ Built-in: `dark`, `light`. Themes hot-reload: modify the active theme file and pi immediately applies changes.
359
+
360
+ Place in `~/.pi/agent/themes/`, `.pi/themes/`, or a [pi package](#pi-packages) to share with others. See [docs/themes.md](docs/themes.md).
361
+
362
+ ### Pi Packages
363
+
364
+ 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).
365
+
366
+ > **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.
367
+
368
+ ```bash
369
+ pi install npm:@foo/pi-tools
370
+ pi install npm:@foo/pi-tools@1.2.3 # pinned version
371
+ pi install git:github.com/user/repo
372
+ pi install git:github.com/user/repo@v1 # tag or commit
373
+ pi install git:git@github.com:user/repo
374
+ pi install git:git@github.com:user/repo@v1 # tag or commit
375
+ pi install https://github.com/user/repo
376
+ pi install https://github.com/user/repo@v1 # tag or commit
377
+ pi install ssh://git@github.com/user/repo
378
+ pi install ssh://git@github.com/user/repo@v1 # tag or commit
379
+ pi remove npm:@foo/pi-tools
380
+ pi uninstall npm:@foo/pi-tools # alias for remove
381
+ pi list
382
+ pi update # skips pinned packages
383
+ pi config # enable/disable extensions, skills, prompts, themes
384
+ ```
385
+
386
+ Packages install to `~/.pi/agent/git/` (git) or global npm. Use `-l` for project-local installs (`.pi/git/`, `.pi/npm/`). Git packages install dependencies with `npm install --omit=dev`, so runtime deps must be listed under `dependencies`. 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"]`.
387
+
388
+ Create a package by adding a `pi` key to `package.json`:
389
+
390
+ ```json
391
+ {
392
+ "name": "my-pi-package",
393
+ "keywords": ["pi-package"],
394
+ "pi": {
395
+ "extensions": ["./extensions"],
396
+ "skills": ["./skills"],
397
+ "prompts": ["./prompts"],
398
+ "themes": ["./themes"]
399
+ }
400
+ }
401
+ ```
402
+
403
+ Without a `pi` manifest, pi auto-discovers from conventional directories (`extensions/`, `skills/`, `prompts/`, `themes/`).
404
+
405
+ See [docs/packages.md](docs/packages.md).
406
+
407
+ ---
408
+
409
+ ## Programmatic Usage
410
+
411
+ ### SDK
412
+
413
+ ```typescript
414
+ import { AuthStorage, createAgentSession, ModelRegistry, SessionManager } from "@mariozechner/pi-coding-agent";
415
+
416
+ const authStorage = AuthStorage.create();
417
+ const modelRegistry = ModelRegistry.create(authStorage);
418
+ const { session } = await createAgentSession({
419
+ sessionManager: SessionManager.inMemory(),
420
+ authStorage,
421
+ modelRegistry,
422
+ });
423
+
424
+ await session.prompt("What files are in the current directory?");
425
+ ```
426
+
427
+ For advanced multi-session runtime replacement, use `createAgentSessionRuntime()` and `AgentSessionRuntime`.
428
+
429
+ See [docs/sdk.md](docs/sdk.md) and [examples/sdk/](examples/sdk/).
430
+
431
+ ### RPC Mode
432
+
433
+ For non-Node.js integrations, use RPC mode over stdin/stdout:
434
+
435
+ ```bash
436
+ pi --mode rpc
437
+ ```
438
+
439
+ 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.
440
+
441
+ See [docs/rpc.md](docs/rpc.md) for the protocol.
442
+
443
+ ---
444
+
445
+ ## Philosophy
446
+
447
+ 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.
448
+
449
+ **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/)
450
+
451
+ **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.
452
+
453
+ **No permission popups.** Run in a container, or build your own confirmation flow with [extensions](#extensions) inline with your environment and security requirements.
454
+
455
+ **No plan mode.** Write plans to files, or build it with [extensions](#extensions), or install a package.
456
+
457
+ **No built-in to-dos.** They confuse models. Use a TODO.md file, or build your own with [extensions](#extensions).
458
+
459
+ **No background bash.** Use tmux. Full observability, direct interaction.
460
+
461
+ Read the [blog post](https://mariozechner.at/posts/2025-11-30-pi-coding-agent/) for the full rationale.
462
+
463
+ ---
464
+
465
+ ## CLI Reference
466
+
467
+ ```bash
468
+ pi [options] [@files...] [messages...]
469
+ ```
470
+
471
+ ### Package Commands
472
+
473
+ ```bash
474
+ pi install <source> [-l] # Install package, -l for project-local
475
+ pi remove <source> [-l] # Remove package
476
+ pi uninstall <source> [-l] # Alias for remove
477
+ pi update [source] # Update packages (skips pinned)
478
+ pi list # List installed packages
479
+ pi config # Enable/disable package resources
480
+ ```
481
+
482
+ ### Modes
483
+
484
+ | Flag | Description |
485
+ |------|-------------|
486
+ | (default) | Interactive mode |
487
+ | `-p`, `--print` | Print response and exit |
488
+ | `--mode json` | Output all events as JSON lines (see [docs/json.md](docs/json.md)) |
489
+ | `--mode rpc` | RPC mode for process integration (see [docs/rpc.md](docs/rpc.md)) |
490
+ | `--export <in> [out]` | Export session to HTML |
491
+
492
+ In print mode, pi also reads piped stdin and merges it into the initial prompt:
493
+
494
+ ```bash
495
+ cat README.md | pi -p "Summarize this text"
496
+ ```
497
+
498
+ ### Model Options
499
+
500
+ | Option | Description |
501
+ |--------|-------------|
502
+ | `--provider <name>` | Provider (anthropic, openai, google, etc.) |
503
+ | `--model <pattern>` | Model pattern or ID (supports `provider/id` and optional `:<thinking>`) |
504
+ | `--api-key <key>` | API key (overrides env vars) |
505
+ | `--thinking <level>` | `off`, `minimal`, `low`, `medium`, `high`, `xhigh` |
506
+ | `--models <patterns>` | Comma-separated patterns for Ctrl+P cycling |
507
+ | `--list-models [search]` | List available models |
508
+
509
+ ### Session Options
510
+
511
+ | Option | Description |
512
+ |--------|-------------|
513
+ | `-c`, `--continue` | Continue most recent session |
514
+ | `-r`, `--resume` | Browse and select session |
515
+ | `--session <path\|id>` | Use specific session file or partial UUID |
516
+ | `--fork <path\|id>` | Fork specific session file or partial UUID into a new session |
517
+ | `--session-dir <dir>` | Custom session storage directory |
518
+ | `--no-session` | Ephemeral mode (don't save) |
519
+
520
+ ### Tool Options
521
+
522
+ | Option | Description |
523
+ |--------|-------------|
524
+ | `--tools <list>` | Enable specific built-in tools (default: `read,bash,edit,write`) |
525
+ | `--no-tools` | Disable all built-in tools (extension tools still work) |
526
+
527
+ Available built-in tools: `read`, `bash`, `edit`, `write`, `grep`, `find`, `ls`
528
+
529
+ ### Resource Options
530
+
531
+ | Option | Description |
532
+ |--------|-------------|
533
+ | `-e`, `--extension <source>` | Load extension from path, npm, or git (repeatable) |
534
+ | `--no-extensions` | Disable extension discovery |
535
+ | `--skill <path>` | Load skill (repeatable) |
536
+ | `--no-skills` | Disable skill discovery |
537
+ | `--prompt-template <path>` | Load prompt template (repeatable) |
538
+ | `--no-prompt-templates` | Disable prompt template discovery |
539
+ | `--theme <path>` | Load theme (repeatable) |
540
+ | `--no-themes` | Disable theme discovery |
541
+ | `--no-context-files`, `-nc` | Disable AGENTS.md and CLAUDE.md context file discovery |
542
+
543
+ Combine `--no-*` with explicit flags to load exactly what you need, ignoring settings.json (e.g., `--no-extensions -e ./my-ext.ts`).
544
+
545
+ ### Other Options
546
+
547
+ | Option | Description |
548
+ |--------|-------------|
549
+ | `--system-prompt <text>` | Replace default prompt (context files and skills still appended) |
550
+ | `--append-system-prompt <text>` | Append to system prompt |
551
+ | `--verbose` | Force verbose startup |
552
+ | `-h`, `--help` | Show help |
553
+ | `-v`, `--version` | Show version |
554
+
555
+ ### File Arguments
556
+
557
+ Prefix files with `@` to include in the message:
558
+
559
+ ```bash
560
+ pi @prompt.md "Answer this"
561
+ pi -p @screenshot.png "What's in this image?"
562
+ pi @code.ts @test.ts "Review these files"
563
+ ```
564
+
565
+ ### Examples
566
+
567
+ ```bash
568
+ # Interactive with initial prompt
569
+ pi "List all .ts files in src/"
570
+
571
+ # Non-interactive
572
+ pi -p "Summarize this codebase"
573
+
574
+ # Non-interactive with piped stdin
575
+ cat README.md | pi -p "Summarize this text"
576
+
577
+ # Different model
578
+ pi --provider openai --model gpt-4o "Help me refactor"
579
+
580
+ # Model with provider prefix (no --provider needed)
581
+ pi --model openai/gpt-4o "Help me refactor"
582
+
583
+ # Model with thinking level shorthand
584
+ pi --model sonnet:high "Solve this complex problem"
585
+
586
+ # Limit model cycling
587
+ pi --models "claude-*,gpt-4o"
588
+
589
+ # Read-only mode
590
+ pi --tools read,grep,find,ls -p "Review the code"
591
+
592
+ # High thinking level
593
+ pi --thinking high "Solve this complex problem"
594
+ ```
595
+
596
+ ### Environment Variables
597
+
598
+ | Variable | Description |
599
+ |----------|-------------|
600
+ | `PI_CODING_AGENT_DIR` | Override config directory (default: `~/.pi/agent`) |
601
+ | `PI_PACKAGE_DIR` | Override package directory (useful for Nix/Guix where store paths tokenize poorly) |
602
+ | `PI_SKIP_VERSION_CHECK` | Skip version check at startup |
603
+ | `PI_TELEMETRY` | Override install telemetry. Use `1`/`true`/`yes` to enable or `0`/`false`/`no` to disable |
604
+ | `PI_CACHE_RETENTION` | Set to `long` for extended prompt cache (Anthropic: 1h, OpenAI: 24h) |
605
+ | `VISUAL`, `EDITOR` | External editor for Ctrl+G |
606
+
607
+ ---
608
+
609
+ ## Contributing & Development
610
+
611
+ See [CONTRIBUTING.md](../../CONTRIBUTING.md) for guidelines and [docs/development.md](docs/development.md) for setup, forking, and debugging.
612
+
613
+ ---
614
+
615
+ ## License
616
+
617
+ MIT
618
+
619
+ ## See Also
620
+
621
+ - [@mariozechner/pi-ai](https://www.npmjs.com/package/@mariozechner/pi-ai): Core LLM toolkit
622
+ - [@mariozechner/pi-agent](https://www.npmjs.com/package/@mariozechner/pi-agent): Agent framework
623
+ - [@mariozechner/pi-tui](https://www.npmjs.com/package/@mariozechner/pi-tui): Terminal UI components