vscode-pi-companion
Share VS Code context with pi coding agent
Package details
Install vscode-pi-companion from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:vscode-pi-companion- Package
vscode-pi-companion- Version
0.2.0- Published
- Mar 23, 2026
- Downloads
- 85/mo · 12/wk
- Author
- ravshansbox
- License
- unknown
- Types
- extension
- Size
- 36.8 KB
- Dependencies
- 5 dependencies · 0 peers
Pi manifest JSON
{
"extensions": [
"./extensions"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
VS Code PI Companion
A VS Code extension that provides real-time IDE context (files, selection) to pi and other agents.
Features
- Real-time context: Monitors open files, cursor position, and selection
- Instant updates: Pushes context changes via SSE
- Seamless integration: Selected lines injected into LLM context automatically
- Widget display: Shows current file/selection in pi UI
Architecture
VS Code Extension → SSE ← pi Extension
- VS Code: Context tracking, SSE server
- pi: SSE client, Widget, Context injection
Installation
1. Install pi Extension
pi install git:github.com/ravshansbox/vscode-pi-companion
Or manually:
mkdir -p ~/.pi/agent/extensions/vscode-pi-companion
git clone git@github.com:ravshansbox/vscode-pi-companion.git ~/.pi/agent/extensions/vscode-pi-companion
cd ~/.pi/agent/extensions/vscode-pi-companion
npm install
2. Install VS Code Extension
The pi extension will auto-install the VS Code extension when you run pi in a VS Code terminal.
Alternatively, install manually:
# Download the .vsix from releases
code --install-extension vscode-pi-companion.vsix
Then reload VS Code window.
Usage
- Open a folder in VS Code
- Open VS Code terminal (`Ctrl+``)
- Run
pi - The extension auto-connects and shows current file in widget
- Select code → widget updates instantly
- Selected lines are injected into LLM context automatically
Widget Display
📄 filename # no selection
📄 filename L9 # single line
📄 filename L9:14 # multi-line selection
MCP Tools (for LLM)
| Tool | Description |
|---|---|
get_ide_context |
Full IDE context |
get_current_file |
Current file with selection |
list_open_files |
List all open files |
Development
# Build VS Code extension
npm install
npm run compile
# Package as .vsix
npx vsce package
Press F5 to run in Extension Development Host.