Integrate the opencode agent into Obsidian with a
native chat panel. The plugin spawns a local opencode serve instance with
your vault as the working directory and talks to it over HTTP + SSE, so the
agent can read notes, write files, and run commands — all rendered with
Obsidian's own Markdown renderer.
- opencode CLI (
opencodemust be onPATH) - Obsidian 1.5.0+ on desktop
- Chat panel in the right sidebar, rendered with Obsidian's
MarkdownRenderer(markdown-rendered), so code blocks, tables, quotes and links follow the active theme automatically - Streaming responses via the opencode server event stream, with a typing cursor
- Collapsible Thinking block for reasoning, with a streaming animation while the model is thinking
- Selectable/copyable output, code blocks with a hover copy button
- Images in responses open in a preview window when clicked
- Footer shows the current model, reasoning effort and agent as clickable pills
/model,/agentand/effortopen searchable picker dialogs (models are grouped by provider);Enterresolves a typed query directly- The last used model / effort / agent are persisted across restarts
- Type
/for a Codex/Copilot-style command popup with prefix matching and arrow-key navigation - Native commands:
model,agent,effort,session,new - Server commands (
init,review, and anything in youropencode.jsoncommandsection) are merged into the same popup - Unknown
/anythingfalls back to a normal message
- Type
@(at a word boundary) to pick a vault file from a searchable, folder-grouped dialog; attachments show as chips above the input - Paste images directly into the input — they are attached as image parts and can be previewed by clicking the thumbnail
- Attachments are cleared after sending
- Lazy session creation: a real session is only created when you send your first message, so no empty sessions pile up
- Session picker modal (
/sessionor the header pill) with a "New session" entry new conversation//new/ the+button reset the panel to an unsaved state
- Permission requests are shown inline with Allow once / Always / Reject
- Optional auto-approve setting
- Collapsible tool cards showing tool name, state, input and output
- Install the plugin from Community Plugins, or build from source (below).
- Enable the plugin — it starts a local
opencode serveon port 4096 (configurable in settings) with your vault as the working directory. - Click the robot ribbon icon or run OpenCode: Open chat panel.
- Type a message and press Enter. Use
/for commands,@to attach a vault file, or paste an image.
The agent works on the vault directory: it can read notes, write files, and run commands with your permission.
- Server port — port for the local opencode server (default 4096)
- Start server automatically — launch
opencode servewhen Obsidian starts - Auto-approve permissions — respond "always" to every permission request
- Allowed origins (CORS) — browser origins allowed to call the server
(Obsidian's
app://obsidian.mdby default; add origins for other clients)
OpenCode: Open chat panelOpenCode: New conversationOpenCode: Start opencode serverOpenCode: Stop opencode server
Requirements: Node.js 20+, pnpm.
pnpm install
pnpm dev # watch mode, writes main.js on changes
pnpm build # typecheck + production build
pnpm install:vault # link the plugin into your vault (.obsidian/plugins/)pnpm install:vault auto-detects your vault from Obsidian's config, or you
can pass a path: pnpm install:vault "D:\path\to\vault". It creates a
directory junction so pnpm dev writes straight into the running vault —
just reload Obsidian to pick up changes.
The desktop plugin currently gives a local opencode process direct access to the vault directory. That does not work when opencode runs on another machine: the remote process cannot see a vault stored on a phone, tablet, or laptop.
The planned solution is for this plugin to act as an Obsidian Tool Gateway. It will expose selected Obsidian APIs as opencode custom tools or standard MCP tools while keeping the vault on the device:
opencode -> MCP / tool relay -> WebSocket -> Obsidian plugin -> Obsidian API
The Obsidian plugin will initiate the authenticated connection to the relay,
receive tool calls, execute them with Vault, MetadataCache, Workspace, or
Editor, and return only the requested result. The relay routes requests; it
does not mount or upload the complete vault. This reverse connection also works
when the device is behind NAT and avoids opening a local port on a phone.
Initial read-only tools may include:
obsidian_get_active_noteobsidian_read_noteobsidian_search_notesobsidian_list_filesobsidian_get_backlinksobsidian_get_propertiesobsidian_get_selection
Later write tools may include obsidian_create_note, obsidian_move_note, and
obsidian_apply_patch. Writes should use patches rather than replacing whole
files, detect conflicts with a content hash, show a local diff, and require
user approval before changing the vault.
The gateway will use a separate token for each device/vault, restrict every path to that vault, limit request and response sizes, and avoid exposing arbitrary JavaScript or unrestricted Obsidian command execution. On mobile, tools are available only while Obsidian is running because the operating system may suspend the app in the background.
Presenting the bridge as MCP also makes the same Obsidian tools reusable by other MCP-capable backends, such as Codex or Claude Code, without duplicating the vault integration.
- Read-only Obsidian Tool Gateway MVP (active note, read, search, backlinks)
- Patch-based write tools with conflict detection, local diff, and approval
- Authenticated relay and reverse WebSocket transport for remote/mobile agents
- Pluggable MCP-capable backends, including Codex and Claude Code
- Drag-and-drop file attachments
- Session diff view
MIT