to-agent
Send files and selections from your editor to a coding agent
Package details
Install to-agent from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:to-agent- Package
to-agent- Version
0.1.1- Published
- Jul 20, 2026
- Downloads
- 112/mo · 112/wk
- Author
- sanatank
- License
- MIT
- Types
- extension
- Size
- 22.3 KB
- Dependencies
- 0 dependencies · 1 peer
Pi manifest JSON
{
"extensions": [
"./pi-extension/to-agent.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
to-agent
Send the current file or selection from Cursor or VS Code to a running pi coding-agent session.
Press cmd+alt+l on macOS or ctrl+alt+l on Windows/Linux. A whole file is inserted as an @file reference; a selection is inserted as a path-labelled fenced code block with line numbers.
Install
npx to-agent install
The installer detects Cursor and VS Code, installs the editor extension, installs the matching pi adapter, and keeps both sides on the same version.
For an explicit, non-interactive installation:
npx to-agent install --editor cursor --agent pi
npx to-agent install --editor vscode --agent pi
Restart the editor after installation, start pi in a terminal, and click the to-agent status item to select a running session.
Commands
npx to-agent install
npx to-agent doctor
npx to-agent uninstall
How it works
Each pi instance publishes discovery metadata under ~/.to-agent/instances/ and listens on a local Unix socket (macOS/Linux) or named pipe (Windows):
~/.to-agent/instances/<id>.json
~/.to-agent/instances/<id>.sock # macOS/Linux
The editor discovers live instances and holds one persistent socket connection to the selected session. The connection is also the presence signal shown on both sides.
The local JSONL protocol is versioned. Version 1 accepts:
{ "type": "attach", "file": "/abs/path.ts", "startLine": 10, "endLine": 20, "text": "..." }
Selection fields are omitted for whole-file attachments.
Current support
| Editor | Agent | Status |
|---|---|---|
| Cursor | pi | Beta |
| VS Code | pi | Beta |
| Zed | — | Planned; subject to extension API support |
| — | Claude Code, Codex, OpenCode | Exploring plugin capabilities |
Development
Requirements: Node.js 18+, npm, and pi. Install dependencies and build:
npm install
npm run check
Useful paths:
cursor-extension/src/extension.ts Cursor / VS Code adapter
pi-extension/to-agent.ts pi adapter
bin/to-agent.js installer and diagnostics CLI
artifacts/to-agent.vsix generated editor package
Test the install plan without changing the machine:
node bin/to-agent.js install --editor cursor --agent pi --dry-run
For pi extension development, load the source directly:
pi -e ./pi-extension/to-agent.ts
License
MIT