← Catalog

@juanibiapina/pi-powerbar

Pi extension that renders a persistent powerline status bar with left/right segments updated via events

Extension

Install

Install with PiG

pig install npm:@juanibiapina/pi-powerbar

Install with Pi

pi install npm:@juanibiapina/pi-powerbar
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./src",
    "node_modules/@juanibiapina/pi-usage/index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.17.0 (README.md). PiG does not review it.

pi-powerbar

A pi extension that renders a persistent powerline-style status bar with left-aligned and right-aligned segments.

Any other pi extension can update segments by emitting a single powerbar:update event — no imports or dependencies required.

Install

pi install npm:@juanibiapina/pi-powerbar

⚠️ Load Order: pi-powerbar must appear after pi-extension-settings and before any segment-emitting extensions in your packages array in ~/.pi/settings.json. It registers settings at load time (requiring pi-extension-settings to already be loaded), and segment emitters send events that pi-powerbar must be ready to receive.

Usage

The powerbar renders a widget with two sides, like tmux:

powerbar screenshot

Producing segments

Any extension can register and update a segment. First, register the segment so it appears in the settings menu:

pi.events.emit("powerbar:register-segment", {
  id: "git-branch",
  label: "Git Branch",
});

Then update it with data:

pi.events.emit("powerbar:update", {
  id: "git-branch",
  text: "main",
  icon: "⎇",
  color: "accent",
});

Segments can include a progress bar with an optional block count hint:

pi.events.emit("powerbar:update", {
  id: "context-usage",
  text: "",
  suffix: "30%",
  bar: 30,              // progress value 0–100
  barSegments: 10,      // optional: number of discrete blocks in blocks mode
  color: "muted",
});

To remove a segment:

pi.events.emit("powerbar:update", {
  id: "git-branch",
  text: undefined,
});

Built-in segments

Segment IDDescription
git-branchCurrent git branch (refreshes after bash commands)
tokensCumulative input/output tokens, cache reads (R) and writes (W), the latest assistant request's cache hit rate (CH), and session cost (e.g. ↑3.0k ↓400 R20k W2.0k CH80.0% $0.15). R and W are session totals; CH covers only the most recent request
context-usageContext window usage as a progress bar with percentage
providerCurrent LLM provider name (e.g. anthropic, openai)
modelCurrent model name and thinking level. With a virtual model, also the model and thinking level that answered last (e.g. auto · high → claude-haiku-4-5 · medium)
sub-hourlyHourly subscription usage from pi-usage
sub-weeklyWeekly subscription usage from pi-usage

Subscription usage resolves on session start, model selection, and turn end. It has no recurring refresh timer. All same-user Pi processes on one machine share endpoint freshness, leases, and retry deadlines through pi-usage.

Configuration

Settings are managed through pi-extension-settings and can be changed via the /extension-settings command in pi.

SettingDescriptionDefault
Left segmentsSegments shown on the left side (ordered multi-select menu)git-branch,tokens,context-usage
Right segmentsSegments shown on the right side (ordered multi-select menu)provider,model,sub-hourly,sub-weekly
SeparatorString drawn between segments on the same side│
PlacementWhere the powerbar appears (belowEditor or aboveEditor)belowEditor
Bar styleVisual style of progress bars (continuous or blocks)blocks
Bar widthWidth of progress bars in characters (4–24)10

The left and right segment settings open an interactive menu where you can toggle segments on/off and reorder them with Shift+↑/↓. All segments registered via powerbar:register-segment appear as options. Segments not listed in either side are ignored.

Development

npm install
npm run check    # lint + typecheck
npm run build    # compile to dist/
npm run dev      # watch mode

Testing locally against your own pi

To run pi with the powerbar loaded from this checkout instead of your globally installed version:

gh pr checkout <n>       # optional: test a branch/PR
scripts/test-local.sh    # launches pi with this repo's powerbar

scripts/test-local.sh seeds a throwaway agent config (under .local/) from your real global config, swaps the powerbar package entry to this repo, and launches pi with PI_CODING_AGENT_DIR pointing at it. Your global ~/.pi/agent config is never modified. Extra arguments pass through to pi.

It inherits your real enabledModels (so every model you use is available) but defaults to Claude Sonnet 4.6 at medium thinking on the anthropic provider (your Claude subscription). Override with PI_TEST_MODEL, PI_TEST_PROVIDER, and PI_TEST_THINKING. It symlinks your auth.json and model catalog; pi-usage uses its normal same-user machine state. The script writes a minimal SYSTEM.md that marks the instance as a throwaway test on a live subscription.

License

MIT