omp packages

@wierdbytes/pi-statusline0.9.0

Minimal modular statusline extension for pi coding agent

GitHub Actions Published 13 days ago MIT ~834 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

@wierdbytes/pi-statusline

Minimal Tokyo Night Storm statusline for pi. Renders a compact one-line status row above the editor, with the editor's own top/bottom borders stripped so the two visually merge into a single cluster.

@wierdbytes/pi-statusline demo

Sections (each appears only when relevant; ordering and visibility are fully configurable โ€” see Layout below):

  • Model โ€” ๐Ÿค– plus the active model's display name (e.g. Opus 4.7). Claude and anthropic/ prefixes are stripped for brevity. The optional thinking segment (๐Ÿง  + level) renders inline after the model name when the active model is reasoning-capable and the Model: show thinking sub-toggle is on. Thinking is a sub-segment of the model block โ€” they always render together and reorder as one unit (mirrors how the hit-rate and savings segments live inside the cache block).

  • Path โ€” up to the last three segments of cwd with a โ€ฆ/ prefix. Parent segments in gray, current directory in purple.

  • Git โ€” branch name plus a clean/dirty marker (โœ“ green / โœ— red). Hidden when not in a git repo.

  • Context โ€” current context-window usage reported by pi, printed as pct%: used[โ–“โ–‘โ–‘โ–‘]remaining against the model's full context window with a colored progress bar. Color shifts green โ†’ yellow โ†’ red as you approach the limit. While usage is temporarily unknown immediately after compaction, the block shows ? markers instead of stale pre-compaction values.

  • Cost โ€” session total in USD when greater than zero.

  • Cache โ€” prompt-cache efficiency for the current session branch, e.g. 99.9% (200k/200) -$0.86 ๓ฐ”Ÿ 4:21 (icons are shown with the Nerd Font icon set only). Three segments, each with its own sub-toggle:

    • Hit rate โ€” cacheRead / (input + cacheRead + cacheWrite), green at โ‰ฅ 98.0%, yellow from 90.0% to 97.9%, red below 90.0%. The parentheses show tokens served from cache vs. tokens that were not (input + cacheWrite).
    • Savings โ€” what prompt caching saved (gray -$0.86) or cost extra (red +$0.15) compared to sending the same prompts without caching. Per assistant message: ฮ” = (cost.input + cost.cacheRead + cost.cacheWrite) โˆ’ (input + cacheRead + cacheWrite) ร— inputPrice. The actual side is pi's own billing, so 5m vs 1h cache writes (usage.cacheWrite1h, billed at 2ร— input) and pricing tiers are already accounted for; output tokens cancel out. The input price is taken from the message (cost.input / input), falling back to the model registry when a message has no uncached input. pi's cache-warming requests (cache_warm usage entries) exist only because of caching, so their full cost is added to ฮ” as overhead; they don't count towards the hit rate.
    • Expiry timer โ€” countdown until the provider evicts the prompt cache (m:ss, ticks every second): gray above 0:30, yellow up to 0:30, red 0:00 once expired (the hourglass empties). The lifetime restarts on every request that reads or writes the cache โ€” real requests (from the moment they are sent, not when they finish) and pi's cache warming refreshes. Lifetime comes from the model's promptCache tiers: the long tier when the request reported 1h cache writes or PI_CACHE_RETENTION=long, the short tier otherwise. While /warmer is on, the timer is followed by ๏‹ฑ (* in the other icon sets), e.g. ๓ฐ”Ÿ 4:52 ๏‹ฑ.

    Hidden until the provider has read from or written to the cache.

  • Stash โ€” ๐Ÿ“ฆ N showing how many prompts are saved in the stash history (see below). Hidden when empty.

  • Subagents โ€” ๐Ÿค– agents N/M chip when @tintinweb/pi-subagents is loaded and at least one agent is active. N is the number currently running, M = N + queued. The chip clears as soon as every agent reaches a terminal state. Failures and long-running completions surface as one-shot toasts above the row โ€” see Subagents bridge.

Inspired by pi-powerline-footer by @nicobailon โ€” the original brought the statusline-as-footer idea to pi. This extension is a from-scratch take that focuses on just that footer (skipping the bash mode, working vibes, and welcome overlay pieces).

Layout

The statusline ships with eight reorderable blocks: model, path, git, context, cost, cache, chips, and stash. The leading โ”€ divider is always first; everything else can be reordered or hidden via the Layout tab in the settings overlay (/statusline), or through the imperative /statusline layout ... subcommands.

The Layout tab lists each block as its own row, in the current order. The right-hand value cell is a checkbox: [โœ“] when the block is visible, [ ] when hidden. Enabled rows render in the active text color; disabled rows fade to gray.

Direct Layout-tab key bindings:

  • space โ€” toggle the focused block's visibility.
  • alt+โ†‘ / alt+โ†“ โ€” swap the focused block with its neighbour. Focus follows the moved row, persistence is immediate, and the separator field at the bottom is non-reorderable so it doesn't get in the way.
  • enter โ€” open the block's sub-menu only if the block has block-specific knobs (currently model and cache). For every other block (path, git, context, cost, chips, stash) Enter is a no-op and the footer hint doesn't advertise it.

Sub-menu contents (Enter on the row):

  • (model) Show thinking level โ€” inline thinking segment after the model name. Only renders for reasoning-capable models anyway.
  • (cache) Show hit rate / Show savings / Show expiry timer โ€” individual sub-toggles for the three segments inside the cache block.

Visibility lives on the Layout tab (space), not inside the sub-menu; reorder lives on the Layout tab (alt+โ†‘โ†“), not inside the sub-menu. This keeps the sub-menu tightly scoped to settings that only make sense for one specific block.

At the bottom of the Layout tab:

  • Separator โ€” glyph rendered between visible blocks. Built-in choices: โ”‚ (default), ยท, โ–Ž, :, (space). Hand-edit ~/.pi/agent/wierd-statusline/events.json for anything else (the loader clamps to 1โ€“2 visible columns; newlines/tabs are stripped).

Imperative shortcuts โ€” same persistence bus the modal uses:

  • /statusline layout โ€” print the active order, e.g. model > path > git! > context > cost > cache > chips > stash (7/8 visible) (a trailing ! marks a disabled block).
  • /statusline layout reset โ€” restore defaults.
  • /statusline layout toggle <block> โ€” flip one block's visibility.
  • /statusline layout move <block> <up|down|top|bottom> โ€” reorder.

The layout slice is persisted alongside the other knobs in ~/.pi/agent/wierd-statusline/events.json (schema version: 2). Upgrading from a version: 1 file is transparent: the missing layout slice is injected with defaults and the file is rewritten on first load, so users coming from 0.6.x see no visible change. Since 0.8.0 the old tokens counter block is replaced by cache: a persisted tokens entry keeps its slot and visibility but renders the cache block instead (the old per-counter sub-toggles are dropped).

Editor stash

Press Alt+S to save the editor's contents and clear the input, type a quick prompt, and the stashed text auto-restores when the agent finishes โ€” but only if the editor is empty at that point (otherwise the stash is preserved and a notification reminds you to clear and Alt+S to restore). Pressing Alt+S again with text in the editor updates the live stash slot. The statusline's ๐Ÿ“ฆ N indicator reflects the current stash-history depth.

Every stash is pushed onto a persisted MRU history (12 entries max, stored at ~/.pi/agent/wierd-statusline/stash-history.json). Press Ctrl+Alt+S to open a picker overlay; navigate with arrows, Enter inserts the selected entry (replace/append/cancel prompt if the editor is non-empty), d deletes the selected entry, and Esc cancels.

Install

pi install npm:@wierdbytes/pi-statusline

Restart pi to activate.

Commands

  • /statusline on โ€” enable the statusline
  • /statusline off โ€” disable, restoring pi's default editor and footer
  • /statusline toggle โ€” toggle
  • /statusline footer on|off|toggle โ€” show/hide pi's built-in footer beneath the editor (hidden by default)
  • /statusline events [status|log|clear|toast-ms <level> <ms>] โ€” inspect / tune the chip+toast pipeline
  • /statusline icons [nerd-font|plain|ascii|minimal|emoji|status] โ€” switch the icon set used for model / thinking / stash / toast levels / subagents chip
  • /statusline layout [status|reset|toggle <block>|move <block> <up|down|top|bottom>] โ€” configure block order + visibility (see Layout)
  • /warmer โ€” toggle forced prompt-cache warming for the current session (off by default, resets on new / resumed / forked sessions). While on, pi's cache-warming decisions are overridden: a refresh is sent whenever the avoided cache miss exceeds the refresh cost by at least $0.01, ignoring pi's idle continuation estimate (15%) and its $0.05 threshold. pi's own limits still apply: the model needs a known cache lifetime, idle warming needs cacheWarming: "idle" in pi settings, and warming stops after 30 minutes idle / 60 minutes of an active run.
  • /statusline subagents [status|on|off|long-ms <ms>|toast-failure <on|off>|toast-long <on|off>|toast-scheduled <on|off>] โ€” control the subagents bridge (see below)

Icon sets

The statusline ships five built-in icon sets you can swap with /statusline icons <set> (or via the Icon set field on the Display tab of the settings overlay). The choice persists in ~/.pi/agent/wierd-statusline/events.json.

Set Sample row Notes
nerd-font (default) โ”€ sonnet-4.5 medium โ”‚ โ€ฆ โ”‚ master โœ“ โ”‚ 45%: โ€ฆ โ”‚ $0.12 โ”‚ 2 Nerd Font glyphs (PUA codepoints). Requires a Nerd Font configured in your terminal.
plain โ”€ โ—† sonnet-4.5 โ—‡ medium โ”‚ โ€ฆ โ”‚ master โœ“ โ”‚ 45%: โ€ฆ โ”‚ $0.12 โ”‚ โ–ค 2 Geometric Unicode glyphs that ship with every modern font. No install required.
ascii - [m] sonnet-4.5 [t] medium | โ€ฆ | master ok | 45%: โ€ฆ | $0.12 | [s] 2 Bracketed ASCII labels. Survives broken fontconfig, ssh sessions, and log files.
minimal โ”€ โ–ธ sonnet-4.5 ยทยทยท medium โ”‚ โ€ฆ โ”‚ master โœ“ โ”‚ 45%: โ€ฆ โ”‚ $0.12 โ”‚ โ‰ก 2 Single-character symbolic glyphs. Powerline / starship aesthetic.
emoji โ”€ ๐Ÿค– sonnet-4.5 ๐Ÿง  medium โ”‚ โ€ฆ โ”‚ master โœ“ โ”‚ 45%: โ€ฆ โ”‚ $0.12 โ”‚ ๐Ÿ“ฆ 2 Original pre-facelift look. Kept for users who prefer emoji.

git (โœ“ / โœ—) and the inline subagent completion / failure marks (โœ“ / โœ—) intentionally stay plain Unicode regardless of the active set โ€” they look identical everywhere and read as state, not decoration.

Subagents bridge

When @tintinweb/pi-subagents is installed alongside this extension, the statusline subscribes to the subagents:* lifecycle events on pi.events and renders an aggregated agents N/M chip in the chips segment whenever at least one agent is active (the chip's icon follows the active icon set). The bridge runs entirely on the statusline side โ€” no changes are required in pi-subagents itself, and the existing ๐Ÿ”ด Agents โ€ฆ widget above the editor keeps rendering its rich tree.

Defaults:

Behaviour Default
Show summary chip while agents are running on
Toast on failure / abort / stop on (error level, sticky until dismissed)
Toast on completions โ‰ฅ 30 s on (success level)
Toast on subagents:scheduled off
Long-completion threshold 30 000 ms

Tune via /statusline subagents โ€ฆ. Settings persist in ~/.pi/agent/wierd-statusline/events.json next to the toast-timeout map. /statusline subagents status prints the live counts plus the current config.

Shortcuts

  • Alt+S โ€” stash editor text / restore stash when editor is empty
  • Ctrl+Alt+S โ€” open the stash history picker