pi-reverse-search

Ctrl+R reverse prompt search for Pi's TUI editor, inspired by shell reverse-i-search.

Packages

Package details

extension

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+R in 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+R again to cycle older matches for the current query.
  • Press Ctrl+S, Down, or Ctrl+N to cycle newer matches.
  • Press Enter to accept and submit the selected prompt.
  • Press Esc or Ctrl+G to cancel and restore your draft.
  • Press Ctrl+C to 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

  1. Start Pi after installing the package, or run /reload in an existing session.
  2. Press Ctrl+R in the prompt editor.
  3. Type a search query.
  4. Use Ctrl+R / Ctrl+S to cycle matches.
  5. Press Enter to submit, or Esc / Ctrl+G to 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.