"Automate Obsidian desktop workflows through the Obsidian CLI: create, read, search, and update notes; run daily-note and task commands; target specific vaults/files; and use plugin/developer commands. Use when a user asks to operate an Obsidian vault from terminal commands, script repeatable note workflows, or troubleshoot Obsidian CLI setup."
Resources
2Install
npx skillscat add scottatron/agent-skills/obsidian Install via the SkillsCat registry.
Obsidian CLI
Run non-interactive commands
Use one-shot commands instead of the interactive TUI unless the user explicitly asks for interactive mode.
- Confirm command availability with
command -v obsidian. - Inspect available commands with
obsidian help. - When syntax is uncertain, re-run
obsidian helpand review the command list before writing content.
Follow a safe execution flow
- Resolve targeting first.
- If the user specifies a vault, place
vault="<vault-name>"first. - If the user specifies a file, prefer
path="Folder/Note.md"for exact targeting.
- Prefer read-only commands before writes (
read,search,tasks,tags,diff). - Apply minimal edits.
- Prefer append/prepend style changes when possible instead of full replacements.
- Return useful command output in the response.
Handle CLI commands that hang
The Obsidian CLI communicates with the running desktop app via Electron IPC.
Two known issues cause commands to hang or lose output:
- stdout race condition — the CLI process can signal exit before stdout
is fully flushed, causing agent harnesses to miss output. - IPC connection failure — the CLI can fail to connect to the running
Obsidian instance and spawn a new Electron process instead, hanging
indefinitely with no output.
Primary pattern: temp file redirect
Redirect output to a temp file so it is captured even if the process exits
before flushing stdout:
obsidian <command> > /tmp/obs_out.txt 2>&1; cat /tmp/obs_out.txtFallback: background with timeout
If the temp file redirect also hangs (IPC failure), use a background process
with a kill timer:
obsidian <command> > /tmp/obs_out.txt 2>&1 &
PID=$!
sleep 10
kill $PID 2>/dev/null
wait $PID 2>/dev/null
cat /tmp/obs_out.txtPrefer direct file edits for writes
CLI write commands (append, prepend, create, daily:append) are the
most likely to hang. A more reliable pattern:
- Use
obsidian vaultto get the vault root path. - Use
obsidian daily:path(orobsidian read path=...) to get the
relative file path. - Construct the full path (
<vault_root>/<relative_path>) and use the
Edit/Read tools to modify the file directly.
Reserve CLI write commands for cases where Obsidian-side processing is needed
(e.g., template insertion, plugin triggers).
Platform caveats
- Windows: Direct file edits via external tools (Node.js
CREATE_ALWAYS)
can resetfile.ctime, breaking creation-date queries in Obsidian. If the
vault relies onfile.ctime, preserve adate createdfrontmatter
property and use a hook to restore ctime after edits. - macOS / Linux: Not affected by the ctime issue. Direct file edits are
safe.
Use command syntax correctly
Use key=value parameters. Quote values containing spaces. Use flags without values.
obsidian create name="Sprint Notes" content="# Sprint\n- [ ] Draft plan"
obsidian search query="release checklist"
obsidian daily:append content="- [ ] Follow up with design"
obsidian vault="Work" read path="Projects/Agent Skills.md"Troubleshoot quickly
- Treat the CLI as early access and expect command/syntax drift.
- If a command fails unexpectedly, re-run
obsidian helpand adapt to the installed command set. - If CLI commands are unavailable, instruct the user to enable
Settings -> General -> Command line interfacein Obsidian and register again. - On macOS, ensure
/Applications/Obsidian.app/Contents/MacOSis inPATH(commonly via~/.zprofile).
Read detailed recipes on demand
Load references/command-recipes.md for concrete command recipes and troubleshooting patterns.