Skip to content

Agentic coding workflow

For developers

The desktop obsidian CLI exposes developer commands for testing and debugging plugins and themes through the running app. These capabilities do not exist in the documented Headless ob surface.

Loop

sequenceDiagram
    participant Agent
    participant CLI as obsidian CLI
    participant App as Obsidian app
    Agent->>CLI: plugin:reload id=my-plugin
    CLI->>App: reload plugin
    App-->>CLI: ok
    Agent->>CLI: dev:errors
    CLI->>App: dump JS errors
    App-->>Agent: error buffer
    Agent->>CLI: dev:screenshot path=after.png
    CLI->>App: capture screenshot
    App-->>Agent: base64 PNG written to path
    Agent->>CLI: eval code="app.vault.getFiles().length"
    CLI->>App: run JS in context
    App-->>Agent: result

Useful commands

StepCommand
Reload a plugin you are developingobsidian plugin:reload id=my-plugin
Open dev toolsobsidian devtools
Attach the Chrome DevTools Protocol debuggerobsidian dev:debug on
Capture a screenshotobsidian dev:screenshot path=screenshot.png
Read the JS error bufferobsidian dev:errors
Read the console bufferobsidian dev:console limit=50 level=error
Inspect CSS for a selectorobsidian dev:css selector=".workspace-leaf"
Query the DOMobsidian dev:dom selector=".cm-line" text
Run arbitrary JSobsidian eval code="app.workspace.getActiveFile()?.path"

Tips

  • Pair dev:errors and dev:console with a plugin:reload cycle so the agent only sees diagnostics from the reload it just triggered.
  • The eval command runs JavaScript with full access to app. Treat it as a powerful capability and only run code you trust.
  • Stop for exact approval before running untrusted eval, installing/uninstalling plugins, or mutating user content. Use an isolated test vault and a rollback plan.
  • Use dev:debug on then attach a CDP client for breakpoint-grade debugging.

See also

Unofficial SOP mirror. Built for terminal-driven and agentic Obsidian workflows.