@groeponline/pi-wishcraft 0.17.3

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 (106) hide show
  1. package/AGENTS.md +68 -0
  2. package/CHANGELOG.md +724 -0
  3. package/CONTRIBUTING.md +37 -0
  4. package/README.md +648 -0
  5. package/RELEASE.md +117 -0
  6. package/ROADMAP.md +52 -0
  7. package/bash-mode/completion-providers.ts +269 -0
  8. package/bash-mode/completion.ts +416 -0
  9. package/bash-mode/editor-ghost.ts +40 -0
  10. package/bash-mode/editor-input.ts +80 -0
  11. package/bash-mode/editor.ts +437 -0
  12. package/bash-mode/history.ts +263 -0
  13. package/bash-mode/shell-session.ts +286 -0
  14. package/bash-mode/transcript.ts +108 -0
  15. package/bash-mode/types.ts +80 -0
  16. package/index.ts +6 -0
  17. package/package.json +55 -0
  18. package/queue/store.ts +443 -0
  19. package/queue/types.ts +54 -0
  20. package/src/config/custom-items.ts +182 -0
  21. package/src/config/extension-statuses.ts +51 -0
  22. package/src/config/layout.ts +60 -0
  23. package/src/config/parse.ts +127 -0
  24. package/src/config/powerline-config.ts +18 -0
  25. package/src/config/presets.ts +245 -0
  26. package/src/config/primitives.ts +117 -0
  27. package/src/config/segment-ids.ts +114 -0
  28. package/src/config/segment-options.ts +128 -0
  29. package/src/config/settings-patch.ts +26 -0
  30. package/src/config/types.ts +277 -0
  31. package/src/core/frontmatter.ts +40 -0
  32. package/src/editor/autocomplete-chain.ts +41 -0
  33. package/src/extension/activate.ts +28 -0
  34. package/src/extension/bash-mode-actions.ts +104 -0
  35. package/src/extension/commands.ts +268 -0
  36. package/src/extension/constants.ts +46 -0
  37. package/src/extension/custom-editor.ts +406 -0
  38. package/src/extension/git-invalidation.ts +40 -0
  39. package/src/extension/layout.ts +160 -0
  40. package/src/extension/menu-views.ts +393 -0
  41. package/src/extension/powerline-widgets.ts +95 -0
  42. package/src/extension/prompt-history.ts +219 -0
  43. package/src/extension/queue-commands.ts +245 -0
  44. package/src/extension/queue-context.ts +12 -0
  45. package/src/extension/queue-integration.ts +434 -0
  46. package/src/extension/segment-context.ts +212 -0
  47. package/src/extension/session-lifecycle.ts +373 -0
  48. package/src/extension/settings-io.ts +202 -0
  49. package/src/extension/shortcuts-config.ts +357 -0
  50. package/src/extension/shortcuts-router.ts +383 -0
  51. package/src/extension/skills/inline-invocation.ts +174 -0
  52. package/src/extension/skills/ook.md +6 -0
  53. package/src/extension/skills/test.md +6 -0
  54. package/src/extension/stale-context.ts +10 -0
  55. package/src/extension/stash-history.ts +103 -0
  56. package/src/extension/state.ts +159 -0
  57. package/src/extension/status-line-renderers.ts +222 -0
  58. package/src/extension/types.ts +97 -0
  59. package/src/extension/vibe-command.ts +160 -0
  60. package/src/extension/welcome-control.ts +27 -0
  61. package/src/extension/welcome-integration.ts +153 -0
  62. package/src/git/status.ts +332 -0
  63. package/src/paths/agent-dirs.ts +67 -0
  64. package/src/render/timer.ts +46 -0
  65. package/src/segments/core.ts +256 -0
  66. package/src/segments/custom.ts +114 -0
  67. package/src/segments/index.ts +3 -0
  68. package/src/segments/registry.ts +87 -0
  69. package/src/segments/shared.ts +36 -0
  70. package/src/segments/system.ts +235 -0
  71. package/src/segments/usage.ts +178 -0
  72. package/src/shell/cd-command.ts +190 -0
  73. package/src/shortcuts/matching.ts +61 -0
  74. package/src/theme/colors.ts +60 -0
  75. package/src/theme/icons.ts +175 -0
  76. package/src/theme/separators.ts +41 -0
  77. package/src/theme/theme.ts +211 -0
  78. package/src/tools/graph.ts +75 -0
  79. package/src/tools/patch.ts +179 -0
  80. package/src/tools/ripgrep.ts +104 -0
  81. package/src/usage/context.ts +97 -0
  82. package/src/usage/ledger.ts +293 -0
  83. package/src/usage/rates.ts +155 -0
  84. package/src/welcome/auto-dismiss.ts +43 -0
  85. package/src/welcome/banner.ts +68 -0
  86. package/src/welcome/discover.ts +234 -0
  87. package/src/welcome/format.ts +18 -0
  88. package/src/welcome/index.ts +5 -0
  89. package/src/welcome/layout.ts +36 -0
  90. package/src/welcome/overlay.ts +80 -0
  91. package/src/welcome/renderer.ts +157 -0
  92. package/src/welcome/sessions.ts +107 -0
  93. package/src/welcome/types.ts +41 -0
  94. package/src/welcome/widgets/graph-widget.ts +25 -0
  95. package/src/welcome/widgets/index.ts +20 -0
  96. package/src/welcome/widgets/queue-widget.ts +26 -0
  97. package/src/welcome/widgets/sessions-widget.ts +23 -0
  98. package/src/welcome/widgets/shortcuts-widget.ts +17 -0
  99. package/src/welcome/widgets/system-widget.ts +29 -0
  100. package/src/working-vibes/generate.ts +144 -0
  101. package/src/working-vibes/index.ts +24 -0
  102. package/src/working-vibes/manager.ts +198 -0
  103. package/src/working-vibes/provider.ts +163 -0
  104. package/src/working-vibes/storage.ts +357 -0
  105. package/theme.example.json +24 -0
  106. package/tsconfig.json +13 -0
package/README.md ADDED
@@ -0,0 +1,648 @@
1
+ <p>
2
+ <img src="banner.png" alt="pi-wishcraft" width="1100">
3
+ </p>
4
+
5
+ # pi-wishcraft
6
+
7
+ *Originally engineered 2,000 years ago as floating military signals across enemy lines, the Kongming sky lantern provided instant visual telemetry. Over centuries, these lanterns evolved into vessels for wishes: operators release their thoughts into the sky, clearing their minds.*
8
+
9
+ This extension translates that philosophy to the [pi](https://github.com/badlogic/pi-mono) coding agent:
10
+ 1. **Ground Telemetry**: A live status bar at the bottom border tracking git, tokens/sec, context window, and active process ports (Alt+P).
11
+ 2. **Cast & Release (`# <idea>`)**: Queue ideas instantly without interrupting the active agent run.
12
+ 3. **Autonomous Horizons**: The queue feeds background dreaming SDK routines, mission runners, and autoresearch loops while you work or sleep.
13
+ 4. **Stash & Pivot (Alt+S)**: Park a prompt draft, ask a quick question, pop it back automatically.
14
+ 5. **Sticky Shell (`!cmd`)**: A persistent bash runtime under your fingertips.
15
+
16
+ Inspired by [Powerlevel10k](https://github.com/romkatv/powerlevel10k) and [oh-my-pi](https://github.com/can1357/oh-my-pi).
17
+
18
+ <img width="1261" height="817" alt="Example powerline UI" src="https://github.com/user-attachments/assets/4cc43320-3fb8-4503-b857-69dffa7028f2" />
19
+
20
+
21
+ ## Features
22
+
23
+ **Editor stash**: Press `Alt+S` to save your editor content and clear the editor, type a quick prompt, and your stashed text auto-restores when the agent finishes. Toggles between stash, pop, and update-existing-stash. A `stash` indicator appears in the powerline bar while text is stashed.
24
+
25
+ **Powerline Queue + Inbox**: Capture thoughts without interrupting the current agent. Type `# <idea>` and press Enter to save an idea instead of sending it; `# @global <idea>`, `# @current <idea>`, and `# @alias <idea>` route it. Messages typed during compaction are held by Powerline and delivered after successful compaction instead of disappearing into Pi's native queue. `/idea`, `/ideas`, and `/queue` provide a file-backed inbox for current-session prompts, project ideas, aliases, retries, clears, and manual delivery. Use `/ideas next` to work the oldest active idea in the current session, or `/ideas issue` to hand it to the current agent for safe GitHub issue triage. Active queue, idea, and blocked counts appear in the `queue` segment only when there is something to show.
26
+
27
+ **Working Vibes**: AI-generated themed loading messages. Set `/vibe star trek` and your "Working..." becomes "Running diagnostics..." or "Engaging warp drive...". Supports any theme: pirate, zen, noir, cowboy, etc.
28
+
29
+ **Welcome overlay**: Branded splash screen shown as centered overlay on startup. Shows gradient logo, model info, keyboard tips, loaded AGENTS.md/extensions/skills/templates counts, an approximate initial system-prompt token count, and recent sessions. Auto-dismisses after 30 seconds or on any key press. Set `powerline.welcome` to `false` to disable it while keeping the footer enabled.
30
+
31
+ **Rounded box design**: Status renders directly in the editor's top border, not as a separate footer.
32
+
33
+ **Native Pi layout**: Pi owns fixed input, feed scrolling, selection, and terminal behavior; this extension supplies powerline widgets and the custom bash/stash/editor integrations.
34
+
35
+ **Live thinking level indicator**: Shows current thinking level (`think:off`, `think:med`, etc.) with per-level colors. High, xhigh, and max levels use a rainbow effect inspired by Claude Code's ultrathink.
36
+
37
+ **Smart defaults**: Nerd Font auto-detection for iTerm, WezTerm, Kitty, Ghostty, and Alacritty with ASCII fallbacks. Colors matched to oh-my-pi's dark theme.
38
+
39
+ **Git integration**: Async status fetching with 1s cache TTL. Automatically invalidates on file writes/edits. Shows branch, staged (+), unstaged (*), and untracked (?) counts.
40
+
41
+ **Context awareness**: Color-coded warnings above 70% (yellow) and above 90% (red) context usage. During streaming, the context segment refreshes from live assistant usage instead of waiting for the next turn. Auto-compact indicator when enabled. If `pi-custom-compaction` is installed and enabled, the powerline automatically hides native context segments so the footer does not show stale post-summary usage.
42
+
43
+ **Token intelligence**: Smart formatting (1.2k, 45M), used/max/percentage context display, subscription detection, and configurable subscription cost display.
44
+
45
+ **Sticky bash mode**: Toggle bash mode with `ctrl+shift+b` or `/bash-mode`. It keeps a managed shell session alive for the current pi session, shows a dedicated `shell_mode` segment, streams command output into an embedded transcript below the editor, and lets `cd` or exported state persist across commands.
46
+
47
+ **Shell ghost suggestions**: Bash mode is now ghost-first. Successful per-project shell history is the primary source, while deterministic path and git continuations can still extend an existing command. Shell-native completion probes are disabled so `!command` predictions never spawn interactive shell completion subprocesses. At command position, short stems first resolve from the newest successful local command, can use guarded global shell history for high-confidence heads like `git`, and finally fall back to a tiny curated default set when history is absent. Right now that curated set is `g` → `git status` and `c` → `cd ..`. If the bash prompt is empty, bash mode shows the newest successful project-history ghost suggestion when one exists, otherwise it stays empty. The same inline predictions now also kick in for one-off `!command` and `!!command` prompts. Right Arrow or Tab accepts ghost text into the editor, and Enter runs the current shell command.
48
+
49
+ ## Installation
50
+
51
+ ### Method 1: Via Pi Package Manager (Recommended)
52
+
53
+ ```bash
54
+ pi install npm:@groeponline/pi-wishcraft
55
+ ```
56
+
57
+ ### Method 2: One-Liner / Cloud Agent Startup Script (Cursor Cloud, Freebuff, Devcontainers, CI)
58
+
59
+ For ephemeral VMs, cloud agents, or dev environments without manual intervention:
60
+
61
+ ```bash
62
+ curl -fsSL https://raw.githubusercontent.com/GroepOnline/pi-wishcraft/main/scripts/install.sh | bash
63
+ ```
64
+
65
+ Restart or `/reload` pi to activate.
66
+
67
+ ## Usage
68
+
69
+ Activates automatically. Toggle with `/powerline`, switch presets with `/powerline <name>`, and move the primary row with `/powerline placement above|below|toggle`.
70
+
71
+ Use `/cd <path>` to continue the current conversation from another working directory. It supports relative paths, absolute paths, `~`, `~/...`, and directory completions. With no argument, `/cd` prints the current Pi session directory. The command switches into a cwd-updated session file so Pi tools and the footer path segment agree after the change.
72
+
73
+ Powerline Queue + Inbox commands and capture shortcuts:
74
+
75
+ - `# <text>`: capture an idea for the current project without sending it to the agent
76
+ - `# @global <text>`: capture a global idea
77
+ - `# @current <text>`: capture an idea targeted to the current session
78
+ - `/queue alias <name> [path]`: save a project alias, defaulting to the current cwd when `path` is omitted
79
+ - `# @name <text>`: capture an idea for a saved project alias
80
+ - `/compact <text>`: compact now and queue `<text>` as the next prompt after successful compaction
81
+ - `/idea [@target] <text>`: command form of idea capture, useful for scripts and users who disable the sigil
82
+ - `/idea issue [id]`: hand the oldest active idea, or a specific idea, to the current agent for safe GitHub issue triage
83
+ - `/ideas`: open the captured-ideas picker
84
+ - `/ideas next`: send the oldest active idea to the current session
85
+ - `/ideas issue [id]`: ask the current agent to dedupe and file a GitHub issue only when the target repo is clear and owned/controlled
86
+ - `/ideas send <id>`: send an idea to the current session
87
+ - `/queue`: open the queued-prompt picker
88
+ - `/queue send [id]` / `/queue retry [id]`: deliver a queued item now
89
+ - `/queue clear <id|all>`: clear queued prompt items
90
+ - `/queue target <id> @name|global|current`: retarget a queued item
91
+
92
+ The default capture sigil is `#`. When the editor text starts with `#` followed by a space, the prompt glyph changes to `#`; pressing Enter saves the idea, clears the editor, and leaves the original sigil text in editor history for quick recovery. Configure or disable this under `powerline.queue.captureSigil`:
93
+
94
+ ```json
95
+ {
96
+ "powerline": {
97
+ "queue": {
98
+ "captureSigil": "#"
99
+ }
100
+ }
101
+ }
102
+ ```
103
+
104
+ Set `captureSigil` to `false` if you often submit markdown headings and prefer `/idea` instead.
105
+
106
+ Captured data is stored under the Pi agent directory in `powerline-footer/inbox.jsonl` and `powerline-footer/projects.json`. `inbox.jsonl` is a stable read surface for orchestrators and helper agents; each line is a queue item with `id`, `text`, `createdAt`, `updatedAt`, `source`, `target`, `intent`, `status`, and optional `error`. Writes should still go through Powerline commands or the store so locking and atomic writes are preserved. Ideas sent with `/ideas next` or `/ideas send <id>` include a small provenance header so the receiving agent can treat them as deferred captured context. `/idea issue` and `/ideas issue` do not file issues directly from the extension; they send a guarded handoff prompt that tells the current agent to dedupe open issues first, create a GitHub issue only for a clear owned/controlled repo, and ask before filing when the target is unclear.
107
+
108
+ - `/powerline placement below`: move the primary powerline row below the editor
109
+ - `/powerline placement above`: restore the default placement
110
+ - `/powerline placement toggle`: switch between above and below
111
+
112
+ You can also set it in the agent settings file (`~/.pi/agent/settings.json` by default, or under `PI_CODING_AGENT_DIR`) or project-local `.pi/settings.json`:
113
+
114
+ ```json
115
+ {
116
+ "showLastPrompt": true,
117
+ "powerline": {
118
+ "preset": "default",
119
+ "placement": "below",
120
+ "welcome": true
121
+ }
122
+ }
123
+ ```
124
+
125
+
126
+ | Preset | Description |
127
+ |--------|-------------|
128
+ | `default` | Model, thinking, path (basename), git, context, tokens, cost |
129
+ | `minimal` | Just path (basename), git, context |
130
+ | `compact` | Model, git, cost, context |
131
+ | `full` | Everything including hostname, time, abbreviated path |
132
+ | `nerd` | Maximum detail for Nerd Font users |
133
+ | `ascii` | Safe for any terminal |
134
+ | `chef` | Fork default: muted colors, slash separators, TPS + open-ports segments |
135
+
136
+ **Environment:** `POWERLINE_NERD_FONTS=1` to force Nerd Fonts, `=0` for ASCII.
137
+
138
+ Preset selection is saved under `powerline` in the agent settings file and restored on startup.
139
+ Run `/powerline default` to switch back to the default preset.
140
+
141
+ ### Custom items from extension statuses
142
+
143
+ You can promote any extension status key into its own dedicated powerline item. This gives you a general way to register your own status items without changing this extension.
144
+
145
+ 1. Any extension can publish status text through `ctx.ui.setStatus("my-key", "...value...")`.
146
+ 2. Configure `powerline.customItems` to place those keys on the left, right, or secondary row.
147
+
148
+ ```json
149
+ {
150
+ "powerline": {
151
+ "preset": "default",
152
+ "customItems": [
153
+ {
154
+ "id": "ci",
155
+ "statusKey": "ci-status",
156
+ "position": "right",
157
+ "prefix": "CI",
158
+ "color": "warning"
159
+ },
160
+ {
161
+ "id": "review",
162
+ "position": "secondary",
163
+ "hideWhenMissing": false,
164
+ "prefix": "review"
165
+ }
166
+ ]
167
+ }
168
+ }
169
+ ```
170
+
171
+ `customItems` fields:
172
+
173
+ - `id` (required): unique item id (`a-z`, `A-Z`, `0-9`, `_`, `-`)
174
+ - `statusKey` (optional): extension status key to read, defaults to `id`
175
+ - `position` (optional): `left`, `right`, or `secondary` (default `right`)
176
+ - `prefix` (optional): text shown before the live status value
177
+ - `color` (optional): any Pi theme color (`warning`, `accent`, etc.) or hex (`#RRGGBB`)
178
+ - `hideWhenMissing` (optional): hide item when no status is present (default `true`)
179
+ - `excludeFromExtensionStatuses` (optional): omit this key from the aggregate `extension_statuses` segment (default `true`)
180
+
181
+ If you still prefer the older string preset config shape, `"powerline": "default"` continues to work. String preset shorthand keeps `welcome` enabled and uses the default shortcut/cost/model display settings.
182
+
183
+ ### Custom segments (computed, no code)
184
+
185
+ Define your own segments directly in settings: run a command, read an env var, or show static text. No TypeScript needed.
186
+
187
+ ```json
188
+ {
189
+ "powerline": {
190
+ "preset": "chef",
191
+ "segments": {
192
+ "battery": { "type": "command", "command": "cat /sys/class/power_supply/BAT0/capacity", "prefix": "batt", "cacheMs": 30000 },
193
+ "who": { "type": "env", "env": "USER", "prefix": "u", "color": "#888888" },
194
+ "chef": { "type": "static", "text": "CHEF", "color": "accent" }
195
+ }
196
+ }
197
+ }
198
+ ```
199
+
200
+ Each segment becomes usable in a preset as `custom:<id>` (e.g. `custom:battery`).
201
+
202
+ Segment fields:
203
+
204
+ - `type` (required): `command` | `env` | `static`
205
+ - `command` (command type): shell command to run; output is trimmed
206
+ - `cacheMs` (command type, optional): cache output for N ms to avoid re-spawning a shell every paint
207
+ - `env` (env type): environment variable to read
208
+ - `fallback` (env type, optional): text shown when the variable is unset (omit to hide the segment)
209
+ - `text` (static type): fixed text
210
+ - `prefix` (optional): text shown before the value
211
+ - `color` (optional): Pi theme color (`warning`, `accent`, ...) or hex (`#RRGGBB`)
212
+
213
+ If a command fails or an env var is unset without a fallback, the segment renders nothing.
214
+
215
+ ### Custom presets
216
+
217
+ Define your own preset in settings; it merges over built-ins and is selectable via `powerline.preset` (or `/powerline <name>`).
218
+
219
+ ```json
220
+ {
221
+ "powerline": {
222
+ "preset": "mine",
223
+ "segments": { "battery": { "type": "command", "command": "cat /sys/class/power_supply/BAT0/capacity", "prefix": "batt" } },
224
+ "presets": {
225
+ "mine": {
226
+ "left": ["hostname", "model", "custom:battery", "git"],
227
+ "right": ["tps", "open_ports", "cost", "time"],
228
+ "separator": "slash",
229
+ "colors": { "model": "text" },
230
+ "segmentOptions": { "path": { "mode": "basename" } }
231
+ }
232
+ }
233
+ }
234
+ }
235
+ ```
236
+
237
+ ### The `chef` preset and interactive commands
238
+
239
+ `preset: "chef"` is the GroepOnline fork's default look: muted colors (no rainbow), slash separators, and two extra right-side segments:
240
+
241
+ - `tps`: live tokens/sec, rolling 1-second window (EMA-free, no spikes); a rocket/bolt icon lights up while generating (override with env `POWERLINE_TPS`)
242
+ - `open_ports`: count of unique **TCP** listening ports (`ss` → `netstat` → `/proc/net` fallback, dedupes IPv4/IPv6). Set `segmentOptions.openPorts.includeUdp: true` to include noisy UDP (mDNS/DHCP/ephemeral).
243
+
244
+ Interactivity (Pi core renders the footer as static text, so live click is not possible; actions live in commands and a navigable overlay):
245
+
246
+ - `/tps [value]`: show or set `POWERLINE_TPS`
247
+ - `/open-ports`: list listening ports and pick one
248
+ - `alt+p`: **powerline menu**: navigate the live segments (`↑`/`↓` + `enter`), configure (preset / TPS / UDP / labels), or open the full ports list
249
+ - `alt+i`: **powerline info**: full open-ports list
250
+
251
+ Both `alt+p` and `alt+i` are rebindable (see Keybinds below); changes apply after `/reload`.
252
+
253
+ ### Keybinds
254
+
255
+ The powerline menu and info shortcuts are configurable via `powerlineShortcuts` (same map as the other powerline shortcuts), with automatic conflict resolution. Set a binding to `null` to disable it.
256
+
257
+ ```json
258
+ {
259
+ "powerlineShortcuts": {
260
+ "menu": "alt+p",
261
+ "info": "alt+i"
262
+ }
263
+ }
264
+ ```
265
+
266
+ Changes apply after `/reload` (the extension re-registers shortcuts on reload).
267
+
268
+ ### Segment labels (custom text)
269
+
270
+ Rename the text shown for any segment via `powerline.segmentLabels` (a map of segment id → label). The label appears between the icon and the value.
271
+
272
+ ```json
273
+ {
274
+ "powerline": {
275
+ "segmentLabels": {
276
+ "tps": "speed",
277
+ "open_ports": "ports"
278
+ }
279
+ }
280
+ }
281
+ ```
282
+
283
+ ### Disabling segments
284
+
285
+ Set `powerline.disabledSegments` to hide built-in or configured custom segments from the active preset:
286
+
287
+ ```json
288
+ {
289
+ "powerline": {
290
+ "preset": "default",
291
+ "disabledSegments": ["cost", "extension_statuses", "custom:ci"]
292
+ }
293
+ }
294
+ ```
295
+
296
+ Built-in names are listed under Segments below. Custom items use `custom:<id>`. Unknown names are ignored with a startup warning.
297
+
298
+ ### Custom layout
299
+
300
+ Use `powerline.layout` to override segment order and grouping while keeping the selected preset’s colors and segment options. Set `powerline.separator` when you want a separator style independent of the preset:
301
+
302
+ ```json
303
+ {
304
+ "powerline": {
305
+ "preset": "default",
306
+ "separator": "chevron",
307
+ "layout": {
308
+ "left": ["model", "thinking", "path", "git"],
309
+ "right": ["context_pct", "cost"],
310
+ "secondary": ["custom:ci"]
311
+ },
312
+ "customItems": [
313
+ { "id": "ci", "statusKey": "ci-status" }
314
+ ]
315
+ }
316
+ }
317
+ ```
318
+
319
+ A present `left`, `right`, or `secondary` array replaces that preset group exactly; an empty array clears it. Omitted groups keep the preset entries and automatically append custom items by their configured `position`. Explicitly listing a segment moves it out of omitted preset groups, and explicitly placed custom items are not auto-appended elsewhere. `disabledSegments` is applied after layout. `separator` accepts any style listed below; omit it to keep the preset’s separator.
320
+
321
+ Responsive behavior is unchanged: these groups control ordering and overflow priority, not permanently pinned terminal rows. `right` means “later primary segments,” not right-edge alignment. On wide terminals secondary entries can fit in the top bar; on narrow terminals primary overflow moves into the secondary line. Some segments are hidden when they have no value, so `thinking` appears only when the active session/model reports a non-`off` thinking level. Unknown entries are ignored with a startup warning. The old fixed `custom` preset has been removed; combine any preset with `layout` instead.
322
+
323
+ ### Demo settings
324
+
325
+ For a compact current footer setup:
326
+
327
+ ```json
328
+ {
329
+ "powerline": {
330
+ "preset": "default",
331
+ "path": { "mode": "basename" },
332
+ "model": { "display": "name" },
333
+ "cost": { "subscriptionDisplay": "subscription", "currency": "USD" }
334
+ }
335
+ }
336
+ ```
337
+
338
+ Use `"model": { "display": "qualified" }` when two providers expose models with the same display name.
339
+
340
+ `cost.currency` accepts `USD`, `CNY`, `EUR`, `GBP`, `JPY`, `CAD`, `AUD`, `CHF`, `INR`, or `KRW`. Pi reports costs in USD; non-USD display uses a keyless USD FX rate fetched in the background and cached for 24 hours under the Pi agent directory. If no cached rate is available yet, the cost segment renders `-- CODE` until a later footer refresh can use the fetched rate.
341
+
342
+ Subscription cost display accepts:
343
+
344
+ | Mode | Subscription + reported cost | Subscription + no reported cost |
345
+ |------|------------------------------|----------------------------------|
346
+ | `subscription` | `(sub)` | `(sub)` |
347
+ | `reported-cost` | `$0.12` | `(sub)` |
348
+ | `both` | `$0.12 (sub)` | `(sub)` |
349
+
350
+ Segment display formats (opt-in; defaults match the historical rendering):
351
+
352
+ | Segment option | Values | Default | Effect |
353
+ |---|---|---|---|
354
+ | `"context": { "format" }` | `"full"` / `"percent"` | `"full"` | `"percent"` shows a bare rounded `83%` (threshold-colored, no icon) instead of `12k/200k (6.2%)` |
355
+ | `"cache_read": { "format" }` | `"tokens"` / `"percent"` / `"both"` | `"tokens"` | `"percent"` shows the cache hit rate `cacheRead / (input + cacheRead)` instead of the raw token count; `"both"` shows raw tokens plus the hit rate, e.g. `cache in: 12k (80%)` |
356
+
357
+ ```json
358
+ {
359
+ "powerline": {
360
+ "context": { "format": "percent" },
361
+ "cache_read": { "format": "both" }
362
+ }
363
+ }
364
+ ```
365
+
366
+ ## Bash mode
367
+
368
+ Toggle bash mode with either:
369
+
370
+ - `ctrl+shift+b`
371
+ - `/bash-mode on`
372
+ - `/bash-mode off`
373
+ - `/bash-mode toggle`
374
+
375
+ Reset the managed shell with `/bash-reset`.
376
+
377
+ While bash mode is active:
378
+
379
+ - Enter runs the current shell command
380
+ - Right Arrow accepts ghost text into the editor without running it
381
+ - Tab accepts the current ghost suggestion when one exists; otherwise it does nothing
382
+ - Up and Down browse matching shell history
383
+ - `escape` exits bash mode and returns to normal prompt mode
384
+ - `ctrl+c` interrupts the active shell job before falling back to normal pi behavior
385
+
386
+ The managed shell is persistent for the current pi session. Command output appears in a transcript below the editor, and shell cwd changes are reflected in the footer path and `shell_mode` segment. If the bash prompt is empty, bash mode shows the newest successful project-history ghost suggestion immediately when one exists, including right after mode entry or after the prompt is cleared again. One-off `!command` and `!!command` prompts reuse the same shell prediction pipeline, including ghost text. Mode entry stays quiet: there is no automatic or manual dropdown completion surface, and ghost suggestions do not run shell-native completion probes.
387
+
388
+ ### Bash mode configuration
389
+
390
+ In `~/.pi/agent/settings.json` (or under `PI_CODING_AGENT_DIR` when that environment variable is set):
391
+
392
+ ```json
393
+ {
394
+ "bashMode": {
395
+ "toggleShortcut": "ctrl+shift+b",
396
+ "transcriptMaxLines": 2000,
397
+ "transcriptMaxBytes": 524288
398
+ }
399
+ }
400
+ ```
401
+
402
+ ## Editor Stash
403
+
404
+ Use `Alt+S` / `Option+S` as a quick stash toggle while drafting. It keeps one active stash and clears the editor when stashing. Powerline listens for unambiguous Alt/Meta-S escape encodings by default. If your old terminal setup only emits the printable German sharp-S character for Option+S and you still want that to trigger stash, set `"stashSharpSShortcut": true` under `powerline`.
405
+
406
+ | Editor | Stash | `Alt+S` result |
407
+ |--------|-------|----------------|
408
+ | Has text | Empty | Stash current text, clear editor |
409
+ | Empty | Has stash | Restore stash into editor |
410
+ | Has text | Has stash | Update stash with current text, clear editor |
411
+ | Empty | Empty | Show "Nothing to stash" |
412
+
413
+ Auto-restore after an agent run only happens when the editor is still empty. If you typed meanwhile, the stash is preserved.
414
+
415
+ The `stash` indicator appears in the powerline bar (on presets with `extension_statuses`). Active stash is still session-local and resets on session switch / disable, but stash history is persisted to the agent dir at `powerline-footer/stash-history.json` so it survives restarts. By default the agent dir is `~/.pi/agent`; set `PI_CODING_AGENT_DIR` to move global powerline settings, stash history, sessions, vibes, skills, commands, and extension discovery with Pi.
416
+
417
+ ### Stash history
418
+
419
+ Open prompt history with either:
420
+
421
+ - `ctrl+alt+h`
422
+ - `/stash-history`
423
+
424
+ Prompt history now has two sources:
425
+
426
+ - stashed prompts: up to 12 recent stashed prompts (newest first)
427
+ - recent project prompts: up to 50 recent user-submitted prompts pulled from pi sessions in the current project folder
428
+
429
+ Selecting a stashed entry lets you insert it or promote it to an idea. Project prompt history entries insert into the editor. If the editor already has text, you can choose `Replace`, `Append`, or `Cancel`.
430
+
431
+ ### Editor clipboard and navigation shortcuts
432
+
433
+ - `ctrl+alt+c`: copy full editor content
434
+ - `ctrl+alt+x`: cut full editor content (copy, then clear)
435
+ - `ctrl+alt+q`: open the queued-prompt picker
436
+ - `cmd+shift+up`: move the editor cursor to the start of the first line
437
+ - `cmd+shift+down`: move the editor cursor to the end of the last line
438
+
439
+ Copy/cut actions do not modify stash state or stash history. Dragging files, folders, images, or screenshots from Finder into the custom editor inserts their path strings. Pi owns chat scrolling, selection, and fixed input behavior natively.
440
+
441
+ ### Shortcut configuration
442
+
443
+ You can override shortcut keys in the agent settings file:
444
+
445
+ ```json
446
+ {
447
+ "powerlineShortcuts": {
448
+ "stashHistory": "ctrl+alt+h",
449
+ "copyEditor": "ctrl+alt+c",
450
+ "cutEditor": "ctrl+alt+x",
451
+ "ideaCapture": null,
452
+ "queueOpen": "ctrl+alt+q",
453
+ "editorStart": "cmd+shift+up",
454
+ "editorEnd": "cmd+shift+down"
455
+ }
456
+ }
457
+ ```
458
+
459
+ After changing bindings, run `/reload`. Invalid bindings, reserved key conflicts like `Alt+S`, or duplicate conflicts fall back to safe defaults. Set a binding to `null` or `""` to disable that action. `cmd` and `command` are accepted aliases for Pi's `super` modifier for the documented Command navigation keys.
460
+
461
+ ### Editor autocomplete composition
462
+
463
+ Powerline wraps Pi's autocomplete provider so bash mode can add shell-aware suggestions. When another editor extension was already installed, powerline now passes Pi's provider through that previous editor's `setAutocompleteProvider()` first and then wraps the resulting provider. This preserves prior autocomplete-provider wrappers where possible, but it is not full render/input composition between custom editors.
464
+
465
+ ## Working Vibes
466
+
467
+ Transform boring "Working..." messages into themed phrases that match your style:
468
+
469
+ ```text
470
+ /vibe star trek → "Running diagnostics...", "Engaging warp drive..."
471
+ /vibe pirate → "Hoisting the sails...", "Charting course..."
472
+ /vibe zen → "Breathing deeply...", "Finding balance..."
473
+ /vibe noir → "Following the trail...", "Checking the angles..."
474
+ /vibe → Shows current theme, mode, and model
475
+ /vibe off → Disables (back to "Working...")
476
+ /vibe model → Shows current model
477
+ /vibe model openai/gpt-4o-mini → Use a different model
478
+ /vibe mode → Shows current mode (generate or file)
479
+ /vibe mode file → Switch to file-based mode (instant, no API calls)
480
+ /vibe mode generate → Switch to on-demand generation (contextual)
481
+ /vibe generate mafia 200 → Pre-generate 200 vibes and save to file
482
+ ```
483
+
484
+ ### Configuration
485
+
486
+ In the agent settings file:
487
+
488
+ ```json
489
+ {
490
+ "workingVibe": "star trek", // Theme phrase
491
+ "workingVibeMode": "generate", // "generate" (on-demand) or "file" (pre-generated)
492
+ "workingVibeModel": "openai-codex/gpt-5.4-mini", // Optional: model to use (default)
493
+ "workingVibeFallback": "Working", // Optional: fallback message
494
+ "workingVibeRefreshInterval": 30, // Optional: seconds between refreshes (default 30)
495
+ "workingVibePrompt": "Generate a {theme} loading message for: {task}", // Optional: custom prompt template
496
+ "workingVibeMaxLength": 65 // Optional: max message length (default 65)
497
+ }
498
+ ```
499
+
500
+ ### Modes
501
+
502
+ | Mode | Description | Pros | Cons |
503
+ |------|-------------|------|------|
504
+ | `generate` | On-demand AI generation (default) | Contextual, hints at actual task | Model-dependent cost and latency |
505
+ | `file` | Pull from pre-generated file | Instant, zero cost, works offline | Not contextual |
506
+
507
+ **File mode setup:**
508
+ ```bash
509
+ /vibe generate mafia 200 # Generate 200 vibes, save to the agent dir
510
+ /vibe mode file # Switch to file mode
511
+ /vibe mafia # Now uses the file
512
+ ```
513
+
514
+ **How file mode works:**
515
+ 1. Vibes are loaded from `vibes/{theme}.txt` in the agent dir into memory
516
+ 2. Uses seeded shuffle (Mulberry32 PRNG): cycles through all vibes before repeating
517
+ 3. New seed each session: different order every time you restart pi
518
+ 4. Zero latency, zero cost, works offline
519
+
520
+ **Prompt template variables (generate mode only):**
521
+ - `{theme}`: the current vibe theme (e.g., "star trek", "mafia")
522
+ - `{task}`: context hint (user prompt initially, then agent's response text or tool info on refresh)
523
+ - `{exclude}`: recent vibes to avoid (auto-populated, e.g., "Don't use: vibe1, vibe2...")
524
+
525
+ **How it works:**
526
+ 1. When you send a message, shows "Channeling {theme}..." placeholder
527
+ 2. AI generates a themed message in the background (3s timeout)
528
+ 3. Message updates to the themed version (e.g., "Engaging warp drive...")
529
+ 4. During long tasks, refreshes on tool calls (rate-limited, default 30s)
530
+ 5. Cost and latency depend on your configured `workingVibeModel`
531
+
532
+ ## Thinking Level Display
533
+
534
+ The thinking segment shows live updates when you change thinking level:
535
+
536
+ | Level | Display | Color |
537
+ |-------|---------|-------|
538
+ | off | `think:off` | gray |
539
+ | minimal | `think:min` | purple-gray |
540
+ | low | `think:low` | blue |
541
+ | medium | `think:med` | teal |
542
+ | high | `think:high` | rainbow |
543
+ | xhigh | `think:xhigh` | rainbow |
544
+ | max | `think:max` | rainbow |
545
+
546
+ ## Path Display
547
+
548
+ The path segment supports three modes:
549
+
550
+ | Mode | Example | Description |
551
+ |------|---------|-------------|
552
+ | `basename` | `powerline-footer` | Just the directory name (default) |
553
+ | `abbreviated` | `…/extensions/powerline-footer` | Full path with home abbreviated and length limit |
554
+ | `full` | `~/.pi/agent/extensions/powerline-footer` | Complete path with home abbreviated |
555
+
556
+ Configure via preset options: `path: { mode: "full" }`
557
+
558
+ ## Git polling
559
+
560
+ By default the git segment polls both branch and dirty state. If background `git status --porcelain` calls interfere with your workflow, use branch-only polling:
561
+
562
+ ```json
563
+ {
564
+ "powerline": {
565
+ "git": { "polling": "branch" }
566
+ }
567
+ }
568
+ ```
569
+
570
+ Use `"off"` to disable extension-owned git polling entirely and only show the branch reported by Pi when available.
571
+
572
+ ## Git host icon
573
+
574
+ Set `git.hostIcon` to replace the branch icon with the origin remote's host logo:
575
+
576
+ ```json
577
+ {
578
+ "powerline": {
579
+ "git": { "hostIcon": true }
580
+ }
581
+ }
582
+ ```
583
+
584
+ The origin remote is detected (SSH or HTTPS) and mapped to an icon: GitHub (`nf-fa-github`), GitLab (`nf-fa-gitlab`), Bitbucket (`nf-fa-bitbucket`), or a generic git logo (`nf-fa-git`) for any other remote (self-hosted, Gitea, Codeberg, …). Repositories without an origin remote keep the plain branch icon (`nf-fa-code_fork`), as do ASCII (non–Nerd Font) setups. The remote is read once and cached, so this adds no per-render cost. Default is `false` (branch icon unchanged).
585
+
586
+ ## Segments
587
+
588
+ `model` · `thinking` · `shell_mode` · `path` · `git` · `subagents` · `token_in` · `token_out` · `token_total` · `cost` · `context_pct` · `context_total` · `time_spent` · `time` · `session` · `hostname` · `cache_read` · `cache_write` · `extension_statuses`
589
+
590
+ ## Separators
591
+
592
+ `powerline` · `powerline-thin` · `slash` · `pipe` · `dot` · `chevron` · `star` · `block` · `none` · `ascii`
593
+
594
+ ## Theming
595
+
596
+ Colors are configurable via pi's theme system. Each preset defines its own color scheme, and you can override individual colors and icons with a `theme.json` file in the extension directory.
597
+
598
+ ### Default Colors
599
+
600
+ | Semantic | Theme Color | Description |
601
+ |----------|-------------|-------------|
602
+ | `model` | `#d787af` | Model name |
603
+ | `shellMode` | `accent` | Bash mode segment |
604
+ | `path` | `#00afaf` | Directory path |
605
+ | `gitClean` | `success` | Git branch (clean) |
606
+ | `gitDirty` | `warning` | Git branch (dirty) |
607
+ | `thinking` | `thinkingOff` | Thinking level (`off`) |
608
+ | `thinkingMinimal` | `thinkingMinimal` | Thinking level (`minimal`) |
609
+ | `thinkingLow` | `thinkingLow` | Thinking level (`low`) |
610
+ | `thinkingMedium` | `thinkingMedium` | Thinking level (`medium`) |
611
+ | `context` | `dim` | Context usage |
612
+ | `contextWarn` | `warning` | Context usage >70% |
613
+ | `contextError` | `error` | Context usage >90% |
614
+ | `cost` | `text` | Cost display |
615
+ | `tokens` | `muted` | Token counts |
616
+
617
+ ### Custom Theme Override
618
+
619
+ Create `extensions/powerline-footer/theme.json` in the agent dir (`~/.pi/agent` by default, or `PI_CODING_AGENT_DIR` when set):
620
+
621
+ ```json
622
+ {
623
+ "colors": {
624
+ "model": "accent",
625
+ "shellMode": "accent",
626
+ "path": "#00afaf",
627
+ "gitClean": "success",
628
+ "thinking": "thinkingOff",
629
+ "thinkingMinimal": "thinkingMinimal",
630
+ "thinkingLow": "thinkingLow",
631
+ "thinkingMedium": "thinkingMedium"
632
+ },
633
+ "icons": {
634
+ "auto": "↯",
635
+ "warning": ""
636
+ }
637
+ }
638
+ ```
639
+
640
+ Colors can be:
641
+ - **Theme color names**: `accent`, `muted`, `dim`, `text`, `success`, `warning`, `error`, `border`, `borderAccent`, `borderMuted`
642
+ - **Hex colors**: `#ff5500`, `#d787af`
643
+
644
+ Icons can be any string, including `""` when you want to suppress a specific glyph entirely.
645
+
646
+ For npm package installs, this documented agent-dir file is separate from the package files under `~/.pi/agent/npm/node_modules`. The extension reads the agent-dir override first, then falls back to a `theme.json` colocated with the loaded extension file. Use `/reload` or restart Pi after creating or editing `theme.json`.
647
+
648
+ See `theme.example.json` for all available options.