pi-open-tui

A polished TUI for Pi coding agent: branded header, responsive footer, framed editor, thinking preview, and compact tool views.

Packages

Package details

extension

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

$ pi install npm:pi-open-tui
Package
pi-open-tui
Version
0.4.9
Published
Dec 3, 2026
Downloads
28.6K/mo · 6,462/wk
Author
oldsuns
License
MIT
Types
extension
Size
435.8 KB
Dependencies
1 dependency · 3 peers
Pi manifest JSON
{
  "image": "https://raw.githubusercontent.com/OldSuns/pi-open-tui/main/assets/preview_dashboard_1.png",
  "extensions": [
    "./extensions/open-tui/index.ts"
  ]
}

Security note

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

README

pi-open-tui

English | 简体中文

A cleaner, more informative terminal UI for the Pi coding agent.

pi-open-tui preview

What you get

  • Branded Pi header — model, thinking level, working directory, and quick slash-command hints at a glance
  • Responsive two-row footer — directory, Git state, detected runtime, live timer, context usage, tokens, cost, and extension status, gracefully adapting to narrow terminals
  • Framed editor — block, bar, and underline cursor styles, built to play nicely with compatible custom editors from other extensions
  • Project & Git awareness — detects 50+ runtimes and tracks detailed Git state (ahead/behind, staged, modified, untracked, stash, and detached HEAD)
  • Turn telemetry — end-of-run summary with TPS, TTFT, duration, stalls, token breakdown, and effective cost rate
  • Thinking peek — live 1- or 2-line preview of hidden reasoning while the model is thinking
  • Compact tool view — scannable call summaries with syntax-highlighted edit/write previews, plus optional support for extension and MCP tools
  • Fullscreen Copy buttons — one-click [Copy] for code blocks, user messages, and input drafts
  • Interactive settings — configure everything live in English or Simplified Chinese with /open-tui

Quick start

Requirements

  • Pi 1.6.1 or later
  • Node.js 22.19.0 or later (Pi's minimum)
  • A terminal with UTF-8 and color support
  • A Nerd Font for the full icon set (optional — Unicode and ASCII modes are built in)

Install

pi install npm:pi-open-tui

Want to try it for a single session first?

pi -e npm:pi-open-tui

Fonts and icons

To get the full icon set, install a Nerd Font, select it in your terminal's font settings, and restart the terminal. Note that apps like VS Code and Windows Terminal require configuring the font in their own profiles—installing it in the OS alone isn't enough.

You can switch icon styles anytime in /open-tui under Appearance → Icons (auto, nerd, unicode, ascii). Because auto inspects the terminal environment rather than installed fonts, pick unicode if you see missing-glyph boxes, or force nerd when your terminal (including over SSH) already has a Nerd Font configured.

For automatic detection rules and Kitty spacing tweaks, see icon detection and spacing.

Configuration

Run /open-tui to open the interactive settings dialog. It organizes options into General, Appearance, Footer, and Telemetry tabs, supports both English and Simplified Chinese, and adapts to your terminal size.

  • Tab / Shift+Tab or ← / → — switch tabs
  • ↑ / ↓ — move between options
  • Enter / Space — toggle or cycle value
  • Esc / q — close

Settings are saved to open-tui.json in Pi's agent directory (~/.pi/agent by default, or PI_CODING_AGENT_DIR when set). If writing to disk fails, a warning lets you know your changes apply to the current session only.

Setting Location in /open-tui Default
Header & settings language General → Interface Header on, English
Thinking peek General → Messages & tools 1 line
Copy buttons General → Messages & tools On (fullscreen only)
Tool view General → Messages & tools Native
Footer in editor border General → Footer Off
Icons & cursor style Appearance Auto icons, block cursor
Footer fields & telemetry metrics Footer / Telemetry Individually toggleable

Switching Tool view to Compact reveals Compact extension tools underneath it; switching back to Native hides the child toggle without forgetting its saved value. For the full JSON schema, defaults, and tool exclusions, see the configuration reference.

Features

Header, footer, and editor

The header surfaces your active model, project context, and useful command hints right at the top. Below the conversation, the two-row footer keeps your directory, Git state, detected runtime, running timer, context bar, model details, tokens, and session cost visible—and every field can be toggled on or off.

  • Smart width handling — When there's room, the footer shows the full ~-relative path and Git branch. As the window narrows, it compacts paths and shortens branches first, keeping Git status counts visible before dropping lower-priority fields. Prefer a fixed basename or absolute path? Set footerCwdFormat in open-tui.json (see footer options).
  • Live Git updates — Git status refreshes after tool runs (including commits on the current branch), batching rapid bursts and flushing any pending update as soon as the agent finishes.
  • Zero-activation Python detection — In trusted projects, the footer reads the Python version from .venv/pyvenv.cfg first (so uv environments work without activation or spawning Python), falls back to VIRTUAL_ENV, and finally checks python3 --version on PATH. Untrusted projects or unavailable versions show only the Python icon. Reload Pi after switching environments to refresh.
  • Complete usage accounting — Footer token and cost totals include assistant replies, tool-reported usage, compaction and branch summaries, and cache warming. The cache-hit percentage reflects the latest assistant response.
  • Footer in editor border — Turn on Footer in editor border to embed the two main footer rows directly into the editor's top and bottom borders while keeping extension status rows below. Compatible editors keep their normal input handling, completion, and ghost text; editors that can't be framed automatically stay on the separate footer.
  • Extension-friendly — Other extensions can render their own status rows or publish segments directly into the main footer.

See editor compatibility and layout for integration details.

Turn telemetry

After each completed agent run, pi-open-tui displays a single transient summary across its assistant turns:

> TPS 42.5 tok/s | ~ TTFT 1.2s | + 29.7s | ↑ 567 | ↓ 1.2k | ! stall 1x / 4.3s | $ $3.60/M
  • TPS divides provider-reported output tokens by generation time (including wait and stalls, excluding tool execution between turns). While streaming, the footer timer also shows a live speed estimate like ~54 tok/s.
  • $ / M shows the effective rate per million tokens for that run, whereas the footer tracks cumulative session spend.

Toggle individual notification fields under Telemetry → Measurements, or live speed under Footer → Runtime → Live TPS. Exact formulas and timing boundaries are documented in usage and telemetry.

Thinking peek

When Pi's Hide thinking is enabled, pi-open-tui replaces the static Thinking... placeholder with a live tail of the model's current reasoning:

~ think ⠋ previous thought
          latest thought

Choose Off, 1 line, or 2 lines under General → Messages & tools → Thinking peek. The preview only appears while reasoning streams, ticks to a checkmark once the answer begins, and returns to Pi's native label after the run settles. It follows Pi's Hide thinking toggle immediately and clips cleanly to fit the available width.

Compact tool view

Tool rendering defaults to Native. Switch General → Messages & tools → Tool view to Compact to turn Pi's built-in tools (read, bash, powershell, edit, write, grep, find, ls, plus the opt-in codemode and tool_search) into clean call-and-summary rows:

● Read(extensions/open-tui/footer.ts:1-120)
  └  120 lines
● Edit(extensions/open-tui/footer.ts)
  └  +2 −1
● Bash(npm test)
  └  Done · 131 lines · 6.4s
● Codemode(const results = await Promise.allSettled([ … (+3 lines))
  ├  ✓ Read(src/config.ts) · 12ms
  ├  ✓ Find(*test.ts) · 18ms
  ├  ✓ Bash(npm test) · 2.6s
  └  Done · 3 calls · 2.7s
     42 tests passed
● Tool Search(browser screenshot)
  └  Loaded 3 tools · 24ms
     browser_snapshot · browser_click · browser_screenshot
  • Edit & write previews — Successful edit and write calls display syntax-highlighted previews of up to 16 rows, with a hint to expand longer changes.
  • Live shell feedback — Running shell commands show recent output and elapsed time; failures keep their error summary.
  • Built-in codemode & tool_search — codemode surfaces up to three recent nested calls along with total counts, elapsed time, and a one-line output or error summary; tool_search shows how many tools loaded and previews up to three names. Both work automatically in Compact mode without enabling Compact extension tools.
  • Expand on demand — Click any row to open its native card, or press Ctrl+O to expand everything. Underlying tool calls, results, and model-visible content are never altered.
  • Extension & MCP tools — Enable Compact extension tools to include extension and MCP tools (with dedicated search summaries for @ff-labs/pi-fff). Add specific tool names to toolView.exclude in open-tui.json if you want them to stay native.
  • Applies to new rows — Toggling the mode affects newly created rows; run /reload or start a new session to restyle the full transcript.

See tool rendering details for preview limits, extension summaries, and renderer compatibility.

Copy buttons

In fullscreen mode (tuiMode: "fullscreen"), completed code blocks get a rounded frame with a clickable [Copy] button whenever there's enough width, and user messages get one too. Click to copy the source text—Pi flashes Copied! to confirm.

╭─ sh ─────────────── [Copy] ╮
│ pi install npm:pi-open-tui │
╰────────────────────────────╯
  • Clean copies — Code buttons copy raw code without markdown fences while preserving indentation and tabs; user-message buttons copy your original message. Streaming code blocks gain their button as soon as streaming finishes, while regular mode and thinking blocks keep Pi's native fences. (To copy an entire assistant reply, use Pi's /copy command.)
  • Input drafts — Any nonempty draft in a compatible editor also gets a [Copy] button in an open gap along the bottom border (falling back to the top border if needed). It copies the full draft—including expanded folded pastes—without moving your cursor or stealing focus, and hides automatically when the border doesn't have enough room.

Toggle this feature under General → Messages & tools → Copy buttons. Width thresholds and renderer details are covered in copy-button behavior.

Documentation

Local development

npm install
npm test
npm run typecheck
pi -e .

CI verifies Pi 1.6.1 and the latest release on Node.js 22.19.0 and 24 across Linux, Windows, and macOS (keep all Pi packages on the same version when testing locally). Run pi -e . to test fonts, mouse interactions, and cursor styles interactively.

Acknowledgements

pi-open-tui builds on ideas and patterns from several great Pi community packages:

  • pi-haiku — two-line footer layout and working timer
  • pi-claude-code-tui — Pi logo artwork and rounded editor border technique
  • pi-zentui — Starship-style footer segments, runtime detection, session lifecycle, and settings dialog pattern
  • pi-tps — turn timing, stall detection, and conservative TPS measurement
  • pi-polish — compact tool-call rows and syntax-highlighted edit diffs

The logo artwork is derived from Pi's official install script (pi.dev/install.sh), and runtime detection and Git porcelain parsing borrow structure from pi-zentui.

Special thanks to the LINUX DO community for its support.

License

MIT