No description
  • TypeScript 100%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-21 17:09:02 -06:00
tests Support Pi theme markers in command statusline output 2026-10-21 17:09:02 -06:00
config.ts Fork: add model.provider to command-mode JSON payload 2026-08-31 12:20:24 -06:00
data.ts feat: show roundrobin leaf models from the session cache 2026-09-09 15:33:03 -06:00
index.ts Support Pi theme markers in command statusline output 2026-10-21 17:09:02 -06:00
LICENSE Fork: add model.provider to command-mode JSON payload 2026-08-31 12:20:24 -06:00
package.json feat: show roundrobin leaf models from the session cache 2026-09-09 15:33:03 -06:00
README.md Support Pi theme markers in command statusline output 2026-10-21 17:09:02 -06:00
render.ts Support Pi theme markers in command statusline output 2026-10-21 17:09:02 -06:00
roundrobin-cache.ts fix: follow provider-manager's per-session roundrobin cache 2026-09-10 14:06:04 -06:00

pi-cc-status (local fork)

Fork note: this is a local fork of upstream pi-cc-status (msdavid). The only change is that the command-mode JSON payload's model object now includes a provider field ({ id, display_name, provider }), so scripts can build a canonical provider/id name (e.g. roundrobin/default) instead of only having display_name/id. Upstream's schema mirrors Claude Code, which has no concept of provider, so this field is intentionally absent there. See data.ts for the change (search "Fork addition").

pi-cc-status

A Claude Code–style status line for the pi coding agent.

Two render modes, selected by config:

  • default (in-process): theme-integrated segment renderer — model, dir, thinking level, context-window bar + cache %, git, session, cost, tokens, version, providers. Configurable layout, colors, thresholds, and an accessibility mode.
  • command (Claude-Code-style): spawns a user script, pipes a JSON status object to its stdin, and displays its stdout. Existing Claude Code statusline scripts work verbatim — same JSON schema, same contract.

Install

# project-local (writes to .pi/settings.json)
pi install -l npm:pi-cc-status

# global (writes to ~/.pi/agent/settings.json)
pi install npm:pi-cc-status

Restart pi (or /reload) after installing. Pi loads the extension via jiti on next start — no build step.

Try without installing:

pi -e npm:pi-cc-status

Commands

Command Action
/cc-status Toggle on/off
/cc-status:reload Re-read the config file
/cc-status:edit Open the current config in the editor

Config

Pi exposes no settings-reading API to extensions, so this package manages its own config file. Resolution is defaults ← global ← project (field-by-field merge):

  • global: ~/.pi/agent/cc-status/config.json
  • project: <cwd>/.pi/cc-status/config.json

Both files are optional. Example with all fields:

{
  "enabled": true,
  "segments": ["model", "dir", "effort", "context", "git"],
  "separator": " | ",
  "bar": { "width": 10, "filled": "█", "empty": "░" },
  "thresholds": { "warning": 80, "error": 95 },
  "refreshSeconds": 2,
  "showCachePercent": true,
  "accessibility": {
    "enabled": false,
    "labels": true,
    "plainBar": true
  },
  "command": null,
  "commandRefreshSeconds": null
}
Field Default Description
enabled true Master on/off
segments ["model","dir","effort","context","git"] Ordered segment ids (default mode only)
separator " | " String between segments
bar.width 10 Context-bar cell count
bar.filled / bar.empty "█" / "░" Bar glyphs
thresholds.warning / .error 80 / 95 Context % color escalation
refreshSeconds 2 Background git-status poll interval (default mode). 0 disables
showCachePercent true Show cache-read % next to the context bar
accessibility.enabled false Enable accessible presentation
accessibility.labels true Prefix segments with semantic labels (Model:, …)
accessibility.plainBar true Use = / - instead of Unicode block glyphs
command null Shell command for command mode (see below)
commandRefreshSeconds null Periodic re-run interval for command mode. null = event-only

Default-mode segments

Available ids for the segments array:

Id Shows
model Active model name/id
dir Working-directory basename
effort Thinking level (minimal/low/medium/high/xhigh)
context Context-window bar gauge + % + cache %
git Branch + dirty(!)/untracked(?) markers
session Session name (if set)
cost Accumulated session cost ($X.XXXX)
duration Elapsed wall-clock time since session start (Hh Mm/Mm Ss/Ss)
tokens Context tokens / window size
version pi version
providers Count of available providers

Command mode (Claude Code parity)

Set command to a shell command. pi-cc-status gathers all available session data into a JSON object mirroring Claude Code's statusLine schema and pipes it to the command's stdin; the command's stdout is displayed (one line per row).

{
  "command": "~/.claude/statusline.sh",
  "commandRefreshSeconds": 5
}

The command can be a script path or an inline one-liner (e.g. a jq filter):

{
  "command": "jq -r '\"[\\(.model.display_name)] \\(.context_window.used_percentage // 0)% context\"'"
}

Run /cc-status:reload after editing the config.

Pi theme colors in command output

Command stdout can contain {{pi:fg:thinkingHigh}}high{{pi:fg:reset}} to style text with Pi's current theme. The extension resolves markers when rendering, so switching themes recolors existing output without rerunning the command. Foreground names are Pi's theme foreground tokens, including thinkingLow, thinkingHigh, and thinkingXhigh. Background names: selectedBg, searchMatchBg, userMessageBg, customMessageBg, toolPendingBg, toolSuccessBg, and toolErrorBg (use {{pi:bg:name}} and {{pi:bg:reset}}). Unknown markers remain literal; existing ANSI output remains supported. Each marker has zero terminal width; scripts that manually align columns must exclude it from their width calculation.

JSON schema (pi-provided subset)

The object piped to stdin mirrors Claude Code's schema. Fields pi cannot provide are omitted:

{
  "cwd": "/current/working/directory",
  "workspace": { "current_dir": "...", "project_dir": "..." },
  "session_id": "abc123",
  "session_name": "my-session",
  "transcript_path": "/path/to/session.jsonl",
  "model": { "id": "...", "display_name": "..." },
  "version": "0.80.3",
  "context_window": {
    "total_input_tokens": 15500,
    "total_output_tokens": 1200,
    "context_window_size": 200000,
    "used_percentage": 8,
    "remaining_percentage": 92,
    "current_usage": {
      "input_tokens": 8500,
      "output_tokens": 1200,
      "cache_creation_input_tokens": 5000,
      "cache_read_input_tokens": 2000
    }
  },
  "exceeds_200k_tokens": false,
  "effort": { "level": "high" },
  "thinking": { "enabled": true },
  "cost": {
    "total_cost_usd": 0.0123,
    "total_duration_ms": 45000,
    "total_api_duration_ms": 0,
    "total_lines_added": 0,
    "total_lines_removed": 0
  },
  "git": { "branch": "main", "dirty": true, "untracked": false }
}

Not provided by pi (omitted from the JSON): workspace.added_dirs, workspace.git_worktree, workspace.repo, rate_limits, prompt_id, output_style, vim.mode, agent.name, pr.*, worktree.*. cost.total_api_duration_ms and lines_added/removed are not tracked by pi and report 0.

current_usage is null before the first API response and after /compact until the next response, matching Claude Code.

Environment

The spawned command receives these env vars (mirroring Claude Code v2.1.153+):

  • COLUMNS — current terminal width
  • LINES — current terminal height
  • plus the existing process environment

Refresh triggers (both modes)

The status refreshes on: each assistant message end, after each tool execution, turn end, model change, thinking-level change, session-name change, and git branch change. In command mode, updates are debounced 300ms and an in-flight process is cancelled if a newer update fires (matching Claude Code). Set commandRefreshSeconds for time-based data while idle.

Accessibility

Set accessibility.enabled: true for an accessible default-mode presentation (inspired by the community accessibility-first statusline pattern):

  • Semantic labels (Model:, Dir:, Context:, …) for screen-reader context
  • Plain ASCII bar (=/-) instead of Unicode block glyphs that screen readers garble
  • High-contrast via theme.bold emphasis

In command mode, accessibility is the script's responsibility — and you can reuse the community accessibility-first Claude Code scripts directly, since the JSON schema matches.

Requirements

  • pi coding agent
  • Node.js >= 20

Pi core packages (@earendil-works/pi-coding-agent, @earendil-works/pi-ai, @earendil-works/pi-tui) are provided by pi at runtime as peer dependencies — this package has no runtime dependencies of its own.

License

MIT © msdavid