pi-foldable-tools
Make pi tool blocks foldable and hideable — collapsed summary, full output, or hidden from the transcript. Adds ctrl+q and /tools controls.
Package details
Install pi-foldable-tools from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-foldable-tools- Package
pi-foldable-tools- Version
0.1.0- Published
- Jun 25, 2026
- Downloads
- not available
- Author
- primp9053
- License
- MIT
- Types
- extension
- Size
- 19.4 KB
- Dependencies
- 0 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-foldable-tools
Make pi tool blocks foldable and hideable.
pi's built-in tool blocks (the green/red "Tool execution box") are always
rendered with a full colored shell. The only built-in control, ctrl+o
(app.tools.expand), toggles output verbosity — invisible for short outputs
and it never collapses the block itself. This extension adds the missing fold /
hide capability.
What it does
Re-registers the built-in tools (read, bash, edit, write, grep,
find, ls) with renderShell: "self" so the always-on colored box is gone,
and adds a 3-state view for completed blocks (running blocks always stream
live so you can still see activity):
| Mode | Completed block shows |
|---|---|
| folded (default) | Compact 2-line card: the call header ($ ls -la / read foo.py) + a one-line status (✓ 3 lines, ✗ exit 127 · 3 lines, +2 -1 for edits) |
| expanded | Full output — syntax-highlighted reads & diffs (delegated to the originals) / full text for bash·edit·write |
| hidden | Removed from the transcript entirely (0 lines) |
Execution behavior is unchanged: every tool delegates execute to the original
built-in tool definition, so reads/edits/bash/grep behave identically. Only the
rendering changes.
Controls
ctrl+q— cyclefolded → expanded → hidden → folded/tools [folded|expanded|hidden]— set directly, or cycle with no arg (use this if your terminal eatsctrl+q)ctrl+o(built-in) — still expands output within folded/expanded modesPI_TOOL_FOLD_MODEenv var — default mode on startup (folded(default),expanded, orhidden)
A footer status line (tools: folded) shows the current mode.
Install
pi install npm:pi-foldable-tools
Or from git:
pi install git:github.com/<user>/pi-foldable-tools
Then restart pi (or run /reload).
Notes
ctrl+qis a single byte (0x11) that tmux passes through (onlyctrl+bis tmux's prefix), so it works inside tmux. If your terminal interceptsctrl+q(some map it to XON flow control), use the/toolscommand instead.- Rendering for
read/grep/find/lsis delegated to the originals (they use aText-based renderer), preserving syntax highlighting and truncation notes.bash/edit/writeuse aContainer+state renderer that is not safe to delegate, so they are rendered locally asText. - Reading an image file in
hiddenmode still renders the image (image rendering is owned by the tool component, not the result renderer); the text part is hidden as expected. Rare edge case.
License
MIT