pi-basic-statusline

Minimal statusline for the Pi coding agent: model name, git branch, context usage, session running time, and session name/id.

Packages

Package details

extension

Install pi-basic-statusline from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-basic-statusline
Package
pi-basic-statusline
Version
0.1.0
Published
Aug 19, 2026
Downloads
169/mo · 20/wk
Author
gmartinsnull
License
MIT
Types
extension
Size
24 KB
Dependencies
0 dependencies · 0 peers
Pi manifest JSON
{
  "extensions": [
    "./src/index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-basic-statusline

A minimal statusline extension for the Pi coding agent.

Shows, left to right:

 🤖 claude-opus-4-6  🌿 main  🪟 50k / 128k - 40%  🕒 12m  🆔 my-session

Rendered as colored powerline-style blocks by default (bold blue model, italic tan git branch, purple context, green time, pink session), or plain -separated text — see Theming below.

  • Model — active model name (provider prefix like anthropic/ stripped)
  • Git branch — omitted if you're not in a git repo
  • Contextused / window - percent%
  • Session time — how long the current session has been running, ticks every 30s
  • Session name/id — the name set via /name <name> (or pi.setSessionName() from another extension); falls back to a short session id if no name has been set, or unnamed if neither is available

Theming

The color palette (top of src/index.ts) is ported from a statusline.sh-generated Claude Code script — same 24-bit powerline segment style, same colors, plus one new color for the session-name segment.

Switch styles at runtime, no restart needed:

/basic-statusline-theme powerline   # colored blocks (default)
/basic-statusline-theme plain       # plain "│"-separated text

Use plain if the colored blocks look misaligned or garbled in your terminal — see "A note on porting the coloring" below for why that could happen.

Set a default with an env var (checked on startup):

export PI_BASIC_STATUSLINE_THEME=plain   # or "powerline"

NO_COLOR (if set to anything) always forces plain, per the NO_COLOR convention, regardless of the above.

Customize colors by creating ~/.pi/pi-basic-statusline.theme.json. Omit any segment or key you don't want to change:

{
  "model": { "fg": [200, 160, 255], "bg": [40, 30, 50], "bold": true },
  "git":   { "italic": false }
}

Valid segment keys: model, git, context, time, session. Each takes fg/bg as [r, g, b] (0-255) and optional bold/italic booleans. Restart pi (or start a new session) to pick up changes.

The default session color is a coral/rose (fg: [224, 138, 148], bg: [54, 30, 34], hue ~353°) chosen to sit in the one open gap on the hue wheel — model/git/ context/time land at roughly 207°/42°/277°/125°, leaving 300°–40° (red- magenta) empty. An earlier teal pick sat at 184°, wedged only 23° from model's blue, which is why it was hard to tell apart at a glance; this one sits ~65-75° from its nearest neighbors on both sides. A couple of alternatives, if coral isn't your taste — drop the relevant block into the theme file above:

{ "session": { "fg": [214, 120, 130], "bg": [50, 26, 30] } }   // deeper rose-red
{ "session": { "fg": [170, 180, 190], "bg": [40, 42, 46] } }   // muted slate gray

A note on porting the coloring

Claude Code statuslines are external scripts — their raw stdout (ANSI codes and all) gets printed straight to the terminal by Claude Code, so color always works. Pi's footer instead runs as a pi-tui Component: ctx.ui.setFooter() takes a factory returning { render(width): string[], invalidate(), dispose? }, and pi's layout engine calls .render() on that object directly. Raw ANSI color codes inside the returned strings are fine — pi-tui appends its own SGR reset at the end of each line — so the palette itself ports cleanly. render() must stay synchronous and each returned line must not exceed the given width, which this extension handles by measuring/truncating on visible width (ANSI-stripped) before returning.

Status

Confirmed against pi's own docs and source (not guessed): the ctx.ui.setFooter Component API, ctx.model.id/contextWindow, ctx.sessionManager.getBranch(), ctx.sessionManager.sessionId, ctx.sessionManager.getSessionName(), and footerData.getGitBranch(). All five segments have been end-to-end tested against that shape.

One thing worth a quick glance: the context-usage segment estimates tokens used from the most recent assistant message's usage.input + cache fields in the session branch — this is a reasonable reading of the available data, but pi doesn't expose a single authoritative "context used" number the way Claude Code's statusline JSON does, so treat the percentage as a close estimate rather than an exact figure. Run /basic-statusline-debug to see the raw usage object it's reading from if a number looks off.

Local install (for development)

From inside this directory, run pi against the extension directly with no install step — pi loads TypeScript extensions via jiti, so there's no build required:

pi -e ./src/index.ts

That runs a single session with the extension loaded, without touching your global config. If the footer looks right, install it for real:

# Global — available in every pi session
pi install -l /absolute/path/to/pi-basic-statusline

# Or project-local — writes to .pi/settings.json in the current project
pi install -l /absolute/path/to/pi-basic-statusline --local

(If -l with a local path isn't accepted by your pi build, symlink or copy this folder into ~/.pi/agent/extensions/pi-basic-statusline/ instead — pi auto-discovers extensions there.)

Reload pi (/reload) or restart it to pick up changes while you iterate.

Publishing to pi.dev/packages

Once you're happy with it:

  1. Bump the version in package.json.
  2. Publish to npm:
    npm publish
    
  3. The pi-package keyword in package.json is what makes it eligible to be listed on the pi.dev/packages gallery — published packages with that keyword get picked up automatically.
  4. Once it's on npm, others install it with:
    pi install npm:pi-basic-statusline
    

Double check pi-basic-statusline is still free on npm right before you publish — package names can get claimed between now and then.

Uninstall

pi remove npm:pi-basic-statusline

or, for a local dev install, just remove the extension entry from ~/.pi/agent/settings.json / .pi/settings.json (whichever you used).