@nicknisi/pi-composer

The whole bottom of pi's screen: input box, footer, working message and spinner, as configurable styles and slots

Packages

Package details

extension

Install @nicknisi/pi-composer from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@nicknisi/pi-composer
Package
@nicknisi/pi-composer
Version
1.0.1
Published
Nov 19, 2026
Downloads
525/mo · 258/wk
Author
nicknisi
License
MIT
Types
extension
Size
358.7 KB
Dependencies
0 dependencies · 3 peers
Pi manifest JSON
{
  "extensions": [
    "./index.ts"
  ]
}

Security note

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

README

@nicknisi/pi-composer

The whole bottom of pi's screen as one configurable system: the input box, the footer, the row above the box, and how pi's working message and spinner look. Pick a style, then override any part of it.

// ~/.pi/agent/configs/composer.json
{ "style": "slab" }

Composer 1.0 replaces three packages: the 0.x composer (input box), @nicknisi/pi-statusline (footer) and @nicknisi/pi-spinner (working verbs). See Migrating from 0.x.

Install

pi install npm:@nicknisi/pi-composer

Styles

Style Look
box (default) A rounded box with the session label on its top border, the working line above it, and one status row below: model, thinking, cost, lines changed, 5h/7d usage, statuses, context bar, branch and PR.
slab The same status row, with a shaded slab instead of a box (after the Codex composer), › as the prompt symbol, and │ 12s │ esc to interrupt on the working line.

Both styles show the same information in the same format; they differ only in the input's chrome. A style is just a set of config values, so anything it does you can undo in your own file. slab changes these, on top of box:

{
  "prompt": { "symbol": "›", "color": "text", "whenBusy": "symbol" },
  "box": { "border": "slab", "padX": 1, "padY": 0, "focusColor": null, "busyEffect": "off" },
  "slots": { "above": ["working", "elapsed", "text:esc to interrupt"], "topRight": [] },
  "toasts": true,
}

An unknown style name (including the pre-1.0 names classic, keycaps, toad, starship and sidepanel) gets a warning and falls back to box.

Commands

Command What it does
/composer Reloads composer.json, reports any problems, and says whether usage data is reachable. Run it after editing the file.
/composer style <name> Tries a style for this session only. It shows the style as shipped, with your overrides paused. Nothing is written to composer.json.
/composer style Goes back to the style and overrides in your file.
/composer preview Steps through every state (typing, paste, working, tool, prompt, near-full, scrolled) with sample data, so you can judge a look without running an agent. Not available while pi is working.

Configuration

One file, ~/.pi/agent/configs/composer.json. Every key is optional: put in only what you want to change. Values resolve as built-in defaults ← the style ← your overrides; objects merge key by key, lists (slots, spinner frames) replace. Run /composer after editing to apply it. Keys starting with $ ($schema, $comment) are ignored.

Every key, with its default (the box style). The items entries are examples; items have no overrides by default.

{
  "style": "box",

  // The symbol before your input, and what happens to it while pi works.
  "prompt": {
    "symbol": "❯",
    "color": "accent",
    "whenBusy": "spinner", // "spinner": the symbol becomes the spinner. "symbol": it stays.
    "states": {}, // per-state symbol/colour, e.g. { "typing": { "symbol": "›" }, "nearFull": { "color": "error" } }
  },

  "spinner": {
    "frames": "dots", // a preset name, or your own list: ["◐", "◓", "◑", "◒"]
    "intervalMs": 0, // ms per frame; 0 = the preset's own speed
    "color": "accent",
  },

  "box": {
    "border": "rounded", // rounded | square | heavy | rule | slab | none
    "color": "border", // border colour
    "focusColor": "accent", // border colour while this tmux pane has focus; null turns it off
    "background": "userMessageBg", // slab only: background theme token
    "padX": 1, // spaces inside the box, left and right
    "padY": 0, // blank rows inside the box, top and bottom
    "placeholder": null, // dim text in an empty input, e.g. "Ask pi anything"
    "busyEffect": "pulse", // off | pulse | shimmer | rainbow, while pi works
    "effectColor": "accent", // colour of the pulse and shimmer effects
    "effectPeriodMs": 2000, // ms for one pulse or sweep (rainbow too); at least 1
    "states": {}, // per-state border colour, e.g. { "nearFull": { "color": "context" } }
    "menuGap": 0, // blank rows between the box and the autocomplete menu
    "menuIndent": 1, // columns the autocomplete menu is indented
  },

  // The working message (folded in from pi-spinner).
  "working": {
    "messages": "verbs", // "verbs": a random fun verb per turn. "default": pi's own. Or your own list.
    "shimmer": true, // a highlight band sweeping across the message
    "shimmerPeriodMs": 2000, // ms for one sweep; at least 1
    "bandWidth": 6, // width of the highlight band, in characters; at least 1
    "baseColor": "muted", // the message colour
    "highlightColor": "text", // the band colour
  },

  // What goes where. Each slot is a list of items; a nested list is a group.
  "slots": {
    "above": ["working"],
    "topLeft": [],
    "topRight": ["label"],
    "bottomLeft": [],
    "bottomRight": [],
    "rightPrompt": [],
    "footerLeft": [["model", "thinking"], "cost", "lines", "usage", "statuses", "context"],
    "footerRight": [["branch", "pr"]],
  },

  // Per-item options (examples, see Item options below).
  "items": {
    "context": { "show": "bar", "barWidth": 20, "label": "ctx" },
    "statuses": { "hide": ["mcp"] },
    "branch": { "priority": 99, "icon": "⎇", "prefix": "on ", "color": "success" },
  },

  "icons": "nerd", // nerd | unicode | ascii (default glyphs; items.<name>.icon overrides)
  "separator": " │ ", // between items
  "groupSeparator": " ", // between items in a group
  "toasts": false, // short-lived messages over the footer (e.g. "pasted 42 lines")
}

Validation

Problems are reported when the file loads (and by /composer), never fatal:

  • An unknown key, slot, item or state warns with a suggestion (unknown item "brnch" (did you mean "branch"?)), and is ignored.
  • A value of the wrong type or outside its list warns and falls back to the style's value.
  • Numbers can't be negative. box.padX, padY, menuGap and menuIndent must be whole numbers, and box.effectPeriodMs, working.shimmerPeriodMs and working.bandWidth must be at least 1.
  • An unknown style warns and uses box.
  • 0.x keys (boxedView, prefix, spinnerStyle, …) are an error; see Migrating from 0.x.
  • A file that isn't valid JSON keeps the previous config until it parses again.

Slots

Slot Where
above A row above the box. It's a pi aboveEditor widget, so it stays on screen while a dialog replaces the input.
topLeft, topRight Inlays on the box's top border (or a row above the input for slab and none).
bottomLeft, bottomRight Inlays on the bottom border.
rightPrompt Right-aligned on the first input line, like zsh's RPROMPT. Hidden when your text gets within two cells of it.
footerLeft, footerRight The footer row. With both empty there is no footer row.

A row with nothing to say takes no space: no working message while idle, no cost before any spend, no branch outside git. A row whose only remaining items are text: literals is hidden too, so ["working", "text:esc to interrupt"] only shows while pi works.

Items

Item Shows Shorter forms
label Text pushed over composer:set-label, else the session name truncated
model Claude Opus 5.5 Opus 5.5, opus
thinking Thinking level, on reasoning models
cost Session cost, once it's above $0.001
lines Lines added/removed by edits (+38/-12)
usage Anthropic 5h and 7d plan windows with reset times (items.usage.showBelow hides it until a window drops below that %) 5h 62% 7d 81%, 5h 62%
context Context left: show is bar (an elastic meter), percent, or tokens 71% ctx, 71%
branch Git branch truncated
pr Open PR for the branch (#226, a link), via gh
cwd Working directory name
statuses Every extension status (ctx.ui.setStatus), minus items.statuses.hide first status + count (? ctrl+. to answer +1), then truncated
status:<key> One extension status, e.g. status:answer-hint
working pi's working indicator: spinner and message, and also pi's retry and compaction notices truncated
elapsed Time since pi started working
tokens Output tokens this run (1,284 tokens) 1.3K tok
tps Tokens per second, with a sparkline rate only
hints Keys you can press in the current state, from your keybindings (none while a dialog shows its own) fewer keys
mode A state badge: READY, INSERT, WORKING, ASK, …
paste 3 lines · 1 paste while the input has several lines or a collapsed paste 3L
scroll ↓ scrolled · ctrl+end to follow while the transcript is scrolled back shorter
text:… Literal text, e.g. text:esc to interrupt

Item options

Set under items.<name>, e.g. "items": { "model": { "color": "muted" } }. Every item takes:

Option Default What it does
priority see When a row is too narrow Higher survives longer when a row runs out of room.
color the item's own Any colour.
icon see Icons Glyph before the item; "" hides it.
prefix none Text before the item, painted dim, e.g. "on ".
suffix none Text after the item, painted dim.

A few items take more:

Item Option Default What it does
context show bar bar (an elastic meter with 71% ctx (58K)), percent (71% ctx) or tokens.
context barWidth 20 The widest the bar may grow.
context label ctx Words after the percentage, e.g. "context left"; "" for none.
statuses hide [] Extension status keys to leave out, e.g. ["mcp"].
usage showBelow none Only show usage when the 5h or 7d window has less than this % left.

Icons

icons picks the default glyphs; items.<name>.icon overrides any one of them.

icons Glyphs
nerd Model family icon (Opus, Sonnet, Haiku, other), plus cost , lines , usage 󰉁, context 󰧑 and branch . Needs a Nerd Font.
unicode model ◆ and branch ⎇.
ascii None.

When a row is too narrow

One rule for every row: the lowest-priority item gives way first. It switches to its shorter forms one at a time, then truncates (if it can) or disappears, before the next item is touched. Once the row fits, higher-priority items get their fuller forms back if there's room, and elastic items (the context bar) take whatever width is left. Default priorities, highest first: working 95, scroll 92, mode 90, context 88, elapsed 85, model 80, paste 78, thinking 70, label 65, pr 55, branch 50, tokens 48, statuses 45, cwd 45, hints 40, tps 35, cost 30, lines 25, usage 20, text: 5. Change any of them with items.<name>.priority.

States

prompt.states takes symbol and color per state, and box.states takes color (the border). Several states can apply at once (typing while context is nearly full); they apply in this order, later winning:

idle → typing → paste → scrolled → nearFull → working → tool → prompt

nearFull means Checkpoint published warning or error for the context meter, or (without Checkpoint) less than 15% context left. prompt means pi is waiting on a dialog (ui_prompt_start).

Colours

Any theme token (accent, border, muted, dim, success, warning, error, thinkingMax, syntaxKeyword, …) or a #rrggbb hex value. "context" means the current context colour (Checkpoint's policy colour when it publishes one), which is how box.states.nearFull.color: "context" turns the border amber, then red.

Spinner presets

dots, disc, moon, star, orbit, corners, triangle, line, pulse, scanner, mini-scanner. Or give spinner.frames your own list. There's only ever one spinner on screen: with prompt.whenBusy: "spinner" the prompt symbol spins and the working item shows just the message; with "symbol" the working item carries the spinner.

Extension API

Over pi's shared event bus (pi.events), so nothing needs to import composer.

// Show text in the `label` item (wins over the session name). Empty or absent text clears it.
pi.events.emit('composer:set-label', { text: `⏱ ${elapsed}` });

// Composer asks on every session start; answer so load order doesn't matter.
pi.events.on('composer:label-request', () => pi.events.emit('composer:set-label', { text: currentLabel() }));

Composer also emits composer:context-bar (true when any slot shows context, false on shutdown) and answers composer:request-context-bar with it. Checkpoint uses this to hide its own context widget, and colours composer's meter through self-compact:context-color.

Other behaviour

  • Paste again to expand: pi collapses large pastes (more than 10 lines or 1000 characters) into [paste #N +X lines]. Paste the same content again while the marker is in the input and it expands inline.
  • History recall puts the cursor at the end: pi places the cursor at the start of a message recalled with Up. Composer moves it to the end, so you can keep typing.
  • Focus indicator: box.focusColor colours the border while this tmux pane has terminal focus (needs tmux focus-events on).
  • Idle means idle: composer runs no timers unless something is animating (busy spinner, busy effect, shimmer, a pending toast).

Migrating from 0.x

Composer 1.0 reads a new nested config. A composer.json with 0.x keys gets one error naming them, and those keys are ignored.

0.x key 1.0
boxedView: false box.border: "rule"
corners box.border (rounded, square, heavy)
boxPadX box.padX
borderColor, focusedBorderColor, focusIndicator: false box.color, box.focusColor, box.focusColor: null
prefix, prefixColor prompt.symbol, prompt.color
spinner: false prompt.whenBusy: "symbol"
spinnerStyle, spinnerFrames, spinnerIntervalMs, spinnerColor spinner.frames (preset name or list), spinner.intervalMs, spinner.color
glow: false, glowStyle, glowColor, glowPeriodMs box.busyEffect (off, pulse, shimmer, rainbow), box.effectColor, box.effectPeriodMs
rainbowPeriodMs box.effectPeriodMs with busyEffect: "rainbow"
sessionName: false remove label from its slot
sessionNamePosition, sessionNameBorder move label to topLeft, topRight, bottomLeft or bottomRight
sessionNameColor items.label.color
sessionNameFormat, sessionNameMaxWidth labels are cut into the border as text and truncate to fit
menuGap, extraMenuIndent box.menuGap, box.menuIndent
statusline.json hiddenStatuses items.statuses.hide
spinner.json shimmer, baseColor, … working.* (see the spinner package README)

Remove @nicknisi/pi-statusline and @nicknisi/pi-spinner from your pi packages; their last releases are stubs that only print a notice. Statusline's tmux status files are written by fleet's pi hook.

Dependencies

Peer dependencies: @earendil-works/pi-coding-agent, @earendil-works/pi-tui, @earendil-works/pi-ai (types). External commands, all optional and async: gh (PR lookup), macOS security (Anthropic token from the keychain), tmux (focus). Usage is fetched in-process and cached in <agent dir>/cache/composer-usage.json.

Caveats

  • pi internals: paste-expand and history-cursor reach into pi-tui Editor privates (state, pastes, pasteCounter, historyIndex, …) and override the TS-private handlePaste and navigateHistory. The box is drawn by re-wrapping pi's stock editor render, detecting its ─ rules and ↑/↓ N more hints by string matching. A pi-tui change to either can break them.
  • One editor: pi's setEditorComponent, setFooter and working indicator are last-call-wins. Another extension that replaces any of them after composer takes that piece over.
  • Narrow panes: if the input would be narrower than 4 cells, composer falls back to pi's stock editor for that frame.
  • pi's editorPaddingX setting doesn't apply inside composer (it would stack with composer's own padding); use box.padX.
  • Usage is shown only for Anthropic models and needs an Anthropic OAuth token (pi's auth.json, or Claude Code's keychain entry on macOS). /composer reports why it's missing.
  • Colour effects (pulse, shimmer) need theme tokens that resolve to truecolor; otherwise they fall back to a steady colour. rainbow always uses truecolor.
  • Glyphs: icons: "nerd" needs a Nerd Font; tps and the meters use block characters.