← Catalog

send-to-pi

Send webpage snippets, URLs, or articles directly to your local Pi coding agent terminal.

Extension

Install

Install with PiG

pig install npm:send-to-pi

Install with Pi

pi install npm:send-to-pi
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": [
    "./pi-extension/index.ts"
  ]
}

README

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

🚀 send-to-pi

简体中文 | English

Seamlessly bridge your web browser to the Pi Coding Agent. Send snippets, articles, or links directly into your Pi terminal prompt in any terminal client—with zero-daemon direct delivery when Pi is open, and 4-layer adaptive cold-start launch when it isn't.

npm version License: MIT Node.js Version Platform


💡 Highlights

  • 🔌 Zero-Daemon Direct Mode (100% Terminal-Agnostic): When Pi is already running—in Rex, Ghostty, iTerm2, Warp, WezTerm, kitty, Alacritty, VS Code, Cursor, Windows Terminal, tmux, or any other terminal—the Chrome extension talks directly to Pi (18091~18095) and prefills via ctx.ui.setEditorText(). No background daemon required for hot delivery.
  • 🪟 Active Session Routing & Popup Switcher: Tracks real user activity (input / agent_start) across multiple Pi sessions and routes to the most recently used window. Click the extension toolbar icon to view all online Pi sessions (project + terminal) and pin a target if needed.
  • 🧠 Smart Length Routing (Short Inline, Long @file): Short snippets (≤ 1,500 chars by default) are prefilled directly; long articles are saved locally to ~/.pi/send-to-pi/inbox/*.md (auto-pruned) and inserted as a clean 3-line @file reference—keeping your terminal prompt clean while preserving logged-in browser content! Switch between Smart / Inline / Link Only anytime in the toolbar popup.
  • 🎯 Prefill Mode (No Auto-Submit): Inserts formatted Markdown at your cursor without pressing Enter, so you can append instructions first.
  • 📝 HTML to Markdown & Clean Article Extraction: Preserves <pre><code> language tags, indentation, tables, lists, quotes, and links. Extracts clean articles (including X/Twitter main posts).
  • ⚡ 4-Layer Adaptive Cold-Start (Optional Bridge Daemon): Start the optional Bridge Daemon (npx send-to-pi start) to wake Pi even when closed:
    1. Custom Command Template (PI_LAUNCH_CMD or ~/.pi/send-to-pi/config.json) — one-line escape hatch for any terminal client.
    2. Last Used Terminal Memory — Pi records the terminal you actually use (~/.pi/send-to-pi/last-terminal.json), so cold-start launches the right client (including Rex, Ghostty, Warp, WezTerm, kitty, Alacritty, iTerm2, Windows Terminal, etc.).
    3. Running / Installed Smart Detection — prefers currently running terminals before OS defaults.
    4. Clipboard Fallback — if no terminal can be launched, formatted Markdown is copied to your clipboard automatically so nothing is ever lost.
  • 🔒 100% Local & Private: Loopback 127.0.0.1 only. Zero cloud calls, zero telemetry.

🛠️ Architecture

flowchart LR
    Chrome[Chrome Extension] -->|1. Primary :18090| Bridge[Bridge Daemon<br/>Optional · Cold-Start]
    Chrome -.->|2. Zero-Daemon Direct<br/>Probes :18091~18095| Pi[Active Pi Session]
    Bridge -->|Hot Delivery :18091~18095| Pi
    Pi -->|ctx.ui.setEditorText| Editor[Any Terminal Client<br/>Rex / Ghostty / Warp / VS Code / WT...]
    Bridge -->|Cold-Start 4 Layers| Launcher[Custom Cmd → Last Terminal<br/>→ Running/Installed → Clipboard]
    Chrome -.->|3. Fallback when all offline| Clip[Clipboard Copy]

📦 Quick Start (2 Steps for Direct Mode)

Step 1: Install the Pi Extension

pi install npm:send-to-pi

Restart or open pi in any terminal. The extension listens on 127.0.0.1:18091~18095.

Step 2: Load the Chrome Extension

npx send-to-pi extension
  1. Open chrome://extensions/ in Chrome or Edge.
  2. Enable Developer mode (top-right).
  3. Click Load unpacked and select the opened folder.

That's it! Highlight text on any page and press Cmd+Shift+S (Windows/Linux: Alt+Shift+S) or right-click to send directly into your active Pi terminal.

Optional Step 3: Start Bridge Daemon (for Cold-Start Auto-Wake)

Only needed if you want send-to-pi to automatically launch a terminal when no Pi session is running:

npx send-to-pi start

Check live status anytime (shows both Bridge and Direct-Mode Pi sessions):

npx send-to-pi status

⚙️ Configuration (~/.pi/send-to-pi/config.json or Env Vars)

Run npx send-to-pi config to view your config path and effective settings.

Example ~/.pi/send-to-pi/config.json:

{
  "terminal": "rex",
  "launchCommand": "rex run --interactive --cwd \"{workdir}\" --keep-open -- pi",
  "focusOnSend": false
}
Env VariableConfig KeyDefaultDescription
PI_BRIDGE_PORTbridgePort18090Port listened by the optional Bridge Daemon
PI_INTERNAL_PORTinternalPort18091Starting port for Pi sessions (probes 5 ports)
PI_DELIVERY_MODEdeliveryModesmartsmart (short inline, long @file), inline, or link
PI_INLINE_LIMITinlineLimit1500Char threshold before smart mode saves to inbox/
PI_WORKDIRworkDirLast Pi workdir / cwdWorking directory for cold-start launch
PI_TERMINALterminalAuto (last used)Preferred terminal (rex, ghostty, iterm2, warp, wezterm, kitty, alacritty, wt, terminal)
PI_LAUNCH_CMDlaunchCommandEmptyCustom launch command template with {workdir} placeholder
PI_FOCUS_ON_SENDfocusOnSendfalseBring the target terminal app to front after sending (macOS)

🆕 v1.4.0 Changes

  • Smart Length Routing (Short Inline + Long @file): Content over 1,500 chars is automatically saved as clean Markdown in ~/.pi/send-to-pi/inbox/ (auto-prunes old files) and prefilled as a concise 3-line @file reference.
  • One-Click Mode Switcher: Switch between Smart, Inline, and Link Only directly inside the Chrome extension popup (plus a new "Send Current Page URL" context menu).
  • Cleaner X/Twitter Extraction: Strips trailing link preview cards, view/quote counters, and redundant t.co link wrappers; truncates overly long page titles.

🆕 v1.3.0 Changes

  • Zero-Daemon Direct Delivery: Chrome extension automatically falls back to probing active Pi sessions (18091~18095) when Bridge (18090) is not running—works out of the box on any terminal client.
  • Toolbar Popup Session Switcher: View Bridge status and all online Pi sessions (workdir + terminal) and switch between Auto (most recent) or a pinned session.
  • Real Activity Tracking: Added input and agent_start hooks in Pi extension so activeAt always reflects the window you are actively using.
  • 4-Layer Cross-Client Cold-Start: Added native Rex (plus Warp, kitty, Alacritty, WezTerm, Ghostty, iTerm2, Windows Terminal) support, automatic last-terminal.json memory, custom launchCommand template escape hatch, and clipboard fallback.

📄 License

MIT License © 2026 Wude