Pi Agent for VS Code

English · 简体中文
A VS Code sidebar and editor tab for the local pi
coding agent — a Claude Code / Codex-style chat UI that runs entirely on
your own pi: your models, your credentials, your sessions.
⚠️ Pi Agent is a front-end. It launches the pi CLI installed on your
machine, which can read/write workspace files and run shell commands. It
activates only in trusted workspaces. Use at your own discretion.
Install
From the Marketplace
From a VSIX
Then install it either way:
Prerequisites
- Install the pi CLI:
npm install -g @earendil-works/pi-coding-agent
- Connect a model provider. The easiest way is from inside VS Code: open the
Pi view (next step), then press Connect on the first-run checklist to
add an API key (Anthropic, OpenAI, DeepSeek, OpenRouter, …), point pi at a
custom OpenAI-compatible endpoint (third-party gateway, self-hosted,
Ollama/LM Studio), or sign in with OAuth in a terminal. Running
pi once
yourself works too.
- Open a trusted folder in VS Code, then click the Pi icon in the
Activity Bar (or run Pi: Open Chat).
The extension keeps no credentials of its own — it reuses your existing
~/.pi configuration (models, sessions, skills, prompts) and, only when you ask
it to, writes to pi's own credential files (auth.json / models.json).
Highlights
- 💬 Streaming chat with thinking display and live tool activity cards.
- ⏯️ Queue & steer — keep typing while pi works: Enter queues a
follow-up, Ctrl/⌘+Enter steers the running turn.
- 🧰 Run shell commands straight from the composer with a leading
!.
- 🎯 Context without copy-paste — attach files/selections (sent as
@path:12-30 references), type @ to mention a file, drop files in, or turn
on automatic context (open file, selection, diagnostics, Git).
- 🧭 Question navigator — a right-edge rail plus
‹ 5/6 ▾ › to jump between
your questions in the current session.
- 🗂️ Sessions — new / switch / rename / clone; unnamed sessions show
their first question, and new ones are auto-named.
- 🧩 Slash commands & skills — type
/ to autocomplete pi's commands,
prompt templates, and skills.
- 🖼️ Image paste — paste a screenshot to send it to vision models.
- 🌿 Git integration — generate a commit message (Source Control title
button) or a pull request description from the current changes.
- ↩️ Review & revert — each turn lists the files it changed; revert them to
their pre-turn state in one click.
- 🗜️ Compact — summarize the context when the window fills up (with a
one-click prompt near the limit).
- 🪟 Editor tabs — open the chat in an editor tab or beside your code; every
surface shares the same session.
- 📝 Rich output — Markdown, syntax-highlighted code with Apply / Copy,
KaTeX math, and lazy-loaded Mermaid diagrams.
- 🛡️ Permission modes — Manual / Auto / Read-only.
- 🌐 Localized — follows the VS Code display language.
Commands & shortcuts
| Action |
How |
| Open chat |
⌥⌘P / Ctrl+Alt+P, status bar ✨Pi, or Pi: Open Chat |
| New chat |
⌘⇧N / Ctrl+Shift+N in the sidebar, or Pi: New Chat |
| Open in editor tab / beside |
Pi: Open Chat in Editor Tab / Pi: Open Chat Beside |
| Jump between questions |
Alt+↑ / Alt+↓, or the ‹ › buttons and rail |
| Search messages |
Ctrl+F / ⌘F anywhere in the chat view |
| Explain / refactor selection |
Select code → right-click → Pi: Explain Code / Pi: Refactor Code |
| Generate code |
Pi: Generate Code |
| Attach file / selection |
📎 in the composer, or right-click → Pi: Attach… |
| Cycle model / thinking level |
Pi: Cycle Model / Pi: Cycle Thinking Level |
| Compact session |
Pi: Compact Session |
| Generate commit message / PR |
Pi: Generate Commit Message / Pi: Generate Pull Request Description |
| Revert last turn's changes |
Pi: Revert Changes From Last Turn |
| Clone session |
Pi: Clone Session |
| Reload session (rebuild from disk) |
Pi: Reload Session |
| Export diagnostics |
Pi: Export Diagnostics |
Settings (pi-agent.*)
| Setting |
Default |
Description |
pi-agent.pi.executable |
(empty) |
Custom pi CLI path (auto-detected when empty) |
pi-agent.pi.arguments |
[] |
Extra arguments passed to pi |
pi-agent.agent.permissionMode |
ask |
ask / autoConfirm (--approve) / restricted (--exclude-tools bash,edit,write) |
pi-agent.context.autoAttach |
false |
Attach the open file/selection to every message |
pi-agent.context.includeDiagnostics |
false |
Include editor diagnostics in automatic context |
pi-agent.context.includeGit |
false |
Include Git branch/changes in automatic context |
pi-agent.sessions.autoName |
true |
Name new sessions automatically from the first message |
pi-agent.notifications.enabled |
true |
Notify on completion while the window is unfocused |
pi-agent.diagnostics.level |
info |
Output-channel log level (error/info/debug) |
Changing pi.executable, pi.arguments or agent.permissionMode reloads every
session automatically (each running turn is ended gracefully first, not killed
mid-write).
Pi: Reload Session (the ⟳ button in the Pi view title bar) replaces the pi
process for the current session only and rebuilds its transcript from the
session file — useful after upgrading pi, when the session was changed by
another pi process, or when pi has stopped responding. Other sessions keep
running. Reloading while pi is working asks first and stops the current turn;
anything already written to the session file is kept. The session list's own ⟳
re-reads the session directory from disk.
Architecture
VS Code extension (this repo)
│ RpcClient (@earendil-works/pi-coding-agent)
▼
pi --mode rpc (local agent harness)
│ tools: read / bash / edit / write
▼
your project files
- The extension is the front-end: chat UI, streaming output, tool activity.
- pi is the engine: file access, commands, multi-step tasks, models and
credentials all come from your pi setup.
Development
npm ci
npm run compile # tsc (extension host) + esbuild (webview)
# press F5 in VS Code to launch the Extension Development Host
npm run watch # tsc --watch
npm run watch:webview # esbuild --watch
npm run lint
npm test # vitest
See CONTRIBUTING.md for details, and
RELEASING.md for the release process.
Links
License
MIT © Pi Agent contributors
| |