Noureddine RAMDI / Embedding OpenCode AI in Obsidian: A pragmatic approach to AI assistant integration

Created Mon, 04 May 2026 10:23:02 +0000 Modified Sat, 23 May 2026 20:41:27 +0000

mtymek/opencode-obsidian

The opencode-obsidian plugin approaches AI assistant integration in Obsidian with a clear tradeoff: instead of building a native chat UI using Obsidian’s API, it embeds OpenCode’s existing web interface directly into the sidebar. This choice simplifies implementation but limits UI customization. It’s worth understanding how this architecture works under the hood, what it gains and loses, and who might adopt it.

How opencode-obsidian integrates OpenCode AI into Obsidian

At its core, opencode-obsidian is an Obsidian plugin written in TypeScript that embeds the OpenCode AI assistant into Obsidian’s sidebar using a web view. Rather than reimplementing the chat UI natively within Obsidian via the Application Command Protocol (ACP), the plugin loads OpenCode’s full web interface inside the sidebar. This means the plugin is effectively a wrapper around the OpenCode web app, providing a seamless but embedded experience.

The plugin architecture involves spawning OpenCode as a Node.js child process alongside Obsidian. Communication between Obsidian and OpenCode happens over HTTP, with CORS headers configured to allow the embedded web view to load from Obsidian’s origin. This approach sidesteps the complexity of implementing a custom chat UI and the ACP protocol but trades off direct control over the UI components and their behavior within Obsidian.

Technically, this means the plugin depends on having the OpenCode CLI installed on the user’s system. The integration relies on Node.js child process management and HTTP communication, which are desktop-only capabilities. The codebase is TypeScript-based, aligning with Obsidian’s plugin ecosystem.

An experimental feature in the plugin is context injection: it can pass the currently open notes and selected text from Obsidian to OpenCode, enriching the AI assistant’s context for better responses. This feature hints at deeper integration possibilities but remains limited by the embedded web UI approach.

Distribution and updates for the plugin are managed via BRAT (Beta Reviewer’s Auto-update Tool), a community plugin that facilitates beta testing and automatic updates in Obsidian.

Tradeoffs and technical strengths in embedding the OpenCode web interface

The standout technical decision here is embedding the entire OpenCode web app inside Obsidian’s sidebar instead of building a native chat UI using Obsidian’s ACP protocol. This tradeoff is deliberate:

  • Reduced implementation complexity: By leveraging the existing OpenCode web interface, the plugin avoids the significant effort of reimplementing a chat UI, message handling, and UI state management within Obsidian’s plugin API. This accelerates development and reduces maintenance overhead.

  • Limited UI customization: Embedding a web view confines the plugin to the UI and UX decisions made by the OpenCode web app. Fine-grained control over UI elements, interactions, or styling within Obsidian is sacrificed.

  • Desktop-only due to Node.js child processes: The plugin requires spawning OpenCode as a child process, which restricts usage to Obsidian’s desktop client. This excludes mobile or web versions where such process control isn’t possible.

  • Context injection capability: The plugin experiments with passing open notes and selection text to the AI assistant, aiming to improve relevance. This is an interesting area for extending AI integration, though constrained by the embedded UI.

  • CORS and security considerations: The plugin configures CORS headers to allow the embedded web interface to communicate properly. This setup is critical but adds a layer of configuration and potential fragility.

The code quality is typical of a focused Obsidian plugin: clean TypeScript code, clear separation of concerns between plugin lifecycle management, child process spawning, and HTTP communication. The experimental features are well marked, showing a pragmatic approach that balances ambition with stability.

Installation and getting started with opencode-obsidian

Requirements

  • Desktop Obsidian client (due to Node.js child process usage)
  • OpenCode CLI installed
  • Bun installed
  1. Install the BRAT plugin from Obsidian Community Plugins
  2. Open BRAT settings and click “Add Beta plugin”
  3. Enter: mtymek/opencode-obsidian
  4. Click “Add Plugin” – BRAT will install the latest release automatically
  5. Enable the OpenCode plugin in Obsidian Settings > Community Plugins

BRAT will handle update checks and notify when new versions are available.

For developers

  1. Clone the repo into your vault’s .obsidian/plugins/obsidian-opencode directory:
   git clone https://github.com/mtymek/opencode-obsidian.git .obsidian/plugins/obsidian-opencode
  1. Install dependencies and build with Bun:
   bun install && bun run build
  1. Enable the plugin in Obsidian Settings > Community Plugins
  2. Optionally, add an AGENTS.md file to your workspace root to guide the AI assistant

Who should consider using opencode-obsidian and its limitations

This plugin serves users and developers who want to experiment with AI assistants inside Obsidian without the overhead of building or maintaining a custom chat UI. The choice to embed OpenCode’s existing web interface makes it a pragmatic solution especially for beta testers and early adopters comfortable with Node.js tooling and desktop environments.

However, the approach limits UI flexibility and confines usage to desktop clients. If you need deep UI integration with Obsidian’s native features or want to build a polished, fully native chat experience, this plugin may fall short.

The experimental context injection is promising, but the embedded web UI restricts how much the AI assistant can adapt to Obsidian’s environment.

Overall, opencode-obsidian is a solid proof-of-concept and a useful tool for those who prefer leveraging existing web apps inside Obsidian rather than reinventing the wheel. Its codebase is approachable for TypeScript developers familiar with Obsidian plugins and Node.js process management, providing a foundation for further development or customization.


→ GitHub Repo: mtymek/opencode-obsidian ⭐ 795 · TypeScript