$ cat ~/map/pi-for-vscode.md
Pi for VS Code
VS Code extension hosting the real pi TUI in the sidebar over a pseudo-terminal — not a chat-panel reimplementation.
tools✓ Sep 16
Facts
- repository
- github.com/yicLionel/pi-for-vscode ↗
- GitHub Stars
- ★ 1
- Forks
- 0
- license
- MIT
- npm / mo
- —
- last push
- Sep 15, 2026
install
Download the VSIX from the GitHub releases page (pi-for-vscode-<version>.vsix), optionally verify it against the SHA256SUMS.txt from the same release, and run code --install-extension pi-for-vscode-*.vsix — there is no Marketplace listing## TL;DR
A VS Code extension that hosts the real pi TUI in the sidebar — xterm.js over a node-pty pseudo-terminal — so slash commands, keybindings, themes, /login, session resume, mouse reporting, and tool-approval prompts behave exactly as in a terminal, because it is one.
## Key points
- $A real TUI, not a reimplementation: the sidebar runs the actual pi TUI through xterm.js over a genuine pseudo-terminal, so nothing is simulated — slash commands, pi's own keybindings, themes, /login, session resume, mouse reporting, bracketed paste, and full-screen TUIs all behave as they do in the terminal.
- $Multiple sessions and code hand-off: Pi: New Pi Terminal (Editor Tab) opens an independent session beside the code; Pi: Send Selection to Pi inserts the current selection into the prompt, Pi: Send Current File Reference to Pi drops an @path mention, and path:line:col references in pi's output become clickable links that open at the exact position.
- $Finding pi in a GUI environment: auto-detection searches PATH, Homebrew, npm and pnpm globals, Volta, asdf, nvm, and ~/.local/share/pi-node before falling back to the login shell's PATH; because pi is a Node script and GUI-launched VS Code often has no node on PATH, the extension reads the shebang and resolves a matching interpreter (preferring the node bundled next to pi); Windows .cmd and .bat shims are wrapped in cmd.exe /c.
- $A PTY without native compilation: the terminal layer uses N-API prebuilt binaries that are ABI-independent, so the same pty.node loads under both system Node and VS Code's Electron extension host — no Xcode Command Line Tools, no Visual Studio Build Tools.
- $Environment isolation: when VS Code itself was launched from a pi session, inherited variables such as PI_SESSION_ID and PI_SESSION_FILE are stripped before spawning the child pi so its session handling is not corrupted.
- $Theme-, font-, and clipboard-aware: terminal colours come from VS Code's terminal CSS variables and follow editor font and cursor settings, updating live on theme switches; copy and paste go through the VS Code clipboard API so they also work in remote, WSL, and web contexts.
- $Configurable startup: settings cover executablePath, extra launch arguments such as --model or --continue, environment variables for API keys, autoStart, working-directory mode, font family and size, scrollback, and whether sending a selection auto-presses Enter.
## FAQ
Q Is the extension available on the VS Code Marketplace?
No. It is distributed through GitHub Releases as a VSIX — download pi-for-vscode-<version>.vsix from the latest release, optionally check it against the SHA256SUMS.txt published alongside it, and install it with code --install-extension.
Q Why a webview with a PTY instead of VS Code's built-in terminal API?
The stable VS Code API has no sidebar location for createTerminal, so a webview plus a real pseudo-terminal is the honest way to get a genuine TUI in the Activity Bar — the extension ships the same pi interface the terminal would.
Q Pi fails to start in a container, remote, or WSL — what should I check?
Set pi-for-vscode.executablePath explicitly. Auto-detection cannot see host paths from inside a container, and the troubleshooting section of the README also points to the Show Logs output channel, which records the resolved executable, interpreter, working directory, and pid.
## References
## Related entries
$ aft
Sensorimotor-cortex layer that ships thin adapters for Pi and OpenCode, replacing raw read/write/edit/bash with semantic operations.
$ pi-acp-jetbrain
Agent Client Protocol adapter that runs pi inside JetBrains IntelliJ's agent panel over stdio, with one pi --mode rpc subprocess per session.
$ pi-conversation-outline
Read-only outline rail for fullscreen: one tick per prompt, hover to preview, click to jump.
## Guides
Last updated: Sep 16, 2026