$npx -y skills add jackal092927/obsidian-official-cli-skills --skill obsidian-cliUse the official Obsidian CLI (1.12+) for vault operations. Prefer CLI for index-powered ops (search, backlinks, tags, tasks, properties, bases). Fall back to file tools when Obsidian is not running or for simple read/write.
| 1 | # Obsidian CLI — Agent Reference |
| 2 | |
| 3 | ## When to Use CLI vs File Tools |
| 4 | |
| 5 | **Use CLI** when you need Obsidian's index or app features: |
| 6 | search, backlinks, links, tags, tasks, properties, bases, templates, outline, orphans, unresolved links |
| 7 | |
| 8 | **Use file tools** (Read/Write/Edit/Grep/Glob) for: |
| 9 | simple file read/write, bulk text replacement, grep across files — no app dependency |
| 10 | |
| 11 | Rule of thumb: if Obsidian's index adds value, use CLI. If it's plain text manipulation, use file tools. |
| 12 | |
| 13 | ## Syntax Basics |
| 14 | |
| 15 | ``` |
| 16 | obsidian <command> [param=value ...] [flag ...] |
| 17 | ``` |
| 18 | |
| 19 | - **Vault targeting**: `vault="My Vault"` as first param, or run from inside vault dir |
| 20 | - **File targeting**: `path=exact/path.md` (vault-relative) vs `file=name` (link-style resolution) |
| 21 | - **Params**: `key=value` — quote values with spaces: `name="My Note"` |
| 22 | - **Flags**: boolean switches, no `=` — e.g. `silent`, `overwrite`, `counts`, `total` |
| 23 | - **Multiline**: `\n` for newline, `\t` for tab in content strings |
| 24 | - **Structured output**: `format=json` (search, base:query), `format=tsv` (properties, tags) |
| 25 | - **Clipboard**: append `--copy` to copy output |
| 26 | |
| 27 | ## Key Commands |
| 28 | |
| 29 | ### Read & Write |
| 30 | ```sh |
| 31 | obsidian read path=<path> # read file content |
| 32 | obsidian append path=<path> content="<text>" # append to file |
| 33 | obsidian prepend path=<path> content="<text>" # prepend after frontmatter |
| 34 | obsidian create name=<name> content="<text>" silent # create file (safe — won't overwrite) |
| 35 | obsidian create name=<name> template=<template> overwrite silent # create from template |
| 36 | obsidian move path=<from> to=<to> # move/rename file |
| 37 | obsidian delete path=<path> # move to system trash (safe) |
| 38 | ``` |
| 39 | Gotchas: |
| 40 | - `create` without `silent` opens the file in Obsidian's UI — always add `silent` during agent operations. |
| 41 | - `create` doesn't auto-create directories — use `mkdir -p` via Bash first if the parent folder doesn't exist. |
| 42 | - `create` with `template=` may place the file in the template's configured folder, ignoring `path=`. Verify the actual path with `search` or `files` after creation. |
| 43 | |
| 44 | ### Daily Notes |
| 45 | ```sh |
| 46 | obsidian daily # open today's daily note |
| 47 | obsidian daily:read # read daily note content |
| 48 | obsidian daily:append content="<text>" # append to daily note |
| 49 | obsidian daily:prepend content="<text>" # prepend to daily note |
| 50 | ``` |
| 51 | |
| 52 | ### Properties (Frontmatter) |
| 53 | ```sh |
| 54 | obsidian property:set name=<key> value=<val> path=<path> # set property |
| 55 | obsidian property:set name=<key> value=<val> type=<type> path=<path> # set with explicit type |
| 56 | obsidian property:read name=<key> path=<path> # read one property |
| 57 | obsidian property:remove name=<key> path=<path> # remove property |
| 58 | obsidian properties path=<path> # list all properties |
| 59 | obsidian properties path=<path> format=tsv # list as TSV (key\tvalue) |
| 60 | ``` |
| 61 | |
| 62 | ### Search |
| 63 | ```sh |
| 64 | obsidian search query="<text>" # search vault (file paths) |
| 65 | obsidian search query="<text>" path=<folder> limit=10 # scoped search |
| 66 | obsidian search query="<text>" format=json # JSON array of paths |
| 67 | obsidian search query="<text>" format=json matches # structured JSON with line numbers (preferred) |
| 68 | obsidian search query="<text>" matches # text format with matching lines |
| 69 | ``` |
| 70 | Tip: `format=json matches` returns `[{"file":"path","matches":[{"line":N,"text":"..."}]}]` — use this for programmatic search. |
| 71 | |
| 72 | ### Tags & Tasks |
| 73 | ```sh |
| 74 | obsidian tags all counts # list ALL vault tags with counts |
| 75 | obsidian tags all counts sort=count # sorted by frequency |
| 76 | obsidian tag name=<tag> # files with specific tag |
| 77 | obsidian tasks all todo # vault-wide open tasks |
| 78 | obsidian tasks all done # vault-wide completed tasks |
| 79 | obsidian tasks daily # tasks from daily note |
| 80 | obsidian tasks path=<path> # tasks in file/folder |
| 81 | obsidian task ref="<path>:<line>" toggle # toggle task status |
| 82 | obsidian task ref="<path>:<line>" done # mark done |
| 83 | ``` |
| 84 | Note: `tags` without `all` lists tags for the active/specified file only. |
| 85 | Note: `tasks` without a scope (`all`, `daily`, `path=`) defaults to the active file — use `tasks all` for vault-wide results. |
| 86 | |
| 87 | ### Links & Graph |
| 88 | ```sh |
| 89 | obsidian backlinks path=<path> # incoming links to file |
| 90 | o |