@pi-spice/thinking-preview
Collapse streaming thinking blocks into a compact live preview; alt+t toggles full text
Package details
Install @pi-spice/thinking-preview from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@pi-spice/thinking-preview- Package
@pi-spice/thinking-preview- Version
0.1.2- Published
- Aug 30, 2026
- Downloads
- 226/mo · 226/wk
- Author
- rook1e404
- License
- MIT
- Types
- extension
- Size
- 9.3 KB
- Dependencies
- 0 dependencies · 1 peer
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-spice/thinking-preview
Collapse streaming thinking blocks into a compact, live-refreshing preview.
pi streams reasoning tokens in full, which can flood the transcript on long thinking turns. This extension turns every thinking block into a compact preview instead:
│ ✻ thinking · 142 lines · alt+t to expand
│ …second-to-last line of the thinking…
│ …last line of the thinking…
The block renders as a blockquote, so it carries pi's │ left bar and quote color — visually distinct from plain thinking text, echoing the framed look of tool-call rows (an exact edit/bash-style background box isn't reachable from a Markdown transformer).
The preview refreshes on every streaming token, so the block doubles as a progress indicator — no flooding, but you always roughly know where the model is.
Install
pi install npm:@pi-spice/thinking-preview
Quick test without installing: pi -e ./extensions/thinking-preview/
How it works
- Uses a Markdown transformer (
pi.registerMarkdownTransformer), which is display-only: the session file and the model context keep the full thinking text, untouched. - Preview content is plain text — Markdown syntax characters are escaped and rendered verbatim — and every preview line (status line included) is hard-clipped to the available terminal width minus the
│bar, by plain character count with no per-charset width tables. A line of wide characters (CJK, emoji) can therefore render up to twice the budget and wrap an occasional extra row — accepted jitter in exchange for simplicity. alt+t(or/thinking-preview) toggles all thinking blocks between preview and full text. Expanded mode shows the full text as escaped plain text inside the same│-framed block, with source line breaks preserved; long lines wrap naturally. Toggling re-renders history immediately and shows a notification. Restart resets to the collapsed preview default.- The toggle is global and sticky: once expanded, new thinking blocks render in full until you toggle back.
Interaction with pi's built-in thinking controls
ctrl+t(hide thinking blocks) takes precedence: while thinking is hidden, blocks render as a one-line label and this extension has no visible effect on the transcript — though thealt+tnotification still fires. Pressctrl+tto make thinking visible again.ctrl+tshowing thinking also goes through this extension, so it shows the preview — not full text. Usealt+tfor full text.- Toggling re-applies the default hidden-thinking label (
Thinking...); if you customized that label elsewhere, it will be reset on toggle.
Notes
- Old thinking blocks pick up a mode change immediately (the toggle forces a re-render), and restored sessions render collapsed previews too.
alt+twas chosen because everyctrl+lettercombination is bound in pi's default keybindings. If you havealt+tbound to something else,/thinking-previewworks as a fallback.