← Catalog

@nicknisi/pi-composer

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

Package

Install

Install with PiG

pig install npm:@nicknisi/pi-composer

Install with Pi

pi install npm:@nicknisi/pi-composer
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": [
    "./index.ts"
  ]
}

README

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

@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

StyleLook
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.
slabThe 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

CommandWhat it does
/composerReloads 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 styleGoes back to the style and overrides in your file.
/composer previewSteps 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

SlotWhere
aboveA row above the box. It's a pi aboveEditor widget, so it stays on screen while a dialog replaces the input.
topLeft, topRightInlays on the box's top border (or a row above the input for slab and none).
bottomLeft, bottomRightInlays on the bottom border.
rightPromptRight-aligned on the first input line, like zsh's RPROMPT. Hidden when your text gets within two cells of it.
footerLeft, footerRightThe 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

ItemShowsShorter forms
labelText pushed over composer:set-label, else the session nametruncated
modelClaude Opus 5.5Opus 5.5, opus
thinkingThinking level, on reasoning models
costSession cost, once it's above $0.001
linesLines added/removed by edits (+38/-12)
usageAnthropic 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%
contextContext left: show is bar (an elastic meter), percent, or tokens71% ctx, 71%
branchGit branchtruncated
prOpen PR for the branch (#226, a link), via gh
cwdWorking directory name
statusesEvery extension status (ctx.ui.setStatus), minus items.statuses.hidefirst status + count (? ctrl+. to answer +1), then truncated
status:<key>One extension status, e.g. status:answer-hint
workingpi's working indicator: spinner and message, and also pi's retry and compaction noticestruncated
elapsedTime since pi started working
tokensOutput tokens this run (1,284 tokens)1.3K tok
tpsTokens per second, with a sparklinerate only
hintsKeys you can press in the current state, from your keybindings (none while a dialog shows its own)fewer keys
modeA state badge: READY, INSERT, WORKING, ASK, …
paste3 lines · 1 paste while the input has several lines or a collapsed paste3L
scroll↓ scrolled · ctrl+end to follow while the transcript is scrolled backshorter
text:…Literal text, e.g. text:esc to interrupt

Item options

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

OptionDefaultWhat it does
prioritysee When a row is too narrowHigher survives longer when a row runs out of room.
colorthe item's ownAny colour.
iconsee IconsGlyph before the item; "" hides it.
prefixnoneText before the item, painted dim, e.g. "on ".
suffixnoneText after the item, painted dim.

A few items take more:

ItemOptionDefaultWhat it does
contextshowbarbar (an elastic meter with 71% ctx (58K)), percent (71% ctx) or tokens.
contextbarWidth20The widest the bar may grow.
contextlabelctxWords after the percentage, e.g. "context left"; "" for none.
statuseshide[]Extension status keys to leave out, e.g. ["mcp"].
usageshowBelownoneOnly 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.

iconsGlyphs
nerdModel family icon (Opus, Sonnet, Haiku, other), plus cost , lines , usage 󰉁, context 󰧑 and branch . Needs a Nerd Font.
unicodemodel ◆ and branch ⎇.
asciiNone.

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 key1.0
boxedView: falsebox.border: "rule"
cornersbox.border (rounded, square, heavy)
boxPadXbox.padX
borderColor, focusedBorderColor, focusIndicator: falsebox.color, box.focusColor, box.focusColor: null
prefix, prefixColorprompt.symbol, prompt.color
spinner: falseprompt.whenBusy: "symbol"
spinnerStyle, spinnerFrames, spinnerIntervalMs, spinnerColorspinner.frames (preset name or list), spinner.intervalMs, spinner.color
glow: false, glowStyle, glowColor, glowPeriodMsbox.busyEffect (off, pulse, shimmer, rainbow), box.effectColor, box.effectPeriodMs
rainbowPeriodMsbox.effectPeriodMs with busyEffect: "rainbow"
sessionName: falseremove label from its slot
sessionNamePosition, sessionNameBordermove label to topLeft, topRight, bottomLeft or bottomRight
sessionNameColoritems.label.color
sessionNameFormat, sessionNameMaxWidthlabels are cut into the border as text and truncate to fit
menuGap, extraMenuIndentbox.menuGap, box.menuIndent
statusline.json hiddenStatusesitems.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.