pi-open-last-response

Pi extension that opens the latest assistant response in an external editor.

Packages

Package details

extension

Install pi-open-last-response from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-open-last-response
Package
pi-open-last-response
Version
0.1.0
Published
Jul 16, 2026
Downloads
112/mo · 112/wk
Author
wujunchuan1994
License
MIT
Types
extension
Size
11.9 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./src/index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-open-last-response

A local Pi extension that writes the latest completed assistant response to a temporary Markdown file and opens it in your external editor.

Why

Long assistant replies are inconvenient to scroll through inside the Pi TUI. /open-last lets you read the newest reply in Cursor, VS Code, Zed, Sublime, or your configured editor without manually copying and pasting.

Install

From npm:

pi install npm:pi-open-last-response

From GitHub:

pi install git:github.com/wujunchuan/pi-open-last-response

For local development:

pi install /Users/john/Project/Github/pi-open-last-response

Then reload Pi:

/reload

Commands

/open-last
/open-last-response
/olast

Examples:

/open-last
/open-last cursor
/open-last code --reuse-window
/open-last --path-only

--path-only writes the Markdown file and prints the path without opening an editor.

Editor selection

Priority:

  1. editor command passed as command args, e.g. /open-last cursor
  2. PI_OPEN_LAST_EDITOR
  3. non-terminal VISUAL / EDITOR
  4. auto-detected GUI/open command:
    • macOS: cursor, code, zed, subl, open
    • Linux: cursor, code, zed, subl, xdg-open
    • Windows: cursor.cmd, code.cmd, notepad.exe

Recommended config:

export PI_OPEN_LAST_EDITOR="cursor"
# or
export PI_OPEN_LAST_EDITOR="code --reuse-window"

By default files are written under your OS temp directory, in pi-open-last-response/. Override with:

export PI_OPEN_LAST_DIR="$HOME/.pi/open-last"

Development

npm install
npm run check

Pi package

This repository is a Pi package because package.json contains:

{
  "pi": {
    "extensions": ["./src/index.ts"]
  }
}

License

MIT