home / skills / nweii / agent-stuff / obsidian-cli

obsidian-cli skill

/skills/obsidian-cli

This skill enables terminal control of Obsidian via the obsidian CLI to automate vaults, create and open notes, search, and manage plugins.

npx playbooks add skill nweii/agent-stuff --skill obsidian-cli

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
6.2 KB
---
name: obsidian-cli
description: Control Obsidian from the terminal via the obsidian CLI. Use for vault automation, opening/creating notes, searching, daily notes, tasks, tags, and plugin development.
metadata:
  author: nweii
  version: "1.1.0"
---

# Obsidian CLI

Run `obsidian <command>` to control Obsidian from the terminal. The app must be running for most commands; the first command will launch Obsidian if not open.

## Targeting vaults and files

- **Vault**: Add `vault=<name>` to target a specific vault. Default: uses cwd if it's a vault folder, else the active vault.
- **File**: Use `file=<name>` (wikilink resolution, extension optional) or `path=<path>` (exact path from vault root).
- **TUI**: Run `obsidian` with no args for interactive mode; omit the `obsidian` prefix inside.

## Parameters and flags

- **Parameters**: `param=value`. Quote values with spaces: `content="Hello world"`.
- **Flags**: Boolean, no value: `silent`, `overwrite`, `newtab`.
- **Multiline content**: Use `\n` for newlines, `\t` for tabs in `content=`.
- Note: Commands default to silent operation and don't expect an active file by default.

## Common commands

### Notes and content

Escape values in quotes if it has whitespaces.

```bash
obsidian create name="Note" content="Hello world"
obsidian create name="Note" template=Travel  # from Templates folder
obsidian create name="Note" content="# Title\n\nBody" overwrite silent
obsidian read file="Note" path="folder/note.md" # path is optional
obsidian append file="Note" content="- [ ] Task"
obsidian prepend file="Note" content="# Header\n"
obsidian delete file="Note"
obsidian move file="Note" to=folder/newpath.md # also can rename
obsidian rename file="Note" name="New file name"
```

### Daily notes

Requires Daily notes plugin. Use `daily:append` / `daily:prepend` for content.

```bash
obsidian daily:read
obsidian daily [paneType=tab|split|window] [open]
obsidian daily:append content="- [ ] Buy groceries" [inline] [open]
obsidian daily:prepend content="- [ ] Morning routine" [inline] # goes after the frontmatter
obsidian daily:path # Returns the expected daily note path even if the file hasn't been created yet.
```

### Search and navigation

```bash
obsidian search query="text" [path=folder] [limit=n] [format=text|json] [total] [case]
obsidian search:context query="text" [path=folder] [limit=n] [format=text|json] [case]
obsidian search:open [query="text"]
obsidian files [folder=path] [ext=md] [total]
obsidian recents [total]
obsidian random [folder=path] [newtab] [open]
```

### Tasks and tags

```bash
obsidian tasks [daily] [file=Note] [todo] [done] [status="x"] [total] [verbose]
obsidian task ref=path:line [toggle] [done] [todo] [daily]
obsidian tags [active] [file=Note] [total] [counts] [sort=count]
obsidian tag name=project [total] [verbose]
```

### Links and structure

```bash
obsidian links [file=Note] [total]
obsidian backlinks [file=Note] [counts] [total]
obsidian outline [file=Note] [format=tree|md]
obsidian orphans [total] [active]
obsidian deadends [total] [active]
obsidian unresolved [total] [counts] [verbose]
```

### Properties and frontmatter

```bash
obsidian properties [active] [file=Note] [total] [counts] [format=yaml|tsv]
obsidian property:read name=status [file=Note]
obsidian property:set name=status value=done [file=Note]
obsidian property:remove name=status [file=Note]
```

### Bases (Bases plugin)

```bash
obsidian bases
obsidian base:views [file=base.base]
obsidian base:query [file=base.base] [view=name] [format=json|csv|tsv|md|paths]
obsidian base:create name="Item" content="..." [open] [newtab]
```

### Plugins and themes

```bash
obsidian plugins [filter=core|community] [versions]
obsidian plugin:install id=plugin-id [enable]
obsidian plugin:enable id=plugin-id
obsidian plugin:disable id=plugin-id
obsidian plugin:reload id=plugin-id  # for development
obsidian themes [versions]
obsidian theme:install name=Theme [enable]
obsidian theme:set name=Theme
```

### Publish

```bash
obsidian publish:status [total] [new] [changed] [deleted]
obsidian publish:add [file=Note] [changed]
obsidian publish:remove [file=Note]
obsidian publish:list [total]
```

### History and diff

```bash
obsidian history [file=Note]
obsidian history:read [file=Note] version=2
obsidian history:restore [file=Note] version=2
obsidian diff [file=Note] [from=1] [to=3] [filter=local|sync]
```

### Vault and workspace

```bash
obsidian vault [info=name|path|files|folders|size]
obsidian vaults [total] [verbose]
obsidian workspace:save [name=layout]
obsidian workspace:load name=layout
obsidian reload
obsidian restart
```

### Execute Obsidian commands

```bash
obsidian commands [filter=prefix]
obsidian command id=app:open-settings
obsidian hotkey id=app:open-settings [verbose]
```

## Developer commands

```bash
obsidian dev:screenshot path=screenshot.png
obsidian dev:dom selector=".cm-editor" [text] [attr=class]
obsidian dev:css selector=".cm-editor" [prop=color]
obsidian dev:console [clear] [limit=10] [level=log|warn|error]
obsidian dev:errors [clear]
obsidian devtools
obsidian eval code="app.vault.getFiles().length"
```

## Quick reference

| Task                        | Command                                      |
| --------------------------- | -------------------------------------------- |
| List commands               | `obsidian help`                              |
| Open daily note             | `obsidian daily`                             |
| Append to daily             | `obsidian daily:append content="- [ ] Task"` |
| Search vault                | `obsidian search query="text"`               |
| Read active/ specified file | `obsidian read` or `obsidian read file=Note` |
| Create from template        | `obsidian create name="Title" template=Name` |
| List tags with counts       | `obsidian tags counts`                       |
| List tasks from daily       | `obsidian tasks daily`                       |
| Diff file versions          | `obsidian diff file=Note from=1 to=3`        |

## Help

- `obsidian help` — full command list
- `obsidian help <command>` — help for a specific command (e.g. `obsidian help search`)
- `obsidian --help` — alias for `help`

## References

For recent CLI documentation: [Obsidian CLI (Context7)](https://context7.com/websites/help_obsidian_md/llms.txt?topic=cli&tokens=10000)

Overview

This skill exposes a terminal-first interface to control Obsidian for automating vault workflows, notes, searches, tasks, and plugin development tasks. It works by sending commands to the running Obsidian app (it will launch the app if needed) and accepts parameters, flags, and file/vault targeting. Use it to script note creation, modify frontmatter, run developer tools, and integrate Obsidian into CI or local automation.

How this skill works

Commands follow the form obsidian <command> with param=value pairs and boolean flags. Target a specific vault with vault=<name>, a note by file=<name> (wikilink resolution) or path=<relative/path.md>, and pass multiline content with \n. Many commands require the Obsidian app to be running; the first CLI invocation starts it when necessary.

When to use it

  • Automate creating, appending, or updating notes from scripts or agents.
  • Run batch searches, list files, or extract metadata for external tools.
  • Manage tasks, tags, backlinks, and frontmatter programmatically.
  • Drive plugin development and debugging using dev: and eval commands.
  • Trigger daily notes, workspaces, or vault-level operations from CI or cron jobs.

Best practices

  • Prefer path=<path> for precise file targeting when duplicates or similar names exist.
  • Quote param values that contain spaces and use \n for newlines in content=.
  • Use flags like silent and overwrite intentionally; avoid overwrite on important notes.
  • For automation, combine search, read, and create commands with exit codes to detect failures.
  • Use dev:console, dev:errors and dev:screenshot for reproducible plugin debugging steps.

Example use cases

  • Create a meeting note from a template: obsidian create name="Meeting" template=Meetings content="..."
  • Append a todo to today's daily note: obsidian daily:append content="- [ ] Call vendor"
  • Export a list of files in a folder for external processing: obsidian files folder=projects ext=md format=json
  • Toggle a task by file reference: obsidian task ref=notes/project.md:42 toggle
  • Run a plugin reload during development: obsidian plugin:reload id=plugin-id

FAQ

Do I need Obsidian open to use the CLI?

Most commands require the app to be running; the first CLI call will launch Obsidian if it isn't already open.

How do I target a specific note reliably?

Use path=<relative/path.md> for exact targeting. file=<name> resolves wikilinks and is convenient but can match multiple notes.