← Catalog

@nicknisi/pi-compact-tools

Two-line tool displays with native click and Ctrl+O expansion

Package

Install

Install with PiG

pig install npm:@nicknisi/pi-compact-tools

Install with Pi

pi install npm:@nicknisi/pi-compact-tools
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 0.3.4 (README.md). PiG does not review it.

pi-compact-tools

Collapse every tool display to a header and one preview line. Press Ctrl+O to expand all tools, or click a tool in Pi's fullscreen mode to expand just that tool.

▸ $ pnpm test
  Test run started … [ctrl+o]

Only the display changes. Tool execution, saved results, images, details, and model context stay untouched. Expanding restores the tool's original renderer, including syntax highlighting, diffs, and custom extension displays.

Install

From a local checkout:

pi install /absolute/path/to/pi-extensions/packages/compact-tools

After publication:

pi install npm:@nicknisi/pi-compact-tools

Restart Pi or run /reload after installation.

Behavior

Action or stateDisplay
Before a result arrivesOne line using the tool's normal human-readable header
Streaming or completed resultHeader plus one readable preview line
Multiline outputAn ellipsis after the preview
SuccessBoth lines use Pi's green toolSuccessBg background
RunningBoth lines use Pi's toolPendingBg background
ErrorBoth lines use Pi's red toolErrorBg background, with an explicit Error: preview
ImagesAn image count in the preview; pi still draws inline images below the row
Ctrl+OPi's existing expand/collapse toggle for all tools
Fullscreen left clickExpand one collapsed tool. Click its original header or result to collapse it again

There is one blank separator before each tool. Long lines truncate to the terminal width rather than wrapping. Built-in, extension, MCP, dynamically registered, and restored tool rows all use the same compact display. Headers reuse the tool's existing renderer, such as read src/index.ts or $ pnpm test. Tools without a custom header show their name and a path, command, query, action, or URL when available. The fallback never dumps JSON arguments or file contents.

Tools start collapsed on session start and reload. The key hint follows your app.tools.expand binding in ~/.pi/agent/keybindings.json. No new tools, commands, shortcuts, widgets, or session entry types are registered.

Configuration

None. The default is two content lines. Use Pi's existing expansion controls when you need more detail.

Dependencies and caveats

  • Pi supplies @earendil-works/pi-coding-agent and @earendil-works/pi-tui as peer dependencies. @nicknisi/pi-shared supplies terminal-label sanitization.
  • Needs Pi 1.5.0 or newer (pi.registerToolRenderer, outputPad in the render context). Regular terminal mode leaves mouse input to terminal scrollback, so use Ctrl+O there.
  • Uses Pi's public pi.registerToolRenderer() hook, wrapping whatever renderer the tool (or a later extension) provides. Rows draw their own shell so collapsed rows stay two lines; expanded rows re-create Pi's default box around the original renderer.
  • Pi draws inline images for a result regardless of the row's renderer, so collapsed rows with images are not fully compact.
  • Previews use the tool's existing result renderer when available, falling back to the first nonempty output line. Pi's own ... (N earlier/more lines) truncation hints are skipped, so long bash output previews its first visible output line (bash keeps the tail). Collapsed rows use the same outputPad indent as expanded rows. JSON-only output shows an item or field count instead of serialized data; results over 64 KB of text only show Structured output. No model call is made. Custom controls and detailed progress displays are available when expanded.
  • Expanded displays retain each tool's own limits. This extension cannot recover output already truncated by a tool.
  • User shell commands entered with ! or !! use a separate Pi component and are unchanged.

Development

pnpm test -- packages/compact-tools/index.test.ts
pnpm typecheck
pnpm lint