Skip to content
| Marketplace
Sign in
Visual Studio Code>AI>Pi Agent StudioNew to Visual Studio Code? Get it now.
Pi Agent Studio

Pi Agent Studio

Johnny Zhao

|
648 installs
| (1) | Free
Feature-rich Pi coding agent for VS Code - native terminal TUI or webview chat panel, full editor bridge, and bundled pi extensions (todo, subagent...) out of the box, plus a sidebar to manage sessions, models, agents, and settings.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info
Pi VSCode Logo

Pi Agent Studio

A feature-rich VS Code extension for the pi coding agent - native terminal TUI or webview chat panel, full editor bridge, and bundled pi extensions (todo, subagent...) out of the box, plus a sidebar for sessions, models, agents, and settings 🔥

English | 简体中文

VS Code Marketplace Open VSX License Stars

Features

  • Native terminal TUI - Pi runs in a real VS Code integrated terminal (PTY). No shell layer, no quoting hacks - pi is spawned directly (default mode)
  • Webview chat panel - Optional webview UI mode opens a streaming chat panel backed by a per-panel pi --mode rpc subprocess, with prompt queuing (Enter steer / Alt+Enter follow-up), input history, fork/revert, built-in commands, and retry
  • Model brand icons — The chat panel shows circular vendor brand avatars (OpenAI, Claude, Gemini, DeepSeek, Qwen, Grok, …) next to the model dropdown in the composer and beside model names in message timestamps, matched by model id prefix (30+ vendors)
  • Rewind code - Rewind a historical message in /tree and optionally restore the file changes too, via the bundled rewind-code extension (file-level snapshots, Accept / Revert controls; /fork rewind is message-only)
  • VS Code bridge — Bundles a pi extension and local HTTP bridge for live editor data
  • Live VS Code footer status — pi's terminal UI shows the active VS Code file, cursor/selection, language, dirty marker, and diagnostic counts in its bottom status area
  • Diagnostics tool — The agent can read VS Code diagnostics (LSP / lint / type errors) on demand via vscode_get_diagnostics
  • Slash commands — /vscode-selection and /vscode-diagnostics inject the current editor selection or diagnostics into the conversation, with the rest of the editor surface intentionally kept off-limits to the model
  • AI-powered Git commit messages — Generate semantic commit messages from staged changes using pi, with support for 14 languages and custom prompt templates
  • Session restoration — Per-workspace pi sessions are persisted and relaunched with --session after IDE reload
  • Sidebar views — Visual management panel: Sessions (new/restore/switch), Agents (subagent definitions), Prompt Templates (user/project prompt files), Models (Providers / OAuth / API Keys), and Settings (env info, system prompt override/append) — all webviews backed by direct ~/.pi/agent/*.json I/O
  • Status bar / title bar buttons — Pi button on the editor title bar for quick access
  • Auto-detection — Finds the pi binary automatically from common paths (~/.bun/bin, ~/.local/bin, ~/.npm-global/bin; on Windows %APPDATA%/npm, %LOCALAPPDATA%/pnpm)

Requirements

  • pi CLI installed:

    npm install -g --ignore-scripts @earendil-works/pi-coding-agent
    # or
    bun add -g --ignore-scripts @earendil-works/pi-coding-agent
    # or
    pnpm add -g --ignore-scripts @earendil-works/pi-coding-agent
    # or
    yarn global add --ignore-scripts @earendil-works/pi-coding-agent
    
  • An API key (or OAuth credential) configured for at least one provider — manage them from the Models sidebar

Install

Available on the VS Code Marketplace and Open VSX:

# VS Code / Cursor
code --install-extension johnny-zhao.pi-agent-studio

# Open VSX (VSCodium, etc.)
ovsx get johnny-zhao/pi-agent-studio

Commands

Command Keybinding Description
Pi: Open Alt+Shift+P Open or focus the pi terminal beside the editor
Pi: Open in New Window — Open pi then move it to a new VS Code window
Pi: Open Here — Open a pi terminal in the selected folder (via explorer context menu)
Pi: Upgrade Pi — Upgrade pi via pi update (falls back to the inferred package manager when offline)
Pi: Open settings.json — Open ~/.pi/agent/settings.json in the editor (creates an empty {} if missing)
Pi: Open models.json — Open ~/.pi/agent/models.json in the editor (creates an empty { providers: {} } if missing)
Pi: Generate Commit Message — Generate an AI-powered Git commit message from staged changes using pi
Pi: Generate Commit Message - Stop — Abort an ongoing commit message generation

The Pi: Open command is also wired to the editor title bar for one-click access.

Sidebar

The Pi activity bar icon opens a sidebar with five webviews:

  • Sessions - Per-workspace session list with live running/idle status icons; dropdown when multiple workspace folders exist
  • Agents - Manage user/project-level subagent definitions used by the bundled subagent tool
  • Prompt Templates - Create / edit / delete / open pi prompt templates (markdown with YAML frontmatter) in user and project scopes
  • Models — Three tabs:
    • Providers — Add / rename / edit / delete custom providers in ~/.pi/agent/models.json
    • OAuth — Sign in to providers that support OAuth, managed through the bundled AuthStorage
    • API Keys — Manage stored API keys in ~/.pi/agent/auth.json
  • Settings — Environment info, quick links, Upgrade Pi button, Open settings.json, and two textareas:
    • Append → ~/.pi/agent/APPEND_SYSTEM.md (appended to pi's system prompt)
    • Override → ~/.pi/agent/SYSTEM.md (replaces pi's system prompt entirely)

Bridge: tools, slash commands, and footer status

Each pi terminal launched by the extension loads a bundled pi extension that opens a local HTTP bridge to VS Code. The bridge powers three things:

  1. Live footer status - Refreshed every ~1.5s in pi's TUI status area: active file, cursor / selection, language id, dirty marker, and diagnostic counts. Disable with pi-agent-studio.statusBar.
  2. One LLM tool - The agent can autonomously read VS Code diagnostics. Other actions are intentionally not exposed to the model. Disable individual tools via pi-agent-studio.disabledTools.
  3. Slash commands — User-triggered commands that pull live editor context and inject it into the conversation as a user message.

Design note. Earlier versions exposed 25 tools to the model. They were cut down to one: tool-spam pollutes context and tempts the model into making file edits behind the editor's back. The remaining live-editor surface is now driven by explicit slash commands so the human stays in control of when context flows in.

Bundled bridge extensions

Beyond the editor bridge, the extension bundles a few pi extensions that add agent-facing tools and commands (disable any via pi-agent-studio.disabledTools):

  • todo - a todo LLM tool with a live list widget above the composer, plus /todos and /todo-clear commands
  • questionnaire - lets the agent ask structured questions (rendered as a native web form in webview mode)
  • subagent - delegate tasks to specialized agents (explore, general, plus your own); managed from the Agents sidebar
  • permission-gate - intercepts dangerous bash commands (matching pi-agent-studio.permission.dangerousPatterns, e.g. rm -rf, sudo) and requires approval before execution; switch per session via /permission
  • rewind-code - file-level content snapshots that let you rewind a historical message via /tree and optionally restore its code changes (message-only on /fork); in the webview panel it drives a live changed-files widget with Accept / Revert
  • btw - /btw asks a question without altering the main conversation context

LLM tool (1)

Tool What it returns
vscode_get_diagnostics VS Code diagnostics (LSP / lint / type errors) for a file or the whole workspace

Accepts an optional filePath (absolute or workspace-relative). With no argument it returns diagnostics for the whole workspace.

Slash commands (2)

Type these inside the pi terminal. Each command resolves arguments from the current VS Code state when omitted, calls the bridge, and injects the JSON result back into the conversation as a user message (so the model sees it and can react).

Command Arguments Behavior
/vscode-selection [intent?] optional free-text intent Returns the current editor selection (text, file path, coordinates). Trailing text is treated as the user's intent and prepended to the injected message.
/vscode-diagnostics [filePath?] [intent?] optional file path, optional intent Returns diagnostics for filePath, or for the active editor when omitted. Non-path tokens are treated as intent.

Example:

/vscode-selection explain this regex
/vscode-diagnostics src/extension.ts why is this failing?
/vscode-diagnostics                 # → diagnostics for the currently active editor

Notes

  • Slash command arguments use a simple heuristic: a token containing /, \, or . is treated as a file path; everything else is treated as free-text intent.
  • File paths can be absolute or workspace-relative.
  • The bridge RPC layer (src/bridge/handlers.ts) still implements the full set of editor operations (selection, symbols, definitions, references, hover, code actions, formatting, workspace edits, save, notifications, …). They are reachable from the bundled bridge but not registered as LLM tools or slash commands today — reserved for future explicit commands.
  • Oversized bridge results are capped; when a response exceeds the limit, the tool returns a valid JSON wrapper with truncated: true, original size metadata, and a resultJsonPrefix preview.

Configuration

Setting Type Default Description
pi-agent-studio.path string "" Absolute path to the pi binary (auto-detected if empty)
pi-agent-studio.env object {} Environment variables merged into the pi terminal (bridge vars win on key collision)
pi-agent-studio.args array [] Extra CLI args appended after --extension and before any caller-supplied extra args
pi-agent-studio.commitLanguage string "English" Language for generated Git commit messages (14 languages supported)
pi-agent-studio.commitMessagePrompt string "" Custom system prompt for commit message generation
pi-agent-studio.commitModel string "" Model used for commit message generation, in provider/model format (e.g. Zai/glm-5.2)
pi-agent-studio.statusBar boolean true Show live VS Code context (editor, selection, diagnostics) in the pi TUI footer
pi-agent-studio.ui string "terminal" UI for Pi: Open: terminal (TUI) or webview (chat panel)
pi-agent-studio.disabledTools array [] Bundled LLM tools to disable: vscode_get_diagnostics, todo, questionnaire, subagent
pi-agent-studio.rpcTrace boolean false Log RPC traffic and pi stderr to the "Pi Chat RPC" output channel
pi-agent-studio.permission.mode string "AskForApproval" Gate dangerous bash commands: AskForApproval (prompt before execution) or FullAccess
pi-agent-studio.permission.dangerousPatterns array ["\\brm\\s+(-rf? | --recursive)", "\\bsudo\\b", "\\b(chmod | chown)\\b.\*777"] Regexes matching dangerous bash commands that require approval (case-insensitive; replaces defaults entirely)
pi-agent-studio.chatFontSize number 13 Font size of the webview chat panel (range 8–32)

Building from source

pnpm install
pnpm build         # rolldown bundle → dist/extension.cjs
pnpm package       # builds + vsce package --no-dependencies
pnpm install-local # package + install into local VS Code

Useful dev commands:

  • pnpm dev — rolldown watch mode
  • pnpm fmt — oxlint --fix + oxfmt
  • pnpm lint — oxlint . && oxfmt --check .
  • pnpm typecheck — tsgo --noEmit --skipLibCheck
  • pnpm vitest run — run the test suite

Changelog

See CHANGELOG.md for release notes.

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft