Integrate your Obsidian vault with OpenCode AI agent
Search for "opencode" in the Obsidian Community Plugins or install as an OpenCode plugin to give your AI agent full access to your Obsidian vault.
| Tool | Description |
|---|---|
obsidian_read |
Read any note with line numbers |
obsidian_write |
Create or replace notes |
obsidian_edit |
SEARCH/REPLACE targeted edits |
obsidian_search |
Find notes by name or content |
obsidian_list |
List notes in vault or folder |
obsidian_append |
Append content to existing note |
obsidian_move |
Rename or move notes |
- Automatically finds your Obsidian vault
- Falls back to
OBSIDIAN_VAULT_PATHenv variable - Excludes
.obsidian,.trash,.gitby default
# Global installation
mkdir -p ~/.config/opencode/plugins
cp dist/index.js ~/.config/opencode/plugins/obsidian-vault.js
# Or project-level
mkdir -p .opencode/plugins
cp dist/index.js .opencode/plugins/obsidian-vault.jsnpm install -g opencode-obsidian-vaultThen add to your opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-obsidian-vault"]
}- Build the plugin:
bun install
bun run build- Copy
dist/index.jsto.opencode/plugins/in your project
# Tell the plugin where your vault is
export OBSIDIAN_VAULT_PATH="/path/to/your/vault"{
"$schema": "https://opencode.ai/config.json",
"provider": {
"anthropic": { "api_key": "sk-ant-..." },
"openai": { "api_key": "sk-..." }
},
"model": "anthropic/claude-sonnet-4-20250514",
"plugin": ["opencode-obsidian-vault"]
}Read my daily note from yesterday
→ AI uses obsidian_read to fetch the note
Create a new note called "Meeting Notes" in the Meetings folder with today's agenda
→ AI uses obsidian_write to create the note
Find all notes about project planning and summarize the key points
→ AI uses obsidian_search then obsidian_read
Add a TODO section to the bottom of "Roadmap.md"
→ AI uses obsidian_append or obsidian_edit
Move all notes from "Inbox" to "Processed/2024" folder
→ AI uses obsidian_move to reorganize
The plugin also hooks into OpenCode's event system:
file.edited- Logs when vault files are modifiedsession.created- Injects vault context into new sessionsexperimental.session.compacting- Adds vault info to compaction prompts
git clone https://github.com/maratsalihov/opencode-obsidian-vault.git
cd opencode-obsidian-vault
bun install
bun run dev # Watch modeMIT
Marat Salikhov — GitHub