pi-reverse-search
Ctrl+R reverse prompt search for Pi's TUI editor, inspired by shell reverse-i-search.
Package details
Install pi-reverse-search from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-reverse-search- Package
pi-reverse-search- Version
0.1.1- Published
- Aug 11, 2026
- Downloads
- 329/mo · 9/wk
- Author
- viggy28
- License
- MIT
- Types
- extension
- Size
- 14.6 KB
- Dependencies
- 0 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./extensions/reverse-search.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-reverse-search
Ctrl+R reverse prompt search for Pi's TUI editor, inspired by shell reverse-i-search in bash/readline and zsh.
Features
- Press
Ctrl+Rin Pi's input box to enter reverse prompt search. - Type to filter previous user prompts from the current session branch.
- Matching text is highlighted in the selected prompt.
- Press
Ctrl+Ragain to cycle older matches for the current query. - Press
Ctrl+S,Down, orCtrl+Nto cycle newer matches. - Press
Enterto accept and submit the selected prompt. - Press
EscorCtrl+Gto cancel and restore your draft. - Press
Ctrl+Cto cancel search and let Pi handle normal clear/interrupt behavior.
Install
From a local checkout
pi install /absolute/path/to/pi-reverse-search
Or test without installing:
pi -e /absolute/path/to/pi-reverse-search/extensions/reverse-search.ts
From GitHub
pi install git:github.com/viggy28/pi-reverse-search@v0.1.0
Or install the latest main branch:
pi install git:github.com/viggy28/pi-reverse-search
From npm
pi install npm:pi-reverse-search
To pin a specific release:
pi install npm:pi-reverse-search@0.1.0
Usage
- Start Pi after installing the package, or run
/reloadin an existing session. - Press
Ctrl+Rin the prompt editor. - Type a search query.
- Use
Ctrl+R/Ctrl+Sto cycle matches. - Press
Enterto submit, orEsc/Ctrl+Gto cancel.
Development
Run tests:
npm test
Smoke-test extension loading:
npm run smoke
Package layout
extensions/reverse-search.ts # Pi extension entrypoint
extensions/reverse-search-lib/core.ts # Pure search state + key decoding logic
test/reverse-search.test.mjs # Node tests for core behavior
Troubleshooting
Extension shortcut conflict for ctrl+r
This package does not register a global Pi shortcut; it handles Ctrl+R only inside its custom prompt editor. If Pi reports a conflict such as:
Extension shortcut conflict: 'ctrl+r' is built-in shortcut for app.session.rename and /path/to/pi-reverse-search/src/index.ts
then Pi is loading an older local checkout that registered Ctrl+R as a global shortcut. Remove that local install, then reload Pi and install the npm package instead:
pi uninstall /path/to/pi-reverse-search
pi install npm:pi-reverse-search
If the warning path points at an npm cache/package directory rather than a local src/index.ts, update to the latest package:
pi install npm:pi-reverse-search@latest
Notes
This extension searches prompts in the active Pi session branch. It does not search all historical session files.