Obsidian Skill
Routing Policy
Use the backend that best matches user intent:
MCP (default for vault data operations)
- Read/write/patch/search notes
- Move/rename notes with
move_note, then explicitly repair backlinks
- Frontmatter and tag updates
- Metadata and batch note operations
Obsidian CLI/App context (only when app context is needed)
- Open a note in Obsidian from URI
- Trigger app/plugin workflows that MCP cannot perform
CLI git (sync/backup workflows)
- Initialize repo, configure remote, commit, pull, push
- Periodic or manual vault backup/sync requests
When a request is ambiguous, pick MCP first unless the user explicitly asks for sync/backup/git/app behavior.
Safe Note Rename Workflow
Use MCP move_note for every note move or rename, even when Obsidian is running. Do not invoke the Obsidian CLI move command automatically: delayed link rewrites can apply stale byte offsets to notes edited after the move began, silently corrupting unrelated content (#176). Reconsider CLI moves only after an upstream fix has been independently retested.
Backlink preservation is an explicit, verifiable second step:
- Before moving, search for the old wikilink target using both its vault-relative path and filename without the extension. If Obsidian is running, its read-only
backlinks command may supplement discovery, but it does not replace the MCP search.
- Move the note with MCP
move_note.
- Read each referring note and patch only exact wikilink targets, including embeds and links with aliases or fragments. Preserve display text (
|alias) and #heading / #^block-id suffixes while changing the target.
- Search again for the old path and basename. Report any remaining references instead of claiming success.
search_notes returns at most 20 results. If a search reaches that cap, or the old basename is ambiguous, tell the user exhaustive backlink repair cannot be proven and ask before continuing with a broader scan.
Report the move and backlink repair separately: which note moved, how many referring notes changed, and any stale references that remain.
Gotchas
patch_note rejects multi-match by default. With replaceAll: false, if oldString appears more than once the call fails and returns matchCount. Set replaceAll: true only when you mean it, or add surrounding context to make the match unique.
patch_note matches inside frontmatter. The replacement runs against the full file including the YAML block. A generic string like title: will match frontmatter fields. Include enough context to target the right occurrence.
patch_note forbids empty strings. Both oldString and newString must be non-empty and non-whitespace. To delete text, use newString with a single space or restructure the note with write_note.
search_notes returns minified JSON. Fields are abbreviated: p (path), t (title), ex (excerpt), mc (matchCount), ln (lineNumber), uri (obsidianUri). Hard cap of 20 results regardless of limit.
search_notes multi-word queries score terms individually AND as a phrase. Each term is OR-matched, so a document matching any term appears in results. The full phrase gets an additional scoring boost.
write_note auto-creates directories. Parent folders are created recursively. In append/prepend mode, if the note doesn't exist it's created. Frontmatter is merged (new keys override) in append/prepend; replaced entirely in overwrite.
delete_note requires exact path confirmation. confirmPath must be character-identical to path. No normalization, no trailing-slash tolerance. Mismatch silently fails with success: false.
move_file needs double confirmation. Both confirmOldPath and confirmNewPath must exactly match their counterparts. Use move_note for markdown renames (text-aware, no confirmation needed); use move_file only for binary files or when you need binary-safe moves.
manage_tags reads from two sources but writes to one. list merges frontmatter tags + inline #hashtags. add/remove only modify the frontmatter tags array. Inline tags are never touched.
read_multiple_notes never rejects. Uses allSettled internally. Failed files appear in the err array; successful ones in ok. Always check both. Hard limit of 10 paths per call.
Error Recovery
| Error |
Next step |
| patch_note "Found N occurrences" |
Add surrounding lines to oldString to make it unique, or set replaceAll: true |
| delete_note / move_file confirmation mismatch |
Re-read the note path with read_note or list_directory, then retry with the exact string |
| search_notes returns 0 results |
Try single keywords instead of phrases, toggle searchFrontmatter, or broaden with partial terms |
read_multiple_notes partial err |
Verify failed paths with list_directory, fix typos or missing extensions, retry only failed ones |
Git Sync Mode
When the user asks to "sync", "backup", or "store my vault with git", use CLI git with this behavior:
Run a preflight before changing anything:
git available
- current directory is a git repo (or prompt to initialize)
git config user.name and git config user.email are set
- at least one remote exists for push/pull sync
If preflight is incomplete, ask exactly one targeted question with a recommended default.
- Use askuserquestion for decisions that materially change behavior.
- Good examples:
- "No git repo found. Initialize one in this vault now? (Recommended: Yes)"
- "No remote configured. Set up GitHub remote now via gh if available, or provide remote URL? (Recommended: Set up via gh)"
- "Local and remote diverged. Try
git pull --rebase now? (Recommended: Yes)"
Safe sync sequence (never force push by default):
git add -A
git commit -m "vault sync: YYYY-MM-DD HH:mm" (skip commit if no changes)
git pull --rebase
git push
gh is optional:
- Use
gh only for remote bootstrapping (create repo / set origin) when requested.
- Do not require
gh for normal sync once remote is configured.
Stop on conflicts and report clear next steps.
- Do not auto-resolve merge conflicts silently.
- Explain what failed and what user should run next.
Obsidian CLI Mode
When the user asks for app-context operations (active file, open in editor, daily notes with templates, backlinks), use the Obsidian CLI directly via shell commands.
Run a preflight before first CLI use:
Resolve the CLI binary using the first match from these candidates:
| Priority |
macOS |
Linux |
Windows |
| 1 |
obsidian (PATH) |
obsidian (PATH) |
obsidian.exe or Obsidian.com (PATH) |
| 2 |
/Applications/Obsidian.app/Contents/MacOS/obsidian-cli |
— |
— |
| 3 |
/Applications/Obsidian.app/Contents/MacOS/Obsidian |
— |
— |
Obsidian 1.12.7+ installer bundles a dedicated obsidian-cli binary (10x
faster than the legacy Electron-based CLI: ~25ms vs ~250ms per call). On macOS,
after installing the 1.12.7+ installer, disable then re-enable the CLI in
Settings > General > Advanced to update PATH registration. This replaces the old
`/.zprofilePATH entry with a/usr/local/bin/obsidiansymlink pointing toobsidian-cli`.
On Linux, PATH registration creates a symlink at /usr/local/bin/obsidian
(or ~/.local/bin/obsidian as fallback). On Windows, the installer places an
Obsidian.com terminal redirector alongside Obsidian.exe.
Note: The priority table and stale PATH check are verified on macOS only.
Linux and Windows may also bundle obsidian-cli with the 1.12.7+ installer,
but this has not been confirmed. Contributions welcome via issue or PR.
Stale PATH check (macOS): If priority 1 resolved obsidian on PATH, check
whether it points to the fast binary or the slow Electron launcher:
| Resolved path |
Meaning |
Action |
/usr/local/bin/obsidian → obsidian-cli |
1.12.7 symlink registration |
None — fast binary |
/Applications/.../MacOS/obsidian |
Old ~/.zprofile entry (pre-1.12.7 registration or 1.12.7 installer without re-registering) |
Check if obsidian-cli exists in the bundle |
If obsidian resolves to the MacOS directory (not /usr/local/bin) AND
/Applications/Obsidian.app/Contents/MacOS/obsidian-cli exists, tell the user:
"Obsidian 1.12.7+ is installed but PATH still points to the slower Electron
binary. In Obsidian, go to Settings > General > Advanced and disable then
re-enable the CLI to update PATH registration."
Continue with whichever priority matched — this is advisory, not blocking.
Check Obsidian is running: pgrep -xiq obsidian (macOS/Linux) or tasklist /FI "IMAGENAME eq Obsidian.exe" /NH (Windows)
If either fails, tell the user and fall back to MCP tools + obsidian:// URIs
Vault targeting: obsidian vault="VaultName" <command>. If OBSIDIAN_VAULT_NAME is set, use that explicit value. Otherwise run obsidian vaults, match the MCP vault path to a registered vault, and use its registered name. If no unique match exists, ask the user. Never infer the registered name from the folder basename.
Key commands:
# Read the currently active file
obsidian read
# Read a specific file
obsidian read file="My Note"
# Open a file in Obsidian
obsidian open path="Notes/example.md"
# Open today's daily note
obsidian daily
# Append to daily note
obsidian daily:append content="- [ ] New task"
# Search (Obsidian's own search, different from MCP's BM25)
obsidian search query="meeting notes" limit=10
# List all tags with frequency
obsidian tags sort=count counts
# Get backlinks for a note
obsidian backlinks file="My Note"
# Find unresolved links
obsidian unresolved
Do not use obsidian move; follow Safe Note Rename Workflow with MCP move_note and explicit backlink repair.
Run obsidian help for the full command reference. The CLI evolves with Obsidian releases.
When to use CLI vs MCP:
- MCP for reads/writes/search/tags/frontmatter and all note moves/renames (sandboxed, validated, works headless)
- CLI for active file, daily notes with template expansion, read-only backlink discovery, open in editor, and plugin commands
- After
move_note, repair and verify backlinks explicitly with the Safe Note Rename Workflow
- If unsure, prefer MCP
Resources
Load these only when needed, not on every invocation.
- Tool Patterns - read when you need a tool's response shape, mode details, or the move_note vs move_file decision
- Obsidian Conventions - read when creating/writing note content (link syntax, frontmatter fields, daily note format, template variables)
- Git Sync - read when user asks for backup/sync/store-vault workflows with git/gh
1---2name: obsidian3description: Activate when the user mentions their Obsidian vault, notes, tags, frontmatter, daily notes, backup, or sync. Route operations across MCP, Obsidian CLI/app actions, and git sync with safe defaults.4---5
6# Obsidian Skill
7
8## Routing Policy
9
10Use the backend that best matches user intent:
11
121. **MCP (default for vault data operations)**
13 - Read/write/patch/search notes
14 - Move/rename notes with `move_note`, then explicitly repair backlinks
15 - Frontmatter and tag updates
16 - Metadata and batch note operations
17
182. **Obsidian CLI/App context (only when app context is needed)**
19 - Open a note in Obsidian from URI
20 - Trigger app/plugin workflows that MCP cannot perform
21
223. **CLI git (sync/backup workflows)**
23 - Initialize repo, configure remote, commit, pull, push
24 - Periodic or manual vault backup/sync requests
25
26When a request is ambiguous, pick MCP first unless the user explicitly asks for sync/backup/git/app behavior.
27
28## Safe Note Rename Workflow
29
30Use MCP `move_note` for every note move or rename, even when Obsidian is running. Do not invoke the Obsidian CLI `move` command automatically: delayed link rewrites can apply stale byte offsets to notes edited after the move began, silently corrupting unrelated content ([#176](https://github.com/bitbonsai/mcpvault/issues/176)). Reconsider CLI moves only after an upstream fix has been independently retested.
31
32Backlink preservation is an explicit, verifiable second step:
33
341. Before moving, search for the old wikilink target using both its vault-relative path and filename without the extension. If Obsidian is running, its read-only `backlinks` command may supplement discovery, but it does not replace the MCP search.
352. Move the note with MCP `move_note`.
363. Read each referring note and patch only exact wikilink targets, including embeds and links with aliases or fragments. Preserve display text (`|alias`) and `#heading` / `#^block-id` suffixes while changing the target.
374. Search again for the old path and basename. Report any remaining references instead of claiming success.
385. `search_notes` returns at most 20 results. If a search reaches that cap, or the old basename is ambiguous, tell the user exhaustive backlink repair cannot be proven and ask before continuing with a broader scan.
39
40Report the move and backlink repair separately: which note moved, how many referring notes changed, and any stale references that remain.
41
42## Gotchas
43
441. **patch_note rejects multi-match by default.** With `replaceAll: false`, if `oldString` appears more than once the call fails and returns `matchCount`. Set `replaceAll: true` only when you mean it, or add surrounding context to make the match unique.
45
462. **patch_note matches inside frontmatter.** The replacement runs against the full file including the YAML block. A generic string like `title:` will match frontmatter fields. Include enough context to target the right occurrence.
47
483. **patch_note forbids empty strings.** Both `oldString` and `newString` must be non-empty and non-whitespace. To delete text, use `newString` with a single space or restructure the note with `write_note`.
49
504. **search_notes returns minified JSON.** Fields are abbreviated: `p` (path), `t` (title), `ex` (excerpt), `mc` (matchCount), `ln` (lineNumber), `uri` (obsidianUri). Hard cap of 20 results regardless of `limit`.
51
525. **search_notes multi-word queries score terms individually AND as a phrase.** Each term is OR-matched, so a document matching any term appears in results. The full phrase gets an additional scoring boost.
53
546. **write_note auto-creates directories.** Parent folders are created recursively. In `append`/`prepend` mode, if the note doesn't exist it's created. Frontmatter is merged (new keys override) in append/prepend; replaced entirely in overwrite.
55
567. **delete_note requires exact path confirmation.** `confirmPath` must be character-identical to `path`. No normalization, no trailing-slash tolerance. Mismatch silently fails with `success: false`.
57
588. **move_file needs double confirmation.** Both `confirmOldPath` and `confirmNewPath` must exactly match their counterparts. Use `move_note` for markdown renames (text-aware, no confirmation needed); use `move_file` only for binary files or when you need binary-safe moves.
59
609. **manage_tags reads from two sources but writes to one.** `list` merges frontmatter tags + inline `#hashtags`. `add`/`remove` only modify the frontmatter `tags` array. Inline tags are never touched.
61
6210. **read_multiple_notes never rejects.** Uses `allSettled` internally. Failed files appear in the `err` array; successful ones in `ok`. Always check both. Hard limit of 10 paths per call.
63
64## Error Recovery
65
66| Error | Next step |
67|-------|-----------|
68| patch_note "Found N occurrences" | Add surrounding lines to `oldString` to make it unique, or set `replaceAll: true` |
69| delete_note / move_file confirmation mismatch | Re-read the note path with `read_note` or `list_directory`, then retry with the exact string |
70| search_notes returns 0 results | Try single keywords instead of phrases, toggle `searchFrontmatter`, or broaden with partial terms |
71| read_multiple_notes partial `err` | Verify failed paths with `list_directory`, fix typos or missing extensions, retry only failed ones |
72
73## Git Sync Mode
74
75When the user asks to "sync", "backup", or "store my vault with git", use CLI git with this behavior:
76
771. Run a **preflight** before changing anything:
78 - `git` available
79 - current directory is a git repo (or prompt to initialize)
80 - `git config user.name` and `git config user.email` are set
81 - at least one remote exists for push/pull sync
82
832. If preflight is incomplete, ask exactly one targeted question with a recommended default.
84 - Use askuserquestion for decisions that materially change behavior.
85 - Good examples:
86 - "No git repo found. Initialize one in this vault now? (Recommended: Yes)"
87 - "No remote configured. Set up GitHub remote now via gh if available, or provide remote URL? (Recommended: Set up via gh)"
88 - "Local and remote diverged. Try `git pull --rebase` now? (Recommended: Yes)"
89
903. Safe sync sequence (never force push by default):
91 - `git add -A`
92 - `git commit -m "vault sync: YYYY-MM-DD HH:mm"` (skip commit if no changes)
93 - `git pull --rebase`
94 - `git push`
95
964. `gh` is optional:
97 - Use `gh` only for remote bootstrapping (create repo / set origin) when requested.
98 - Do not require `gh` for normal sync once remote is configured.
99
1005. Stop on conflicts and report clear next steps.
101 - Do not auto-resolve merge conflicts silently.
102 - Explain what failed and what user should run next.
103
104## Obsidian CLI Mode
105
106When the user asks for app-context operations (active file, open in editor, daily notes with templates, backlinks), use the Obsidian CLI directly via shell commands.
107
1081. Run a **preflight** before first CLI use:
109 - Resolve the CLI binary using the first match from these candidates:
110
111 | Priority | macOS | Linux | Windows |
112 |----------|-------|-------|---------|
113 | 1 | `obsidian` (PATH) | `obsidian` (PATH) | `obsidian.exe` or `Obsidian.com` (PATH) |
114 | 2 | `/Applications/Obsidian.app/Contents/MacOS/obsidian-cli` | — | — |
115 | 3 | `/Applications/Obsidian.app/Contents/MacOS/Obsidian` | — | — |
116
117 > **Obsidian 1.12.7+ installer** bundles a dedicated `obsidian-cli` binary (~10x
118 > faster than the legacy Electron-based CLI: ~25ms vs ~250ms per call). On macOS,
119 > after installing the 1.12.7+ installer, disable then re-enable the CLI in
120 > Settings > General > Advanced to update PATH registration. This replaces the old
121 > `~/.zprofile` PATH entry with a `/usr/local/bin/obsidian` symlink pointing to
122 > `obsidian-cli`.
123 >
124 > On Linux, PATH registration creates a symlink at `/usr/local/bin/obsidian`
125 > (or `~/.local/bin/obsidian` as fallback). On Windows, the installer places an
126 > `Obsidian.com` terminal redirector alongside `Obsidian.exe`.
127 >
128 > **Note:** The priority table and stale PATH check are verified on macOS only.
129 > Linux and Windows may also bundle `obsidian-cli` with the 1.12.7+ installer,
130 > but this has not been confirmed. Contributions welcome via issue or PR.
131
132 - **Stale PATH check (macOS):** If priority 1 resolved `obsidian` on PATH, check
133 whether it points to the fast binary or the slow Electron launcher:
134
135 | Resolved path | Meaning | Action |
136 |---------------|---------|--------|
137 | `/usr/local/bin/obsidian` → `obsidian-cli` | 1.12.7 symlink registration | None — fast binary |
138 | `/Applications/.../MacOS/obsidian` | Old `~/.zprofile` entry (pre-1.12.7 registration or 1.12.7 installer without re-registering) | Check if `obsidian-cli` exists in the bundle |
139
140 If `obsidian` resolves to the MacOS directory (not `/usr/local/bin`) AND
141 `/Applications/Obsidian.app/Contents/MacOS/obsidian-cli` exists, tell the user:
142 _"Obsidian 1.12.7+ is installed but PATH still points to the slower Electron
143 binary. In Obsidian, go to Settings > General > Advanced and disable then
144 re-enable the CLI to update PATH registration."_
145 Continue with whichever priority matched — this is advisory, not blocking.
146
147 - Check Obsidian is running: `pgrep -xiq obsidian` (macOS/Linux) or `tasklist /FI "IMAGENAME eq Obsidian.exe" /NH` (Windows)
148 - If either fails, tell the user and fall back to MCP tools + `obsidian://` URIs
149
1502. Vault targeting: `obsidian vault="VaultName" <command>`. If `OBSIDIAN_VAULT_NAME` is set, use that explicit value. Otherwise run `obsidian vaults`, match the MCP vault path to a registered vault, and use its registered name. If no unique match exists, ask the user. Never infer the registered name from the folder basename.
151
1523. Key commands:
153 ```bash
154 # Read the currently active file
155 obsidian read
156
157 # Read a specific file
158 obsidian read file="My Note"
159
160 # Open a file in Obsidian
161 obsidian open path="Notes/example.md"
162
163 # Open today's daily note
164 obsidian daily
165
166 # Append to daily note
167 obsidian daily:append content="- [ ] New task"
168
169 # Search (Obsidian's own search, different from MCP's BM25)
170 obsidian search query="meeting notes" limit=10
171
172 # List all tags with frequency
173 obsidian tags sort=count counts
174
175 # Get backlinks for a note
176 obsidian backlinks file="My Note"
177
178 # Find unresolved links
179 obsidian unresolved
180 ```
181
182 Do not use `obsidian move`; follow **Safe Note Rename Workflow** with MCP `move_note` and explicit backlink repair.
183
1844. Run `obsidian help` for the full command reference. The CLI evolves with Obsidian releases.
185
1865. **When to use CLI vs MCP:**
187 - MCP for reads/writes/search/tags/frontmatter and all note moves/renames (sandboxed, validated, works headless)
188 - CLI for active file, daily notes with template expansion, read-only backlink discovery, open in editor, and plugin commands
189 - After `move_note`, repair and verify backlinks explicitly with the Safe Note Rename Workflow
190 - If unsure, prefer MCP
191
192## Resources
193
194Load these only when needed, not on every invocation.
195
196- [Tool Patterns](resources/tool-patterns.md) - read when you need a tool's response shape, mode details, or the move_note vs move_file decision
197- [Obsidian Conventions](resources/obsidian-conventions.md) - read when creating/writing note content (link syntax, frontmatter fields, daily note format, template variables)
198- [Git Sync](resources/git-sync.md) - read when user asks for backup/sync/store-vault workflows with git/gh