← Catalog

pi-prompt-refine

Rewrite a draft against the current conversation and review it before sending it to the Pi agent.

ExtensionPrompt

Install

Install with PiG

pig install npm:pi-prompt-refine

Install with Pi

pi install npm:pi-prompt-refine
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./src/extension.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.3.0 (README.md). PiG does not review it.

Pi Prompt Refine

简体中文

Refine your prompt without leaving Pi Coding Agent. The rewrite model uses your current conversation to clarify the draft. You can preview it above the editor, ask for changes, and decide what to send.

In Pi, “fix it and test it” becomes a request to stabilize the overlay height. After accepting, the user adds “Run the test locally.” in the editor.

Press Ctrl+\ on “fix it and test it” to see which fix the conversation points to. Press a to accept, then keep typing in the editor. The recordings use scripted replies from an offline model. Timings are illustrative.

Installation

Use Pi Coding Agent in its interactive terminal UI with a model configured in Pi. Refine requires Node.js 22.19+ and has been tested with Pi 1.6.0.

pi install npm:pi-prompt-refine

Start Pi, or run /reload in an existing Pi session.

Features

Context-aware rewriting

Pi preview expands “push to GitHub” using the earlier merge into local main

The conversation identifies the merged commits and their destination. Refine turns “push to GitHub” into a request to push local main to origin/main.

Iterative refinement

The Revise form with “Focus on performance. Don't modify any files.” entered under Additional requirements

Press f in the preview to narrow “review my code” to a performance review. Submit the extra instructions with Ctrl+S to get another draft.

Structured rewrites

Pi preview organizes a scheduler performance investigation around a baseline and API constraints

The expanded preview lays out the baseline comparison, the public API constraint, and the profiling evidence the agent should report.

Models and Preferences

  • Independent rewrite model. Pick any available model in Pi for rewrites and keep your main agent's model.
  • Model comparison. Try multiple models in parallel on the same draft and context, then compare their rewrites and response times.
  • Reusable Preferences. Save instructions you often use and apply them to future rewrites.

Quick start

  1. Run /refine model in Pi and choose your rewrite model.
  2. Type a draft in the Pi editor. For example, “Look at the error handling we just discussed. Suggest improvements, but leave the code as it is.”
  3. Press Ctrl+\ to rewrite the draft and open its quick preview. The same shortcut reopens a matching result in the current round. Use v for the full preview or w for the workspace.
  4. Review a completed result and press a to accept it into the Pi editor. Edit it if needed, then submit it yourself when you're ready.

Essential commands

Command or keyAction
/refineOpen the Refine workspace without a model call.
/refine optimize <text>Request a rewrite if the editor shortcut is unavailable.
? in RefineSee the shortcuts for your current selection.

Important notes

  • Cost. A rewrite is a separate model request and may use quota or incur charges.
  • Privacy. The rewrite provider receives your draft, submitted editing instructions, and enabled context. By default, that includes selected recent messages. See what is sent and how to limit it.
  • Local history. By default, Refine saves submitted drafts, results, and editing instructions alongside your Pi session file when one exists. Manage or clear saved history.

Documentation