A pi extension that renders a Claude Code-style statusline showing model, directory, git status, and a context-window bar.
🦙 qwen3.6-35b-a3b | 💭high | 📁my-project | 🔀main (2 files uncommitted, synced) | t#14 · 42m | ⏱ 8s | ██████▄░░░ 63.2% of 128k tokens
↳ can you refactor the middleware to use async handlers and add tests
Line 1 sections (separated by |):
- Provider glyph + model — accent-colored; provider → emoji (
🦙LM Studio/Ollama,🤖Anthropic,⚫OpenAI,⚡Groq,✨Gemini,🧬Qwen,🧠fallback) - Thinking level —
💭high|medium|low|xhigh, hidden whenoff - Directory —
📁<basename>ofctx.cwd - Git —
🔀<branch> (N files uncommitted, <sync-status>), skipped when not in a repo - Turn counter + session time —
t#<completed-turns> · <elapsed> - Live turn/tool indicator — while a model turn is running:
⏱ <elapsed>(updated every second). When a tool is executing:🔧<toolName>. Hidden when idle. - Context bar — 10-block usage bar plus
N.N% of Kk tokens. Color shifts to orange at >80% and red at >95%. Uses pi'sgetContextUsage()when a turn has completed, otherwise a 20k-token baseline estimate with~prefix.
Line 2 (only when placement is belowEditor or aboveEditor):
- Last user message —
↳ <text>preview, whitespace-collapsed, truncated to terminal width. Hidden when there's no user message yet.
The statusline refreshes on session_start, agent_start, agent_end, turn_end, tool_execution_start, tool_execution_end, model_select, and message_end. While a turn is active a 1s ticker redraws to keep the ⏱ timer live.
pi install git:github.com/Acelogic/pi-statuslineOr add to ~/.pi/agent/settings.json:
{
"packages": ["git:github.com/Acelogic/pi-statusline"]
}pi update git:github.com/Acelogic/pi-statuslineThen /reload inside pi.
Environment variables (all optional):
PI_STATUSLINE_PLACEMENT— where the statusline renders. One of:belowEditor(default) — own line right under pi's input boxaboveEditor— own line above chatfooter— legacy behavior, crammed onto pi's shared extension-status row alongsideClaude Memories,LM Studio Active, etc.
PI_STATUSLINE_COLOR— accent color, one of:gray,orange,blue(default),teal,green,lavender,rose,gold,slate,cyanPI_STATUSLINE_BASELINE_TOKENS— baseline tokens used for the bar before the first turn completes (default20000)PI_STATUSLINE_GIT_CACHE_MS— how long git status is cached before re-running (default1500; set to0to disable caching)PI_STATUSLINE_SHOW_GIT— set tofalse/0/offto hide the git section entirelyPI_STATUSLINE_PCT_DECIMALS— decimal places on the context percentage (default1, set to0for integer-only like35%, max4)PI_STATUSLINE_WARN_PCT— context percentage at which the bar turns orange (default80)PI_STATUSLINE_DANGER_PCT— context percentage at which the bar turns red (default95)PI_STATUSLINE_TICK_MS— live-timer refresh interval in ms while a turn runs (default1000, min250)PI_STATUSLINE_SHOW_LAST_MSG— set tofalse/0/offto hide the second (last-user-message) line
- Uses ANSI 256-color escape codes in
ctx.ui.setStatus. pi'ssanitizeStatusTextonly strips whitespace, so color codes pass through to the footer. - Git shelling-out is cached to keep per-turn overhead low. Caching is invalidated on a 1.5s clock.
- pi's existing footer remains visible above this line; to fully replace pi's footer, use
setFooterinstead (not done here to avoid losing pi's built-in token/cost summary).