OpenCode
approvedby krisspy
Use OpenCode CLI without leaving your vault. - This plugin has not been manually reviewed by Obsidian staff.
Obsidian OpenCode
A plugin that embeds the OpenCode CLI directly into Obsidian. Manage your AI coding sessions, browse conversation history, and resume work without leaving your vault.
β¨ Features
- Native OpenCode Execution: Runs the OpenCode CLI directly inside Obsidian using an integrated terminal, ensuring smooth performance for long coding sessions.
- Vault-Centric Workflow: Automatically spawns the agent in your vault's root, ensuring it has immediate access to your notes and project files.
- Drag and Drop Context: Drop files from Obsidian's file explorer directly into the terminal to insert them as
@path/to/file.md#1mentions for OpenCode. - Session Manager:
- History Browser: View a list of all your past OpenCode sessions with timestamps and working directories.
- Conversation Preview: Inspect message history, token usage, model details, and costs before deciding to resume.
- One-Click Restore: Instantly resume a previous session in the embedded terminal.
- Export to Markdown: Save entire conversation threads as formatted notes in your vault for documentation or review.
π₯οΈ Platform Support
- Linux: stable on my daily driver, not tested on all distros.
- Windows: Beta support on Windows 10 version 1809 and later through ConPTY. Node.js must be available on
PATHfor the isolated PTY helper. - macOS: Experimental.
π Installation
From Obsidian Community Plugins (Recommended)
- Open Obsidian and go to Settings β Community plugins
- Click Browse and search for OpenCode
- Click Install, then Enable
Manual Installation
- Download
main.js,manifest.json, andstyles.cssfrom the latest release - Create a folder named
opencodein your vault's.obsidian/plugins/directory - Copy the downloaded files into that folder
- Reload Obsidian and enable the OpenCode plugin in Community Plugins settings
Usage
- Terminal: Use the command palette (
Ctrl/Cmd + P) and select "OpenCode: Open Terminal" to launch the CLI. - Sessions View: Use the command palette to select "OpenCode: Open Sessions" to browse, restore, or export past conversations.
- Settings: Configure your
opencodebinary path, default CLI arguments, and terminal styling preferences (font size/family) in the Obsidian settings under the "OpenCode" tab.
Development
To develop the plugin, you can run the development script which automatically rebuilds the plugin when files change:
npm run dev
Unit tests run with npm test. To create a fresh isolated vault and test the built plugin inside a sandboxed Obsidian instance, run:
npm run test:obsidian
Use npm run test:obsidian:smoke for the smaller baseline suite. Windows contributors can also run npm run test:obsidian:windows-ui to exercise the installed OpenCode CLI and native terminal interactions.
See Testing in Obsidian for setup, coverage, evidence, and limitations.
β οΈ Known Issues
-
Session Previews / Loading: While the buffer size for exporting sessions has been increased (up to 100MB), exceptionally large or deeply complex OpenCode sessions with massive token counts may still occasionally fail to preview or load properly.
-
Limited Linux support: While the plugin should work on major distros, it's only tested on manjaro, ubuntu, and fedora.
π Acknowledgements
- Terminal integration approach inspired by polyipseity/obsidian-terminal β the Python PTY proxy with
pty.fork()and 4-pipe stdio for resize control (FD 3).
π License
MIT License
For plugin developers
Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.