@bachi/pi-coder 1.0.0
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.
- package/CHANGELOG.md +24 -0
- package/LICENSE +21 -0
- package/README.md +162 -0
- package/config/AGENTS.md +100 -0
- package/config/pi-statusline.json +140 -0
- package/config/settings.json +38 -0
- package/config/web-search.json +5 -0
- package/docs/README.md +14 -0
- package/docs/configuration.md +123 -0
- package/docs/development.md +177 -0
- package/docs/extensions.md +292 -0
- package/docs/handbook.zh.md +432 -0
- package/docs/installation.md +124 -0
- package/docs/themes.md +107 -0
- package/extensions/ask-user-question/answers.test.ts +104 -0
- package/extensions/ask-user-question/answers.ts +72 -0
- package/extensions/ask-user-question/dialog.test.ts +180 -0
- package/extensions/ask-user-question/dialog.ts +102 -0
- package/extensions/ask-user-question/index.ts +253 -0
- package/extensions/ask-user-question/model.test.ts +275 -0
- package/extensions/ask-user-question/model.ts +259 -0
- package/extensions/ask-user-question/schema.ts +49 -0
- package/extensions/ask-user-question/types.ts +86 -0
- package/extensions/ask-user-question/validate.test.ts +183 -0
- package/extensions/ask-user-question/validate.ts +110 -0
- package/extensions/ask-user-question/view.ts +262 -0
- package/extensions/auto-default-model/default-model.test.ts +268 -0
- package/extensions/auto-default-model/index.ts +87 -0
- package/extensions/bash-command-collapse.ts +1476 -0
- package/extensions/below-editor-after-statusline.ts +118 -0
- package/extensions/clear-command.ts +29 -0
- package/extensions/cwd-statusline.ts +39 -0
- package/extensions/exit-command.ts +59 -0
- package/extensions/fenceless-code-block/index.test.ts +208 -0
- package/extensions/fenceless-code-block/index.ts +28 -0
- package/extensions/fenceless-code-block/render.test.ts +177 -0
- package/extensions/fenceless-code-block/render.ts +142 -0
- package/extensions/folder-history.ts +197 -0
- package/extensions/init-command.ts +163 -0
- package/extensions/prompt-editor/bash-prompt.test.ts +94 -0
- package/extensions/prompt-editor/bash-prompt.ts +59 -0
- package/extensions/prompt-editor/render.test.ts +283 -0
- package/extensions/prompt-editor.ts +212 -0
- package/extensions/read-path-collapse.ts +474 -0
- package/extensions/recap/index.test.ts +348 -0
- package/extensions/recap/index.ts +462 -0
- package/extensions/recap/subagents.test.ts +144 -0
- package/extensions/recap/subagents.ts +128 -0
- package/extensions/rewind/README.md +229 -0
- package/extensions/rewind/checkpoints.test.ts +560 -0
- package/extensions/rewind/checkpoints.ts +820 -0
- package/extensions/rewind/flow.test.ts +756 -0
- package/extensions/rewind/flow.ts +362 -0
- package/extensions/rewind/index.ts +400 -0
- package/extensions/rewind/picker.ts +135 -0
- package/extensions/rewind/viewport.test.ts +76 -0
- package/extensions/rewind/viewport.ts +48 -0
- package/extensions/simple-task/gap.test.ts +147 -0
- package/extensions/simple-task/gap.ts +122 -0
- package/extensions/simple-task/index.ts +439 -0
- package/extensions/simple-task/types.ts +53 -0
- package/extensions/simple-task/widget.ts +86 -0
- package/extensions/startup-logo/header-guard.test.ts +274 -0
- package/extensions/startup-logo/header-guard.ts +166 -0
- package/extensions/startup-logo/index.test.ts +305 -0
- package/extensions/startup-logo/index.ts +194 -0
- package/extensions/startup-logo/loaded-sections.test.ts +257 -0
- package/extensions/startup-logo/loaded-sections.ts +267 -0
- package/extensions/startup-logo/logo.test.ts +124 -0
- package/extensions/startup-logo/logo.ts +124 -0
- package/extensions/statusline/footer-guard.test.ts +273 -0
- package/extensions/statusline/footer-guard.ts +171 -0
- package/extensions/statusline/git.test.ts +174 -0
- package/extensions/statusline/git.ts +142 -0
- package/extensions/statusline/index.ts +294 -0
- package/extensions/statusline/line.test.ts +316 -0
- package/extensions/statusline/line.ts +201 -0
- package/extensions/subagent-log-guard/filter.test.ts +85 -0
- package/extensions/subagent-log-guard/filter.ts +32 -0
- package/extensions/subagent-log-guard/index.ts +112 -0
- package/extensions/theme-command.ts +263 -0
- package/extensions/thinking-collapse/window.test.ts +321 -0
- package/extensions/thinking-collapse/window.ts +354 -0
- package/extensions/thinking-collapse.ts +60 -0
- package/extensions/tool-diff/title-row.test.ts +254 -0
- package/extensions/tool-diff/title-row.ts +191 -0
- package/extensions/tool-diff.ts +1276 -0
- package/extensions/working-indicator/bash-spinner.test.ts +135 -0
- package/extensions/working-indicator/bash-spinner.ts +114 -0
- package/extensions/working-indicator/index.test.ts +579 -0
- package/extensions/working-indicator/index.ts +940 -0
- package/extensions/working-indicator/spinner-frames.test.ts +219 -0
- package/extensions/working-indicator/spinner-frames.ts +156 -0
- package/extensions/working-indicator/summary-request.test.ts +195 -0
- package/extensions/working-indicator/summary-request.ts +207 -0
- package/extensions/working-indicator/working-summary.test.ts +499 -0
- package/extensions/working-indicator/working-summary.ts +375 -0
- package/package.json +71 -0
- package/themes/ayu.json +97 -0
- package/themes/catppuccin.json +103 -0
- package/themes/summer-night.json +87 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this package. The extensions themselves are snapshot copies from the author's pi environment; their individual histories live in that repository.
|
|
4
|
+
|
|
5
|
+
## 1.0.0 — 2026-09-18
|
|
6
|
+
|
|
7
|
+
First release. A complete pi coding-agent environment packaged for npm.
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **22 extensions** under `extensions/`, copied verbatim from the author's `~/.pi/agent/extensions/`:
|
|
12
|
+
- Tool rendering: `bash-command-collapse.ts`, `read-path-collapse.ts`, `tool-diff.ts`, `thinking-collapse.ts`, `fenceless-code-block/`
|
|
13
|
+
- TUI chrome: `statusline/`, `cwd-statusline.ts`, `startup-logo/`, `below-editor-after-statusline.ts`, `prompt-editor.ts`, `working-indicator/`
|
|
14
|
+
- Workflow: `simple-task/`, `recap/`, `rewind/`, `init-command.ts`, `theme-command.ts`, `folder-history.ts`, `clear-command.ts`, `exit-command.ts`
|
|
15
|
+
- Model and tooling: `auto-default-model/`, `ask-user-question/`, `subagent-log-guard/`
|
|
16
|
+
- **3 themes** under `themes/`: `summer-night` (default), `catppuccin`, `ayu` — including the two custom diff-background tokens and `bashOutput`.
|
|
17
|
+
- **Global config files** under `config/`: `AGENTS.md`, `settings.json`, `web-search.json`, `pi-statusline.json`.
|
|
18
|
+
- **454 unit tests** runnable with `npm test`, plus the pure-logic module split that makes them possible.
|
|
19
|
+
- English documentation: [installation](docs/installation.md), [configuration](docs/configuration.md), [extensions](docs/extensions.md), [themes](docs/themes.md), [development](docs/development.md).
|
|
20
|
+
- The original Chinese handbook, kept verbatim as [docs/handbook.zh.md](docs/handbook.zh.md).
|
|
21
|
+
|
|
22
|
+
### Not included
|
|
23
|
+
|
|
24
|
+
- `config/models.json`, and the `defaultProvider` / `defaultModel` / `modelThinkingLevels` keys in `config/settings.json`. Provider registrations point at a local gateway and are machine-specific.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 lijing00333 (jayli)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# @bachi/pi-coder
|
|
2
|
+
|
|
3
|
+
A complete [Pi](https://pi.dev) coding-agent environment packaged for npm: **22 extensions**, **3 themes**, and the global config files that make them work together.
|
|
4
|
+
|
|
5
|
+
This is a working setup, not a collection of demos. Every extension is used daily, and each one documents the pi internals it depends on in its own file header — including the failure that motivated it and the things that look like they could be simplified but cannot be.
|
|
6
|
+
|
|
7
|
+
- Repository: <https://github.com/jayli/pi-coder>
|
|
8
|
+
- Issues: <https://github.com/jayli/pi-coder/issues>
|
|
9
|
+
|
|
10
|
+
## What it looks like
|
|
11
|
+
|
|
12
|
+
A startup header, a one-line statusline, a `❯` prompt, and a diff renderer that paints whole lines. Captured from pi 0.85.1 at 108 columns, with the resource-list sections elided and the Nerd Font branch glyph dropped (it does not survive a terminal capture):
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
█████████
|
|
16
|
+
███ ███ pi v0.85.1
|
|
17
|
+
██████ ███ ~/jaylli/pi-coder
|
|
18
|
+
███ ███
|
|
19
|
+
|
|
20
|
+
escape interrupt · ctrl+c/ctrl+d clear/exit · / commands · ! bash
|
|
21
|
+
|
|
22
|
+
[Extensions]
|
|
23
|
+
ask-user-question, auto-default-model, bash-command-collapse.ts, below-editor-after-statusline.ts,
|
|
24
|
+
clear-command.ts, cwd-statusline.ts, exit-command.ts, fenceless-code-block, folder-history.ts,
|
|
25
|
+
init-command.ts, prompt-editor.ts, read-path-collapse.ts, recap, rewind, simple-task, startup-logo,
|
|
26
|
+
statusline, subagent-log-guard, theme-command.ts, thinking-collapse.ts, tool-diff.ts, working-indicator
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
────────────────────────────────────────────────────────────────────────────────────
|
|
31
|
+
❯
|
|
32
|
+
────────────────────────────────────────────────────────────────────────────────────
|
|
33
|
+
⚡️ claude-opus-4-8/medium | Ctx 0.0% | main | (+0,-0)
|
|
34
|
+
📁 /Users/bachi/jaylli/pi-coder | ◆ 1 checkpoint
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The startup list also loses its `[Context]`, `[Prompts]` and `[Themes]` sections, which carry no information. The statusline's second line is written by other extensions (`cwd-statusline`, `simple-task`, `rewind`) through `ctx.ui.setStatus()`, so it grows with whatever you have installed.
|
|
38
|
+
|
|
39
|
+
Colors come from the active theme rather than from hardcoded values, so `/theme` repaints everything on the next frame.
|
|
40
|
+
|
|
41
|
+
## Install
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pi install npm:@bachi/pi-coder
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Extensions and themes are loaded straight from the package (see the `pi` manifest in `package.json`) — there is nothing to configure. Restart pi, then check `pi list` or run `pi config` to see every resource with its enable/disable toggle.
|
|
48
|
+
|
|
49
|
+
### Companion packages
|
|
50
|
+
|
|
51
|
+
This environment is built around two packages that are deliberately **not** bundled — they are heavy, they have their own release cycles, and `pi-subagents` needs `settings.json` entries that only make sense once it is installed:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pi install npm:pi-web-access # pi_web_search / fetch_content / source_check / get_search_content
|
|
55
|
+
pi install npm:pi-subagents # subagent / bg_wait / scripted workflows
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Without them two extensions degrade instead of failing: `recap` cannot tell whether a background subagent is still running (it treats the failed probe as "none"), and `below-editor-after-statusline` usually has nothing to move.
|
|
59
|
+
|
|
60
|
+
## What you get
|
|
61
|
+
|
|
62
|
+
### Extensions
|
|
63
|
+
|
|
64
|
+
| Extension | What it does |
|
|
65
|
+
| --- | --- |
|
|
66
|
+
| [`bash-command-collapse.ts`](extensions/bash-command-collapse.ts) | Overrides `bash`: long commands collapse to N visual lines with a `… (N tokens hidden)` hint, hard-wrap at the column budget, shell syntax highlighting, and its own background box. |
|
|
67
|
+
| [`read-path-collapse.ts`](extensions/read-path-collapse.ts) | Overrides `read`'s title row: long paths stay on one line, ellipsis at the front, file name kept whole. |
|
|
68
|
+
| [`tool-diff.ts`](extensions/tool-diff.ts) | Overrides `edit`/`write`: Claude Code style full-line diff backgrounds, line-number gutter, inline and syntax highlighting. |
|
|
69
|
+
| [`thinking-collapse.ts`](extensions/thinking-collapse.ts) | Thinking blocks render as one continuous horizontally scrolling line labelled `Think: `. |
|
|
70
|
+
| [`prompt-editor.ts`](extensions/prompt-editor.ts) | A `❯ ` gutter in the editor, Claude Code style `!` bash mode, plus a blank line between the autocomplete list and the statusline. |
|
|
71
|
+
| [`fenceless-code-block/`](extensions/fenceless-code-block/) | Markdown code blocks lose their fences (syntax colors kept, no background added). |
|
|
72
|
+
| [`statusline/`](extensions/statusline/) | Replaces the footer: model/thinking level, context usage, git branch and diff stat, plus a second line for extension statuses. |
|
|
73
|
+
| [`startup-logo/`](extensions/startup-logo/) | Static header logo with version and shortened cwd, and prunes `[Context]`/`[Prompts]`/`[Themes]` from the startup list. |
|
|
74
|
+
| [`working-indicator/`](extensions/working-indicator/) | Semantic working message (`Tools Calling`, `Editing`, `Writing`, `Reading`, `Thinking`) with per-segment token counts and elapsed time. |
|
|
75
|
+
| [`simple-task/`](extensions/simple-task/) | Task list driven by `task_set` / `task_update` / `task_get` and `/tasks`; state rides the session log, never the repo. |
|
|
76
|
+
| [`recap/`](extensions/recap/) | `/recap`, plus an automatic summary above the editor after 30s of idling. |
|
|
77
|
+
| [`rewind/`](extensions/rewind/) | Shadow-git checkpoints and `/rewind` (or Esc Esc) to restore code and/or conversation. |
|
|
78
|
+
| [`ask-user-question/`](extensions/ask-user-question/) | An `ask_user_question` tool: up to 4 questions with 2–4 described options plus a free-text row, answered in the terminal. |
|
|
79
|
+
| [`auto-default-model/`](extensions/auto-default-model/) | Writes every model switch to `settings.json` — the Ctrl+S step, automated. |
|
|
80
|
+
| [`subagent-log-guard/`](extensions/subagent-log-guard/) | Stops `[pi-subagents]` stderr diagnostics from corrupting the TUI. |
|
|
81
|
+
| [`cwd-statusline.ts`](extensions/cwd-statusline.ts) | Prints the full working directory as a second statusline line. |
|
|
82
|
+
| [`below-editor-after-statusline.ts`](extensions/below-editor-after-statusline.ts) | Moves `belowEditor` widgets underneath the statusline. |
|
|
83
|
+
| [`folder-history.ts`](extensions/folder-history.ts) | Persists command history per working directory and injects it into the editor's native ↑/↓. |
|
|
84
|
+
| [`theme-command.ts`](extensions/theme-command.ts) | `/theme` with live preview: arrow keys preview, Enter persists, Esc cancels. |
|
|
85
|
+
| [`init-command.ts`](extensions/init-command.ts) | Claude Code style `/init`: update `CLAUDE.md`, else `AGENTS.md`, else create `AGENTS.md`. |
|
|
86
|
+
| [`clear-command.ts`](extensions/clear-command.ts) | `/clear` as an alias of `/new`. |
|
|
87
|
+
| [`exit-command.ts`](extensions/exit-command.ts) | `exit`, `quit` or `bye` on an otherwise empty prompt quits pi; `/exit` too. |
|
|
88
|
+
|
|
89
|
+
### Themes
|
|
90
|
+
|
|
91
|
+
`summer-night` (the default here), `catppuccin` and `ayu` — reference-only palettes whose `colors` entries point at `vars`, plus two custom diff-background tokens that [`tool-diff.ts`](extensions/tool-diff.ts) reads. Details in [docs/themes.md](docs/themes.md).
|
|
92
|
+
|
|
93
|
+
### Commands
|
|
94
|
+
|
|
95
|
+
`/ask` `/bash-collapse` `/bash-preview` `/bash-stream` `/bash-timeout` `/bash-tree` `/clear` `/exit` `/init` `/read-collapse` `/recap` `/rewind` `/tasks` `/theme`
|
|
96
|
+
|
|
97
|
+
Esc Esc opens `/rewind` (requires `doubleEscapeAction: "none"`, which the shipped config sets).
|
|
98
|
+
|
|
99
|
+
### Environment switches
|
|
100
|
+
|
|
101
|
+
Every switch is an environment variable, so it can be scoped per project or set in a shell alias. An unset variable means "on"; `off` always disables. The full table is in [docs/extensions.md](docs/extensions.md#environment-switches) — highlights:
|
|
102
|
+
|
|
103
|
+
| Variable | Default | Effect |
|
|
104
|
+
| --- | --- | --- |
|
|
105
|
+
| `PI_AUTO_DEFAULT_MODEL=off` | on | Do not persist model switches to `settings.json`. |
|
|
106
|
+
| `PI_BASH_STREAM=on` | off | Use pi's native streaming for bash instead of the collapse path. |
|
|
107
|
+
| `PI_BASH_TREE=off` | on | Disable tree indentation (`│`/`└`) for bash output. |
|
|
108
|
+
| `PI_FENCELESS_CODE=off` | on | Keep Markdown code fences. |
|
|
109
|
+
| `PI_LOGO=off` | on | Do not install the startup header. |
|
|
110
|
+
| `PI_SUBAGENT_LOG_GUARD=notify` | `drop` | Show `[pi-subagents]` diagnostics through `ctx.ui.notify` instead of dropping them. |
|
|
111
|
+
|
|
112
|
+
## Global config files
|
|
113
|
+
|
|
114
|
+
Four files in [`config/`](config) are not package resources — pi reads them from `~/.pi/agent/`, so copy the ones you want by hand. pi installs the package under `~/.pi/agent/npm/node_modules/@bachi/pi-coder` (project installs go to `.pi/npm/node_modules/`):
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
PKG=~/.pi/agent/npm/node_modules/@bachi/pi-coder
|
|
118
|
+
|
|
119
|
+
cp "$PKG/config/AGENTS.md" ~/.pi/agent/AGENTS.md # global working rules
|
|
120
|
+
cp "$PKG/config/settings.json" ~/.pi/agent/settings.json # read this first!
|
|
121
|
+
cp "$PKG/config/web-search.json" ~/.pi/agent/web-search.json # required by pi-web-access
|
|
122
|
+
mkdir -p ~/.pi/agent/themes
|
|
123
|
+
cp "$PKG/themes/"*.json ~/.pi/agent/themes/ # optional: also shipped as a package theme
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
> **If you already copied these extensions into `~/.pi/agent/extensions/`, remove that copy first.** pi loads both sources, the second registration of `bash`, `read`, `edit`, `write` and the rest conflicts, and pi refuses to start with `Tool "bash" conflicts with ...`.
|
|
127
|
+
|
|
128
|
+
**Read [`config/settings.json`](config/settings.json) before copying it.** It overwrites your settings wholesale, and two of its entries are machine-specific:
|
|
129
|
+
|
|
130
|
+
- `npmCommand` pins `pnpm --config.node-linker=hoisted`. Remove it if you do not have pnpm, or `pi install` will fail.
|
|
131
|
+
- `doubleEscapeAction: "none"` hands Esc-Esc to the `rewind` extension instead of pi's built-in tree navigator.
|
|
132
|
+
|
|
133
|
+
`config/models.json` is **not** shipped: provider and model registrations point at a local gateway and belong to the machine that runs it. See [docs/configuration.md](docs/configuration.md).
|
|
134
|
+
|
|
135
|
+
## Requirements
|
|
136
|
+
|
|
137
|
+
- pi **0.85.1** or newer (the extensions are written against this version's internals), Node **22.19+**.
|
|
138
|
+
- macOS or Linux. Nothing is Windows-specific, but it is untested there.
|
|
139
|
+
- Optional but assumed by a few extensions: `pi-web-access` (the web tools) and `pi-subagents` (subagent events, fleet status line).
|
|
140
|
+
|
|
141
|
+
## Documentation
|
|
142
|
+
|
|
143
|
+
| Document | Contents |
|
|
144
|
+
| --- | --- |
|
|
145
|
+
| [docs/installation.md](docs/installation.md) | Install, verify, upgrade, uninstall, and the local-checkout workflow. |
|
|
146
|
+
| [docs/configuration.md](docs/configuration.md) | Every shipped config file, what was removed from the snapshot, and why. |
|
|
147
|
+
| [docs/extensions.md](docs/extensions.md) | Reference for all 22 extensions: commands, switches, caveats, storage. |
|
|
148
|
+
| [docs/themes.md](docs/themes.md) | Theme files, the custom tokens, and the rules that make them load. |
|
|
149
|
+
| [docs/development.md](docs/development.md) | Running the 454 unit tests, verifying against a real pi, publishing. |
|
|
150
|
+
| [docs/handbook.zh.md](docs/handbook.zh.md) | **Chinese.** The original handbook this package was extracted from: the author's machine, gateway setup, and the full rationale behind every design decision. |
|
|
151
|
+
|
|
152
|
+
## Development
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
npm test # node --test, 454 tests
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
The pure-logic modules are deliberately free of `@earendil-works/pi-*` imports so they run under plain `node --test`; see [docs/development.md](docs/development.md) for the layout rules, the tmux verification procedure and the traps this codebase documents.
|
|
159
|
+
|
|
160
|
+
## License
|
|
161
|
+
|
|
162
|
+
MIT — see [LICENSE](LICENSE).
|
package/config/AGENTS.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Global working rules
|
|
2
|
+
|
|
3
|
+
How you work in any project on this machine. A project's own AGENTS.md/CLAUDE.md describes that project and wins over the style rules here when they conflict.
|
|
4
|
+
|
|
5
|
+
## Persistence
|
|
6
|
+
|
|
7
|
+
- Keep going until the task is genuinely finished in this turn. Do not stop at analysis or a partial fix; carry the change through implementation and verification, then report the outcome unless the user pauses or redirects you.
|
|
8
|
+
- Treat "can you...", "I want...", "help me..." as instructions to do the work. Do not reply with a capability statement, a plan, or an offer to continue.
|
|
9
|
+
- Do not hand back a "good enough" version to save tokens or time. If the task needs sustained work, do the sustained work.
|
|
10
|
+
- When a tool call fails, work the problem instead of ending the turn.
|
|
11
|
+
- Do not guess or invent an answer. If you cannot verify something, say so.
|
|
12
|
+
- If intent or scope is unclear, proceed with what you have and state the assumption — but if the missing choice would change the result, ask first.
|
|
13
|
+
|
|
14
|
+
## Authorization
|
|
15
|
+
|
|
16
|
+
- Match scope to request type. Answer / explain / review / status requests authorize reading and diagnosis only — not writes, commits, messages to other people, or other external mutations. "Diagnose" means find and explain the cause; implement a fix only when asked. "Change / build" means implement, verify in proportion to risk, and hand off.
|
|
17
|
+
- Authorization persists across turns. Do not re-ask for something already approved earlier in the session.
|
|
18
|
+
- Do the work first, then ask. The user should approve a concrete, reviewable result, not a proposal: finish the reversible, in-scope work and make approval the last step for irreversible or external actions.
|
|
19
|
+
- Read-only actions and ordinary implementation steps inside the requested scope need no confirmation.
|
|
20
|
+
- Terminal instructions ("finish", "do not stop") require persistence but do not widen the set of authorized actions.
|
|
21
|
+
- When new authority is genuinely required, a missing user choice would materially change the result, or the work expands beyond the task's implied scope: stop, report the blocker, and ask rather than assuming permission.
|
|
22
|
+
- Do not add warnings, disclaimers, approval flows, or safety checklists for hypothetical risk.
|
|
23
|
+
|
|
24
|
+
## Skills
|
|
25
|
+
|
|
26
|
+
- The user's request wins over any skill's guidelines; a skill never authorizes work outside that request.
|
|
27
|
+
- When a skill makes you pause, ask, or leave work unfinished, name it, quote the rule that required it, and report that in your final message.
|
|
28
|
+
|
|
29
|
+
## Destructive actions
|
|
30
|
+
|
|
31
|
+
Anything that deletes, overwrites, or makes data hard to recover gets extra care.
|
|
32
|
+
|
|
33
|
+
- Confirm the action is clearly inside the user's request.
|
|
34
|
+
- Resolve exact targets with read-only checks first.
|
|
35
|
+
- Never target `$HOME`, `~`, `/`, a repo root, or another broad directory with a recursive or destructive command. Never run anything equivalent to `rm -rf $HOME`.
|
|
36
|
+
- Identify targets with explicit, validated paths — not unresolved env vars, globs, or command substitution.
|
|
37
|
+
- Use `mktemp -d` for temporary directories.
|
|
38
|
+
- Never repurpose `$HOME` or `PI_*` system variables as script variable names; use task-specific names.
|
|
39
|
+
- Prefer recoverable operations (move aside, rename, trash) when practical.
|
|
40
|
+
- If the target or scope is unclear, stop and ask.
|
|
41
|
+
- After deleting anything material, say what was removed and whether it is recoverable.
|
|
42
|
+
|
|
43
|
+
## Shell commands
|
|
44
|
+
|
|
45
|
+
- Never launch interactive or TTY-dependent programs: editors (`vim`), `git rebase -i`, pagers, REPLs. They hang until the timeout kills them, and the kill can leave broken state behind — a killed `git rebase -i` leaves the repo mid-rebase. Use the non-interactive form instead: `GIT_SEQUENCE_EDITOR=:` and `GIT_EDITOR=:`, `git --no-pager`, `-y` / `--yes`.
|
|
46
|
+
- A command that waits on stdin does not hang; it receives EOF and exits at once.
|
|
47
|
+
- Do not run a long-lived process in the foreground (dev server, watch mode). Detach it with output redirected (`cmd >server.log 2>&1 &`) so the call returns, then read the log.
|
|
48
|
+
- Bash has a default timeout and a hard maximum. For a legitimately long build or test run, pass an explicit larger `timeout`, otherwise it gets killed mid-run.
|
|
49
|
+
- `timeout(1)` is not installed on macOS; do not reach for it.
|
|
50
|
+
- Never chain commands with separator banners (`echo "===="`, `printf '---'`); they add noise to every call.
|
|
51
|
+
- Treat command text as code: backticks and `$()` still execute — never let untrusted text reach the shell.
|
|
52
|
+
- Do not block on `sleep` or any wait longer than 60 seconds.
|
|
53
|
+
|
|
54
|
+
## Editing
|
|
55
|
+
|
|
56
|
+
- Fix root causes rather than symptoms. Keep changes minimal and consistent with the surrounding code.
|
|
57
|
+
- When asked to shorten or simplify, cut by default; keep a passage only for a stated reason, and treat "it may still be useful" as a reason to ask, not to keep.
|
|
58
|
+
- Do not fix unrelated bugs or broken tests; mention them in the final message instead.
|
|
59
|
+
- Do not rename files or variables unnecessarily. Be surgical in an existing codebase; save ambition for green-field work.
|
|
60
|
+
- Edit files with `edit` / `write`; do not create or edit files with shell write tricks or Python when `edit` / `write` is enough. Formatting commands and bulk mechanical rewrites are exempt.
|
|
61
|
+
- Do not re-read a file to confirm an `edit` or `write` succeeded — a failed call reports itself.
|
|
62
|
+
- Do not add inline comments, copyright or license headers, or a formatter unless asked. Do not add tests to a codebase that has none.
|
|
63
|
+
- Update documentation when your change makes it stale.
|
|
64
|
+
|
|
65
|
+
## Verification
|
|
66
|
+
|
|
67
|
+
- If the project has tests or a build, use them. Start with the narrowest check that covers your change, then broaden as confidence grows.
|
|
68
|
+
- With no test or build — docs, comments, config — verify each claim you keep by re-deriving it from the code or config that defines it; inherited text is untrusted input.
|
|
69
|
+
- Once the relevant checks pass, stop; broaden or repeat only when new changes or failures justify it.
|
|
70
|
+
- Formatting: iterate at most 3 times. If it still fails, deliver a correct solution and call out the formatting issue.
|
|
71
|
+
- If you could not run the checks, say so plainly instead of implying verification happened.
|
|
72
|
+
|
|
73
|
+
## Git
|
|
74
|
+
|
|
75
|
+
- Do not commit, branch, or amend unless explicitly asked.
|
|
76
|
+
- Never revert changes you did not make. In a dirty worktree preserve unrelated edits; if they conflict with your task, stop and ask.
|
|
77
|
+
- Never run destructive git commands (`git reset --hard`, `git checkout --`, force push) unless the user clearly asked for them.
|
|
78
|
+
- Prefer non-interactive git commands. Use `git log` and `git blame` for history.
|
|
79
|
+
|
|
80
|
+
## Task list
|
|
81
|
+
|
|
82
|
+
When you use the task-list tools (`task_set` / `task_update`):
|
|
83
|
+
|
|
84
|
+
- Exactly one item `in_progress` at a time. Never move an item straight from `pending` to `done`.
|
|
85
|
+
- If understanding changes — split, merge, reorder — update the list before continuing.
|
|
86
|
+
- Do not restate the list in prose; the UI already shows it.
|
|
87
|
+
|
|
88
|
+
## Communication
|
|
89
|
+
|
|
90
|
+
- Lead with the outcome, then the reasoning that supports it. Report what changed, why, how it was verified, and any material risk.
|
|
91
|
+
- A failed, skipped, or unexpected result is the report's first sentence, even when the rest succeeded.
|
|
92
|
+
- Scale length to the change: small single-file change → 2–5 sentences; medium → ≤6 bullets; large → 1–2 bullets per file. Never paste before/after pairs or whole method bodies.
|
|
93
|
+
- Do not echo file contents you just wrote; reference the path.
|
|
94
|
+
- Plain language over jargon. Present tense, active voice. No filler.
|
|
95
|
+
- Avoid "delve", "foster", "leverage", "it's worth noting", "Bottom Line:", and "X, not Y" framing that introduces an option nobody asked about.
|
|
96
|
+
- When the user challenges your work, lead with evidence and reasoning rather than reflexive agreement. Reconsider when the evidence warrants it; hold your position when it does not.
|
|
97
|
+
|
|
98
|
+
## After compaction
|
|
99
|
+
|
|
100
|
+
Compaction does not end the task. Continue from the summarized state, treat the newest user message as steering rather than a replacement objective, do not restart from scratch, and do not redo completed work or repeat updates already sent.
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
{
|
|
2
|
+
"palettePreset": "tokyo-night",
|
|
3
|
+
"density": "compact",
|
|
4
|
+
"separator": "none",
|
|
5
|
+
"segments": [
|
|
6
|
+
"model",
|
|
7
|
+
"thinking",
|
|
8
|
+
"branch",
|
|
9
|
+
"context",
|
|
10
|
+
"tokens",
|
|
11
|
+
"tools"
|
|
12
|
+
],
|
|
13
|
+
"segmentText": {
|
|
14
|
+
"brand": {
|
|
15
|
+
"prefix": "",
|
|
16
|
+
"suffix": ""
|
|
17
|
+
},
|
|
18
|
+
"provider": {
|
|
19
|
+
"prefix": "🔌 ",
|
|
20
|
+
"suffix": ""
|
|
21
|
+
},
|
|
22
|
+
"model": {
|
|
23
|
+
"prefix": "🤖 ",
|
|
24
|
+
"suffix": "",
|
|
25
|
+
"truncationLength": 36,
|
|
26
|
+
"truncationSymbol": "…",
|
|
27
|
+
"truncationDirection": "start"
|
|
28
|
+
},
|
|
29
|
+
"thinking": {
|
|
30
|
+
"prefix": "✨ ",
|
|
31
|
+
"suffix": ""
|
|
32
|
+
},
|
|
33
|
+
"cwd": {
|
|
34
|
+
"prefix": "📁 ",
|
|
35
|
+
"suffix": ""
|
|
36
|
+
},
|
|
37
|
+
"branch": {
|
|
38
|
+
"prefix": "🌿 ",
|
|
39
|
+
"suffix": ""
|
|
40
|
+
},
|
|
41
|
+
"tools": {
|
|
42
|
+
"prefix": "",
|
|
43
|
+
"suffix": ""
|
|
44
|
+
},
|
|
45
|
+
"context": {
|
|
46
|
+
"prefix": "🪟 ctx ",
|
|
47
|
+
"suffix": ""
|
|
48
|
+
},
|
|
49
|
+
"tokens": {
|
|
50
|
+
"prefix": "🔢 ",
|
|
51
|
+
"suffix": ""
|
|
52
|
+
},
|
|
53
|
+
"cache": {
|
|
54
|
+
"prefix": "📦 ",
|
|
55
|
+
"suffix": ""
|
|
56
|
+
},
|
|
57
|
+
"cost": {
|
|
58
|
+
"prefix": "💸 $",
|
|
59
|
+
"suffix": ""
|
|
60
|
+
},
|
|
61
|
+
"time": {
|
|
62
|
+
"prefix": "🕒 ",
|
|
63
|
+
"suffix": ""
|
|
64
|
+
},
|
|
65
|
+
"turn": {
|
|
66
|
+
"prefix": "🔁 #",
|
|
67
|
+
"suffix": ""
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"extensionStatusIcons": {
|
|
71
|
+
"accounts": "👤",
|
|
72
|
+
"caffeinate": "💊",
|
|
73
|
+
"chrome-devtools": "🌐",
|
|
74
|
+
"cwd": " 📁",
|
|
75
|
+
"firecrawl": "🔥",
|
|
76
|
+
"github-pr": "🔎",
|
|
77
|
+
"goal": "🎯",
|
|
78
|
+
"google-genai": "✨",
|
|
79
|
+
"lsp": "🧰",
|
|
80
|
+
"plan-mode": "📝",
|
|
81
|
+
"retry": "🔁",
|
|
82
|
+
"subagents": "🧑🤝🧑",
|
|
83
|
+
"sync": "🔄",
|
|
84
|
+
"usage": "📊"
|
|
85
|
+
},
|
|
86
|
+
"palette": {
|
|
87
|
+
"brand": {
|
|
88
|
+
"fg": "#090c0c",
|
|
89
|
+
"bg": "#a3aed2"
|
|
90
|
+
},
|
|
91
|
+
"provider": {
|
|
92
|
+
"fg": "#090c0c",
|
|
93
|
+
"bg": "#a3aed2"
|
|
94
|
+
},
|
|
95
|
+
"model": {
|
|
96
|
+
"fg": "#090c0c",
|
|
97
|
+
"bg": "#a3aed2"
|
|
98
|
+
},
|
|
99
|
+
"thinking": {
|
|
100
|
+
"fg": "#090c0c",
|
|
101
|
+
"bg": "#a3aed2"
|
|
102
|
+
},
|
|
103
|
+
"cwd": {
|
|
104
|
+
"fg": "#e3e5e5",
|
|
105
|
+
"bg": "#769ff0"
|
|
106
|
+
},
|
|
107
|
+
"branch": {
|
|
108
|
+
"fg": "#769ff0",
|
|
109
|
+
"bg": "#394260"
|
|
110
|
+
},
|
|
111
|
+
"tools": {
|
|
112
|
+
"fg": "#769ff0",
|
|
113
|
+
"bg": "#212736"
|
|
114
|
+
},
|
|
115
|
+
"context": {
|
|
116
|
+
"fg": "#769ff0",
|
|
117
|
+
"bg": "#212736"
|
|
118
|
+
},
|
|
119
|
+
"tokens": {
|
|
120
|
+
"fg": "#769ff0",
|
|
121
|
+
"bg": "#212736"
|
|
122
|
+
},
|
|
123
|
+
"cache": {
|
|
124
|
+
"fg": "#769ff0",
|
|
125
|
+
"bg": "#212736"
|
|
126
|
+
},
|
|
127
|
+
"cost": {
|
|
128
|
+
"fg": "#a0a9cb",
|
|
129
|
+
"bg": "#1d2230"
|
|
130
|
+
},
|
|
131
|
+
"time": {
|
|
132
|
+
"fg": "#a0a9cb",
|
|
133
|
+
"bg": "#1d2230"
|
|
134
|
+
},
|
|
135
|
+
"turn": {
|
|
136
|
+
"fg": "#a0a9cb",
|
|
137
|
+
"bg": "#1d2230"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lastChangelogVersion": "0.85.1",
|
|
3
|
+
"theme": "summer-night",
|
|
4
|
+
"defaultThinkingLevel": "xhigh",
|
|
5
|
+
"compaction": {
|
|
6
|
+
"enabled": true,
|
|
7
|
+
"reserveTokens": 52429,
|
|
8
|
+
"keepRecentTokens": 20000
|
|
9
|
+
},
|
|
10
|
+
"npmCommand": [
|
|
11
|
+
"pnpm",
|
|
12
|
+
"--config.node-linker=hoisted"
|
|
13
|
+
],
|
|
14
|
+
"extensions": [],
|
|
15
|
+
"tuiMode": "regular",
|
|
16
|
+
"packages": [
|
|
17
|
+
"npm:pi-web-access",
|
|
18
|
+
"npm:pi-subagents"
|
|
19
|
+
],
|
|
20
|
+
"steeringMode": "one-at-a-time",
|
|
21
|
+
"markdown": {
|
|
22
|
+
"mermaid": "streaming"
|
|
23
|
+
},
|
|
24
|
+
"doubleEscapeAction": "none",
|
|
25
|
+
"subagents": {
|
|
26
|
+
"agentOverrides": {
|
|
27
|
+
"researcher": {
|
|
28
|
+
"tools": "inherit"
|
|
29
|
+
},
|
|
30
|
+
"delegate": {
|
|
31
|
+
"tools": "inherit"
|
|
32
|
+
},
|
|
33
|
+
"worker": {
|
|
34
|
+
"tools": "inherit"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
package/docs/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Documentation
|
|
2
|
+
|
|
3
|
+
`@bachi/pi-coder` is a Pi package: extensions and themes are loaded from the package itself, while a handful of global config files are applied by hand.
|
|
4
|
+
|
|
5
|
+
| Document | Read it when |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| [installation.md](installation.md) | Installing, trying without installing, verifying that pi loaded everything, upgrading, uninstalling. |
|
|
8
|
+
| [configuration.md](configuration.md) | Applying `config/` files, and understanding what was intentionally left out of this package. |
|
|
9
|
+
| [extensions.md](extensions.md) | You want to know what an extension does, which command drives it, which environment switch silences it, or where it stores state. |
|
|
10
|
+
| [themes.md](themes.md) | Switching themes, editing them, or porting one. |
|
|
11
|
+
| [development.md](development.md) | Running the tests, adding an extension, verifying changes against a real pi, publishing. |
|
|
12
|
+
| [handbook.zh.md](handbook.zh.md) | **Chinese.** The original handbook this package was extracted from: the author's machine, the LiteLLM gateway, and the full rationale behind every design decision. It is more detailed than the English docs and is kept verbatim, including the parts that describe a machine you do not have. |
|
|
13
|
+
|
|
14
|
+
Everything else lives in the source: each extension carries a long header comment (in Chinese, except `rewind/`) explaining the pi internals it depends on, the failure that motivated it, and the trade-offs that are not obvious from the code.
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Configuration
|
|
2
|
+
|
|
3
|
+
`@bachi/pi-coder` ships extensions and themes as package resources, which pi loads by itself. It also ships the **global config files** the environment was built with, because those are files pi reads from `~/.pi/agent/` and no package can install them for you.
|
|
4
|
+
|
|
5
|
+
| In this package | Destination | Purpose |
|
|
6
|
+
| --- | --- | --- |
|
|
7
|
+
| `config/AGENTS.md` | `~/.pi/agent/AGENTS.md` | The agent's global working rules: persistence, authorization, destructive-action care, shell hygiene, editing and verification rules, communication style. |
|
|
8
|
+
| `config/settings.json` | `~/.pi/agent/settings.json` | Everything in the key table below. |
|
|
9
|
+
| `config/web-search.json` | `~/.pi/agent/web-search.json` | `pi-web-access` configuration; one required key (see below). |
|
|
10
|
+
| `config/pi-statusline.json` | `~/.pi/agent/pi-statusline.json` | Legacy. See [pi-statusline.json](#pi-statuslinejson-is-legacy). |
|
|
11
|
+
|
|
12
|
+
Copy commands are in [installation.md](installation.md#apply-the-global-config-files).
|
|
13
|
+
|
|
14
|
+
## Read `settings.json` before copying it
|
|
15
|
+
|
|
16
|
+
`cp` overwrites your file completely — there is no merge. Two entries are specific to the author's machine:
|
|
17
|
+
|
|
18
|
+
### `npmCommand` pins pnpm
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
"npmCommand": ["pnpm", "--config.node-linker=hoisted"]
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
This routes every pi npm operation (install, remove, dependency install for git packages) through pnpm with a hoisted layout. **If you do not have pnpm installed, `pi install` will fail.** Delete the key to use plain npm, or replace it with your own wrapper, e.g.:
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
"npmCommand": ["mise", "exec", "node@20", "--", "npm"]
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### `doubleEscapeAction` hands Esc-Esc to `rewind`
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
"doubleEscapeAction": "none"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
pi's default is `"tree"` (the built-in session-tree navigator). The `rewind` extension takes over the double-Escape gesture and consumes the second press, so with `"tree"` you would get rewind's menu and never pi's tree. `"none"` states that intent explicitly. To go back: remove `extensions/rewind/` and set the value to `"tree"`.
|
|
37
|
+
|
|
38
|
+
## What each `settings.json` key does
|
|
39
|
+
|
|
40
|
+
| Key | Value here | Notes |
|
|
41
|
+
| --- | --- | --- |
|
|
42
|
+
| `lastChangelogVersion` | `"0.85.1"` | Internal marker for "last changelog the user saw". It only suppresses a changelog notice; harmless to keep or delete. |
|
|
43
|
+
| `theme` | `"summer-night"` | Must equal the `name` field inside `themes/summer-night.json`, not just the file name. |
|
|
44
|
+
| `defaultThinkingLevel` | `"xhigh"` | Startup thinking level. Not available on every model; see `thinkingLevelMap` in your `models.json`. |
|
|
45
|
+
| `compaction.enabled` / `reserveTokens` / `keepRecentTokens` | `true` / `52429` / `20000` | `keepRecentTokens` is pi's default; `reserveTokens` is raised well above pi's `16384` default because this setup's models stream long thinking blocks. |
|
|
46
|
+
| `npmCommand` | `["pnpm", "--config.node-linker=hoisted"]` | See above. Machine-specific. |
|
|
47
|
+
| `extensions` | `[]` | No explicit extension paths — auto-discovery of `~/.pi/agent/extensions/` and package resources only. The author's real file pointed at a telemetry extension from another tool; that absolute path was intentionally dropped. |
|
|
48
|
+
| `tuiMode` | `"regular"` | pi's default, written out explicitly. |
|
|
49
|
+
| `packages` | `["npm:pi-web-access", "npm:pi-subagents"]` | The two companion packages. This array is exactly what `pi install` writes. |
|
|
50
|
+
| `steeringMode` | `"one-at-a-time"` | pi's default, explicit. |
|
|
51
|
+
| `markdown.mermaid` | `"streaming"` | pi's default, explicit. |
|
|
52
|
+
| `doubleEscapeAction` | `"none"` | See above. |
|
|
53
|
+
| `subagents.agentOverrides` | `researcher` / `delegate` / `worker` → `tools: "inherit"` | A `pi-subagents` setting, not a pi core one. |
|
|
54
|
+
|
|
55
|
+
### Why `tools: "inherit"` on three subagents
|
|
56
|
+
|
|
57
|
+
`pi-subagents` filters a child agent's tools against a strict whitelist. Core builtins that the host lacks are removed with a warning; **non-core names are passed through and validated by the child session's own registry** — so a tool silently disappears when its name does not exist there.
|
|
58
|
+
|
|
59
|
+
That is exactly what happens with the built-in `researcher` agent: its frontmatter asks for `web_search`, while `web-search.json` renames that tool to `pi_web_search`. The child registry has no `web_search`, so the tool is dropped and the subagent cannot search at all.
|
|
60
|
+
|
|
61
|
+
`inherit` deletes the whitelist entirely (`applyToolsOverride` does `delete target.tools`), and the subagent gets every tool the child registry has. It is applied only to the three **write-capable** agents:
|
|
62
|
+
|
|
63
|
+
- `researcher`, `delegate`, `worker` — they already may write, so nothing is lost.
|
|
64
|
+
- Read-only agents (`scout`, `reviewer`, `oracle`) must **not** get `inherit`: it would hand them `write`, `edit` and `bash` and break their read-only contract. `evidence-auditor` has a whitelist of the same broken shape, but inheriting it would silently grant write access, so it is left alone.
|
|
65
|
+
|
|
66
|
+
Interaction tools need no exclusion: `ask_user_question` checks `ctx.hasUI` and removes itself from child sessions.
|
|
67
|
+
|
|
68
|
+
## What is not shipped
|
|
69
|
+
|
|
70
|
+
### `models.json`
|
|
71
|
+
|
|
72
|
+
Provider and model registrations are machine-specific: this setup's `litellm-any` provider points at a LiteLLM gateway on `127.0.0.1:996` (LAN address on other machines), carries a compat configuration, and registers six model ids that must match the gateway's routes exactly. Shipping it would be wrong on every other machine, so it is excluded.
|
|
73
|
+
|
|
74
|
+
`models.json` is the only file excluded, and the three settings keys that select a model were removed along with it:
|
|
75
|
+
|
|
76
|
+
| Removed key | Why |
|
|
77
|
+
| --- | --- |
|
|
78
|
+
| `defaultProvider: "litellm-any"` | The provider only exists in the excluded `models.json`. |
|
|
79
|
+
| `defaultModel: "deepseek-flash"` | Depends on that provider. |
|
|
80
|
+
| `modelThinkingLevels` | Pins `deepseek-flash` and `deepseek-flash-qd` to `max`; model ids again. |
|
|
81
|
+
|
|
82
|
+
Everything else in `settings.json` is byte-for-byte the author's file. If you run your own gateway you can add them back:
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
"defaultProvider": "<provider>",
|
|
86
|
+
"defaultModel": "<model-id>",
|
|
87
|
+
"modelThinkingLevels": { "<provider>/<model-id>": "max" }
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
For how providers and thinking levels work, see pi's own `docs/models.md` and `docs/custom-provider.md`.
|
|
91
|
+
|
|
92
|
+
### `pi-statusline.json` is legacy
|
|
93
|
+
|
|
94
|
+
This file configures `npm:@narumitw/pi-statusline`, a package this environment no longer uses — `extensions/statusline/` replaced it. The local statusline reads **no config file at all**: colors come from `theme.fg(...)`, so it follows whatever theme is active, and the second line comes from other extensions calling `ctx.ui.setStatus()`.
|
|
95
|
+
|
|
96
|
+
The file is kept only so you can switch back to the npm package without re-deriving the palette (it holds a Tokyo Night palette, segment order and per-extension status icons). Nothing in this package reads it.
|
|
97
|
+
|
|
98
|
+
## `web-search.json` — one key, and it is required
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
{ "toolNames": { "webSearch": "pi_web_search" } }
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
pi registers the `pi-web-access` search tool as `web_search` by default. A LiteLLM Anthropic→OpenAI translation layer treats **any tool literally named `web_search`** as Anthropic's built-in web search (`_is_web_search_tool`), strips it from `tools`, and substitutes an empty `web_search_options: {}` — which the backend rejects. The result is not an error: the request succeeds and the tool simply does not exist for the model.
|
|
105
|
+
|
|
106
|
+
Renaming the tool changes the same request from `tools=7` to `tools=8` in the gateway log (and to `tools=0` when only `web_search` was sent). If you are not routing through such a gateway, the rename is still harmless.
|
|
107
|
+
|
|
108
|
+
> When a tool vanishes like this, do not trust the model's own explanation — it will guess from the stale `promptSnippet` still present in the system prompt. Count `tools=N` in the gateway log instead.
|
|
109
|
+
|
|
110
|
+
## Machine-local files that are intentionally not in the package
|
|
111
|
+
|
|
112
|
+
| File | Why not |
|
|
113
|
+
| --- | --- |
|
|
114
|
+
| `~/.pi/agent/auth.json` | Credentials. |
|
|
115
|
+
| `~/.pi/agent/trust.json` | Per-machine project trust decisions, keyed by absolute path. |
|
|
116
|
+
| `~/.pi/agent/models-store.json` | Cache of pi's built-in model catalog. |
|
|
117
|
+
| `~/.pi/agent/sessions/` | Session transcripts. |
|
|
118
|
+
| `~/.pi/agent/missions/`, `run-history.jsonl` | `pi-subagents` mission and run history. |
|
|
119
|
+
| `~/.pi/agent/rewind/` | The `rewind` extension's shadow snapshot repositories. |
|
|
120
|
+
| `~/.pi/agent/npm/`, `bin/` | Installed packages (use `pi install`) and pi's bundled `fd`/`rg`. |
|
|
121
|
+
| `~/.pi/agent/web-search-cache/`, `~/.pi/folder-history/*.jsonl` | Runtime caches and history. |
|
|
122
|
+
|
|
123
|
+
The [Chinese handbook](handbook.zh.md) documents the same list with the reasoning behind each entry, plus the gateway and model routing this environment was tuned for.
|