























@@ -1,81 +1,119 @@
11---
22name: obsidian
3-description: "Work with Obsidian vaults (plain Markdown notes) and automate via obsidian-cli."
4-homepage: https://help.obsidian.md
5-metadata:
6-{
7-"openclaw":
8-{
9-"emoji": "💎",
10-"requires": { "bins": ["obsidian-cli"] },
11-"install":
12-[
13-{
14-"id": "brew",
15-"kind": "brew",
16-"formula": "yakitrak/yakitrak/obsidian-cli",
17-"bins": ["obsidian-cli"],
18-"label": "Install obsidian-cli (brew)",
19-},
20-],
21-},
22-}
3+description: "Work with Obsidian vaults using the official obsidian CLI: read/search/create/edit notes, tasks, links, properties, plugins."
4+homepage: https://obsidian.md/cli
5+metadata: { "openclaw": { "emoji": "💎", "requires": { "bins": ["obsidian"] } } }
236---
247258# Obsidian
26927-Obsidian vault = a normal folder on disk.
10+Use the official `obsidian` CLI for Obsidian vault work. Vault files are plain Markdown, so direct file edits are still fine when safer/faster.
281129-Vault structure (typical)
12+## Requirements
301331-- Notes: `*.md` (plain text Markdown; edit with any editor)
32-- Config: `.obsidian/` (workspace + plugin settings; usually don't touch from scripts)
33-- Canvases: `*.canvas` (JSON)
34-- Attachments: whatever folder you chose in Obsidian settings (images/PDFs/etc.)
14+- Obsidian 1.12.7+ installed.
15+- Settings -> General -> Command line interface enabled.
16+- `obsidian` registered on PATH.
17+- Obsidian app running; the CLI connects to the running app.
351836-## Find the active vault(s)
19+Check:
372038-Obsidian desktop tracks vaults here (source of truth):
21+```bash
22+obsidian version
23+obsidian help
24+```
25+26+macOS registration creates `/usr/local/bin/obsidian` pointing at the app-bundled CLI. Linux registration copies the binary to `~/.local/bin/obsidian`.
27+28+## Vault model
29+30+- Notes: `*.md`.
31+- Config: `.obsidian/`; avoid editing unless asked.
32+- Canvases: `*.canvas` JSON.
33+- Attachments: vault-configured folder.
34+- Multiple vaults are common; pass `vault="<name>"` when ambiguous.
35+36+Obsidian desktop tracks vaults here:
39374038- `~/Library/Application Support/obsidian/obsidian.json`
413942-`obsidian-cli` resolves vaults from that file; vault name is typically the **folder name** (path suffix).
40+## Command pattern
41+42+```bash
43+obsidian <command> [name=value] [flag]
44+obsidian vault="Notes" search query="meeting notes" format=json
45+```
46+47+Parameter values with spaces need quotes. Add `--copy` to copy output where useful.
48+49+## Common commands
435044-Fast "what vault is active / where are the notes?"
51+Open/read:
455246-- If you've already set a default: `obsidian-cli print-default --path-only`
47-- Otherwise, read `~/Library/Application Support/obsidian/obsidian.json` and use the vault entry with `"open": true`.
53+```bash
54+obsidian open file=Recipe
55+obsidian open path="Inbox/Idea.md" newtab
56+obsidian read
57+obsidian read file=Recipe
58+```
485949-Notes
60+Search:
506151-- Multiple vaults common (iCloud vs `~/Documents`, work/personal, etc.). Don't guess; read config.
52-- Avoid writing hardcoded vault paths into scripts; prefer reading the config or using `print-default`.
62+```bash
63+obsidian search query="TODO" matches
64+obsidian search query="status::active" format=json
65+obsidian search:open query="project notes"
66+```
536754-## obsidian-cli quick start
68+Create/modify:
556956-Pick a default vault (once):
70+```bash
71+obsidian create name="New Note"
72+obsidian create path="Inbox/Idea.md" content="# Idea"
73+obsidian append file=Note content="New line"
74+obsidian prepend file=Note content="After frontmatter"
75+```
577658-- `obsidian-cli set-default "<vault-folder-name>"`
59-- `obsidian-cli print-default` / `obsidian-cli print-default --path-only`
77+Move/delete:
607861-Search
79+```bash
80+obsidian move file=Note to=Archive/
81+obsidian move path="Inbox/Old.md" to="Projects/New.md"
82+obsidian delete file=Note
83+```
628463-- `obsidian-cli search "query"` (note names)
64-- `obsidian-cli search-content "query"` (inside notes; shows snippets + lines)
85+Daily/tasks:
658666-Create
87+```bash
88+obsidian daily
89+obsidian daily:read
90+obsidian daily:append content="- [ ] Review inbox"
91+obsidian tasks all todo
92+obsidian task file=Note line=8 done
93+```
679468-- `obsidian-cli create "Folder/New note" --content "..." --open`
69-- Requires Obsidian URI handler (`obsidian://…`) working (Obsidian installed).
70-- Avoid creating notes under "hidden" dot-folders (e.g. `.something/...`) via URI; Obsidian may refuse.
95+Properties/links:
719672-Move/rename (safe refactor)
97+```bash
98+obsidian tags all counts
99+obsidian property:read file=Note name=status
100+obsidian property:set file=Note name=status value=done
101+obsidian backlinks file=Note
102+obsidian unresolved verbose counts
103+```
7310474-- `obsidian-cli move "old/path/note" "new/path/note"`
75-- Updates `[[wikilinks]]` and common Markdown links across the vault (this is the main win vs `mv`).
105+Developer/debug:
7610677-Delete
107+```bash
108+obsidian plugin:reload my-plugin
109+obsidian dev:errors
110+obsidian dev:screenshot file=shot.png
111+obsidian eval "app.vault.getFiles().length"
112+```
7811379-- `obsidian-cli delete "path/note"`
114+## Notes
8011581-Prefer direct edits when appropriate: open the `.md` file and change it; Obsidian will pick it up.
116+- `file=<name>` uses Obsidian-style file resolution; `path=<vault-relative.md>` is exact.
117+- Prefer CLI move/delete/property commands for Obsidian-aware updates.
118+- Prefer direct Markdown edits for bulk text changes after locating the vault path.
119+- Do not rely on third-party `obsidian-cli` unless user explicitly asks for it.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。