pi-compact-activity 0.5.0
One Pi extension combining compact tool-call markers with smart-fold's thinking timing, using Pi's native click handlers and expanded renderers.
Collapsed transcript:
▸ Worked 4.1s · 2 thoughts · 3 commands · 1 read · 1 edit
Fixed the lock release; tests pass.
▾ Worked 16.4s · 1 thought · 1 command · 1 search · 1 read · 1 failed
Thought Check the worker lock handling before running the suite again. · 16.2s
Searched /pattern/ in src · no matches
Read src/example.ts:10–29 · 20 lines
Ran npm test · failed · exit 1
worker.test.ts:42 — expected lock to be released
Consecutive activity forms a group under one summary row: an arrow, Working or Worked with the sum of known thinking and command durations, and a tally by kind; edits and writes add their summed line changes (2 edits +14/−3). The summary sits in the prose column in the theme's bright text with a bold lead; members indent four columns deeper. A group is open while the agent works on it and folds once a reply or other message follows. It stays open when a member failed (the tally adds N failed in red) or was expanded. Clicking the summary opens or folds the group, and that choice sticks.
Collapsed rows lead with the activity verb, padded to one column, then the target a reader scans for: file, command, search, URL, or the opening of the reasoning. Durations, counts, and failure status follow the target after a ·; a long target is cropped first so they stay visible. Settled thinking shows the start of its first paragraph, which usually names the plan; live thinking follows the paragraph being written. Successful rows stay neutral, while live work is amber and failures are red. A failed row adds one detail line under its target, preferring the first line that names a location or cause. At narrow widths the exit code and the filename survive before a long command or directory prefix does. Long, simple command lists show previews from the beginning and end, while expansion keeps the exact command. Bash timings that round to 0.0s are omitted. Whole-file reads show a line count; partial reads show the range returned, not the range requested.
Each tool and thinking run remains independently clickable. Tools retain Ctrl+O; thinking retains Ctrl+T. The shortcuts live once in the footer: ctrl+o tools · ctrl+t thinking. Expanding a row restores native Pi content and formatting. Tool, thinking, and subagent rows share one indented column with no rail, under their group summary, so expanding a row never breaks a line running down the edge; filled backgrounds stay reserved for user prompts and decisions that need input. Assistant prose and error notices retain native spacing. An extra unfilled blank row separates the user message or user shell block from the following activity. A single blank row separates assistant prose or extension message cards (including Herdsman completion messages) from the following activity; tool/thinking sequences stay compact. Expanded rows retain native spacing. Images and question/subagent tools may need more than one collapsed line to preserve useful content.
Upgrade from 0.1.0
Replace the contents of the installed pi-compact-activity folder with this version and run /reload (or restart Pi). Keep the old smart-fold and tool-call-markers resources disabled.
Install
Extract this archive somewhere permanent, then:
pi install /absolute/path/to/pi-compact-activity
Before restarting Pi, disable/remove these existing extension resources from your settings or configuration:
@clapecho233/pi-smart-fold
@pi-kaush/pi-tool-call-markers:src (or its src/index.ts entry)
@pi-kaush/pi-tool-call-markers:src/thinking-block-merger.ts
Keep the other extensions in your list enabled. Restart Pi for the initial replacement, so the previous prototype adapters are fully unloaded. Afterwards, /reload can reload this extension normally. Do not additionally load the vendored markers directory: the manifest loads only index.ts.
To try it without installing:
pi -e /absolute/path/to/pi-compact-activity/index.ts
The old three resources must still be disabled for the trial.
Appearance
Group summaries start in the prose column; their rows start five columns in, with one blank column at the right edge. Bash uses the slim single-column › prompt with a space before command text. Unhighlighted Bash text is muted, including text after syntax-color resets, so prose remains visually dominant.
Labels carry the meaning, so icons are opt-in decoration. PI_COMPACT_ACTIVITY_ICONS=nerd adds Nerd Font icons for JetBrainsMono Nerd Font: document for reads, magnifier for searches, folder for directories, pencil for edits, save for writes, a slim › prompt for Bash, globe for web calls, and lightbulb for thinking. Thinking shares the icon column with tools. Unknown tools use a gear.
Opt-in icons distinguish read/navigation, search, change, and command families using the theme's semantic syntax colors. Summary text uses the readable tool-output color; settled thinking stays muted. Color marks state rather than success: active rows use the warning token, failures use error, and successful rows stay neutral. Folded Bash tokens use Pi's theme-aware highlighting for strings, variables, built-ins, and other supported syntax.
Live thinking shows the start of the current nonempty paragraph, cropping before the timer. The preview switches to a new paragraph when its text starts arriving. It updates on streaming events and remains one row on resize. Clicking expands to Pi's complete native thinking view.
Finished thinking shows the start of its first paragraph, with list, heading, bold, and code markers dropped, followed by its duration. The excerpt stays muted so it never outweighs tool rows; the full trace stays one click or Ctrl+T away.
For plain ASCII symbols:
PI_COMPACT_ACTIVITY_ICONS=plain pi
Themes can still override collapsed summary and thinking colors via collapsedToolCall and collapsedThinkingCall. Bash syntax keeps its semantic tokens because the command itself is the content.
Write/Edit progress
Active Write/Edit rows can be expanded and folded on click before a result exists. Their expanded content remains Pi's native renderer.
Folded rows show Writing path · receiving · +N lines for Write, and Editing path · receiving · +N/−N lines for Edit. The status changes to queued after arguments complete and writing/applying once execution starts. Counts update as Pi streams parsed arguments; Write counts describe received content. Edit counts compare the streamed replacement against old text, excluding unchanged lines; they are provisional and may rise or fall as more text arrives. They do not measure filesystem bytes flushed. Write does not infer removed lines when overwriting an existing file. Completed edits use Pi's actual diff counts. Failed calls retain their error status.
Write line counts reuse prior samples and scan only appended content. Edit diffs are cached until old/new text changes; large diff middles use a bounded replacement estimate to keep streaming responsive. There are no file reads, extra timers, or tool execution overrides.
Scope and compatibility
This is a focused merge of the display behavior, not every smart-fold feature. Tool calls are never grouped. Smart-fold's built-in tool re-registration and /fold settings, and tool-call-markers' /toggle-info feature are intentionally omitted. This preserves native tool execution and expanded rendering, including existing custom tool definitions. Folded Bash commands use Pi's native Bash syntax highlighting. Expanded Bash output keeps Pi's native renderer.
Thinking durations are saved as display-only session entries; existing smart-fold-thinking entries are read on resume. Unknown historical durations are omitted. Adjacent thinking blocks are combined by Pi's native message component; provider messages and signatures are unchanged.
Uses guarded Pi TUI adapters because Pi has no public transcript-layout hook. Requires Pi >=0.86.1. Verified against Pi 0.86.1, 1.0.3, and 1.6.0 with strict TypeScript checks and real Pi components, including click routing, native expansion comparisons, live reasoning, narrow widths, session timing persistence, and patch shutdown/reload. Your full extension stack was not available here, so interaction with herdsman, ponytail, caveman-think, and the other entries needs a local smoke check.
Performance
Fully expanded transcripts delegate directly to Pi's native container renderer when no other transcript hook needs to run. Folded tools share one palette probe per transcript render; settled folded thinking rows reuse width-fitted output. Assistant layout metadata is cached until the message component rebuilds, and finalized thinking runs are reused across rebuilds. Streaming rows, resize, theme changes, and real tool updates continue to invalidate their display state.
Unchanged mixed and folded transcripts reuse their flattened output and, on Pi 1.6, their mouse layout. In a synthetic 2,000-row session (1,000 thinking/tool pairs), this cut warm mixed redraws from about 4.2 ms to 1.1 ms and folded redraws from 0.96 ms to 0.83 ms. Fully expanded redraws stayed near native Pi. These are component timings, not end-to-end terminal latency.
Run node test/performance.mjs for expanded, collapsed, and mixed timings and the palette-probe regression check. BENCH_ROWS selects the number of thinking/tool pairs. To capture a CPU profile, run BENCH_ROWS=1000 node --cpu-prof --cpu-prof-dir=/tmp test/performance.mjs.
Development
Install Pi packages locally for verification (Pi supplies them at runtime):
npm install --ignore-scripts --no-save @earendil-works/pi-coding-agent @earendil-works/pi-tui typescript@5.9.3 @types/node
node test/integration.mjs
node test/appearance.mjs
node test/change-progress.mjs
node test/labels.mjs
node test/performance.mjs
npx tsc -p tsconfig.json
Credits
Derived from @clapecho233/pi-smart-fold 0.3.0 (thinking timer and formatting helpers) and @pi-kaush/pi-tool-call-markers 0.3.50 (tool summaries, native-renderer delegation, caching, and mouse adapters). Both are MIT licensed. See NOTICE.md and the included license files.
0.3.5
Restores the 0.3.2 implementation and adds a separating blank row after an expanded tool or thinking block before following collapsed activity. Mouse routing includes the new separator. The expanded-header and raw-stream changes from 0.3.3–0.3.4 are reverted.
0.3.6
Adds one blank row between prose and following folded thinking inside the same assistant message. Compact activity sequences and native expanded rendering are preserved; the separator is a component so native mouse routing includes its height.
0.3.8 (superseded by the clipping fix below)
Finished thinking selects the first paragraph only. Live thinking remains a single line anchored at the current paragraph start. Blank lines (including CRLF and whitespace-only lines) delimit paragraphs. Click expansion still reveals the complete native trace. Built on 0.3.6; native Herdsman rendering is unchanged.
0.3.9
Fixes 0.3.8 wrapping: both live and finished collapsed thinking remain exactly one line, clipping at the right edge. Finished previews select the first paragraph; live previews select the current paragraph and stay anchored at its start. Expanded rendering is unchanged.
0.4.0
Activity rows now lead with verbs (Read, Searched, Edited, Ran, Wrote) and put the filename or command first. Icons are opt-in. Successful rows stay neutral; live work is amber and failures are red. Failures add one detail line with the most useful error, and narrow rows keep the failure status and filename. Finished thinking keeps only its duration, while live thinking keeps one preview row. Activity shares the submitted-prompt gutter, and the expand shortcuts appear once in the footer.
0.5.0
Consecutive activity folds under one clickable summary row (▾ Worked 6.4s · 4 thoughts · 6 commands · 1 read · 1 edit). Groups stay open while the agent works, fold once a reply follows, and stay open when a member failed or was expanded. The left rail is gone: rows indent under their summary, verbs pad to one column, and durations, counts, and failure status follow the target after a ·. Finished thinking shows the opening of its first paragraph again. Peer dependencies are now *, as Pi packages require.