Obsidian CLI Skill
The user has the obsidian CLI installed, which communicates with a running Obsidian instance over a local REST API. Use it to search, read, create, modify, and analyze notes without touching files directly on disk.
When to Use CLI vs Direct File Access
| Use CLI |
Use Direct Read/Edit |
Use Both |
Search (search, search:context) |
Large content edits requiring precise line-level changes |
Find notes with CLI, then Read/Edit their files |
| Graph analysis (backlinks, orphans, deadends, unresolved) |
Multi-line insertions at specific positions |
Get vault path with vault info=path, then Glob/Grep |
| Properties/tags (read, set, list, count) |
Complex regex replacements |
List tasks with CLI, edit file to restructure |
| Tasks (list, toggle, filter) |
Reading very large files with offset/limit |
|
| Daily notes (read, append, prepend) |
|
|
| Templates (list, read, insert) |
|
|
| Vault-wide counts and statistics |
|
|
| Opening files in Obsidian UI |
|
|
Key principle: Use CLI for discovery and metadata; use direct file access for surgical edits. Combine them for find-then-edit workflows.
CLI Syntax Conventions
obsidian <command> [key=value ...] [bare-flags]
file= resolves by name like wikilinks (no extension needed): file=Meeting Notes
path= is an exact vault-relative path: path=Journal/2024-01-15.md
- Quote values with spaces:
file="Project Planning", content="Hello World"
- Newlines in content: Use
\n — e.g., content="Line 1\nLine 2"
- Bare boolean flags have no value:
total, verbose, counts, done, todo
vault= targets a specific vault: vault="Work Vault"
format=json for structured/parseable output (prefer this for programmatic use)
- Most commands default to the active file when
file=/path= is omitted
Safe vs Destructive Operations
Safe (no confirmation needed)
- All read commands:
read, search, search:context, file, files, folders, outline, wordcount, recents
- All list commands:
tags, properties, tasks, backlinks, links, orphans, deadends, unresolved, aliases, bookmarks, templates, bases, plugins, themes, snippets, hotkeys, commands, tabs, workspace
- Single-value reads:
tag, property:read, daily:read, daily:path, template:read, random:read, vault, vaults, version, history, history:list, history:read, diff, publish:list, publish:site, publish:status, base:query, base:views
- UI navigation:
open, daily, search:open, tab:open, web
Mutating (use with normal judgment)
- Content modification:
append, prepend, create, daily:append, daily:prepend
- Properties:
property:set, property:remove
- Tasks:
task with toggle/done/todo/status=
- Bookmarks:
bookmark
- Templates:
template:insert
- Bases:
base:create
Destructive (confirm with user first)
delete — moves to trash (or permanent with permanent flag)
move, rename — changes file location/name
history:restore — overwrites current file with historical version
plugin:install, plugin:uninstall, plugin:enable, plugin:disable — changes plugin state
theme:install, theme:uninstall, theme:set — changes theme
snippet:enable, snippet:disable — changes CSS snippets
plugins:restrict — toggles restricted mode
publish:add, publish:remove — affects published site
reload, restart — disrupts the running app
command — executes arbitrary Obsidian commands
Core Command Patterns
Search & Discovery
# Full-text search
obsidian search query="project planning" format=json
# Search with line context (shows matching lines)
obsidian search:context query="TODO" path=Projects limit=10
# Count matches
obsidian search query="meeting" total
# List all markdown files in a folder
obsidian files folder=Projects ext=md
# Recently opened files
obsidian recents
Reading Notes
# Read by wikilink name
obsidian read file="Meeting Notes"
# Read by exact path
obsidian read path="Journal/2024-01-15.md"
# Get file metadata
obsidian file file="My Note"
# Show heading outline
obsidian outline file="My Note" format=json
# Word count
obsidian wordcount file="My Note"
Writing & Modifying Notes
# Create a new note
obsidian create name="New Note" content="# New Note\n\nContent here"
# Create from template
obsidian create name="Meeting 2024-01-15" template="Meeting Template"
# Append to a note
obsidian append file="My Note" content="\n## New Section\n\nAdded content"
# Prepend to a note
obsidian prepend file="My Note" content="Important update at the top\n"
Properties (Frontmatter)
# List all properties across the vault with counts
obsidian properties counts sort=count format=json
# Read a specific property from a file
obsidian property:read name=status file="My Project"
# Set a property
obsidian property:set name=status value=active file="My Project"
# Set a date property
obsidian property:set name=due value=2024-03-15 type=date file="My Task"
# Set a list property
obsidian property:set name=tags value="[work, urgent]" type=list file="My Note"
# Remove a property
obsidian property:remove name=draft file="Published Post"
# Show properties for a specific file
obsidian properties file="My Note" format=yaml
Tags
# List all tags with counts, sorted by frequency
obsidian tags counts sort=count format=json
# Get info about a specific tag
obsidian tag name=project verbose
# Count how many times a tag is used
obsidian tag name=work total
# Tags for a specific file
obsidian tags file="My Note"
Graph & Links
# Find what links TO a note (backlinks)
obsidian backlinks file="My Note" counts format=json
# Find what a note links TO (outgoing)
obsidian links file="My Note"
# Find orphan notes (nothing links to them)
obsidian orphans
# Count orphans
obsidian orphans total
# Find dead-end notes (they link to nothing)
obsidian deadends
# Find broken/unresolved links
obsidian unresolved counts verbose format=json
Tasks
# List all incomplete tasks
obsidian tasks todo
# List completed tasks
obsidian tasks done
# Tasks in a specific file
obsidian tasks file="Project Plan" verbose
# Tasks from daily note
obsidian tasks daily todo
# Count incomplete tasks
obsidian tasks todo total
# Tasks as JSON for processing
obsidian tasks todo format=json
# Toggle a task (by file and line number)
obsidian task file="My Note" line=15 toggle
# Mark a task done
obsidian task file="My Note" line=15 done
# Mark a daily note task done
obsidian task daily line=5 done
Daily Notes
# Read today's daily note
obsidian daily:read
# Get the daily note's file path
obsidian daily:path
# Append to today's daily note
obsidian daily:append content="\n- [ ] New task for today"
# Prepend to daily note
obsidian daily:prepend content="## Morning Update\n\nStarting the day with..."
# Open daily note in Obsidian
obsidian daily
Templates
# List available templates
obsidian templates
# Read a template's content
obsidian template:read name="Meeting Template"
# Read with variables resolved
obsidian template:read name="Meeting Template" resolve title="Q1 Planning"
# Insert template into active file
obsidian template:insert name="Meeting Template"
Bookmarks
# List all bookmarks
obsidian bookmarks format=json
# Bookmark a file
obsidian bookmark file="Important Note"
# Bookmark a heading within a file
obsidian bookmark file="Project Plan" subpath="## Timeline"
# Bookmark a search query
obsidian bookmark search="TODO urgent"
History & Versions
# List history versions for a file
obsidian history file="My Note"
# List all files that have history
obsidian history:list
# Read a specific version
obsidian history:read file="My Note" version=2
# Diff two versions
obsidian diff file="My Note" from=1 to=3
Bases (Obsidian Databases)
# List all base files
obsidian bases
# List views in a base
obsidian base:views file="Tasks DB"
# Query a base view
obsidian base:query file="Tasks DB" view="Active Tasks" format=json
# Create a new item in a base
obsidian base:create file="Tasks DB" name="New Task" content="Task description"
Plugins, Themes, Snippets
# List community plugins with versions
obsidian plugins filter=community versions format=json
# Get info about a specific plugin
obsidian plugin id=dataview
# List enabled plugins
obsidian plugins:enabled
# List installed themes
obsidian themes versions
# Show active theme
obsidian theme
# List CSS snippets
obsidian snippets
Vault Info
# Full vault info
obsidian vault
# Just the vault path
obsidian vault info=path
# Just vault name
obsidian vault info=name
# File and folder counts
obsidian vault info=files
obsidian vault info=folders
# List all known vaults
obsidian vaults verbose
# Obsidian version
obsidian version
Opening Files in Obsidian UI
# Open a file
obsidian open file="My Note"
# Open in new tab
obsidian open file="My Note" newtab
# Open daily note
obsidian daily
# Open search with query
obsidian search:open query="project"
# Execute any Obsidian command
obsidian command id=graph:open
Best Practices
- Use
format=json for structured output — easier to parse and process programmatically
- Use
total for counts — returns just a number instead of listing everything
- Batch appends — combine multiple items into one
content= with \n separators rather than making multiple CLI calls
- Check before mutating — read the current state before setting properties or modifying content
- Get vault path dynamically — use
obsidian vault info=path rather than hardcoding paths, then combine with Read/Edit for file operations
- Use
file= for convenience, path= for precision — file= is shorter but may be ambiguous if multiple files share a name
- Use
verbose for detailed output — many list commands support verbose for extra context (file paths, counts, types)
Troubleshooting
| Problem |
Solution |
| "Obsidian is not running" or connection refused |
Obsidian desktop app must be open. Start it first. |
| "No active file" error |
Some commands default to the active file. Specify file= or path= explicitly. |
| "File not found" |
Check the name with obsidian search query="partial name" or obsidian files. Use path= for exact match. |
| Spaces in file/folder names |
Always quote: file="My Note", path="My Folder/note.md" |
| Multi-vault |
Specify vault="Vault Name" to target a specific vault |
| Command returns nothing |
The file may be empty, or the query had no matches. Use total to confirm zero results. |
Full Command Reference
For the complete catalog of all 80+ commands with all options, read:
references/command-reference.md (relative to this skill's directory)
1---2name: obsidian-cli3description: Use this skill for ANY task involving Obsidian, vaults, notes, daily notes, backlinks, tags, properties, frontmatter, tasks/todos, templates, wikilinks, knowledge management, searching notes, note metadata, plugins, themes, CSS snippets, vault structure, orphan notes, graph analysis, bookmarks, aliases, bases (Obsidian databases), note history, word counts, outlines, publish, or any interaction with an Obsidian vault. Trigger when the user mentions Obsidian, their vault, their notes, or wants to find/read/create/modify notes programmatically.4---56# Obsidian CLI Skill78The user has the `obsidian` CLI installed, which communicates with a running Obsidian instance over a local REST API. Use it to search, read, create, modify, and analyze notes without touching files directly on disk.910## When to Use CLI vs Direct File Access1112| Use CLI | Use Direct Read/Edit | Use Both |13|---------|---------------------|----------|14| Search (`search`, `search:context`) | Large content edits requiring precise line-level changes | Find notes with CLI, then Read/Edit their files |15| Graph analysis (backlinks, orphans, deadends, unresolved) | Multi-line insertions at specific positions | Get vault path with `vault info=path`, then Glob/Grep |16| Properties/tags (read, set, list, count) | Complex regex replacements | List tasks with CLI, edit file to restructure |17| Tasks (list, toggle, filter) | Reading very large files with offset/limit | |18| Daily notes (read, append, prepend) | | |19| Templates (list, read, insert) | | |20| Vault-wide counts and statistics | | |21| Opening files in Obsidian UI | | |2223**Key principle:** Use CLI for discovery and metadata; use direct file access for surgical edits. Combine them for find-then-edit workflows.2425## CLI Syntax Conventions2627```28obsidian <command> [key=value ...] [bare-flags]29```3031- **`file=`** resolves by name like wikilinks (no extension needed): `file=Meeting Notes`32- **`path=`** is an exact vault-relative path: `path=Journal/2024-01-15.md`33- **Quote values with spaces:** `file="Project Planning"`, `content="Hello World"`34- **Newlines in content:** Use `\n` — e.g., `content="Line 1\nLine 2"`35- **Bare boolean flags** have no value: `total`, `verbose`, `counts`, `done`, `todo`36- **`vault=`** targets a specific vault: `vault="Work Vault"`37- **`format=json`** for structured/parseable output (prefer this for programmatic use)38- **Most commands default to the active file** when `file=`/`path=` is omitted3940## Safe vs Destructive Operations4142### Safe (no confirmation needed)43- All read commands: `read`, `search`, `search:context`, `file`, `files`, `folders`, `outline`, `wordcount`, `recents`44- All list commands: `tags`, `properties`, `tasks`, `backlinks`, `links`, `orphans`, `deadends`, `unresolved`, `aliases`, `bookmarks`, `templates`, `bases`, `plugins`, `themes`, `snippets`, `hotkeys`, `commands`, `tabs`, `workspace`45- Single-value reads: `tag`, `property:read`, `daily:read`, `daily:path`, `template:read`, `random:read`, `vault`, `vaults`, `version`, `history`, `history:list`, `history:read`, `diff`, `publish:list`, `publish:site`, `publish:status`, `base:query`, `base:views`46- UI navigation: `open`, `daily`, `search:open`, `tab:open`, `web`4748### Mutating (use with normal judgment)49- Content modification: `append`, `prepend`, `create`, `daily:append`, `daily:prepend`50- Properties: `property:set`, `property:remove`51- Tasks: `task` with `toggle`/`done`/`todo`/`status=`52- Bookmarks: `bookmark`53- Templates: `template:insert`54- Bases: `base:create`5556### Destructive (confirm with user first)57- `delete` — moves to trash (or permanent with `permanent` flag)58- `move`, `rename` — changes file location/name59- `history:restore` — overwrites current file with historical version60- `plugin:install`, `plugin:uninstall`, `plugin:enable`, `plugin:disable` — changes plugin state61- `theme:install`, `theme:uninstall`, `theme:set` — changes theme62- `snippet:enable`, `snippet:disable` — changes CSS snippets63- `plugins:restrict` — toggles restricted mode64- `publish:add`, `publish:remove` — affects published site65- `reload`, `restart` — disrupts the running app66- `command` — executes arbitrary Obsidian commands6768## Core Command Patterns6970### Search & Discovery7172```bash73# Full-text search74obsidian search query="project planning" format=json7576# Search with line context (shows matching lines)77obsidian search:context query="TODO" path=Projects limit=107879# Count matches80obsidian search query="meeting" total8182# List all markdown files in a folder83obsidian files folder=Projects ext=md8485# Recently opened files86obsidian recents87```8889### Reading Notes9091```bash92# Read by wikilink name93obsidian read file="Meeting Notes"9495# Read by exact path96obsidian read path="Journal/2024-01-15.md"9798# Get file metadata99obsidian file file="My Note"100101# Show heading outline102obsidian outline file="My Note" format=json103104# Word count105obsidian wordcount file="My Note"106```107108### Writing & Modifying Notes109110```bash111# Create a new note112obsidian create name="New Note" content="# New Note\n\nContent here"113114# Create from template115obsidian create name="Meeting 2024-01-15" template="Meeting Template"116117# Append to a note118obsidian append file="My Note" content="\n## New Section\n\nAdded content"119120# Prepend to a note121obsidian prepend file="My Note" content="Important update at the top\n"122```123124### Properties (Frontmatter)125126```bash127# List all properties across the vault with counts128obsidian properties counts sort=count format=json129130# Read a specific property from a file131obsidian property:read name=status file="My Project"132133# Set a property134obsidian property:set name=status value=active file="My Project"135136# Set a date property137obsidian property:set name=due value=2024-03-15 type=date file="My Task"138139# Set a list property140obsidian property:set name=tags value="[work, urgent]" type=list file="My Note"141142# Remove a property143obsidian property:remove name=draft file="Published Post"144145# Show properties for a specific file146obsidian properties file="My Note" format=yaml147```148149### Tags150151```bash152# List all tags with counts, sorted by frequency153obsidian tags counts sort=count format=json154155# Get info about a specific tag156obsidian tag name=project verbose157158# Count how many times a tag is used159obsidian tag name=work total160161# Tags for a specific file162obsidian tags file="My Note"163```164165### Graph & Links166167```bash168# Find what links TO a note (backlinks)169obsidian backlinks file="My Note" counts format=json170171# Find what a note links TO (outgoing)172obsidian links file="My Note"173174# Find orphan notes (nothing links to them)175obsidian orphans176177# Count orphans178obsidian orphans total179180# Find dead-end notes (they link to nothing)181obsidian deadends182183# Find broken/unresolved links184obsidian unresolved counts verbose format=json185```186187### Tasks188189```bash190# List all incomplete tasks191obsidian tasks todo192193# List completed tasks194obsidian tasks done195196# Tasks in a specific file197obsidian tasks file="Project Plan" verbose198199# Tasks from daily note200obsidian tasks daily todo201202# Count incomplete tasks203obsidian tasks todo total204205# Tasks as JSON for processing206obsidian tasks todo format=json207208# Toggle a task (by file and line number)209obsidian task file="My Note" line=15 toggle210211# Mark a task done212obsidian task file="My Note" line=15 done213214# Mark a daily note task done215obsidian task daily line=5 done216```217218### Daily Notes219220```bash221# Read today's daily note222obsidian daily:read223224# Get the daily note's file path225obsidian daily:path226227# Append to today's daily note228obsidian daily:append content="\n- [ ] New task for today"229230# Prepend to daily note231obsidian daily:prepend content="## Morning Update\n\nStarting the day with..."232233# Open daily note in Obsidian234obsidian daily235```236237### Templates238239```bash240# List available templates241obsidian templates242243# Read a template's content244obsidian template:read name="Meeting Template"245246# Read with variables resolved247obsidian template:read name="Meeting Template" resolve title="Q1 Planning"248249# Insert template into active file250obsidian template:insert name="Meeting Template"251```252253### Bookmarks254255```bash256# List all bookmarks257obsidian bookmarks format=json258259# Bookmark a file260obsidian bookmark file="Important Note"261262# Bookmark a heading within a file263obsidian bookmark file="Project Plan" subpath="## Timeline"264265# Bookmark a search query266obsidian bookmark search="TODO urgent"267```268269### History & Versions270271```bash272# List history versions for a file273obsidian history file="My Note"274275# List all files that have history276obsidian history:list277278# Read a specific version279obsidian history:read file="My Note" version=2280281# Diff two versions282obsidian diff file="My Note" from=1 to=3283```284285### Bases (Obsidian Databases)286287```bash288# List all base files289obsidian bases290291# List views in a base292obsidian base:views file="Tasks DB"293294# Query a base view295obsidian base:query file="Tasks DB" view="Active Tasks" format=json296297# Create a new item in a base298obsidian base:create file="Tasks DB" name="New Task" content="Task description"299```300301### Plugins, Themes, Snippets302303```bash304# List community plugins with versions305obsidian plugins filter=community versions format=json306307# Get info about a specific plugin308obsidian plugin id=dataview309310# List enabled plugins311obsidian plugins:enabled312313# List installed themes314obsidian themes versions315316# Show active theme317obsidian theme318319# List CSS snippets320obsidian snippets321```322323### Vault Info324325```bash326# Full vault info327obsidian vault328329# Just the vault path330obsidian vault info=path331332# Just vault name333obsidian vault info=name334335# File and folder counts336obsidian vault info=files337obsidian vault info=folders338339# List all known vaults340obsidian vaults verbose341342# Obsidian version343obsidian version344```345346### Opening Files in Obsidian UI347348```bash349# Open a file350obsidian open file="My Note"351352# Open in new tab353obsidian open file="My Note" newtab354355# Open daily note356obsidian daily357358# Open search with query359obsidian search:open query="project"360361# Execute any Obsidian command362obsidian command id=graph:open363```364365## Best Practices3663671. **Use `format=json` for structured output** — easier to parse and process programmatically3682. **Use `total` for counts** — returns just a number instead of listing everything3693. **Batch appends** — combine multiple items into one `content=` with `\n` separators rather than making multiple CLI calls3704. **Check before mutating** — read the current state before setting properties or modifying content3715. **Get vault path dynamically** — use `obsidian vault info=path` rather than hardcoding paths, then combine with Read/Edit for file operations3726. **Use `file=` for convenience, `path=` for precision** — `file=` is shorter but may be ambiguous if multiple files share a name3737. **Use `verbose` for detailed output** — many list commands support `verbose` for extra context (file paths, counts, types)374375## Troubleshooting376377| Problem | Solution |378|---------|----------|379| "Obsidian is not running" or connection refused | Obsidian desktop app must be open. Start it first. |380| "No active file" error | Some commands default to the active file. Specify `file=` or `path=` explicitly. |381| "File not found" | Check the name with `obsidian search query="partial name"` or `obsidian files`. Use `path=` for exact match. |382| Spaces in file/folder names | Always quote: `file="My Note"`, `path="My Folder/note.md"` |383| Multi-vault | Specify `vault="Vault Name"` to target a specific vault |384| Command returns nothing | The file may be empty, or the query had no matches. Use `total` to confirm zero results. |385386## Full Command Reference387388For the complete catalog of all 80+ commands with all options, read:389`references/command-reference.md` (relative to this skill's directory)