A OpenCode GUI for VS Code.
OpenCode GUI brings the OpenCode coding agent directly into Visual Studio Code with streaming chat, code context, file and image attachments, implementation plans, subagent tracking, session history, and live quota monitoring.
It is built for developers who use OpenCode but want a smoother IDE workflow instead of switching between the terminal and editor.
If this extension helps your workflow, consider giving the repo a star.
This extension requires the OpenCode CLI to be installed locally.
curl -fsSL https://opencode.ai/install | bashYou can also install OpenCode with a package manager such as:
brew install anomalyco/tap/opencodeor:
npm i -g opencode-ai@latestImportant
Disclaimer: This extension is an independent personal project and is not affiliated with, endorsed by, or maintained by OpenCode or its creators.
If you already use OpenCode in the terminal, this extension gives you a more integrated VS Code workflow.
- Use OpenCode inside a dedicated VS Code sidebar
- Chat with the OpenCode coding agent without leaving your editor
- Attach files, images, and selected code directly into the chat
- Generate and review
implementation_plan.mdfiles before code changes - Answer inline planning questions from the agent
- Add annotations and comments to implementation plans
- Track agent-generated todos and active tasks
- View subagent activity, tool calls, and execution progress
- Monitor live quota usage for GitHub Copilot, Z.ai, OpenAI, and other supported providers
- Keep persistent session history across VS Code restarts
- Use slash-command skills, MCP status, LSP status, and agent panels from one UI
OpenCode UI wraps your local OpenCode runtime with a native VS Code experience. It talks to the OpenCode server through @opencode-ai/sdk, streams events over SSE, and renders the workflow inside a React-powered webview.
This gives you the power of OpenCode while keeping your planning, prompting, reviewing, and coding flow inside VS Code.
- Real-time streaming responses
- Markdown rendering with syntax highlighting
- Collapsible reasoning/thinking sections
- Copy message content to clipboard
- Inline image previews
- Unified error cards for API failures and timeout issues
- Token usage tracking for prompt, response, reasoning, and cache activity
- Attach highlighted code selections from the editor
- Insert file references directly into the chat input
- Attach images through paste or drag-and-drop
- Ground prompts with files, screenshots, code snippets, and project context
- Use keyboard shortcuts for fast file and code context insertion
- Generate structured
implementation_plan.mdfiles before code changes - Review implementation plans in a dedicated plan viewer
- Add annotations and comments before execution
- Track checklist progress
- Request revisions before switching to build mode
- Keep planning, review, and execution connected in the same workflow
- The agent can ask clarification questions inline
- Supports selectable quick answers
- Supports custom answers
- Helps the Plan agent gather missing requirements before generating or revising a plan
- Preserves interactive context across session reloads
- Track active background subagents
- View subagent status, progress, thinking events, and tool calls
- Inspect subagent details in a modal
- See subagent cards inside assistant messages
- Understand what the agent is doing while work is in progress
- View agent-generated todos and tasks
- Keep track of what the agent thinks still needs to be done
- See active work beside quotas, MCP status, LSP status, skills, and agent panels
- Persistent chat sessions across VS Code restarts
- Rename, delete, and fork sessions
- Keep long-running work organized
- Automatically compact sessions when context usage gets too high
- Continue working without losing important context
Live quota status is available for:
- OpenAI
- GitHub Copilot
- Z.ai
- Google Gemini
- Zhipu
- Other supported providers exposed by OpenCode
The quota panel helps you see provider usage, limits, and daily budget signals directly inside VS Code.
The right sidebar can show:
- MCP server status
- MCP tool lists
- LSP server status
- Slash-command skills
- Available OpenCode agents
- Agent mode, color, and description
- Active tasks and quota state
OpenCode UI works with OpenCode plugin-driven workflows, including community plugin collections like Oh My OpenCode.
Plugin-provided agents, skills, and capabilities can be surfaced directly inside the extension UI.
Full chat flow with streaming responses, structured outputs, and session continuity.
Plan workflow from generation to review, including comments and annotations before execution.
Attach file references and highlighted code lines directly in the chat box.
Agent-generated tasks, subagent activity, and side-panel visibility for active execution state.
Interactive question flow with selectable answers, custom responses, and live quota visibility.
-
Install the OpenCode CLI:
curl -fsSL https://opencode.ai/install | bash -
Install this extension in VS Code.
-
Open the OpenCode panel from the Activity Bar.
-
Start a new session and send your first prompt.
| Action | Shortcut |
|---|---|
| Focus / open chat | Ctrl+Esc / Cmd+Esc |
| New session | Ctrl+Shift+Esc / Cmd+Shift+Esc |
| Send selected code | Ctrl+L / Cmd+L |
| Insert file reference | Ctrl+Alt+K / Cmd+Alt+K |
You can also open the panel from the Activity Bar using the OpenCode icon.
Type your prompt in the chat input and press Enter.
Use Shift+Enter for a new line.
You can:
- Attach images by pasting or dragging them into the input
- Reference files with
Ctrl+Alt+K/Cmd+Alt+K - Attach selected code with
Ctrl+L/Cmd+L - Use slash commands by typing
/ - Select an agent from the agent dropdown
- Switch between Plan, Build, and custom agents exposed by OpenCode
- Select the Plan agent from the agent dropdown.
- Describe the feature or change you want.
- Answer any inline questions from the agent.
- OpenCode generates an
implementation_plan.md. - Click View Implementation Plan.
- Review the plan.
- Add annotations or comments.
- Request revisions if needed.
- Switch to Build mode or proceed with implementation.
- Click the history icon in the chat header to open the session list.
- Sessions are listed with title, date, and token count.
- Use the session menu to rename, delete, or fork a session.
Click the Stop button in the chat header to abort the current AI request.
Access settings through:
File → Preferences → Settings → OpenCodeor add them to settings.json.
| Setting | Type | Default | Description |
|---|---|---|---|
opencode.serverPort |
number |
0 |
Port for the OpenCode server. 0 auto-assigns a free port. |
opencode.autoStart |
boolean |
true |
Start the server automatically when the extension activates. |
opencode.persistSessions |
boolean |
true |
Persist chat sessions across VS Code restarts. |
opencode.autoCompact |
boolean |
true |
Compact a session automatically when context usage nears the threshold. |
opencode.autoCompactThreshold |
number |
0.9 |
Fraction of model context usage that triggers auto-compaction. |
opencode.requestTimeout |
number |
120000 |
Request timeout in milliseconds. |
opencode.complexQueryMultiplier |
number |
1.5 |
Timeout multiplier for prompts with heavier context. |
| Setting | Type | Default | Description |
|---|---|---|---|
opencode.logging.level |
string |
"info" |
Minimum log level: error, warn, info, debug. |
opencode.logging.enableConsole |
boolean |
true |
Write logs to the VS Code Output channel. |
opencode.logging.enableFile |
boolean |
false |
Write logs to a rotating file on disk. |
opencode.logging.maxFileSize |
number |
5242880 |
Max log file size in bytes before rotation. |
opencode.logging.maxFiles |
number |
3 |
Number of backup log files to keep. |
{
"opencode.serverPort": 0,
"opencode.autoStart": true,
"opencode.persistSessions": true,
"opencode.autoCompact": true,
"opencode.autoCompactThreshold": 0.9,
"opencode.requestTimeout": 120000,
"opencode.logging.level": "debug",
"opencode.logging.enableFile": true
}┌─────────────────────────────────────────────────────────────┐
│ VS Code Extension Host │
│ │
│ extension.ts │
│ ├── OpencodeServerManager (manages local OpenCode server)│
│ ├── SessionService (persistence + sync) │
│ ├── StatusBarProvider (connection indicator) │
│ ├── ChatViewProvider (main webview host) │
│ ├── PlanViewProvider (implementation plan viewer) │
│ └── DiffReviewProvider (VCS diff panel) │
│ │
│ Services │
│ ├── MessageStreamService (SSE event streaming) │
│ ├── SubagentTracker (background task tracking) │
│ ├── QuotaService (provider quota polling) │
│ ├── RequestBudgeter (daily budget calculation) │
│ ├── PlanParser (implementation_plan.md) │
│ └── GeminiTokenUsageTracker │
└────────────────────┬────────────────────────────────────────┘
│ HTTP + SSE via @opencode-ai/sdk
│ port: auto-assigned or configured
┌────────────────────▼────────────────────────────────────────┐
│ OpenCode Local Server │
│ accessed via @opencode-ai/sdk │
│ │
│ REST API │
│ GET /agent — list agents │
│ GET /command — list slash-command skills │
│ GET /mcp — MCP server status │
│ GET /lsp/status — LSP server status │
│ GET /event — SSE event stream │
│ POST /session/:id/prompt — send message │
│ ...and more session, file, tool, and VCS endpoints │
└─────────────────────────────────────────────────────────────┘
│
┌────────────────────▼────────────────────────────────────────┐
│ Webview React UI │
│ webview/shared/dist/chat.js │
│ │
│ ChatShell.tsx — layout container │
│ MessageComponents.tsx — user and assistant messages │
│ PanelComponents.tsx — sidebar panels │
│ StreamingComponents.tsx — live streaming card │
│ BudgetIndicator.tsx — inline budget banner │
│ SubagentDetailModal.tsx — subagent inspection modal │
└─────────────────────────────────────────────────────────────┘- User types in the chat input.
- The webview sends a
sendPromptmessage to the extension host. ChatViewProviderreceives the message.- The extension calls
client.session.prompt(). MessageStreamServicestreams SSE events from the OpenCode server.- Events are forwarded to the webview.
- The React reducer updates the UI in real time.
vscode-opencode/
├── src/
│ ├── extension.ts
│ ├── providers/
│ │ ├── ChatViewProvider.ts
│ │ ├── DiffReviewProvider.ts
│ │ ├── PlanViewProvider.ts
│ │ └── StatusBarProvider.ts
│ ├── services/
│ │ ├── OpencodeServerManager.ts
│ │ ├── SessionService.ts
│ │ ├── MessageStreamService.ts
│ │ ├── SubagentTracker.ts
│ │ ├── QuotaService.ts
│ │ ├── RequestBudgeter.ts
│ │ ├── PlanParser.ts
│ │ └── GeminiTokenUsageTracker.ts
│ ├── shared/
│ ├── types/
│ └── utils/
│ └── Logger.ts
├── webview/
│ └── shared/
│ ├── src/
│ │ ├── chat/
│ │ │ ├── ChatShell.tsx
│ │ │ ├── MessageComponents.tsx
│ │ │ ├── PanelComponents.tsx
│ │ │ ├── StreamingComponents.tsx
│ │ │ ├── BudgetIndicator.tsx
│ │ │ ├── SubagentDetailModal.tsx
│ │ │ ├── ImagePreviewModal.tsx
│ │ │ └── lib/
│ │ │ ├── store.ts
│ │ │ ├── types.ts
│ │ │ ├── messageHandler.ts
│ │ │ ├── structuredOutputValidator.ts
│ │ │ └── generated/
│ │ ├── plan/
│ │ ├── diff-review/
│ │ └── components/ui/
│ └── dist/
├── scripts/
├── tests/
├── resources/
├── AGENTS.md
├── LOGGING.md
├── package.json
├── tsconfig.json
└── esbuild.config.jsStarts and manages the local OpenCode server process.
Handles:
- Dynamic port allocation
- Server readiness detection
- Cross-platform process cleanup
- Automatic reconnection
- Status events for the status bar and chat provider
Custom fetch-based SSE client for OpenCode events.
Handles:
- SSE line parsing
- Chunk-boundary buffering
- Request cancellation
- Subscriber management
- Auto-reconnect with back-off
Persists sessions between VS Code restarts using context.globalState.
It also syncs with the server on startup and reconciles sessions created externally.
Parses subagent-related events and builds parent-child session relationships.
It exposes subagent summaries and details to the webview.
Polls provider-specific quota APIs.
Supported providers include:
- OpenAI
- GitHub Copilot
- Google Gemini
- Zhipu
- Z.ai
Calculates daily request allowance based on monthly quota and days remaining in the billing cycle.
Stores usage data under:
~/.opencode/budget/Parses implementation_plan.md files.
Extracts:
- Goal
- Description
- File operations
- Verification steps
- Checklist items
- Completion state
The webview is a standalone React application bundled into:
webview/shared/dist/chat.js
webview/shared/dist/chat.cssIt communicates with the extension host through:
vscode.postMessage(...)
window.addEventListener("message", ...)| File | Purpose |
|---|---|
ChatShell.tsx |
Main layout container |
MessageComponents.tsx |
User and assistant messages |
PanelComponents.tsx |
Sidebar panels |
StreamingComponents.tsx |
Live streaming card |
BudgetIndicator.tsx |
Inline quota and budget banner |
SubagentDetailModal.tsx |
Subagent inspection modal |
| Direction | Type | Purpose |
|---|---|---|
| Extension → Webview | initState |
Initial state on panel open |
| Extension → Webview | streamEvent |
SSE event chunk |
| Extension → Webview | mcpStatus |
MCP server status |
| Extension → Webview | lspStatus |
LSP server status |
| Extension → Webview | agentsList |
Available agents |
| Extension → Webview | commandsList |
Available slash commands |
| Extension → Webview | quotaData |
Provider quota data |
| Extension → Webview | budgetInfo |
Daily budget data |
| Webview → Extension | sendPrompt |
Send a user prompt |
| Webview → Extension | getMcpStatus |
Request MCP status |
| Webview → Extension | getLspStatus |
Request LSP status |
| Webview → Extension | getAgents |
Request agents |
| Webview → Extension | stopRequest |
Stop active request |
| Webview → Extension | newSession |
Create new session |
npm installnpm run buildPress F5 to launch an Extension Development Host.
Use two terminals:
npm run watchnpm run webview:watchDuring development:
- Extension code is rebuilt by esbuild.
- Webview code is rebuilt separately.
- Reload the Extension Host with
Ctrl+R/Cmd+R.
The JSON schema for structured AI responses is shared between the backend and webview.
Run this when changing the structured output contract:
npm run structured-output:syncVerify generated files are up to date:
npm run structured-output:checkInstall vsce:
npm install -g @vscode/vsceBuild and package:
npm run build
vsce packageThis creates a .vsix file that can be installed through:
Extensions → Install from VSIXMarketplace packaging uses hosted image/content URLs.
VSCE_BASE_IMAGES_URL="https://your-cdn-url.com" npm run package:marketplacePublish:
VSCE_BASE_IMAGES_URL="https://your-cdn-url.com" npm run publish:marketplaceThe extension includes structured logging with correlation IDs, feature flow tracking, and performance monitoring.
Add this to settings.json:
{
"opencode.logging.enableFile": true,
"opencode.logging.level": "info"
}npm run analyze-logs:summary
npm run analyze-logs:flows
npm run analyze-logs:errors
npm run analyze-logs:perfOpen:
Output → OpenCodeFor full details, see:
LOGGING.mdRun all tests:
npm testRun a specific test file:
node --test tests/plan-parser.test.mjsThe test suite covers:
- Plan parsing
- Structured output validation
- Quota logic
- Subagent tracking
- Message streaming
- Session CRUD
- UI contracts
- MCP/LSP panels
- Model dropdown behavior
Install repo-managed git hooks:
npm run hooks:installRun the local pre-push guard manually:
npm run guard:prepushRun impacted tests only:
npm run test:impactedThe guard checks:
- Structured output contract
- Extension compile
- Type checking
- Linting
- Webview build when needed
- Impacted regression tests
The following features should not be silently removed or broken:
- Token usage sticky header
- View Implementation Plan button
- Stop Request button
- React webview contract
- Chat script and stylesheet loading
- Plan viewer workflow
- Session persistence
- Subagent tracking
- Quota monitor
- Fork the repository.
- Create a feature branch.
- Follow the rules in
AGENTS.md. - Run the required checks.
- Open a pull request with a clear summary.
Before opening a PR, run:
npm run structured-output:check
npm testMIT
Built on top of OpenCode by Anomaly.




















