pi-bash-diff0.1.1
Pi bash tool extension: show a user-friendly diff after each command
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
pi-bash-diff
pi-bash-diff is a Pi bash tool extension that shows a user-friendly diff after each command. It renders an interactive view of what the call actually changed within the project: a diff per changed file, the files it read, and the command output.
Visual changes only. Prompts and tool input/output are not modified.
Install
pi install npm:pi-bash-diff
Or straight from git, pinned to a release, or to try it for one run:
pi install git:github.com/lruijsink/pi-bash-diff@v0.1.0
pi -e npm:pi-bash-diff
Preview

Stock tool, for reference:

Motivation
Models sometimes revert to bash for file operations, which can be hard to read and decipher. This extension aims to solve this with a clear, structured visualisation of what the bash command actually did.
It is deterministic and acts purely in the visualisation layer, so there is no need to go against the trained behaviour of models that rely heavily on bash, allowing them to perform better.
Inspired by Thinking Machines' Inkling 2 Mini, a very impressive model except for its relentless stubbornness to use bash for everything. This extension aims to make it much more workable to just allow it to do so.
It works by snapshotting the working tree before and after each bash call to compare the two. For now, it only works within the working directory's git repository. Reads are inferred from the bash commands as best as possible. Full overview of the design considerations are in docs/DESIGN.md.
Tool output is truncated to a configurable number of lines. Support mouse
interactions (requires fullscreen TUI mode), click a section to expand/collapse.
Follows the global expand/collapse key (Ctrl+O by default) in both TUI modes.
Options
The number of previewed lines is modifiable. Create a config file either
globally in ~/.pi/agent/bash-diff.json or in a project's .pi/bash-diff.json.
Defaults are (min. value: 2):
{
"commandPreviewLines": 3,
"editPreviewLines": 5,
"outputPreviewLines": 3
}
Requirements and limits
- Pi with
registerToolRenderer(tested with 1.7.0) giton thePATH- Mac or Linux. Windows is untested, and relative paths won't be shown there
- Changes outside the repository or in gitignored files are not shown
- Concurrent bash calls or other changes within the repository can get incorrectly attributed to the tool call, since it uses the work tree snapshots
- Mouse hover effects rely on
TUI.handleTerminalInput, which is not a public API, this could break highlighting effects on future Pi updates
Development
git clone https://github.com/lruijsink/pi-bash-diff && cd pi-bash-diff
pi -e ./extensions/bash-diff/index.ts # try the checkout for one run
npm test # unit tests, plain node, real git repositories in temp dirs
npm run load # test whether Pi's own loader (jiti) accepts the sources
Most of the code in this project was written with Claude Code and Inkling 2 Mini.
License
MIT